Bug 15701 - Linux should ignore Producer/Consumer bit in _CRS Address Space descriptors
Summary: Linux should ignore Producer/Consumer bit in _CRS Address Space descriptors
Status: CLOSED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: Config-Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Bjorn Helgaas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-05 23:32 UTC by Bjorn Helgaas
Modified: 2010-09-29 02:24 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.34-rc3
Tree: Mainline
Regression: No


Attachments
test DSDT (22.71 KB, text/plain)
2010-04-05 23:33 UTC, Bjorn Helgaas
Details
Windows Server 2008 R2 summary (61.31 KB, image/png)
2010-04-05 23:34 UTC, Bjorn Helgaas
Details
Windows memory map (46.77 KB, image/png)
2010-04-05 23:35 UTC, Bjorn Helgaas
Details
HPET resources (86.07 KB, image/png)
2010-04-05 23:36 UTC, Bjorn Helgaas
Details
PCI host bridge resources (87.05 KB, image/png)
2010-04-05 23:38 UTC, Bjorn Helgaas
Details
PCI host bridge resources, part 2 (86.90 KB, image/png)
2010-04-05 23:39 UTC, Bjorn Helgaas
Details
PCI NIC resources (91.63 KB, image/png)
2010-04-05 23:41 UTC, Bjorn Helgaas
Details

Description Bjorn Helgaas 2010-04-05 23:32:13 UTC
In the ACPI PCI host bridge driver, the arch-specific code parses _CRS resources to learn the windows forwarded to the PCI bus.  Both ia64 and x86 follow section 6.4.3.5 of ACPI spec 4.0, which says that Bit[0] of Byte 4 in QWord, DWord, Word, and Extended Address Space Descriptors is a "Consumer/Producer" bit.  This bit is set if the device consumes the resource, and clear if the device produces and consumes it, i.e., if the device forwards the resource to a downstream bus.

However, it is rumored that BIOSes have not used the Consumer/Producer bit consistently, and the bit was documented as "Ignored" in ACPI 2.0c.  The bit was added back in 3.0, but this apparently was a mistake.

I experimented with Windows Server 2008 R2 in a qemu environment, running SeaBIOS, where I could modify the _CRS description and see how Windows handled it.

The PCI host bridge windows should be described as ResourceProducer, and the HPET registers should be described as ResourceConsumer.  As shown here, I modified the SeaBIOS DSDT to reverse both flags, so the bridge window is a Consumer and the HPET registers are a Producer:

        Device(PCI0) {
            Name (_HID, EisaId ("PNP0A03"))
            Name (_CRS, ResourceTemplate ()
            {
                ...
                DWordMemory (ResourceConsumer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
                    0x00000000,         // Address Space Granularity
                    0xE0000000,         // Address Range Minimum
                    0xFEBFFFFF,         // Address Range Maximum
                    0x00000000,         // Address Translation Offset
                    0x1EC00000,         // Address Length
                    ,, , AddressRangeMemory, TypeStatic)
            })
        }
        Device(HPET) {
            Name(_HID,  EISAID("PNP0103"))
            Name(_CRS, ResourceTemplate() {
                DWordMemory(
                    ResourceProducer, PosDecode, MinFixed, MaxFixed,
                    NonCacheable, ReadWrite,
                    0x00000000,
                    0xFED00000,
                    0xFED003FF,
                    0x00000000,
                    0x00000400 /* 1K memory: FED00000 - FED003FF */
                )
            })
        }

The attachments of Windows Device Manager screenshots show that Windows interpreted the bridge ResourceConsumer as a window and the HPET ResourceProducer as normal registers.  PCI devices, e.g., the NIC and VGA, inside the ResourceConsumer range worked normally.
Comment 1 Bjorn Helgaas 2010-04-05 23:33:43 UTC
Created attachment 25873 [details]
test DSDT

modified SeaBIOS DSDT
Comment 2 Bjorn Helgaas 2010-04-05 23:34:54 UTC
Created attachment 25874 [details]
Windows Server 2008 R2 summary
Comment 3 Bjorn Helgaas 2010-04-05 23:35:39 UTC
Created attachment 25875 [details]
Windows memory map
Comment 4 Bjorn Helgaas 2010-04-05 23:36:49 UTC
Created attachment 25876 [details]
HPET resources

These are incorrectly described as ResourceProducer in the DSDT, but seem to still work fine.
Comment 5 Bjorn Helgaas 2010-04-05 23:38:15 UTC
Created attachment 25877 [details]
PCI host bridge resources

Note the 0xcf8-0xcff region doesn't appear at all, even though it is correctly described as a ResourceConsumer in the DSDT.
Comment 6 Bjorn Helgaas 2010-04-05 23:39:40 UTC
Created attachment 25878 [details]
PCI host bridge resources, part 2

The window from 0xE0000000-0xFEBFFFFF is incorrectly described as a ResourceConsumer in the DSDT.
Comment 7 Bjorn Helgaas 2010-04-05 23:41:36 UTC
Created attachment 25879 [details]
PCI NIC resources

PCI NIC resources, inside the window incorrectly described as a ResourceConsumer.
Comment 8 Zhang Rui 2010-06-24 08:28:32 UTC
hmm, bjorn, any update of this bug?
Comment 9 Bjorn Helgaas 2010-07-08 22:19:46 UTC
This patch makes the x86 PCI host bridge driver ignore the Producer/Consumer bit:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;
h=73a0e614580fb650846be1e9315f6b7b6069b9cc

This patch appeared in v2.6.34-rc6.

Note You need to log in before you can comment on or make changes to this bug.