]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commitdiff
PCI: drop pci_segments_init()
authorJan Beulich <jbeulich@suse.com>
Tue, 11 Mar 2025 08:54:19 +0000 (09:54 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Mar 2025 08:54:19 +0000 (09:54 +0100)
Have callers invoke pci_add_segment() directly instead: With radix tree
initialization moved out of the function, its name isn't quite
describing anymore what it actually does.

On x86 move the logic into __start_xen() itself, to reduce the risk of
re-introducing ordering issues like the one which was addressed by
26fe09e34566 ("radix-tree: introduce RADIX_TREE{,_INIT}()").

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/arch/arm/pci/pci.c
xen/arch/x86/setup.c
xen/arch/x86/x86_64/mmconfig-shared.c
xen/drivers/passthrough/pci.c
xen/include/xen/pci.h

index 78b97beaef12e85771602af4b296e075596affb7..8d9692c92e0a56a72407c6e789ada70b598920ff 100644 (file)
@@ -88,7 +88,8 @@ static int __init pci_init(void)
     if ( !pci_passthrough_enabled )
         return 0;
 
-    pci_segments_init();
+    if ( pci_add_segment(0) )
+        panic("Could not initialize PCI segment 0\n");
 
     if ( acpi_disabled )
         return dt_pci_init();
index 143749e5da5bae83fca719fc8ff9d506254d6ea2..4a32d8491186d8d36a87c81c48331a9fc3baa99c 100644 (file)
@@ -1899,6 +1899,13 @@ void asmlinkage __init noreturn __start_xen(void)
      */
     setup_system_domains();
 
+    /*
+     * Ahead of any ACPI table parsing make sure we have control structures
+     * for PCI segment 0.
+     */
+    if ( pci_add_segment(0) )
+        panic("Could not initialize PCI segment 0\n");
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
index 77ba1e28f1a0b58934245d6b2af4667c134094c1..f1a3d42c5b217ce51d18369c8a782377422f78ec 100644 (file)
@@ -402,8 +402,6 @@ void __init acpi_mmcfg_init(void)
 {
     bool valid = true;
 
-    pci_segments_init();
-
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
index ab25840e2019374b0012d00c496d62cbf0b05f46..3edcfa8a048f5c109e1d6b3a0c477c080f789132 100644 (file)
@@ -127,12 +127,6 @@ static int pci_segments_iterate(
     return rc;
 }
 
-void __init pci_segments_init(void)
-{
-    if ( !alloc_pseg(0) )
-        panic("Could not initialize PCI segment 0\n");
-}
-
 int __init pci_add_segment(u16 seg)
 {
     return alloc_pseg(seg) ? 0 : -ENOMEM;
index 4f12bcf089ac9e3c0553bdc8d838f7989b6399ff..ef601966533e66363b8297a48f3b4df397b9cae6 100644 (file)
@@ -219,7 +219,6 @@ void setup_hwdom_pci_devices(struct domain *d,
                              int (*handler)(uint8_t devfn,
                                             struct pci_dev *pdev));
 int pci_release_devices(struct domain *d);
-void pci_segments_init(void);
 int pci_add_segment(u16 seg);
 const unsigned long *pci_get_ro_map(u16 seg);
 int pci_add_device(u16 seg, u8 bus, u8 devfn,