[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.19] x86/iommu: setup MMCFG ahead of IOMMU



commit 3f250a375fc02b87f69328d3fa6120056232ef3e
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Wed Sep 3 14:06:00 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Sep 3 14:06:00 2025 +0200

    x86/iommu: setup MMCFG ahead of IOMMU
    
    Otherwise the PCI accesses to segments different than the first one done by
    the IOMMU initialization code would silently fail by returning all ones.
    
    Introduce a new helper, called pci_setup(), and move both the creation of
    PCI segment 0 internal data structures, plus the parsing of ACPI MMCFG
    table to it.  This moves acpi_mmcfg_init() slightly earlier from
    acpi_boot_init() into pci_setup().
    
    Note that further work will be needed to support systems where access
    methods to segments different than 0 is not discoverable by Xen.
    
    Fixes: 3950f2485bbc ('x86/x2APIC: defer probe until after IOMMU ACPI table 
parsing')
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: c292772b4945d3a264a61c3c1920f1aebd17998b
    master date: 2025-08-21 11:57:25 +0200
---
 xen/arch/x86/acpi/boot.c              | 2 --
 xen/arch/x86/setup.c                  | 6 ++++++
 xen/arch/x86/x86_64/mmconfig-shared.c | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 170f9783c5..aa9ab1a2e3 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -748,8 +748,6 @@ int __init acpi_boot_init(void)
 
        acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
 
-       acpi_mmcfg_init();
-
        erst_init();
 
        acpi_hest_init();
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 2148dde05f..a123f94e85 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1802,6 +1802,12 @@ void asmlinkage __init noreturn __start_xen(unsigned 
long mbi_p)
      */
     setup_system_domains();
 
+    /*
+     * Initialize PCI (create segment 0, setup MMCFG access) ahead of IOMMU
+     * setup, as devices in segment > 0 must also be discoverable.
+     */
+    acpi_mmcfg_init();
+
     /*
      * IOMMU-related ACPI table parsing has to happen before APIC probing, for
      * check_x2apic_preenabled() to be able to observe respective findings, in
diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c 
b/xen/arch/x86/x86_64/mmconfig-shared.c
index b3b2da7362..7818ae5c3f 100644
--- a/xen/arch/x86/x86_64/mmconfig-shared.c
+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
@@ -403,6 +403,9 @@ void __init acpi_mmcfg_init(void)
 
     pci_segments_init();
 
+    if ( acpi_disabled )
+        return;
+
     /* MMCONFIG disabled */
     if ((pci_probe & PCI_PROBE_MMCONF) == 0)
         return;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.