On 05/21/2015 08:08 AM, Hanjun Guo wrote:
On 2015年05月21日 17:10, Tomasz Nowicki wrote:
Hi Suravee,
On 21.05.2015 00:19, Suravee Suthikulpanit wrote:
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);
ACK !
Hanjun,
Any reason why you removed rcu read lock for pci_mmconfig_lookup()? Also, we should do sanity check here for: if (!root->mcfg_addr) return -EINVAL; before new MCFG region injection.
Just some unknown reason (maybe catathymic amnesia :) ), anyway, I will add them back :)
Thanks Hanjun
I'm impressed. I actually had to look up "catathymic amnesia". I had never heard the term before. Maybe I suffer from it too :-D.