@samitouri / QOSamiQemu / commits / 4912111c68

hw/arm/smmuv3-accel: Introduce CMDQV ops interface

Command Queue Virtualization (CMDQV) is a hardware extension available on certain platforms that allows the SMMUv3 command queue to be virtualized and passed through to a VM, improving performance. For example, NVIDIA Tegra241 implements CMDQV to support virtualization of multiple command queues (VCMDQs). The term CMDQV is used here generically to refer to any platform that provides hardware support to virtualize the SMMUv3 command queue. CMDQV support is a specialization of the IOMMUFD-backed accelerated SMMUv3 path. Introduce an ops interface to factor out CMDQV-specific probe, initialization, and vIOMMU allocation logic from the base implementation. The ops pointer and associated state are stored in the accelerated SMMUv3 state. This provides an extensible design to support future vendor-specific CMDQV implementations. No functional change. Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com> Tested-by: Eric Auger <eric.auger@redhat.com> Message-id: 20260609112552.378999-7-skolothumtho@nvidia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Shameer Kolothum committed Jun 9, 2026 at 12:25 UTC 4912111c682f9649176026c5ce0137c25dc91b4a
1 file changed +34
hw/arm/smmuv3-accel.h
+34
@@ -10,11 +10,44 @@
10 #define HW_ARM_SMMUV3_ACCEL_H
11
12 #include "hw/arm/smmu-common.h"
13 +#include "hw/arm/smmuv3.h"
14 #include "system/iommufd.h"
15 #ifdef CONFIG_LINUX
16 #include <linux/iommufd.h>
17 #endif
18
19 +/*
20 + * CMDQ-Virtualization (CMDQV) hardware support, extends the SMMUv3 to
21 + * support multiple VCMDQs with virtualization capabilities.
22 + * CMDQV specific behavior is factored behind this ops interface.
23 + */
24 +typedef struct SMMUv3AccelCmdqvOps {
25 + /**
26 + * @probe: Mandatory. Vendor-specific device probing.
27 + */
28 + bool (*probe)(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev, Error **errp);
29 + /**
30 + * @init: Optional callback. Initialize CMDQV hardware.
31 + */
32 + bool (*init)(SMMUv3State *s, Error **errp);
33 + /**
34 + * @alloc_viommu: Mandatory. Allocate CMDQV viommu resources.
35 + */
36 + bool (*alloc_viommu)(SMMUv3State *s,
37 + HostIOMMUDeviceIOMMUFD *idev,
38 + uint32_t *out_viommu_id,
39 + Error **errp);
40 + /**
41 + * @free_viommu: Optional callback. Free CMDQV viommu resources.
42 + * If NULL, the viommu_id is freed directly via iommufd_backend_free_id().
43 + */
44 + void (*free_viommu)(SMMUv3State *s);
45 + /**
46 + * @reset: Optional callback. Reset CMDQV state.
47 + */
48 + void (*reset)(SMMUv3State *s);
49 +} SMMUv3AccelCmdqvOps;
50 +
51 /*
52 * Represents an accelerated SMMU instance backed by an iommufd vIOMMU object.
53 * Holds bypass and abort proxy HWPT IDs used for device attachment.
@@ -27,6 +60,7 @@ typedef struct SMMUv3AccelState {
60 QLIST_HEAD(, SMMUv3AccelDevice) device_list;
61 bool auto_mode;
62 bool auto_finalised;
63 + const SMMUv3AccelCmdqvOps *cmdqv_ops;
64 } SMMUv3AccelState;
65
66 typedef struct SMMUS1Hwpt {