fix PCI interrupt routing via ACPI
PATCH 1/1 fix PCI interrupt routing via ACPI
Hi -
The attached patch gets PCI interrupt routing working with ACPI.
The basic problem was we weren't specifying the correct _ADR for the PCI-ISA bridge in the ACPI DSDT. (It's the PCI-ISA bridge that implements PCI interrupt routing. Its address is device 1, fn 0 on the parent PCI bus -- see the _ADR change in the patch.) This makes attempts to program the PCI interrupt routing (i.e., to assign a particular IRQ to one of the four PCI "LNK" devices) write into the correct device's PCI config space. (These writes were going into the PCI-host bridge's config space ...)
But that fix alone causes even more grief with ACPI-compliant guests
that use (the I/O) APIC. What happens is the fixed PRTA PCI routing table returned for APIC mode doesn't reference the LNK devices (which are still defined in ACPI), and so calls their _DIS (disable) methods in ACPI, which effectively stops PCI devices from interrupting. There are a couple of alternatives for fixing this. I think the best one (which happens to be easiest, and what I've implemented in this patch) is to *always* return the programmable PRTP routing table, even in APIC mode. That way the LNK devices are always used so we don't need to detect that they're not used.
This also has the advantage of allowing APIC-mode guests to better manage
IRQ conflicts. Normally (on real hardware) the APIC-mode PRT table maps the four PCI interrupts to IRQs > 15. But QEMU is (essentially, for now) wired straight into a virtual PIC -- we can't raise IRQs > 15, so the old APIC-mode PRT was mapping them to IRQS < 16, subjecting them to the possible IRQ- sharing that the PIC-mode table allows them to adjust via the LNK devices.
Oh yeah, the patch also corrects a typo in LNKA's _CRS method. Surely
this
should be referencing PIRA, not PIRB (see the other LNKx's _CRS methods).
This combination of things gets rid of complaints about not finding IRQs
for some PCI devices from several ACPI-compliant guests, including Win2003 and RHEL4-64. It also seemed to fix some more mysterious hang I was seeing (on xen-unstable only) when trying to boot certain configs with ACPI-compliant guests.
Dave
P.S. The second attachment is a version of the fix that applies after the DSDT fix from [email protected].
P.P.S. Keir -- should we be submitting the patched AML (acpi_dsdt.c) as well? I did, but wasn't sure of the convention ...
Fixed PCI interrupt routing in ACPI BIOS:
(a) Corrected PCI interrupt router (i.e., the PIIX3 PCI-ISA bridge) device address (on PCI bus 0) to dev 1, fn 0. Previously it was writing into the PCI-host bridge's config space (not sure what that did, if anything).
(b) Fixed typo in LNKA's _CRS method. This should be reading PIRA, not PIRB (see other LNKx _CRS methods).
(c) Started returning the dynamic PCI interrupt routing table (i.e., the one with the LNKx devices) even in APIC mode. The QEMU PIIX3 emulation always looks in the PIIX3's PCI config space when raising PCI interrupts, and it sees disabled LNKx devices if they're not used in the PCI routing table, and so fails to raise interrupts. We avoid this problem by always providing the LNKx devices, even for guests in APIC mode. This should also help APIC- mode guests manage IRQ conflicts since QEMU really provides only 16 IRQ outputs.
(d) Listed 8 PCI slots (up from 4) in PCI bus description. Should probably extend this to 32 (embedded slot 0, and slots 9-31) since the PCI namespace allows it.
Fixes various boot-time hangs of Windows 2003 with ACPI HAL. Also gets rid of some boot-time complaints from both ACPI-Windows and Linux.
tools/firmware/acpi/acpi_dsdt.asl +45 -46
@@ -50,12 +50,6 @@ }) - Name(PICD, 0) - - Method(_PIC, 1) { - - Store(Arg0, PICD) - } Scope (\_SB) { /* Fix HCT test for 0x400 pci memory - need to report low 640 MB mem as motherboard resource */
@@ -175,7 +169,7 @@ } Method(_CRS) { - And(PIRB, 0x0f, Local0) + And(PIRA, 0x0f, Local0) ShiftLeft(0x1, Local0, IRQV) Return(BUFB) }
@@ -294,49 +288,54 @@ Store(Local0, PIRD) } // Method(_SRS) } - Method(_PRT,0) { - If(PICD) {Return(PRTA)} - Return (PRTP) - } // end _PRT - - Name(PRTP, Package(){ - Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0}, // Slot 1, INTA - Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0}, // Slot 1, INTB - Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0}, // Slot 1, INTC - Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0}, // Slot 1, INTD - - Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0}, // Slot 2, INTB - Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0}, // Slot 2, INTC - Package(){0x0001ffff, 2, \_SB.PCI0.LNKD, 0}, // Slot 2, INTD - Package(){0x0001ffff, 3, \_SB.PCI0.LNKA, 0}, // Slot 2, INTA - - Package(){0x0002ffff, 0, \_SB.PCI0.LNKC, 0}, // Slot 3, INTC - Package(){0x0002ffff, 1, \_SB.PCI0.LNKD, 0}, // Slot 3, INTD - Package(){0x0002ffff, 2, \_SB.PCI0.LNKA, 0}, // Slot 3, INTA - Package(){0x0002ffff, 3, \_SB.PCI0.LNKB, 0}, // Slot 3, INTB - - Package(){0x0003ffff, 0, \_SB.PCI0.LNKD, 0}, // Slot 2, INTD - Package(){0x0003ffff, 1, \_SB.PCI0.LNKA, 0}, // Slot 2, INTA - Package(){0x0003ffff, 2, \_SB.PCI0.LNKB, 0}, // Slot 2, INTB - Package(){0x0003ffff, 3, \_SB.PCI0.LNKC, 0}, // Slot 2, INTC - - } - ) - Name(PRTA, Package(){ - Package(){0x0001ffff, 0, 0, 5}, // Device 1, INTA - - Package(){0x0002ffff, 0, 0, 7}, // Device 2, INTA - - Package(){0x0003ffff, 0, 0, 10}, // Device 3, INTA - Package(){0x0004ffff, 0, 0, 11}, // Device 4, INTA - - } - ) + Name(_PRT, Package() { + Package() { 0x0001ffff, 0, LNKA, 0 }, // Slot 1, Pin 0 -> LNKA + Package() { 0x0001ffff, 1, LNKB, 0 }, // Slot 1, Pin 1 -> LNKB + Package() { 0x0001ffff, 2, LNKC, 0 }, // Slot 1, Pin 2 -> LNKC + Package() { 0x0001ffff, 3, LNKD, 0 }, // Slot 1, Pin 3 -> LNKD + + Package() { 0x0002ffff, 0, LNKB, 0 }, // Slot 2, Pin 0 -> LNKB + Package() { 0x0002ffff, 1, LNKC, 0 }, // Slot 2, Pin 1 -> LNKC + Package() { 0x0002ffff, 2, LNKD, 0 }, // Slot 2, Pin 2 -> LNKD + Package() { 0x0002ffff, 3, LNKA, 0 }, // Slot 2, Pin 3 -> LNKA + + Package() { 0x0003ffff, 0, LNKC, 0 }, // Slot 3, Pin 0 -> LNKC + Package() { 0x0003ffff, 1, LNKD, 0 }, // Slot 3, Pin 1 -> LNKD + Package() { 0x0003ffff, 2, LNKA, 0 }, // Slot 3, Pin 2 -> LNKA + Package() { 0x0003ffff, 3, LNKB, 0 }, // Slot 3, Pin 3 -> LNKB + + Package() { 0x0004ffff, 0, LNKD, 0 }, // Slot 4, Pin 0 -> LNKD + Package() { 0x0004ffff, 1, LNKA, 0 }, // Slot 4, Pin 1 -> LNKA + Package() { 0x0004ffff, 2, LNKB, 0 }, // Slot 4, Pin 2 -> LNKB + Package() { 0x0004ffff, 3, LNKC, 0 }, // Slot 4, Pin 3 -> LNKC + + Package() { 0x0005ffff, 0, LNKA, 0 }, // Slot 5, Pin 0 -> LNKA + Package() { 0x0005ffff, 1, LNKB, 0 }, // Slot 5, Pin 1 -> LNKB + Package() { 0x0005ffff, 2, LNKC, 0 }, // Slot 5, Pin 2 -> LNKC + Package() { 0x0005ffff, 3, LNKD, 0 }, // Slot 5, Pin 3 -> LNKD + + Package() { 0x0006ffff, 0, LNKB, 0 }, // Slot 6, Pin 0 -> LNKB + Package() { 0x0006ffff, 1, LNKC, 0 }, // Slot 6, Pin 1 -> LNKC + Package() { 0x0006ffff, 2, LNKD, 0 }, // Slot 6, Pin 2 -> LNKD + Package() { 0x0006ffff, 3, LNKA, 0 }, // Slot 6, Pin 3 -> LNKA + + Package() { 0x0007ffff, 0, LNKC, 0 }, // Slot 7, Pin 0 -> LNKC + Package() { 0x0007ffff, 1, LNKD, 0 }, // Slot 7, Pin 1 -> LNKD + Package() { 0x0007ffff, 2, LNKA, 0 }, // Slot 7, Pin 2 -> LNKA + Package() { 0x0007ffff, 3, LNKB, 0 }, // Slot 7, Pin 3 -> LNKB + + Package() { 0x0008ffff, 0, LNKD, 0 }, // Slot 8, Pin 0 -> LNKD + Package() { 0x0008ffff, 1, LNKA, 0 }, // Slot 8, Pin 1 -> LNKA + Package() { 0x0008ffff, 2, LNKB, 0 }, // Slot 8, Pin 2 -> LNKB + Package() { 0x0008ffff, 3, LNKC, 0 }, // Slot 8, Pin 3 -> LNKC + }) + + // PCI-to-ISA bridge Device (ISA) { - Name (_ADR, 0x00000000) /* device id, PCI bus num, ... */ + Name (_ADR, 0x00010000) // PCI Device 1, Function 0 OperationRegion(PIRQ, PCI_Config, 0x60, 0x4) Scope(\) {
tools/firmware/acpi/acpi_dsdt.c +281 -263
565 lines not on this page · raw message
Fixed PCI interrupt routing in ACPI BIOS:
(a) Corrected PCI interrupt router (i.e., the PIIX3 PCI-ISA bridge) device address (on PCI bus 0) to dev 1, fn 0. Previously it was writing into the PCI-host bridge's config space (not sure what that did, if anything).
(b) Fixed typo in LNKA's _CRS method. This should be reading PIRA, not PIRB (see other LNKx _CRS methods).
(c) Started returning the dynamic PCI interrupt routing table (i.e., the one with the LNKx devices) even in APIC mode. The QEMU PIIX3 emulation always looks in the PIIX3's PCI config space when raising PCI interrupts, and it sees disabled LNKx devices if they're not used in the PCI routing table, and so fails to raise interrupts. We avoid this problem by always providing the LNKx devices, even for guests in APIC mode. This should also help APIC- mode guests manage IRQ conflicts since QEMU really provides only 16 IRQ outputs.
(d) Listed 8 PCI slots (up from 4) in PCI bus description. Should probably extend this to 32 (embedded slot 0, and slots 9-31) since the PCI namespace allows it.
Fixes various boot-time hangs of Windows 2003 with ACPI HAL. Also gets rid of some boot-time complaints from both ACPI-Windows and Linux.
tools/firmware/acpi/acpi_dsdt.asl +45 -46
113 lines not on this page · raw message
tools/firmware/acpi/acpi_dsdt.c +277 -259
554 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel