@samitouri / QOSamiQemu / commits / d3e56703bf

hw/arm/smmuv3-accel: Introduce helper to query CMDQV type

Introduce a SMMUv3AccelCmdqvType enum and a helper to query the CMDQV implementation type associated with an accelerated SMMUv3 instance. A subsequent patch will use this helper when generating the Tegra241 CMDQV DSDT. Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Nicolin Chen <nicolinc@nvidia.com> Tested-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com> Tested-by: Eric Auger <eric.auger@redhat.com> Message-id: 20260609112552.378999-28-skolothumtho@nvidia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Shameer Kolothum committed Jun 9, 2026 at 12:25 UTC d3e56703bfc58969ac02009bcdbac7f5b25998db
4 files changed +33
hw/arm/smmuv3-accel-stubs.c
+5
@@ -57,3 +57,8 @@ bool smmuv3_accel_event_read_validate(IOMMUFDVeventq *veventq, uint32_t type,
57 void smmuv3_accel_reset(SMMUv3State *s)
58 {
59 }
60 +
61 +SMMUv3AccelCmdqvType smmuv3_accel_cmdqv_type(Object *obj)
62 +{
63 + return SMMUV3_CMDQV_NONE;
64 +}
hw/arm/smmuv3-accel.c
+12
@@ -1060,6 +1060,18 @@ static void smmuv3_accel_as_init(SMMUv3State *s)
1060 address_space_init(shared_as_sysmem, &root, "smmuv3-accel-as-sysmem");
1061 }
1062
1063 +SMMUv3AccelCmdqvType smmuv3_accel_cmdqv_type(Object *obj)
1064 +{
1065 + SMMUv3State *s = ARM_SMMUV3(obj);
1066 + SMMUv3AccelState *accel = s->s_accel;
1067 +
1068 + if (!accel || !accel->cmdqv_ops || !accel->cmdqv_ops->get_type) {
1069 + return SMMUV3_CMDQV_NONE;
1070 + }
1071 +
1072 + return accel->cmdqv_ops->get_type();
1073 +}
1074 +
1075 static void smmuv3_accel_machine_done(Notifier *notifier, void *data)
1076 {
1077 SMMUv3State *s = container_of(notifier, SMMUv3State, machine_done);
hw/arm/smmuv3-accel.h
+10
@@ -16,6 +16,11 @@
16 #include <linux/iommufd.h>
17 #endif
18
19 +typedef enum SMMUv3AccelCmdqvType {
20 + SMMUV3_CMDQV_NONE = 0,
21 + SMMUV3_CMDQV_TEGRA241,
22 +} SMMUv3AccelCmdqvType;
23 +
24 /*
25 * CMDQ-Virtualization (CMDQV) hardware support, extends the SMMUv3 to
26 * support multiple VCMDQs with virtualization capabilities.
@@ -42,6 +47,10 @@ typedef struct SMMUv3AccelCmdqvOps {
47 * If NULL, the viommu_id is freed directly via iommufd_backend_free_id().
48 */
49 void (*free_viommu)(SMMUv3State *s);
50 + /**
51 + * @get_type: Optional callback. Return the CMDQV implementation type.
52 + */
53 + SMMUv3AccelCmdqvType (*get_type)(void);
54 /**
55 * @reset: Optional callback. Reset CMDQV state.
56 */
@@ -90,5 +99,6 @@ bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp);
99 bool smmuv3_accel_event_read_validate(IOMMUFDVeventq *veventq, uint32_t type,
100 void *buf, size_t size, Error **errp);
101 void smmuv3_accel_reset(SMMUv3State *s);
102 +SMMUv3AccelCmdqvType smmuv3_accel_cmdqv_type(Object *obj);
103
104 #endif /* HW_ARM_SMMUV3_ACCEL_H */
hw/arm/tegra241-cmdqv.c
+6
@@ -964,6 +964,11 @@ static bool tegra241_cmdqv_init(SMMUv3State *s, Error **errp)
964 return true;
965 }
966
967 +static SMMUv3AccelCmdqvType tegra241_cmdqv_get_type(void)
968 +{
969 + return SMMUV3_CMDQV_TEGRA241;
970 +}
971 +
972 static bool tegra241_cmdqv_probe(SMMUv3State *s, HostIOMMUDeviceIOMMUFD *idev,
973 Error **errp)
974 {
@@ -1004,6 +1009,7 @@ static const SMMUv3AccelCmdqvOps tegra241_cmdqv_ops = {
1009 .init = tegra241_cmdqv_init,
1010 .alloc_viommu = tegra241_cmdqv_alloc_viommu,
1011 .free_viommu = tegra241_cmdqv_free_viommu,
1012 + .get_type = tegra241_cmdqv_get_type,
1013 .reset = tegra241_cmdqv_reset,
1014 };
1015