On 9/29/25 3:36 PM, Shameer Kolothum wrote:
> 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.
Does not really explain what the patch does:
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
>
> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
> ---
> hw/arm/virt-acpi-build.c | 8 ++++++++
> hw/arm/virt.c | 4 ++++
> include/hw/arm/virt.h | 1 +
> 3 files changed, 13 insertions(+)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 96830f7c4e..fd03b7f6a9 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -163,6 +163,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 for preserving PCI Boot Configurations
_DSM function 5 (Ignore PCI Boot Configuration)
> + */
> + if (vms->pci_preserve_config) {
> + cfg.preserve_config = true;
> + }
> +
> if (vms->highmem_mmio) {
> cfg.mmio64 = memmap[VIRT_HIGH_PCIE_MMIO];
> }
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index b533b0556e..6467d7cfc8 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -3087,6 +3087,10 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev,
> }
>
> create_smmuv3_dev_dtb(vms, dev, bus);
> + if (object_property_get_bool(OBJECT(dev), "accel", &error_abort) &&
> + !vms->pci_preserve_config) {
> + vms->pci_preserve_config = true;
why don't you put that in above "if
(object_property_get_bool(OBJECT(dev), "accel", &error_abort)) {"
block. Besides do you need to test !vms->pci_preserve_config? Eric
> + }
> }
> }
>
> diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
> index ea2cff05b0..00287941a9 100644
> --- a/include/hw/arm/virt.h
> +++ b/include/hw/arm/virt.h
> @@ -180,6 +180,7 @@ struct VirtMachineState {
> bool ns_el2_virt_timer_irq;
> CXLState cxl_devices_state;
> bool legacy_smmuv3_present;
> + bool pci_preserve_config;
> };
>
> #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)