@samitouri / QOSamiQemu / commits / 7e88c1a9d0

hw/arm/smmuv3-accel: Implement "auto" value for "ats"

Allow accelerated SMMUv3 Address Translation Services support property to be derived from host IOMMU capabilities. Derive host values using IOMMU_GET_HW_INFO, retrieving ATS capability from IDR0. 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-5-nathanc@nvidia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Nathan Chen committed Jun 8, 2026 at 10:48 UTC 7e88c1a9d0f99f42a652e0af856b903e038b38cb
2 files changed +13 -7
hw/arm/smmuv3-accel.c
+9
@@ -53,6 +53,11 @@ static void smmuv3_accel_auto_finalise(SMMUv3State *s,
53 return;
54 }
55
56 + if (s->ats == ON_OFF_AUTO_AUTO) {
57 + s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS,
58 + FIELD_EX32(info->idr[0], IDR0, ATS));
59 + }
60 +
61 accel->auto_finalised = true;
62 }
63
@@ -961,6 +966,10 @@ bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
966 bs->iommu_ops = &smmuv3_accel_ops;
967 smmuv3_accel_as_init(s);
968
969 + if (s->ats == ON_OFF_AUTO_AUTO) {
970 + s->s_accel->auto_mode = true;
971 + }
972 +
973 if (s->s_accel->auto_mode) {
974 s->machine_done.notify = smmuv3_accel_machine_done;
975 qemu_add_machine_init_done_notifier(&s->machine_done);
hw/arm/smmuv3.c
+4 -7
@@ -1965,10 +1965,6 @@ static void smmu_reset_exit(Object *obj, ResetType type)
1965
1966 static bool smmu_validate_property(SMMUv3State *s, Error **errp)
1967 {
1968 - if (s->ats == ON_OFF_AUTO_AUTO) {
1969 - error_setg(errp, "ats auto mode is not supported");
1970 - return false;
1971 - }
1968 if (s->ril == ON_OFF_AUTO_AUTO) {
1969 error_setg(errp, "ril auto mode is not supported");
1970 return false;
@@ -2172,9 +2168,10 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
2168 "Disable range invalidation support (for accel=on). ril=auto "
2169 "is not supported.");
2170 object_class_property_set_description(klass, "ats",
2175 - "Enable/disable ATS support (for accel=on). Please ensure host "
2176 - "platform has ATS support before enabling this. ats=auto is not "
2177 - "supported.");
2171 + "Enable/disable ATS support (for accel=on). "
2172 + "Valid values are on, off, and auto. Defaults to off. "
2173 + "Please ensure host platform supports ATS before setting it "
2174 + "to on.");
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. oas=auto is not "