• Bjorn Helgaas's avatar
    x86/PCI: Clip only host bridge windows for E820 regions · 4c5e242d
    Bjorn Helgaas authored
    ACPI firmware advertises PCI host bridge resources via PNP0A03 _CRS
    methods.  Some BIOSes include non-window address space in _CRS, and if we
    allocate that non-window space for PCI devices, they don't work.
    
    4dc2287c ("x86: avoid E820 regions when allocating address space")
    works around this issue by clipping out any regions mentioned in the E820
    table in the allocate_resource() path, but the implementation has a couple
    issues:
    
      - The clipping is done for *all* allocations, not just those for PCI
        address space, and
    
      - The clipping is done at each allocation instead of being done once when
        setting up the host bridge windows.
    
    Rework the implementation so we only clip PCI host bridge windows, and we
    do it once when setting them up.
    
    Example output changes:
    
        BIOS-e820: [mem 0x00000000b0000000-0x00000000c00fffff] reserved
      + acpi PNP0A08:00: clipped [mem 0xc0000000-0xfebfffff window] to [mem 0xc0100000-0xfebfffff window] for e820 entry [mem 0xb0000000-0xc00fffff]
      - pci_bus 0000:00: root bus resource [mem 0xc0000000-0xfebfffff window]
      + pci_bus 0000:00: root bus resource [mem 0xc0100000-0xfebfffff window]
    
    Link: https://lore.kernel.org/r/20220304035110.988712-3-helgaas@kernel.orgSigned-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
    Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    4c5e242d
resource.c 1.53 KB