Skip to contentSkip to conversation

Fix non-ACPI Timer Interrupt Routing

PATCH In review Beth Kon 4 participants 10 messages Apr 14, 2009 – Apr 21, 2009

lore
Share & tools
lore

Beth Kon

author
#0 lore raw

PATCH 1/1 Fix non-ACPI Timer Interrupt Routing

Replicate ACPI irq0->inti2 override in mp table for non-acpi case.

bios/BIOS-bochs-latest binary +0 -0
index ebec71b..82d7792 100644
Binary files a/bios/BIOS-bochs-latest and b/bios/BIOS-bochs-latest differ
bios/rombios32.c +9 -1
index 7be4216..bc17118 100644
@@ -1,4 +1,4 @@
-/////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
 // $Id$
 /////////////////////////////////////////////////////////////////////////
 //
@@ -1168,6 +1168,10 @@ static void mptable_init(void)
 
     /* irqs */
     for(i = 0; i < 16; i++) {
+#ifdef BX_QEMU
+        if (i == 2)
+            continue;
+#endif        
         putb(&q, 3); /* entry type = I/O interrupt */
         putb(&q, 0); /* interrupt type = vectored interrupt */
         putb(&q, 0); /* flags: po=0, el=0 */
@@ -1175,7 +1179,11 @@ static void mptable_init(void)
         putb(&q, 0); /* source bus ID = ISA */
         putb(&q, i); /* source bus IRQ */
         putb(&q, ioapic_id); /* dest I/O APIC ID */
+#ifdef BX_QEMU
+        putb(&q, i == 0 ? 2 : i); /* dest I/O APIC interrupt in */
+#else
         putb(&q, i); /* dest I/O APIC interrupt in */
+#endif        
     }
     /* patch length */
     len = q - mp_config_table;
#1 lore raw
Quoted 12 lines · Elizabeth Kon

Replicate ACPI irq0->inti2 override in mp table for non-acpi case.

bios/BIOS-bochs-latest binary +0 -0
index ebec71b..82d7792 100644
Binary files a/bios/BIOS-bochs-latest and b/bios/BIOS-bochs-latest differ
bios/rombios32.c +0 -0
index 7be4216..bc17118 100644

bios/rombios32.c line 1

Quoted 2 lines
bios/rombios32.c +1 -1
@@ -1,4 +1,4 @@
-/////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////

Did you mean to change the number of slashs? =)

bios/rombios32.c static void mptable_init(void) · line 1174

Quoted 11 lines
bios/rombios32.c +4 -0
 // $Id$
 /////////////////////////////////////////////////////////////////////////
 //
@@ -1168,6 +1168,10 @@ static void mptable_init(void)
 
     /* irqs */
     for(i = 0; i < 16; i++) {
+#ifdef BX_QEMU
+        if (i == 2)
+            continue;
+#endif        

I'd think that deserves a comment on why we're skipping i==2.

Quoted 15 lines
bios/rombios32.c +4 -0
         putb(&q, 3); /* entry type = I/O interrupt */
         putb(&q, 0); /* interrupt type = vectored interrupt */
         putb(&q, 0); /* flags: po=0, el=0 */
@@ -1175,7 +1179,11 @@ static void mptable_init(void)
         putb(&q, 0); /* source bus ID = ISA */
         putb(&q, i); /* source bus IRQ */
         putb(&q, ioapic_id); /* dest I/O APIC ID */
+#ifdef BX_QEMU
+        putb(&q, i == 0 ? 2 : i); /* dest I/O APIC interrupt in */
+#else
         putb(&q, i); /* dest I/O APIC interrupt in */
+#endif        
     }
     /* patch length */
     len = q - mp_config_table;
Signature · 4 lines
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
[email protected]
author
#2 lore raw
Quoted 8 lines · Ryan Harper
Quoted 4 lines · Elizabeth Kon

Replicate ACPI irq0->inti2 override in mp table for non-acpi case.

Quoted 14 lines

bios/rombios32.c line 2

Quoted 11 lines
bios/BIOS-bochs-latest binary +0 -0
index ebec71b..82d7792 100644
Binary files a/bios/BIOS-bochs-latest and b/bios/BIOS-bochs-latest differ
bios/rombios32.c +1 -1
index 7be4216..bc17118 100644
@@ -1,4 +1,4 @@
-/////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////
 

Did you mean to change the number of slashs? =)

I guess the significance of it isn't clear, huh? I'll add a comment. :-)

Quoted 6 lines
Quoted 6 lines
bios/rombios32.c +0 -0
 // $Id$
 /////////////////////////////////////////////////////////////////////////

//

bios/rombios32.c +0 -0
@@ -1168,6 +1168,10 @@ static void mptable_init(void)
 
Quoted 10 lines

bios/rombios32.c static void mptable_init(void)

Quoted 7 lines
bios/rombios32.c +4 -0
     /* irqs */
     for(i = 0; i < 16; i++) {
+#ifdef BX_QEMU
+        if (i == 2)
+            continue;
+#endif        
 

I'd think that deserves a comment on why we're skipping i==2.

Ok.

Quoted 20 lines
Quoted 17 lines
bios/rombios32.c +0 -0
         putb(&q, 3); /* entry type = I/O interrupt */
         putb(&q, 0); /* interrupt type = vectored interrupt */
         putb(&q, 0); /* flags: po=0, el=0 */
bios/rombios32.c +4 -0
@@ -1175,7 +1179,11 @@ static void mptable_init(void)
         putb(&q, 0); /* source bus ID = ISA */
         putb(&q, i); /* source bus IRQ */
         putb(&q, ioapic_id); /* dest I/O APIC ID */
+#ifdef BX_QEMU
+        putb(&q, i == 0 ? 2 : i); /* dest I/O APIC interrupt in */
+#else
         putb(&q, i); /* dest I/O APIC interrupt in */
+#endif        
     }
     /* patch length */
     len = q - mp_config_table;
#3 lore raw
In reply to Beth Kon

Hi,

Could you explain why you doing these changes for QEMU only (with ifdef QEMU) ?

Thanks,
Stanislav

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Beth Kon
Sent: Tuesday, April 14, 2009 3:30 AM
To: qemu-devel; [email protected]
Cc: [email protected]; [email protected]
Subject: [Qemu-devel] [PATCH] Fix non-ACPI Timer Interrupt Routing

Replicate ACPI irq0->inti2 override in mp table for non-acpi case.

author
#4 lore raw
Quoted 6 lines · Stanislav

Hi,

Could you explain why you doing these changes for QEMU only (with ifdef QEMU) ?

The irq0->inti2 override is not absolutely required. Running Windows 2008 in QEMU with the emulated HPET does require it, so this is a QEMU-only change.

Quoted 19 lines

Thanks,
Stanislav

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Beth Kon
Sent: Tuesday, April 14, 2009 3:30 AM
To: qemu-devel; [email protected]
Cc: [email protected]; [email protected]
Subject: [Qemu-devel] [PATCH] Fix non-ACPI Timer Interrupt Routing

Replicate ACPI irq0->inti2 override in mp table for non-acpi case.

#5 lore raw
Quoted 3 lines

The irq0->inti2 override is not absolutely required. Running Windows 2008 in QEMU with the emulated HPET does require it, so this is a QEMU-only change.

Non-absolutely required is not good answer :)
Is anything will be broken if the change is merged for Bochs as well ? I think it will not.
And as bonus, Windows 7 32-bit is not booting under Bochs without this change.

Stanislav

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Beth Kon
Sent: Tuesday, April 14, 2009 5:20 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] Fix non-ACPI Timer Interrupt Routing

Quoted 6 lines · Stanislav

Hi,

Could you explain why you doing these changes for QEMU only (with ifdef QEMU) ?

The irq0->inti2 override is not absolutely required. Running Windows 2008 in QEMU with the emulated HPET does require it, so this is a QEMU-only change.

author
#6 lore raw
Quoted 10 lines · Stanislav
Quoted 2 lines

The irq0->inti2 override is not absolutely required. Running Windows 2008 in QEMU with the emulated HPET does require it, so this is a QEMU-only change.

Non-absolutely required is not good answer :)
Is anything will be broken if the change is merged for Bochs as well ? I think it will not.
And as bonus, Windows 7 32-bit is not booting under Bochs without this change.

This is part of a bigger change for QEMU, incorporating irq0->inti2 override for ACPI, and non-ACPI, driven by addition of the HPET. It required BIOS changes as well as QEMU changes to route irq0 to inti2 of the IOAPIC. This patch alone is not complete. I have tested the complete solution in QEMU, thus the guards.

The complete solution would require the madt_int_override portions of this patch:
http://lists.gnu.org/archive/html/qemu-devel/2008-11/txtSbJwxwQwiT.txt

and the Bochs equivalent of the QEMU irq0->inti2 routing (see changes to ioapic_set_irq) in this patch:
http://lists.gnu.org/archive/html/qemu-devel/2008-11/txtswJIdPnCbr.txt

Quoted 30 lines

Stanislav

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Beth Kon
Sent: Tuesday, April 14, 2009 5:20 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [Qemu-devel] [PATCH] Fix non-ACPI Timer Interrupt Routing

Quoted 7 lines · Stanislav

Hi,

Could you explain why you doing these changes for QEMU only (with ifdef QEMU) ?

The irq0->inti2 override is not absolutely required. Running Windows 2008 in QEMU with the emulated HPET does require it, so this is a QEMU-only change.

#7 lore raw
Quoted 1 line · Beth Kon

This is part of a bigger change for QEMU, incorporating irq0->inti2 override for ACPI, and non-ACPI, driven by addition of the HPET. It required BIOS changes as well as QEMU changes to route irq0 to inti2 of the IOAPIC. This patch alone is not complete. I have tested the complete solution in QEMU, thus the guards.

I just tested qemu r7185 with bochs bios (without your patch) and used a Linux 2.6.27.7 guest (openSUSE-11.1-NET-i586.iso). If i don't misunderstand you this change is only needed with HPET. I have tested the following configurations which all fail:

hpet enabled, no guest kernel parameters
hpet enabled, guest kernel with acpi=off
hpet disabled, no guest kernel parameters
hpet disabled, guest kernel with acpi=off

Since it even fails with HPET disabled, this change can't only be needed for HPET, can it?

Ed: Have you tried your Linux guest with HPET enabled or disabled in your original report / patch?

- Sebastian

author
#8 lore raw
Quoted 4 lines · Sebastian Herbszt
Quoted 1 line · Beth Kon

This is part of a bigger change for QEMU, incorporating irq0->inti2 override for ACPI, and non-ACPI, driven by addition of the HPET. It required BIOS changes as well as QEMU changes to route irq0 to inti2 of the IOAPIC. This patch alone is not complete. I have tested the complete solution in QEMU, thus the guards.

I just tested qemu r7185 with bochs bios (without your patch) and used a Linux

Do you mean you used a bochs bios that doesn't include #ifdef BX_QEMU portions? Then it wouldn't work because QEMU overrides irq0->inti2 in its ioapic code and without the matching bios that notifies the guest of the override, boots would likely fail. This change was put in because of the needs of the HPET, but now it is standard procedure for QEMU. With or without HPET, QEMU will override irq0->inti2.

If you mean that you used a QEMU Bochs (with ifdef BX_QEMU included), please let me know what kind of errors you are seeing.

Quoted 17 lines

2.6.27.7 guest (openSUSE-11.1-NET-i586.iso). If i don't misunderstand you this change is only needed with HPET. I have tested the following configurations which all fail:

hpet enabled, no guest kernel parameters
hpet enabled, guest kernel with acpi=off
hpet disabled, no guest kernel parameters
hpet disabled, guest kernel with acpi=off

Since it even fails with HPET disabled, this change can't only be needed for HPET, can it?

Ed: Have you tried your Linux guest with HPET enabled or disabled in your original report / patch?

- Sebastian

#9 lore raw
Quoted 6 lines · Beth Kon
Quoted 4 lines · Sebastian Herbszt
Quoted 1 line · Beth Kon

This is part of a bigger change for QEMU, incorporating irq0->inti2 override for ACPI, and non-ACPI, driven by addition of the HPET. It required BIOS changes as well as QEMU changes to route irq0 to inti2 of the IOAPIC. This patch alone is not complete. I have tested the complete solution in QEMU, thus the guards.

I just tested qemu r7185 with bochs bios (without your patch) and used a Linux

Do you mean you used a bochs bios that doesn't include #ifdef BX_QEMU portions?

I was indeed testing pure bochs bios.

Quoted 1 line

Then it wouldn't work because QEMU overrides irq0->inti2 in its ioapic code and without the matching bios that notifies the guest of the override, boots would likely fail. This change was put in because of the needs of the HPET, but now it is standard procedure for QEMU. With or without HPET, QEMU will override irq0->inti2.

This was the missing piece. I just looked at the change [1] and now it explains why my testing with pure bochs bios failed. Thanks.
It's also the reason why this change is qemu only. ioapic.cc from bochs doesn't have such override hard-coded.

Quoted 1 line

If you mean that you used a QEMU Bochs (with ifdef BX_QEMU included), please let me know what kind of errors you are seeing.

I did just retest with bios.bin from qemu r7055

hpet enabled, no guest kernel parameters
hpet enabled, guest kernel with acpi=off <- hang
hpet disabled, no guest kernel parameters
hpet disabled, guest kernel with acpi=off <- hang

and those two hangs with acpi=off are fixed in r7169.

[1] http://svn.savannah.gnu.org/viewvc/trunk/hw/apic.c?root=qemu&r1=5890&r2=6081

- Sebastian