On Sun, Aug 25, 2013 at 2:44 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > Il 25/08/2013 04:16, Liu Ping Fan ha scritto: >> According to hpet spec, hpet irq is high active. But according to >> ICH spec, there is inversion before the input of ioapic. So the OS >> will expect low active on this IRQ line.(And this is observed on >> bare metal). >> >> We fold the emulation of this inversion inside the hpet logic. >> >> Signed-off-by: Liu Ping Fan <pingf...@linux.vnet.ibm.com> >> --- >> kernel has a bug with ioapic, refer to >> https://lkml.org/lkml/2013/8/23/98 >> With all these patch, linux-2.6/Documentation/timers/hpet_example.c can work >> on qemu > > Can you explain "in qemu q35 machine ioapic's ioredtbl[x] can never be > set as low-active, even if the hpet driver registered it"? > >From kernel side, in drivers/char/hpet.c hpet_timer_set_irq() gsi = acpi_register_gsi(NULL, irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
So we expect the ioredtbl[x] will be set as low-active polarity, but on q35, I found this did not happen. Scene: a former call to io_apic_setup_irq_pin_once(), then the later one(hpet, which decided to share this pin with other device) will not actually program the pin. Here, notice the name xx_once(), but it ignored the second request without a check. Regards, Pingfan > Paolo