Commit f284dff4 authored by Bjorn Helgaas's avatar Bjorn Helgaas

x86/pci: Comment pci_mmconfig_insert() obscure MCFG dependency

In pci_mmconfig_insert(), there's no reference to "addr" between locking
pci_mmcfg_lock and testing "addr", so it *looks* like we should move the
test before the lock.

But 07f9b61c ("x86/PCI: MMCONFIG: Check earlier for MMCONFIG region at
address zero") did that, which broke things by returning -EINVAL when
"addr" is zero instead of -EEXIST.

So 07f9b61c was reverted by 67d470e0 ("Revert "x86/PCI: MMCONFIG:
Check earlier for MMCONFIG region at address zero"").

Add a comment about this issue to prevent it from happening again.

Link: https://lore.kernel.org/r/20231121183643.249006-8-helgaas@kernel.orgTested-by: default avatarTomasz Pala <gotar@polanet.pl>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent d26e7fc3
......@@ -786,6 +786,10 @@ int pci_mmconfig_insert(struct device *dev, u16 seg, u8 start, u8 end,
return -EEXIST;
}
/*
* Don't move earlier; we must return -EEXIST, not -EINVAL, if
* pci_mmconfig_lookup() finds something
*/
if (!addr) {
mutex_unlock(&pci_mmcfg_lock);
return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment