]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/arm/virt: Set PCI preserve_config for accel SMMUv3
authorShameer Kolothum <skolothumtho@nvidia.com>
Thu, 29 Jan 2026 13:32:05 +0000 (13:32 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 29 Jan 2026 13:32:05 +0000 (13:32 +0000)
Introduce a new pci_preserve_config field in virt machine state which
allows the generation of DSM #5. This field is only set if accel SMMU
is instantiated.

In a subsequent patch, SMMUv3 accel mode will make use of IORT RMR nodes
to enable nested translation of MSI doorbell addresses. IORT RMR requires
_DSM #5 to be set for the PCI host bridge so that the Guest kernel
preserves the PCI boot configuration.

Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
Message-id: 20260126104342.253965-24-skolothumtho@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/virt-acpi-build.c
hw/arm/virt.c
include/hw/arm/virt.h

index 03b43425746351f1fbc1cbe074cb24aa84909d98..9032a5df1c93ed632bfc2f4f64d4d39af7de7a09 100644 (file)
@@ -164,6 +164,14 @@ static void acpi_dsdt_add_pci(Aml *scope, const MemMapEntry *memmap,
         .pci_native_hotplug = !acpi_pcihp,
     };
 
+    /*
+     * Accel SMMU requires RMRs for MSI 1-1 mapping, which require _DSM
+     * function 5 (_DSM for Preserving PCI Boot Configurations).
+     */
+    if (vms->pci_preserve_config) {
+        cfg.preserve_config = true;
+    }
+
     if (vms->highmem_mmio) {
         cfg.mmio64 = memmap[VIRT_HIGH_PCIE_MMIO];
     }
index 91fec582ed078b91de384cea599746ea9880faa3..899b02e1f77dc7dfd6142c08daec22a25b9ce306 100644 (file)
@@ -3080,6 +3080,7 @@ static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
             }
             object_property_set_uint(OBJECT(dev), "msi-gpa", db_start,
                                      &error_abort);
+            vms->pci_preserve_config = true;
         }
     }
 }
index 5907d41dbb2b61f30c1351ad56cd9ee7604d7728..3b382bdf49ff6d49a036410463e3cd3106f5189e 100644 (file)
@@ -182,6 +182,7 @@ struct VirtMachineState {
     bool legacy_smmuv3_present;
     MemoryRegion *sysmem;
     MemoryRegion *secure_sysmem;
+    bool pci_preserve_config;
 };
 
 #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)