Skip to contentSkip to conversation

bugs fix for hpet

PATCH Applied Liu Ping Fan 3 participants 4 messages Dec 8, 2013 – Dec 10, 2013

lore
Share & tools
lore
#0 lore raw

v9 cover bugs fix for hpet

I see the open of 2.0 development window, and rebase V8 with a small fix

v9:
use PC_Q35_1_8_MACHINE_OPTIONS in pc_q35_machine_v1_8
v8:
make piix/q35 compat diverge
simplify the code, use hpet_irqs to pass "intcap" value

Liu Ping Fan (2):
hpet: inverse polarity when pin above ISA_NUM_IRQS
hpet: enable to entitle more irq pins for hpet

 hw/i386/pc.c         | 19 ++++++++++++++++---
 hw/i386/pc_piix.c    |  3 ++-
 hw/i386/pc_q35.c     | 21 +++++++++++++++++----
 hw/timer/hpet.c      | 23 +++++++++++++++++++----
 include/hw/i386/pc.h | 24 +++++++++++++++++++++++-
 5 files changed, 77 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH v9 1/2 hpet: inverse polarity when pin above ISA_NUM_IRQS

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. (On bare metal, if OS driver claims high active on this line, spurious irq is generated)

We fold the emulation of this inversion inside the hpet logic.

---
 hw/timer/hpet.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
hw/timer/hpet.c +12 -2
index 2eb75ea..0aee2c1 100644
@@ -198,13 +198,23 @@ static void update_irq(struct HPETTimer *timer, int set)
     if (!set || !timer_enabled(timer) || !hpet_enabled(timer->state)) {
         s->isr &= ~mask;
         if (!timer_fsb_route(timer)) {
-            qemu_irq_lower(s->irqs[route]);
+            /* fold the ICH PIRQ# pin's internal inversion logic into hpet */
+            if (route >= ISA_NUM_IRQS) {
+                qemu_irq_raise(s->irqs[route]);
+            } else {
+                qemu_irq_lower(s->irqs[route]);
+            }
         }
     } else if (timer_fsb_route(timer)) {
         stl_le_phys(timer->fsb >> 32, timer->fsb & 0xffffffff);
     } else if (timer->config & HPET_TN_TYPE_LEVEL) {
         s->isr |= mask;
-        qemu_irq_raise(s->irqs[route]);
+        /* fold the ICH PIRQ# pin's internal inversion logic into hpet */
+        if (route >= ISA_NUM_IRQS) {
+            qemu_irq_lower(s->irqs[route]);
+        } else {
+            qemu_irq_raise(s->irqs[route]);
+        }
     } else {
         s->isr &= ~mask;
         qemu_irq_pulse(s->irqs[route]);
Signature · 1 line
1.8.1.4
#2 lore raw
In reply to Liu Ping Fan

Il 08/12/2013 10:38, Liu Ping Fan ha scritto:

Quoted 13 lines

I see the open of 2.0 development window, and rebase V8 with a small fix

v9:
use PC_Q35_1_8_MACHINE_OPTIONS in pc_q35_machine_v1_8
v8:
make piix/q35 compat diverge
simplify the code, use hpet_irqs to pass "intcap" value

Liu Ping Fan (2):
hpet: inverse polarity when pin above ISA_NUM_IRQS
hpet: enable to entitle more irq pins for hpet

Quoted 7 lines
 hw/i386/pc.c         | 19 ++++++++++++++++---
 hw/i386/pc_piix.c    |  3 ++-
 hw/i386/pc_q35.c     | 21 +++++++++++++++++----
 hw/timer/hpet.c      | 23 +++++++++++++++++++----
 include/hw/i386/pc.h | 24 +++++++++++++++++++++++-
 5 files changed, 77 insertions(+), 13 deletions(-)
#3 lore raw
In reply to Liu Ping Fan
Quoted 8 lines · Liu Ping Fan

I see the open of 2.0 development window, and rebase V8 with a small fix

v9:
use PC_Q35_1_8_MACHINE_OPTIONS in pc_q35_machine_v1_8
v8:
make piix/q35 compat diverge
simplify the code, use hpet_irqs to pass "intcap" value

Applied, thanks.

Quoted 13 lines

Liu Ping Fan (2):
hpet: inverse polarity when pin above ISA_NUM_IRQS
hpet: enable to entitle more irq pins for hpet

 hw/i386/pc.c         | 19 ++++++++++++++++---
 hw/i386/pc_piix.c    |  3 ++-
 hw/i386/pc_q35.c     | 21 +++++++++++++++++----
 hw/timer/hpet.c      | 23 +++++++++++++++++++----
 include/hw/i386/pc.h | 24 +++++++++++++++++++++++-
 5 files changed, 77 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.1.4