@samitouri / QOSamiQemu / commits / c2ff1305cc

hw/arm/smmuv3-accel: Change "oas" property type to OasMode

Change accel SMMUv3 OAS property from uint8_t to OasMode. 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 'auto' value to match the host SMMUv3 OAS value. The conversion of the "oas" property type to OnOffAuto is an incompatible change for JSON/QMP when a uint8_t value is expected for "oas", but this property is new in 11.0 and this patch is submitted as a fix to the property type. Fixes: a015ac990fd3 ("hw/arm/smmuv3-accel: Add property to specify OAS bits") Tested-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Shameer Kolothum <skolothumtho@nvidia.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Nathan Chen <nathanc@nvidia.com> Message-id: 20260323182454.1416110-8-nathanc@nvidia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Nathan Chen committed Mar 24, 2026 at 14:02 UTC c2ff1305cc7da7cd4596f4409936f25489ea0397
4 files changed +11 -12
hw/arm/smmuv3-accel.c
+1 -1
@@ -850,7 +850,7 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
850 }
851
852 /* Advertise 48-bit OAS in IDR5 when requested (default is 44 bits). */
853 - if (s->oas == SMMU_OAS_48BIT) {
853 + if (s->oas == OAS_MODE_48) {
854 s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS_48);
855 }
856
hw/arm/smmuv3.c
+9 -8
@@ -1984,6 +1984,11 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
1984 error_setg(errp, "ssidsize auto mode is not supported");
1985 return false;
1986 }
1987 + if (s->oas != OAS_MODE_44 && s->oas != OAS_MODE_48) {
1988 + error_setg(errp, "QEMU SMMUv3 model only implements 44 and 48 bit"
1989 + "OAS; other OasMode values are not supported");
1990 + return false;
1991 + }
1992
1993 if (!s->accel) {
1994 if (s->ril == ON_OFF_AUTO_OFF) {
@@ -1994,7 +1999,7 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
1999 error_setg(errp, "ats can only be enabled if accel=on");
2000 return false;
2001 }
1997 - if (s->oas != SMMU_OAS_44BIT) {
2002 + if (s->oas > OAS_MODE_44) {
2003 error_setg(errp, "OAS must be 44 bits when accel=off");
2004 return false;
2005 }
@@ -2012,11 +2017,6 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
2017 return false;
2018 }
2019
2015 - if (s->oas != SMMU_OAS_44BIT && s->oas != SMMU_OAS_48BIT) {
2016 - error_setg(errp, "OAS can only be set to 44 or 48 bits");
2017 - return false;
2018 - }
2019 -
2020 return true;
2021 }
2022
@@ -2143,7 +2143,7 @@ static const Property smmuv3_properties[] = {
2143 /* RIL can be turned off for accel cases */
2144 DEFINE_PROP_ON_OFF_AUTO("ril", SMMUv3State, ril, ON_OFF_AUTO_ON),
2145 DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
2146 - DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
2146 + DEFINE_PROP_OAS_MODE("oas", SMMUv3State, oas, OAS_MODE_44),
2147 DEFINE_PROP_SSIDSIZE_MODE("ssidsize", SMMUv3State, ssidsize,
2148 SSID_SIZE_MODE_0),
2149 };
@@ -2180,7 +2180,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
2180 "supported.");
2181 object_class_property_set_description(klass, "oas",
2182 "Specify Output Address Size (for accel=on). Supported values "
2183 - "are 44 or 48 bits. Defaults to 44 bits");
2183 + "are 44 or 48 bits. Defaults to 44 bits. oas=auto is not "
2184 + "supported.");
2185 object_class_property_set_description(klass, "ssidsize",
2186 "Number of bits used to represent SubstreamIDs (SSIDs). "
2187 "A value of N allows SSIDs in the range [0 .. 2^N - 1]. "
include/hw/arm/smmuv3-common.h
-2
@@ -342,8 +342,6 @@ REG32(IDR5, 0x14)
342 FIELD(IDR5, VAX, 10, 2);
343 FIELD(IDR5, STALL_MAX, 16, 16);
344
345 -#define SMMU_OAS_44BIT 44
346 -#define SMMU_OAS_48BIT 48
345 #define SMMU_IDR5_OAS_44 4
346 #define SMMU_IDR5_OAS_48 5
347
include/hw/arm/smmuv3.h
+1 -1
@@ -72,7 +72,7 @@ struct SMMUv3State {
72 Error *migration_blocker;
73 OnOffAuto ril;
74 OnOffAuto ats;
75 - uint8_t oas;
75 + OasMode oas;
76 SsidSizeMode ssidsize;
77 };
78