Tuesday, January 8, 2008

HPET support for qemu

For those who don't know what HPET is check out the specifications at the Intel site and continue reading.

It was only yesterday I decided to work on adding HPET support to qemu. I talked to Amit Shah(the only employee of Qumranet in India), for ideas on this and how to go about it.

He told me to start off by making qemu access the HPET in userspace and then extend it to make it visible on the guest. Emulation of a HPET in cases where there is no real hardware, comes at a later stage. I am lucky to have a new Core 2 Duo 945 chipset machine which has HPET which fortunately became 'visible' only after I flashed my BIOS!. But my excitation quickly died down when I began trying to run the userspace program (Documentation/hpet.txt). It would not run. It was failing at the Interrupt Enable (HPET_IE_ON) ioctl command.

As usual, i decided to find a solution to this problem by googling for HPET. But even after searching for a long time, I could not find even a single place where i could get help, so i decided to write this blog, so that I will be the first one to have a nice resource on HPET!

Deciding to track down this problem, I started looking at the kernel sources. I began by adding printks in drivers/char/hpet.c. Grepping through the kernel logs showed me that my HPET had 3 timer blocks which used interrupts 2, 8 and 0. My printks told me that when I opened /dev/hpet, I got assigned a timer block which had interrupt 0, and hence the routine hpet_ioctl_ieon would not continue using it and it fails.

I think this happens because of improper ACPI tables which report the IRQ of the third HEPT timer block as 0. I have posted a query on kernelnewbies and now awaiting a reply..

Will continue this once i get this reply! Stay tuned..

1 comment:

Geeta said...

Hi Balaji,
Thanks for the effort. Have u succeeded getting reply for the problem. me facing the same issue with HPET_IE_ON