qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 00/27] hw/arm/virt: Add support for user-creatable accelerated SMMUv3
@ 2025-09-29 13:36 Shameer Kolothum
  2025-09-29 13:36 ` [PATCH v4 01/27] backends/iommufd: Introduce iommufd_backend_alloc_viommu Shameer Kolothum
                   ` (27 more replies)
  0 siblings, 28 replies; 118+ messages in thread
From: Shameer Kolothum @ 2025-09-29 13:36 UTC (permalink / raw)
  To: qemu-arm, qemu-devel
  Cc: eric.auger, peter.maydell, jgg, nicolinc, ddutile, berrange,
	nathanc, mochs, smostafa, wangzhou1, jiangkunkun,
	jonathan.cameron, zhangfei.gao, zhenzhong.duan, yi.l.liu,
	shameerkolothum

Hi,

Changes from RFCv3:

 -Removed RFC tag as we have the user-creatable SMMUv3 sereis now applied[0]
 -Addressed feedback from RFCv3. Thanks to all!(I believe I have addressed
  all comments, apologies if I missed any)
 -Removed dependency on “at least one cold-plugged vfio-pci device.” The
  accelerated SMMUv3 features are now initialized based on QEMU SMMUv3
  defaults, and each time a device is attached, the host SMMUv3 info is
  retrieved and features are cross-checked.
 -Includes IORT RMR support to enable MSI doorbell address translation.
  Thanks to Eric, this is based on his earlier attempt on DSM #5 and
  IORT RMR support.
 -Added optional properties (like ATS, RIL, etc.) for the user to override
  the default QEMU SMMUv3 features.
 -Deferred batched invalidation of commands for now. This series supports
  basic single in-order command issuing to the host. Batched support will
  be added as a follow up series.
 -Includes synthesizing PASID capability for the assigned vfio-pci device.
  Thanks to Yi’s effort, this is based on his out-of-tree patches.
 -Added a migration blocker for now. Plan is to enable migration support
  later.
 -Has dependency(patches: 4/5/8)on Zhenzhong's pass-through support series[1]

PATCH organization:
 1–20: Enables accelerated SMMUv3 with features based on default QEMU SMMUv3,
       including IORT RMR based MSI support.
 21–23: Adds options for specifying RIL, ATS, and OAS features.
 24–27: Adds PASID support, including VFIO changes.

Tests:
Performed basic sanity tests on an NVIDIA GRACE platform with GPU device
assignments. A CUDA test application was used to verify the SVA use case.
Further tests are always welcome.

Eg: Qemu Cmd line:

qemu-system-aarch64 -machine virt,gic-version=3,highmem-mmio-size=2T \
-cpu host -smp cpus=4 -m size=16G,slots=2,maxmem=66G -nographic \
-bios QEMU_EFI.fd -object iommufd,id=iommufd0 -enable-kvm \
-object memory-backend-ram,size=8G,id=m0 \
-object memory-backend-ram,size=8G,id=m1 \
-numa node,memdev=m0,cpus=0-3,nodeid=0 -numa node,memdev=m1,nodeid=1 \
-numa node,nodeid=2 -numa node,nodeid=3 -numa node,nodeid=4 -numa node,nodeid=5 \
-numa node,nodeid=6 -numa node,nodeid=7 -numa node,nodeid=8 -numa node,nodeid=9 \
-device pxb-pcie,id=pcie.1,bus_nr=1,bus=pcie.0 \
-device arm-smmuv3,primary-bus=pcie.1,id=smmuv3.0,accel=on,ats=on,ril=off,pasid=on,oas=48 \
-device pcie-root-port,id=pcie.port1,bus=pcie.1,chassis=1,pref64-reserve=512G,id=dev0 \
-device vfio-pci,host=0019:06:00.0,rombar=0,id=dev0,iommufd=iommufd0,bus=pcie.port1 \
-object acpi-generic-initiator,id=gi0,pci-dev=dev0,node=2 \
...
-object acpi-generic-initiator,id=gi7,pci-dev=dev0,node=9 \
-device pxb-pcie,id=pcie.2,bus_nr=8,bus=pcie.0 \
-device arm-smmuv3,primary-bus=pcie.2,id=smmuv3.1,accel=on,ats=on,ril=off,pasid=on \
-device pcie-root-port,id=pcie.port2,bus=pcie.2,chassis=2,pref64-reserve=512G \
-device vfio-pci,host=0018:06:00.0,rombar=0,id=dev1,iommufd=iommufd0,bus=pcie.port2 \
-device virtio-blk-device,drive=fs \
-drive file=image.qcow2,index=0,media=disk,format=qcow2,if=none,id=fs \
-net none \
-nographic

A complete branch can be found here,
https://github.com/shamiali2008/qemu-master smmuv3-accel-v4

Please take a look and let me know your feedback.

Thanks,
Shameer

[0] https://lore.kernel.org/qemu-devel/20250829082543.7680-1-skolothumtho@nvidia.com/
[1] https://lore.kernel.org/qemu-devel/20250918085803.796942-1-zhenzhong.duan@intel.com/

Deatils from RFCv3 Cover letter:
-------------------------------
This patch series introduces initial support for a user-creatable,
accelerated SMMUv3 device (-device arm-smmuv3,accel=on) in QEMU.

This is based on the user-creatable SMMUv3 device series [0].

Why this is needed:

On ARM, to enable vfio-pci pass-through devices in a VM, the host SMMUv3
must be set up in nested translation mode (Stage 1 + Stage 2), with
Stage 1 (S1) controlled by the guest and Stage 2 (S2) managed by the host.

This series introduces an optional accel property for the SMMUv3 device,
indicating that the guest will try to leverage host SMMUv3 features for
acceleration. By default, enabling accel configures the host SMMUv3 in
nested mode to support vfio-pci pass-through.

This new accelerated, user-creatable SMMUv3 device lets you:

 -Set up a VM with multiple SMMUv3s, each tied to a different physical SMMUv3
  on the host. Typically, you’d have multiple PCIe PXB root complexes in the
  VM (one per virtual NUMA node), and each of them can have its own SMMUv3.
  This setup mirrors the host's layout, where each NUMA node has its own
  SMMUv3, and helps build VMs that are more aligned with the host's NUMA
  topology.

 -The host–guest SMMUv3 association results in reduced invalidation broadcasts
  and lookups for devices behind different physical SMMUv3s.

 -Simplifies handling of host SMMUv3s with differing feature sets.

 -Lays the groundwork for additional capabilities like vCMDQ support.

Eric Auger (3):
  acpi/gpex: Fix PCI Express Slot Information function 0 returned value
  hw/pci-host/gpex: Allow to generate preserve boot config DSM #5
  hw/arm/virt-acpi-build: Add IORT RMR regions to handle MSI nested
    binding

Nicolin Chen (5):
  backends/iommufd: Introduce iommufd_backend_alloc_viommu
  backends/iommufd: Introduce iommufd_vdev_alloc
  hw/arm/smmuv3-accel: Add set/unset_iommu_device callback
  hw/arm/smmuv3-accel: Support nested STE install/uninstall support
  hw/arm/smmuv3-accel: Allocate a vDEVICE object for device

Shameer Kolothum (18):
  hw/arm/smmu-common: Factor out common helper functions and export
  hw/arm/smmu-common:Make iommu ops part of SMMUState
  hw/arm/smmuv3-accel: Introduce smmuv3 accel device
  hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints
    with iommufd
  hw/arm/smmuv3: Implement get_viommu_cap() callback
  hw/pci/pci: Introduce optional get_msi_address_space() callback
  hw/arm/smmuv3-accel: Make use of get_msi_address_space() callback
  hw/arm/smmuv3-accel: Add support to issue invalidation cmd to host
  hw/arm/smmuv3-accel: Get host SMMUv3 hw info and validate
  hw/arm/virt: Set PCI preserve_config for accel SMMUv3
  hw/arm/smmuv3-accel: Install S1 bypass hwpt on reset
  hw/arm/smmuv3: Add accel property for SMMUv3 device
  hw/arm/smmuv3-accel: Add a property to specify RIL support
  hw/arm/smmuv3-accel: Add support for ATS
  hw/arm/smmuv3-accel: Add property to specify OAS bits
  backends/iommufd: Retrieve PASID width from
    iommufd_backend_get_device_info()
  backends/iommufd: Add a callback helper to retrieve PASID support
  hw.arm/smmuv3: Add support for PASID enable

Yi Liu (1):
  vfio: Synthesize vPASID capability to VM

 backends/iommufd.c                  |  68 ++-
 backends/trace-events               |   2 +
 hw/arm/Kconfig                      |   5 +
 hw/arm/meson.build                  |   3 +-
 hw/arm/smmu-common.c                |  51 +-
 hw/arm/smmuv3-accel.c               | 726 ++++++++++++++++++++++++++++
 hw/arm/smmuv3-accel.h               |  83 ++++
 hw/arm/smmuv3-internal.h            |   7 +-
 hw/arm/smmuv3.c                     | 145 +++++-
 hw/arm/trace-events                 |   5 +
 hw/arm/virt-acpi-build.c            |  93 +++-
 hw/arm/virt.c                       |  36 +-
 hw/pci-bridge/pci_expander_bridge.c |   1 -
 hw/pci-host/gpex-acpi.c             |  29 +-
 hw/pci/pci.c                        |  19 +
 hw/vfio/iommufd.c                   |   7 +-
 hw/vfio/pci.c                       |  31 ++
 include/hw/arm/smmu-common.h        |   7 +
 include/hw/arm/smmuv3.h             |   9 +
 include/hw/arm/virt.h               |   1 +
 include/hw/iommu.h                  |   1 +
 include/hw/pci-host/gpex.h          |   1 +
 include/hw/pci/pci.h                |  16 +
 include/hw/pci/pci_bridge.h         |   1 +
 include/system/host_iommu_device.h  |  14 +
 include/system/iommufd.h            |  29 +-
 target/arm/kvm.c                    |   2 +-
 27 files changed, 1335 insertions(+), 57 deletions(-)
 create mode 100644 hw/arm/smmuv3-accel.c
 create mode 100644 hw/arm/smmuv3-accel.h

-- 
2.43.0



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

end of thread, other threads:[~2025-10-22 16:57 UTC | newest]

Thread overview: 118+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29 13:36 [PATCH v4 00/27] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 01/27] backends/iommufd: Introduce iommufd_backend_alloc_viommu Shameer Kolothum
2025-09-29 15:35   ` Jonathan Cameron via
2025-10-17 12:21   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 02/27] backends/iommufd: Introduce iommufd_vdev_alloc Shameer Kolothum
2025-09-29 15:40   ` Jonathan Cameron via
2025-09-29 17:52   ` Nicolin Chen
2025-09-30  8:14     ` Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 03/27] hw/arm/smmu-common: Factor out common helper functions and export Shameer Kolothum
2025-09-29 15:43   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 04/27] hw/arm/smmu-common:Make iommu ops part of SMMUState Shameer Kolothum
2025-09-29 15:45   ` Jonathan Cameron via
2025-09-29 21:53   ` Nicolin Chen via
2025-10-01 16:11   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 05/27] hw/arm/smmuv3-accel: Introduce smmuv3 accel device Shameer Kolothum
2025-09-29 15:53   ` Jonathan Cameron via
2025-09-29 22:24   ` Nicolin Chen
2025-10-01 16:25   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 06/27] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints with iommufd Shameer Kolothum
2025-09-29 16:08   ` Jonathan Cameron via
2025-09-30  8:03     ` Shameer Kolothum
2025-10-01 16:38       ` Eric Auger
2025-10-02  8:16         ` Shameer Kolothum
2025-09-30  0:11   ` Nicolin Chen
2025-10-02  7:29     ` Shameer Kolothum
2025-10-01 17:32   ` Eric Auger
2025-10-02  9:30     ` Shameer Kolothum
2025-10-17 12:47       ` Eric Auger
2025-10-17 13:15         ` Shameer Kolothum
2025-10-17 17:19           ` Eric Auger
2025-10-20 16:31   ` Eric Auger
2025-10-20 18:25     ` Nicolin Chen
2025-10-20 18:59       ` Shameer Kolothum
2025-10-21 15:28         ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 07/27] hw/arm/smmuv3: Implement get_viommu_cap() callback Shameer Kolothum
2025-09-29 16:13   ` Jonathan Cameron via
2025-10-01 17:36   ` Eric Auger
2025-10-02  9:38     ` Shameer Kolothum
2025-10-02 12:31       ` Eric Auger
2025-10-02  9:39     ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 08/27] hw/arm/smmuv3-accel: Add set/unset_iommu_device callback Shameer Kolothum
2025-09-29 16:25   ` Jonathan Cameron via
2025-09-30  8:13     ` Shameer Kolothum
2025-10-02  6:52   ` Eric Auger
2025-10-02 11:34     ` Shameer Kolothum
2025-10-02 16:44       ` Nicolin Chen
2025-10-02 18:35         ` Jason Gunthorpe
2025-10-17 12:06         ` Eric Auger
2025-10-17 12:23   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 09/27] hw/arm/smmuv3-accel: Support nested STE install/uninstall support Shameer Kolothum
2025-09-29 16:41   ` Jonathan Cameron via
2025-10-02 10:04   ` Eric Auger
2025-10-02 12:08     ` Shameer Kolothum
2025-10-02 12:27       ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 10/27] hw/arm/smmuv3-accel: Allocate a vDEVICE object for device Shameer Kolothum
2025-09-29 16:42   ` Jonathan Cameron via
2025-10-17 13:08   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 11/27] hw/pci/pci: Introduce optional get_msi_address_space() callback Shameer Kolothum
2025-09-29 16:48   ` Jonathan Cameron via
2025-10-16 22:30   ` Nicolin Chen
2025-10-20 16:14     ` Eric Auger
2025-10-20 18:00       ` Nicolin Chen
2025-10-21 16:26         ` Eric Auger
2025-10-21 18:56           ` Nicolin Chen
2025-10-22 16:25             ` Eric Auger
2025-10-22 16:56               ` Shameer Kolothum
2025-10-20 16:21   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 12/27] hw/arm/smmuv3-accel: Make use of " Shameer Kolothum
2025-09-29 16:51   ` Jonathan Cameron via
2025-10-02  7:33     ` Shameer Kolothum
2025-10-16 23:28   ` Nicolin Chen
2025-10-20 16:43   ` Eric Auger
2025-10-21  8:15     ` Shameer Kolothum
2025-10-21 16:16       ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 13/27] hw/arm/smmuv3-accel: Add support to issue invalidation cmd to host Shameer Kolothum
2025-09-29 16:53   ` Jonathan Cameron via
2025-10-16 22:59   ` Nicolin Chen via
2025-09-29 13:36 ` [PATCH v4 14/27] hw/arm/smmuv3-accel: Get host SMMUv3 hw info and validate Shameer Kolothum
2025-10-01 12:56   ` Jonathan Cameron via
2025-10-02  7:37     ` Shameer Kolothum
2025-10-02  9:54       ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 15/27] acpi/gpex: Fix PCI Express Slot Information function 0 returned value Shameer Kolothum
2025-10-01 12:59   ` Jonathan Cameron via
2025-10-02  7:39     ` Shameer Kolothum
2025-10-21 15:32       ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 16/27] hw/pci-host/gpex: Allow to generate preserve boot config DSM #5 Shameer Kolothum
2025-10-01 13:05   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 17/27] hw/arm/virt: Set PCI preserve_config for accel SMMUv3 Shameer Kolothum
2025-10-01 13:06   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 18/27] hw/arm/virt-acpi-build: Add IORT RMR regions to handle MSI nested binding Shameer Kolothum
2025-10-01 13:30   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 19/27] hw/arm/smmuv3-accel: Install S1 bypass hwpt on reset Shameer Kolothum
2025-10-01 13:32   ` Jonathan Cameron via
2025-10-16 23:19   ` Nicolin Chen
2025-10-20 14:22     ` Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 20/27] hw/arm/smmuv3: Add accel property for SMMUv3 device Shameer Kolothum
2025-10-16 21:48   ` Nicolin Chen
2025-09-29 13:36 ` [PATCH v4 21/27] hw/arm/smmuv3-accel: Add a property to specify RIL support Shameer Kolothum
2025-10-01 13:39   ` Jonathan Cameron via
2025-10-17  8:48   ` Zhangfei Gao
2025-10-17  9:40     ` Shameer Kolothum
2025-10-17 14:05       ` Zhangfei Gao
2025-09-29 13:36 ` [PATCH v4 22/27] hw/arm/smmuv3-accel: Add support for ATS Shameer Kolothum
2025-10-01 13:43   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 23/27] hw/arm/smmuv3-accel: Add property to specify OAS bits Shameer Kolothum
2025-10-01 13:46   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 24/27] backends/iommufd: Retrieve PASID width from iommufd_backend_get_device_info() Shameer Kolothum
2025-10-01 13:50   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 25/27] backends/iommufd: Add a callback helper to retrieve PASID support Shameer Kolothum
2025-10-01 13:52   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 26/27] vfio: Synthesize vPASID capability to VM Shameer Kolothum
2025-10-01 13:58   ` Jonathan Cameron via
2025-10-02  8:03     ` Shameer Kolothum
2025-10-02  9:58       ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 27/27] hw.arm/smmuv3: Add support for PASID enable Shameer Kolothum
2025-10-01 14:01   ` Jonathan Cameron via
2025-10-17  6:25 ` [PATCH v4 00/27] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Zhangfei Gao
2025-10-17  9:43   ` Shameer Kolothum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).