public inbox for qemu-arm@nongnu.org
 help / color / mirror / Atom feed
From: Nathan Chen <nathanc@nvidia.com>
To: qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: "Eric Auger" <eric.auger@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Shannon Zhao" <shannon.zhaosl@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Eric Blake" <eblake@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Shameer Kolothum" <skolothumtho@nvidia.com>,
	"Nicolin Chen" <nicolinc@nvidia.com>,
	"Matt Ochs" <mochs@nvidia.com>,
	"Nathan Chen" <nathanc@nvidia.com>
Subject: [PATCH v2 2/8] hw/arm/smmuv3-accel: Change ATS property to OnOffAuto
Date: Thu, 12 Mar 2026 14:03:21 -0700	[thread overview]
Message-ID: <20260312210328.2016191-3-nathanc@nvidia.com> (raw)
In-Reply-To: <20260312210328.2016191-1-nathanc@nvidia.com>

From: Nathan Chen <nathanc@nvidia.com>

Change accel SMMUv3 ATS property from bool to OnOffAuto. Setting 'auto'
will result in the default value being used, i.e. 0 in IDR0 which
translates to 'off'. A future patch will implement resolution of 'auto'
value to match the host SMMUv3 ATS support.

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
---
 hw/arm/smmuv3-accel.c    | 8 ++++++--
 hw/arm/smmuv3.c          | 9 +++++++--
 hw/arm/virt-acpi-build.c | 2 +-
 include/hw/arm/smmuv3.h  | 4 +++-
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
index fe78ce69a5..5d14abe307 100644
--- a/hw/arm/smmuv3-accel.c
+++ b/hw/arm/smmuv3-accel.c
@@ -827,8 +827,12 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
     /* By default QEMU SMMUv3 has RIL. Update IDR3 if user has disabled it */
     s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, s->ril);
 
-    /* QEMU SMMUv3 has no ATS. Advertise ATS if opt-in by property */
-    s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, s->ats);
+    /* Only override ATS if user explicitly set ON or OFF */
+    if (s->ats == ON_OFF_AUTO_ON) {
+        s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, 1);
+    } else if (s->ats == ON_OFF_AUTO_OFF) {
+        s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, 0);
+    }
 
     /* Advertise 48-bit OAS in IDR5 when requested (default is 44 bits). */
     if (s->oas == SMMU_OAS_48BIT) {
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 068108e49b..862ca945d5 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -317,6 +317,11 @@ static void smmuv3_init_id_regs(SMMUv3State *s)
     smmuv3_accel_idr_override(s);
 }
 
+bool smmuv3_ats_enabled(SMMUv3State *s)
+{
+    return FIELD_EX32(s->idr[0], IDR0, ATS);
+}
+
 static void smmuv3_reset(SMMUv3State *s)
 {
     s->cmdq.base = deposit64(s->cmdq.base, 0, 5, SMMU_CMDQS);
@@ -1971,7 +1976,7 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
             error_setg(errp, "ril can only be disabled if accel=on");
             return false;
         }
-        if (s->ats) {
+        if (s->ats == ON_OFF_AUTO_ON) {
             error_setg(errp, "ats can only be enabled if accel=on");
             return false;
         }
@@ -2128,7 +2133,7 @@ static const Property smmuv3_properties[] = {
     DEFINE_PROP_UINT64("msi-gpa", SMMUv3State, msi_gpa, 0),
     /* RIL can be turned off for accel cases */
     DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
-    DEFINE_PROP_BOOL("ats", SMMUv3State, ats, false),
+    DEFINE_PROP_ON_OFF_AUTO("ats", SMMUv3State, ats, ON_OFF_AUTO_OFF),
     DEFINE_PROP_UINT8("oas", SMMUv3State, oas, 44),
     DEFINE_PROP_UINT8("ssidsize", SMMUv3State, ssidsize, 0),
 };
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 719d2f994e..591cfc993c 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -402,7 +402,7 @@ static int iort_smmuv3_devices(Object *obj, void *opaque)
 
     bus = PCI_BUS(object_property_get_link(obj, "primary-bus", &error_abort));
     sdev.accel = object_property_get_bool(obj, "accel", &error_abort);
-    sdev.ats = object_property_get_bool(obj, "ats", &error_abort);
+    sdev.ats = smmuv3_ats_enabled(ARM_SMMUV3(obj));
     pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
     sbdev = SYS_BUS_DEVICE(obj);
     sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
index 26b2fc42fd..ce51a5b9b4 100644
--- a/include/hw/arm/smmuv3.h
+++ b/include/hw/arm/smmuv3.h
@@ -70,7 +70,7 @@ struct SMMUv3State {
     uint64_t msi_gpa;
     Error *migration_blocker;
     bool ril;
-    bool ats;
+    OnOffAuto ats;
     uint8_t oas;
     uint8_t ssidsize;
 };
@@ -91,6 +91,8 @@ struct SMMUv3Class {
     ResettablePhases parent_phases;
 };
 
+bool smmuv3_ats_enabled(struct SMMUv3State *s);
+
 #define TYPE_ARM_SMMUV3   "arm-smmuv3"
 OBJECT_DECLARE_TYPE(SMMUv3State, SMMUv3Class, ARM_SMMUV3)
 
-- 
2.43.0



  parent reply	other threads:[~2026-03-12 21:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12 21:03 [PATCH v2 0/8] hw/arm/smmuv3-accel: Support AUTO properties Nathan Chen
2026-03-12 21:03 ` [PATCH v2 1/8] hw/arm/smmuv3-accel: Check ATS compatibility between host and guest Nathan Chen
2026-03-16  7:32   ` Eric Auger
2026-03-17 16:11     ` Nathan Chen
2026-03-12 21:03 ` Nathan Chen [this message]
2026-03-16  7:38   ` [PATCH v2 2/8] hw/arm/smmuv3-accel: Change ATS property to OnOffAuto Eric Auger
2026-03-17 16:12     ` Nathan Chen
2026-03-16  7:40   ` Eric Auger
2026-03-16  8:48   ` Shameer Kolothum Thodi
2026-03-17 16:18     ` Nathan Chen
2026-03-12 21:03 ` [PATCH v2 3/8] hw/arm/smmuv3-accel: Change RIL " Nathan Chen
2026-03-16  7:41   ` Eric Auger
2026-03-16  8:50   ` Shameer Kolothum Thodi
2026-03-17 16:18     ` Nathan Chen
2026-03-12 21:03 ` [PATCH v2 4/8] qdev: Add a SsidSizeMode property Nathan Chen
2026-03-16  7:46   ` Eric Auger
2026-03-12 21:03 ` [PATCH v2 5/8] hw/arm/smmuv3-accel: Change SSIDSIZE property to SsidSizeMode Nathan Chen
2026-03-16  7:50   ` Eric Auger
2026-03-17 16:15     ` Nathan Chen
2026-03-16  8:56   ` Shameer Kolothum Thodi
2026-03-17 16:20     ` Nathan Chen
2026-03-12 21:03 ` [PATCH v2 6/8] qdev: Add an OasMode property Nathan Chen
2026-03-16  7:52   ` Eric Auger
2026-03-12 21:03 ` [PATCH v2 7/8] hw/arm/smmuv3-accel: Change OAS property to OasMode Nathan Chen
2026-03-16  7:55   ` Eric Auger
2026-03-12 21:03 ` [PATCH v2 8/8] qemu-options.hx: Document arm-smmuv3 device's accel properties Nathan Chen
2026-03-16  8:00   ` Eric Auger
2026-03-16  8:27   ` Shameer Kolothum Thodi
2026-03-17 16:17     ` Nathan Chen
2026-03-16  8:08 ` [PATCH v2 0/8] hw/arm/smmuv3-accel: Support AUTO properties Eric Auger
2026-03-16 10:05   ` Peter Maydell
2026-03-17 16:21     ` Nathan Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260312210328.2016191-3-nathanc@nvidia.com \
    --to=nathanc@nvidia.com \
    --cc=anisinha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=eric.auger@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mochs@nvidia.com \
    --cc=mst@redhat.com \
    --cc=nicolinc@nvidia.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shannon.zhaosl@gmail.com \
    --cc=skolothumtho@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox