Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: PCI: Search ACPI namespace to ensure ECAM space is reserved

The static MCFG table tells us the base of ECAM space, but it does not
reserve the space -- the reservation should be done via a device in the
ACPI namespace whose _CRS includes the ECAM region.

Use acpi_resource_consumer() to check whether the ECAM space is reserved by
an ACPI namespace device. If it is, emit a message showing which device
reserves it. If not, emit a "[Firmware Bug]" warning.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

authored by

Bjorn Helgaas and committed by
Bjorn Helgaas
08b1c196 dfd1972c

+11 -1
+11 -1
arch/arm64/kernel/pci.c
··· 124 124 struct device *dev = &root->device->dev; 125 125 struct resource *bus_res = &root->secondary; 126 126 u16 seg = root->segment; 127 - struct pci_config_window *cfg; 128 127 struct resource cfgres; 128 + struct acpi_device *adev; 129 + struct pci_config_window *cfg; 129 130 unsigned int bsz; 130 131 131 132 /* Use address from _CBA if present, otherwise lookup MCFG */ ··· 142 141 cfgres.start = root->mcfg_addr + bus_res->start * bsz; 143 142 cfgres.end = cfgres.start + resource_size(bus_res) * bsz - 1; 144 143 cfgres.flags = IORESOURCE_MEM; 144 + 145 + adev = acpi_resource_consumer(&cfgres); 146 + if (adev) 147 + dev_info(dev, "ECAM area %pR reserved by %s\n", &cfgres, 148 + dev_name(&adev->dev)); 149 + else 150 + dev_warn(dev, FW_BUG "ECAM area %pR not reserved in ACPI namespace\n", 151 + &cfgres); 152 + 145 153 cfg = pci_ecam_create(dev, &cfgres, bus_res, &pci_generic_ecam_ops); 146 154 if (IS_ERR(cfg)) { 147 155 dev_err(dev, "%04x:%pR error %ld mapping ECAM\n", seg, bus_res,