hw/arm/smmuv3-accel: Implement "auto" value for "oas"
Allow accelerated SMMUv3 OAS property to be derived from host IOMMU capabilities. Derive host values using IOMMU_GET_HW_INFO, retrieving OAS from IDR5. This keeps the OAS value advertised by the virtual SMMU compatible with the capabilities of the host SMMUv3, so that the intermediate physical addresses (IPA) consumed by host SMMU for stage-2 translation do not exceed the host's max supported IPA size. Reviewed-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Shameer Kolothum <skolothumtho@nvidia.com> Signed-off-by: Nathan Chen <nathanc@nvidia.com> Tested-by: Eric Auger <eric.auger@redhat.com> Message-id: 20260608174900.2227340-8-nathanc@nvidia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Nathan Chen committed
Jun 8, 2026 at 10:48 UTC
86ec6639b18cafab2e23cd10c50f4b27597c4a9b
2 files changed
+17
-8
hw/arm/smmuv3-accel.c
+7
-1
@@ -68,6 +68,11 @@ static void smmuv3_accel_auto_finalise(SMMUv3State *s,
68
FIELD_EX32(info->idr[1], IDR1, SSIDSIZE));
69
}
70
71
+ if (s->oas == OAS_MODE_AUTO) {
72
+ s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS,
73
+ FIELD_EX32(info->idr[5], IDR5, OAS));
74
+ }
75
+
76
accel->auto_finalised = true;
77
}
78
@@ -985,7 +990,8 @@ bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
990
991
if (s->ats == ON_OFF_AUTO_AUTO ||
992
s->ril == ON_OFF_AUTO_AUTO ||
988
- s->ssidsize == SSID_SIZE_MODE_AUTO) {
993
+ s->ssidsize == SSID_SIZE_MODE_AUTO ||
994
+ s->oas == OAS_MODE_AUTO) {
995
s->s_accel->auto_mode = true;
996
}
997
hw/arm/smmuv3.c
+10
-7
@@ -1968,9 +1968,11 @@ static void smmu_reset_exit(Object *obj, ResetType type)
1968
1969
static bool smmu_validate_property(SMMUv3State *s, Error **errp)
1970
{
1971
- if (s->oas != OAS_MODE_44 && s->oas != OAS_MODE_48) {
1972
- error_setg(errp, "QEMU SMMUv3 model only implements 44 and 48 bit"
1973
- "OAS; other OasMode values are not supported");
1971
+ if (s->oas != OAS_MODE_44 && s->oas != OAS_MODE_48 &&
1972
+ s->oas != OAS_MODE_AUTO) {
1973
+ error_setg(errp, "QEMU SMMUv3 model only implements auto, "
1974
+ "44 bit, or 48 bit OAS. Other OasMode values are "
1975
+ "not supported.");
1976
return false;
1977
}
1978
@@ -1984,7 +1986,7 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
1986
return false;
1987
}
1988
if (s->oas > OAS_MODE_44) {
1987
- error_setg(errp, "OAS must be 44 bits when accel=off");
1989
+ error_setg(errp, "oas must be 44 bits when accel=off");
1990
return false;
1991
}
1992
if (s->ssidsize > SSID_SIZE_MODE_0) {
@@ -2171,9 +2173,10 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
2173
"Please ensure host platform supports ATS before setting it "
2174
"to on.");
2175
object_class_property_set_description(klass, "oas",
2174
- "Specify Output Address Size (for accel=on). Supported values "
2175
- "are 44 or 48 bits. Defaults to 44 bits. oas=auto is not "
2176
- "supported.");
2176
+ "Set Output Address Size in bits (for accel=on). "
2177
+ "Valid values are 44, 48, and auto. Defaults to 44 bits."
2178
+ "Please ensure the value does not exceed the maximum "
2179
+ "Output Address Size supported by the host platform.");
2180
object_class_property_set_description(klass, "ssidsize",
2181
"Set number of bits used to represent SubstreamIDs (SSIDs). "
2182
"Valid values are 0-20 and auto. Defaults to 0. "