From: Eric Auger <eric.auger@redhat.com>
To: Shameer Kolothum <skolothumtho@nvidia.com>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, jgg@nvidia.com, nicolinc@nvidia.com,
ddutile@redhat.com, berrange@redhat.com, nathanc@nvidia.com,
mochs@nvidia.com, smostafa@google.com, wangzhou1@hisilicon.com,
jiangkunkun@huawei.com, jonathan.cameron@huawei.com,
zhangfei.gao@linaro.org, zhenzhong.duan@intel.com,
yi.l.liu@intel.com, kjaju@nvidia.com
Subject: Re: [PATCH v5 27/32] hw/arm/smmuv3-accel: Add support for ATS
Date: Tue, 4 Nov 2025 15:22:52 +0100 [thread overview]
Message-ID: <2a4a1246-4515-4e98-b5dc-e1ff0e9f0003@redhat.com> (raw)
In-Reply-To: <20251031105005.24618-28-skolothumtho@nvidia.com>
On 10/31/25 11:50 AM, Shameer Kolothum wrote:
> QEMU SMMUv3 does not enable ATS (Address Translation Services) by default.
> When accelerated mode is enabled and the host SMMUv3 supports ATS, it can
> be useful to report ATS capability to the guest so it can take advantage
> of it if the device also supports ATS.
>
> Note: ATS support cannot be reliably detected from the host SMMUv3 IDR
> registers alone, as firmware ACPI IORT tables may override them. The
> user must therefore ensure the support before enabling it.
Please add a note that this is a partial ATS support, made possible because
emulated devices can be pluugged onto accel SMMU (ie. we do not support
ATS translation requests for instance)
>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
> Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
> ---
> hw/arm/smmuv3-accel.c | 4 ++++
> hw/arm/smmuv3.c | 25 ++++++++++++++++++++++++-
> hw/arm/virt-acpi-build.c | 10 ++++++++--
> include/hw/arm/smmuv3.h | 1 +
> 4 files changed, 37 insertions(+), 3 deletions(-)
>
> diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
> index 35298350cb..5b0ef3804a 100644
> --- a/hw/arm/smmuv3-accel.c
> +++ b/hw/arm/smmuv3-accel.c
> @@ -645,6 +645,10 @@ void smmuv3_accel_idr_override(SMMUv3State *s)
> if (!s->ril) {
> s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 0);
> }
> + /* QEMU SMMUv3 has no ATS. Update IDR0 if user has enabled it */
"advertise ats if opt-on by property?"
> + if (s->ats) {
> + s->idr[0] = FIELD_DP32(s->idr[0], IDR0, ATS, 1); /* ATS */
use s->ats directly?
> + }
> }
>
> /* Based on SMUUv3 GBPA configuration, attach a corresponding HWPT */
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index b9d96f5762..d95279a733 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -1517,13 +1517,28 @@ static int smmuv3_cmdq_consume(SMMUv3State *s)
> */
> smmuv3_range_inval(bs, &cmd, SMMU_STAGE_2);
> break;
> + case SMMU_CMD_ATC_INV:
> + {
> + SMMUDevice *sdev = smmu_find_sdev(bs, CMD_SID(&cmd));
> + Error *local_err = NULL;
> +
> + if (!sdev) {
> + break;
> + }
> +
> + if (!smmuv3_accel_issue_inv_cmd(s, &cmd, sdev, &local_err)) {
> + error_report_err(local_err);
> + cmd_error = SMMU_CERROR_ILL;
> + break;
> + }
> + break;
> + }
> case SMMU_CMD_TLBI_EL3_ALL:
> case SMMU_CMD_TLBI_EL3_VA:
> case SMMU_CMD_TLBI_EL2_ALL:
> case SMMU_CMD_TLBI_EL2_ASID:
> case SMMU_CMD_TLBI_EL2_VA:
> case SMMU_CMD_TLBI_EL2_VAA:
> - case SMMU_CMD_ATC_INV:
> case SMMU_CMD_PRI_RESP:
> case SMMU_CMD_RESUME:
> case SMMU_CMD_STALL_TERM:
> @@ -1942,6 +1957,10 @@ 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) {
> + error_setg(errp, "ats can only be enabled if accel=on");
> + return false;
> + }
> return false;
> }
> return true;
> @@ -2067,6 +2086,7 @@ static const Property smmuv3_properties[] = {
> DEFINE_PROP_BOOL("accel", SMMUv3State, accel, false),
> /* RIL can be turned off for accel cases */
> DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
> + DEFINE_PROP_BOOL("ats", SMMUv3State, ats, false),
> };
>
> static void smmuv3_instance_init(Object *obj)
> @@ -2096,6 +2116,9 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
> "in nested mode for vfio-pci dev assignment");
> object_class_property_set_description(klass, "ril",
> "Disable range invalidation support (for accel=on)");
> + object_class_property_set_description(klass, "ats",
> + "Enable/disable ATS support (for accel=on). Please ensure host "
> + "platform has ATS support before enabling this");
> }
>
> static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 6106ad1b6e..1b0d0a2029 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -345,6 +345,7 @@ typedef struct AcpiIortSMMUv3Dev {
> /* Offset of the SMMUv3 IORT Node relative to the start of the IORT */
> size_t offset;
> bool accel;
> + bool ats;
> } AcpiIortSMMUv3Dev;
>
> /*
> @@ -400,6 +401,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);
> pbus = PLATFORM_BUS_DEVICE(vms->platform_bus_dev);
> sbdev = SYS_BUS_DEVICE(obj);
> sdev.base = platform_bus_get_mmio_addr(pbus, sbdev, 0);
> @@ -544,6 +546,7 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> int i, nb_nodes, rc_mapping_count;
> AcpiIortSMMUv3Dev *sdev;
> size_t node_size;
> + bool ats_needed = false;
> int num_smmus = 0;
> uint32_t id = 0;
> int rc_smmu_idmaps_len = 0;
> @@ -579,6 +582,9 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> /* Calculate RMR nodes required. One per SMMUv3 with accelerated mode */
> for (i = 0; i < num_smmus; i++) {
> sdev = &g_array_index(smmuv3_devs, AcpiIortSMMUv3Dev, i);
> + if (sdev->ats) {
> + ats_needed = true;
> + }
> if (sdev->accel) {
> nb_nodes++;
> }
> @@ -678,8 +684,8 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> build_append_int_noprefix(table_data, 0, 2); /* Reserved */
> /* Table 15 Memory Access Flags */
> build_append_int_noprefix(table_data, 0x3 /* CCA = CPM = DACS = 1 */, 1);
> -
> - build_append_int_noprefix(table_data, 0, 4); /* ATS Attribute */
> + /* ATS Attribute */
> + build_append_int_noprefix(table_data, (ats_needed ? 1 : 0), 4);
can't you use ats_needed directly?
> /* MCFG pci_segment */
> build_append_int_noprefix(table_data, 0, 4); /* PCI Segment number */
>
> diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
> index 95202c2757..5fd5ec7b49 100644
> --- a/include/hw/arm/smmuv3.h
> +++ b/include/hw/arm/smmuv3.h
> @@ -69,6 +69,7 @@ struct SMMUv3State {
> struct SMMUv3AccelState *s_accel;
> Error *migration_blocker;
> bool ril;
> + bool ats;
> };
>
> typedef enum {
Eric
next prev parent reply other threads:[~2025-11-04 14:23 UTC|newest]
Thread overview: 148+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 10:49 [PATCH v5 00/32] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 01/32] backends/iommufd: Introduce iommufd_backend_alloc_viommu Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 02/32] backends/iommufd: Introduce iommufd_backend_alloc_vdev Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 03/32] hw/arm/smmu-common: Factor out common helper functions and export Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 04/32] hw/arm/smmu-common: Make iommu ops part of SMMUState Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 05/32] hw/arm/smmuv3-accel: Introduce smmuv3 accel device Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 06/32] hw/arm/smmuv3-accel: Initialize shared system address space Shameer Kolothum
2025-10-31 21:10 ` Nicolin Chen
2025-11-03 14:17 ` Shameer Kolothum
2025-11-03 13:12 ` Jonathan Cameron via
2025-11-03 15:53 ` Shameer Kolothum
2025-11-03 13:39 ` Philippe Mathieu-Daudé
2025-11-03 16:30 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 07/32] hw/pci/pci: Move pci_init_bus_master() after adding device to bus Shameer Kolothum
2025-11-03 13:24 ` Jonathan Cameron via
2025-11-03 16:40 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 08/32] hw/pci/pci: Add optional supports_address_space() callback Shameer Kolothum
2025-11-03 13:30 ` Jonathan Cameron via
2025-11-03 16:47 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 09/32] hw/pci-bridge/pci_expander_bridge: Move TYPE_PXB_PCIE_DEV to header Shameer Kolothum
2025-11-03 13:30 ` Jonathan Cameron via
2025-11-03 14:25 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 10/32] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints with iommufd Shameer Kolothum
2025-11-03 16:51 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 11/32] hw/arm/smmuv3: Implement get_viommu_cap() callback Shameer Kolothum
2025-11-03 16:55 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 12/32] hw/arm/smmuv3-accel: Add set/unset_iommu_device callback Shameer Kolothum
2025-10-31 22:02 ` Nicolin Chen
2025-10-31 22:08 ` Nicolin Chen
2025-11-03 14:19 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 13/32] hw/arm/smmuv3-accel: Add nested vSTE install/uninstall support Shameer Kolothum
2025-10-31 23:52 ` Nicolin Chen
2025-11-01 0:20 ` Nicolin Chen
2025-11-03 15:11 ` Shameer Kolothum
2025-11-03 17:32 ` Nicolin Chen
2025-11-04 11:05 ` Eric Auger
2025-11-04 12:26 ` Shameer Kolothum
2025-11-04 13:30 ` Eric Auger
2025-11-04 16:48 ` Nicolin Chen
2025-10-31 10:49 ` [PATCH v5 14/32] hw/arm/smmuv3-accel: Install SMMUv3 GBPA based hwpt Shameer Kolothum
2025-11-04 13:28 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 15/32] hw/pci/pci: Introduce optional get_msi_address_space() callback Shameer Kolothum
2025-11-04 14:11 ` Eric Auger
2025-11-04 14:20 ` Jason Gunthorpe
2025-11-04 14:42 ` Shameer Kolothum
2025-11-04 14:51 ` Jason Gunthorpe
2025-11-04 14:58 ` Shameer Kolothum
2025-11-04 15:12 ` Jason Gunthorpe
2025-11-04 15:20 ` Shameer Kolothum
2025-11-04 15:35 ` Jason Gunthorpe
2025-11-04 17:11 ` Nicolin Chen
2025-11-04 17:41 ` Jason Gunthorpe
2025-11-04 17:57 ` Nicolin Chen
2025-11-04 18:09 ` Jason Gunthorpe
2025-11-04 18:44 ` Nicolin Chen
2025-11-04 18:56 ` Jason Gunthorpe
2025-11-04 19:31 ` Nicolin Chen
2025-11-04 19:35 ` Jason Gunthorpe
2025-11-04 19:43 ` Nicolin Chen
2025-11-04 19:45 ` Jason Gunthorpe
2025-11-04 19:59 ` Nicolin Chen
2025-11-04 19:46 ` Shameer Kolothum
2025-11-05 12:52 ` Jason Gunthorpe
2025-11-05 17:32 ` Eric Auger
2025-11-04 14:37 ` Shameer Kolothum
2025-11-04 14:44 ` Eric Auger
2025-11-04 15:14 ` Shameer Kolothum
2025-11-04 16:01 ` Eric Auger
2025-11-04 17:47 ` Nicolin Chen
2025-11-05 7:47 ` Eric Auger
2025-11-05 19:30 ` Nicolin Chen
2025-11-04 19:08 ` Shameer Kolothum
2025-11-05 8:56 ` Eric Auger
2025-11-05 11:41 ` Shameer Kolothum
2025-11-05 17:25 ` Eric Auger
2025-11-05 18:10 ` Jason Gunthorpe
2025-11-05 18:33 ` Nicolin Chen
2025-11-05 18:58 ` Jason Gunthorpe
2025-11-05 19:33 ` Nicolin Chen
2025-11-06 7:42 ` Eric Auger
2025-11-06 11:48 ` Shameer Kolothum
2025-11-06 17:04 ` Eric Auger
2025-11-07 10:27 ` Shameer Kolothum
2025-11-06 14:32 ` Jason Gunthorpe
2025-11-06 15:47 ` Eric Auger
2025-11-05 18:33 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 16/32] hw/arm/smmuv3-accel: Make use of " Shameer Kolothum
2025-10-31 23:57 ` Nicolin Chen
2025-11-03 15:19 ` Shameer Kolothum
2025-11-03 17:34 ` Nicolin Chen
2025-10-31 10:49 ` [PATCH v5 17/32] hw/arm/smmuv3-accel: Add support to issue invalidation cmd to host Shameer Kolothum
2025-11-01 0:35 ` Nicolin Chen via
2025-11-03 15:28 ` Shameer Kolothum
2025-11-03 17:43 ` Nicolin Chen
2025-11-03 18:17 ` Shameer Kolothum
2025-11-03 18:51 ` Nicolin Chen
2025-11-04 8:55 ` Eric Auger
2025-11-04 16:41 ` Nicolin Chen
2025-11-03 17:11 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 18/32] hw/arm/smmuv3: Initialize ID registers early during realize() Shameer Kolothum
2025-11-01 0:24 ` Nicolin Chen
2025-11-03 13:57 ` Jonathan Cameron via
2025-11-03 15:11 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 19/32] hw/arm/smmuv3-accel: Get host SMMUv3 hw info and validate Shameer Kolothum
2025-11-01 0:49 ` Nicolin Chen
2025-11-01 14:20 ` Zhangfei Gao
2025-11-03 15:42 ` Shameer Kolothum
2025-11-03 17:16 ` Eric Auger
2025-11-03 14:47 ` Jonathan Cameron via
2025-10-31 10:49 ` [PATCH v5 20/32] hw/pci-host/gpex: Allow to generate preserve boot config DSM #5 Shameer Kolothum
2025-11-03 13:58 ` Jonathan Cameron via
2025-10-31 10:49 ` [PATCH v5 21/32] hw/arm/virt: Set PCI preserve_config for accel SMMUv3 Shameer Kolothum
2025-11-03 14:58 ` Eric Auger
2025-11-03 15:03 ` Eric Auger via
2025-11-03 16:01 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 22/32] tests/qtest/bios-tables-test: Prepare for IORT revison upgrade Shameer Kolothum
2025-11-03 14:48 ` Jonathan Cameron via
2025-11-03 14:59 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 23/32] hw/arm/virt-acpi-build: Add IORT RMR regions to handle MSI nested binding Shameer Kolothum
2025-11-03 14:53 ` Jonathan Cameron via
2025-11-03 15:43 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 24/32] tests/qtest/bios-tables-test: Update IORT blobs after revision upgrade Shameer Kolothum
2025-11-03 14:54 ` Jonathan Cameron via
2025-11-03 15:01 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 25/32] hw/arm/smmuv3: Add accel property for SMMUv3 device Shameer Kolothum
2025-11-03 14:56 ` Jonathan Cameron via
2025-10-31 10:49 ` [PATCH v5 26/32] hw/arm/smmuv3-accel: Add a property to specify RIL support Shameer Kolothum
2025-11-03 15:07 ` Eric Auger
2025-11-03 16:08 ` Shameer Kolothum
2025-11-03 16:25 ` Eric Auger
2025-11-04 9:38 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 27/32] hw/arm/smmuv3-accel: Add support for ATS Shameer Kolothum
2025-11-04 14:22 ` Eric Auger [this message]
2025-10-31 10:50 ` [PATCH v5 28/32] hw/arm/smmuv3-accel: Add property to specify OAS bits Shameer Kolothum
2025-11-04 14:35 ` Eric Auger
2025-11-04 14:50 ` Jason Gunthorpe
2025-11-06 7:54 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 29/32] backends/iommufd: Retrieve PASID width from iommufd_backend_get_device_info() Shameer Kolothum
2025-10-31 10:50 ` [PATCH v5 30/32] Extend get_cap() callback to support PASID Shameer Kolothum
2025-11-03 14:58 ` Jonathan Cameron via
2025-11-06 8:45 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 31/32] vfio: Synthesize vPASID capability to VM Shameer Kolothum
2025-11-03 15:00 ` Jonathan Cameron via
2025-11-06 13:55 ` Eric Auger
2025-11-06 14:27 ` Shameer Kolothum
2025-11-06 15:44 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 32/32] hw/arm/smmuv3-accel: Add support for PASID enable Shameer Kolothum
2025-11-06 16:46 ` Eric Auger
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=2a4a1246-4515-4e98-b5dc-e1ff0e9f0003@redhat.com \
--to=eric.auger@redhat.com \
--cc=berrange@redhat.com \
--cc=ddutile@redhat.com \
--cc=jgg@nvidia.com \
--cc=jiangkunkun@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=kjaju@nvidia.com \
--cc=mochs@nvidia.com \
--cc=nathanc@nvidia.com \
--cc=nicolinc@nvidia.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=skolothumtho@nvidia.com \
--cc=smostafa@google.com \
--cc=wangzhou1@hisilicon.com \
--cc=yi.l.liu@intel.com \
--cc=zhangfei.gao@linaro.org \
--cc=zhenzhong.duan@intel.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;
as well as URLs for NNTP newsgroup(s).