All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: drop pci_segments_init()
@ 2025-02-26 11:38 Jan Beulich
  2025-02-26 14:46 ` Roger Pau Monné
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jan Beulich @ 2025-02-26 11:38 UTC (permalink / raw)
  To: xen-devel@lists.xenproject.org
  Cc: Julien Grall, Stefano Stabellini, Volodymyr Babchuk,
	Bertrand Marquis, Michal Orzel, Andrew Cooper,
	Roger Pau Monné, Anthony Perard

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>
---
This is entirely optional and up for discussion. There certainly also is
an argument towards keeping the function. Otoh on Arm there is the still
open question whether segment 0 really is kind of special there (as it
is on x86, largely for historical reasons), or whether the code can be
dropped there altogether.
---
v4: Move x86 logic into __start_xen() itself.
v3: Adjust description to account for and re-base over dropped earlier
    patch.
v2: New.

--- a/xen/arch/arm/pci/pci.c
+++ b/xen/arch/arm/pci/pci.c
@@ -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();
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -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;
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1898,6 +1898,13 @@ void asmlinkage __init noreturn __start_
     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
      * particular iommu_intremap having got turned off.
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -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;
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -219,7 +219,6 @@ void setup_hwdom_pci_devices(struct doma
                              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,


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-03-10 10:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 11:38 [PATCH] PCI: drop pci_segments_init() Jan Beulich
2025-02-26 14:46 ` Roger Pau Monné
2025-02-26 19:57 ` Stewart Hildebrand
2025-02-27  6:58   ` Jan Beulich
2025-02-27 17:29     ` Stewart Hildebrand
2025-03-10  8:35 ` Ping: " Jan Beulich
2025-03-10 10:33 ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.