@samitouri / QOSamiQemu / commits / 9f8a8e0f2c

hw/arm/smmuv3-accel: Change "ats" property type to OnOffAuto

Change accel SMMUv3 ATS property from bool to OnOffAuto. The 'auto' value is not implemented, as this commit is meant to set the property to the correct type and avoid breaking JSON/QMP when the auto mode is introduced. A future patch will implement resolution of the 'auto' value to match the host SMMUv3 ATS support. The conversion of the ATS property type to OnOffAuto is an incompatible change for JSON/QMP when a bool value is expected for "ats", but the "ats" property is new in 11.0 and this patch is submitted as a fix to the property type. Fixes: f7f5013a55a3 ("hw/arm/smmuv3-accel: Add support for ATS") Tested-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com> Tested-by: Shameer Kolothum <skolothumtho@nvidia.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Nathan Chen <nathanc@nvidia.com> Message-id: 20260323182454.1416110-3-nathanc@nvidia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Nathan Chen committed Mar 24, 2026 at 14:02 UTC 9f8a8e0f2c6fd48b4f3759a02b5210cba6a978e3
4 files changed +21 -6
hw/arm/smmuv3-accel.c
+3 -1
@@ -827,7 +827,9 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
827 s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, s->ril);
828
829 /* QEMU SMMUv3 has no ATS. Advertise ATS if opt-in by property */
830 - s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, s->ats);
830 + if (s->ats == ON_OFF_AUTO_ON) {
831 + s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, 1);
832 + }
833
834 /* Advertise 48-bit OAS in IDR5 when requested (default is 44 bits). */
835 if (s->oas == SMMU_OAS_48BIT) {
hw/arm/smmuv3.c
+14 -3
@@ -317,6 +317,11 @@ static void smmuv3_init_id_regs(SMMUv3State *s)
317 smmuv3_accel_idr_override(s);
318 }
319
320 +bool smmuv3_ats_enabled(SMMUv3State *s)
321 +{
322 + return FIELD_EX32(s->idr[0], IDR0, ATS);
323 +}
324 +
325 static void smmuv3_reset(SMMUv3State *s)
326 {
327 s->cmdq.base = deposit64(s->cmdq.base, 0, 5, SMMU_CMDQS);
@@ -1966,12 +1971,17 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
1971 }
1972 #endif
1973
1974 + if (s->ats == ON_OFF_AUTO_AUTO) {
1975 + error_setg(errp, "ats auto mode is not supported");
1976 + return false;
1977 + }
1978 +
1979 if (!s->accel) {
1980 if (!s->ril) {
1981 error_setg(errp, "ril can only be disabled if accel=on");
1982 return false;
1983 }
1974 - if (s->ats) {
1984 + if (s->ats == ON_OFF_AUTO_ON) {
1985 error_setg(errp, "ats can only be enabled if accel=on");
1986 return false;
1987 }
@@ -2128,7 +2138,7 @@ static const Property smmuv3_properties[] = {
2138 DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
2139 /* RIL can be turned off for accel cases */
2140 DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
2131 - DEFINE_PROP_BOOL("ats", SMMUv3State, ats, false),
2141 + DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
2142 DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
2143 DEFINE_PROP_UINT8("ssidsize", SMMUv3State, ssidsize, 0),
2144 };
@@ -2160,7 +2170,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
2170 "Disable range invalidation support (for accel=on)");
2171 object_class_property_set_description(klass, "ats",
2172 "Enable/disable ATS support (for accel=on). Please ensure host "
2163 - "platform has ATS support before enabling this");
2173 + "platform has ATS support before enabling this. ats=auto is not "
2174 + "supported.");
2175 object_class_property_set_description(klass, "oas",
2176 "Specify Output Address Size (for accel=on). Supported values "
2177 "are 44 or 48 bits. Defaults to 44 bits");
hw/arm/virt-acpi-build.c
+1 -1
@@ -402,7 +402,7 @@ static int iort_smmuv3_devices(Object *obj, void *opaque)
402
403 bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
404 sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
405 - sdev.ats = object_property_get_bool(obj, "ats", &error_abort);
405 + sdev.ats = smmuv3_ats_enabled(ARM_SMMUV3(obj));
406 pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
407 sbdev = SYS_BUS_DEVICE(obj);
408 sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
include/hw/arm/smmuv3.h
+3 -1
@@ -70,7 +70,7 @@ struct SMMUv3State {
70 uint64_t msi_gpa;
71 Error *migration_blocker;
72 bool ril;
73 - bool ats;
73 + OnOffAuto ats;
74 uint8_t oas;
75 uint8_t ssidsize;
76 };
@@ -91,6 +91,8 @@ struct SMMUv3Class {
91 ResettablePhases parent_phases;
92 };
93
94 +bool smmuv3_ats_enabled(struct SMMUv3State *s);
95 +
96 #define TYPE_ARM_SMMUV3 "arm-smmuv3"
97 OBJECT_DECLARE_TYPE(SMMUv3State, SMMUv3Class, ARM_SMMUV3)
98