]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
PCI: Assign PCI domain IDs by ida_alloc()
authorPali Rohár <pali@kernel.org>
Thu, 14 Jul 2022 18:41:30 +0000 (20:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:44:28 +0000 (07:44 +0200)
commitdb273126bf548a2dc611372e8f6a817b2b16b563
treecc1492dadfad7f51c8759a2771fe79fe4e6c4191
parentfd168b7d1d7cfc61cea561b1e3cc47aefc9e8f19
PCI: Assign PCI domain IDs by ida_alloc()

[ Upstream commit c14f7ccc9f5dcf9d06ddeec706f85405b2c80600 ]

Replace assignment of PCI domain IDs from atomic_inc_return() to
ida_alloc().

Use two IDAs, one for static domain allocations (those which are defined in
device tree) and second for dynamic allocations (all other).

During removal of root bus / host bridge, also release the domain ID.  The
released ID can be reused again, for example when dynamically loading and
unloading native PCI host bridge drivers.

This change also allows to mix static device tree assignment and dynamic by
kernel as all static allocations are reserved in dynamic pool.

[bhelgaas: set "err" if "bus->domain_nr < 0"]
Link: https://lore.kernel.org/r/20220714184130.5436-1-pali@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Stable-dep-of: 804443c1f278 ("PCI: Fix reference leak in pci_register_host_bridge()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/pci.c
drivers/pci/probe.c
drivers/pci/remove.c
include/linux/pci.h