During MCFG parsing, the configuration space is added through the following code path:
-- acpi_parse_mcfg() |-- pci_mmconfig_add() |-- pci_mmconfig_alloc()
Then, during PCI root creation, it is trying to re-allocating the config space.
-- acpi_pci_root_add() |-- pci_acpi_scan_root() |-- acpi_pci_root_create() |-- ops->init_info() == pci_acpi_root_init_info() |-- pci_add_mmconfig_region() |-- pci_mmconfig_lookup() |-- pci_mmconfig_alloc()
Therefore, we should be safe to just return if it's already existed.
Signed-off-by: Suravee Suthikulpanit Suravee.Suthikulpanit@amd.com --- arch/arm64/kernel/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 5c79f51..3dc82e0 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -157,8 +157,13 @@ static int pci_add_mmconfig_region(struct acpi_pci_root_info *ci) info->mcfg_added = false;
cfg = pci_mmconfig_lookup(seg, info->start_bus); - if (cfg) - return -EEXIST; + if (cfg) { + /* Note: if segment already exist. + * This should be okay we should + * simply just return. + */ + return 0; + }
cfg = pci_mmconfig_alloc(seg, info->start_bus, info->end_bus, root->mcfg_addr);