qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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, shameerkolothum@gmail.com
Subject: Re: [PATCH v4 21/27] hw/arm/smmuv3-accel: Add a property to specify RIL support
Date: Mon, 27 Oct 2025 15:44:15 +0100	[thread overview]
Message-ID: <b6105534-4a17-4700-bb0b-e961babd10bb@redhat.com> (raw)
In-Reply-To: <20250929133643.38961-22-skolothumtho@nvidia.com>

Hi Shameer,

On 9/29/25 3:36 PM, Shameer Kolothum wrote:
> Currently QEMU SMMUv3 has RIL support by default. But if accelerated mode
> is enabled, RIL has to be compatible with host SMMUv3 support.

We may have extended this prop to emulation code too.

While checking I noticed AIDR is set to 3.1 in vIOMMU. Not related to
this patch but should we test the host IOMMU has a compatible
architecture too?
>
> Add a property so that the user can specify this.
>
> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
> ---
>  hw/arm/smmuv3-accel.c   | 16 ++++++++++++++--
>  hw/arm/smmuv3-accel.h   |  4 ++++
>  hw/arm/smmuv3.c         | 13 +++++++++++++
>  include/hw/arm/smmuv3.h |  1 +
>  4 files changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
> index 8396053a6c..e8607b253e 100644
> --- a/hw/arm/smmuv3-accel.c
> +++ b/hw/arm/smmuv3-accel.c
> @@ -79,10 +79,10 @@ smmuv3_accel_check_hw_compatible(SMMUv3State *s,
>          return false;
>      }
>  
> -    /* QEMU SMMUv3 supports Range Invalidation by default */
> +    /* User can override QEMU SMMUv3 Range Invalidation support */
>      val = FIELD_EX32(info->idr[3], IDR3, RIL);
>      if (val != FIELD_EX32(s->idr[3], IDR3, RIL)) {
> -        error_setg(errp, "Host SUMMUv3 deosn't support Range Invalidation");
> +        error_setg(errp, "Host SUMMUv3 differs in Range Invalidation support");
>          return false;
>      }
>  
> @@ -634,6 +634,18 @@ static const PCIIOMMUOps smmuv3_accel_ops = {
>      .get_msi_address_space = smmuv3_accel_find_msi_as,
>  };
>  
> +void smmuv3_accel_idr_override(SMMUv3State *s)
> +{
> +    if (!s->accel) {
> +        return;
> +    }
> +
> +    /* By default QEMU SMMUv3 has RIL. Update IDR3 if user has disabled it */
> +    if (!s->ril) {
> +        s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 0);
> +    }
> +}
> +
>  /*
>   * If the guest reboots and devices are configured for S1+S2, Stage1 must
>   * be switched to bypass. Otherwise, QEMU/UEFI may fail when accessing a
> diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
> index 75f858e34a..357d8352c5 100644
> --- a/hw/arm/smmuv3-accel.h
> +++ b/hw/arm/smmuv3-accel.h
> @@ -49,6 +49,7 @@ bool smmuv3_accel_install_nested_ste_range(SMMUv3State *s, SMMUSIDRange *range,
>  bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
>                                  Error **errp);
>  void smmuv3_accel_attach_bypass_hwpt(SMMUv3State *s);
> +void smmuv3_accel_idr_override(SMMUv3State *s);
>  #else
>  static inline void smmuv3_accel_init(SMMUv3State *s)
>  {
> @@ -74,6 +75,9 @@ smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
>  static inline void smmuv3_accel_attach_bypass_hwpt(SMMUv3State *s)
>  {
>  }
> +static inline void smmuv3_accel_idr_override(SMMUv3State *s)
> +{
> +}
>  #endif
>  
>  #endif /* HW_ARM_SMMUV3_ACCEL_H */
> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
> index a0f704fc35..0f3a61646a 100644
> --- a/hw/arm/smmuv3.c
> +++ b/hw/arm/smmuv3.c
> @@ -300,6 +300,8 @@ static void smmuv3_init_regs(SMMUv3State *s)
>      s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN16K, 1);
>      s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN64K, 1);
>  
> +    smmuv3_accel_idr_override(s);
> +
>      s->cmdq.base = deposit64(s->cmdq.base, 0, 5, SMMU_CMDQS);
>      s->cmdq.prod = 0;
>      s->cmdq.cons = 0;
> @@ -1925,6 +1927,13 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
>          return false;
>      }
>  #endif
> +    if (s->accel) {
> +        return true;
> +    }
> +    if (!s->ril) {
> +        error_setg(errp, "ril can only be disabled if accel=on");
> +        return false;
> +    }
>      return true;
>  }
>  
> @@ -2047,6 +2056,8 @@ static const Property smmuv3_properties[] = {
>       */
>      DEFINE_PROP_STRING("stage", SMMUv3State, stage),
>      DEFINE_PROP_BOOL("accel", SMMUv3State, accel, false),
> +    /* RIL can be turned off for accel cases */
> +    DEFINE_PROP_BOOL("ril", SMMUv3State, ril, true),
>  };
>  
>  static void smmuv3_instance_init(Object *obj)
> @@ -2074,6 +2085,8 @@ static void smmuv3_class_init(ObjectClass *klass, const void *data)
>                                            "Enable SMMUv3 accelerator support."
>                                            "Allows host SMMUv3 to be configured "
>                                            "in nested mode for vfio-pci dev assignment");
> +    object_class_property_set_description(klass, "ril",
> +        "Enable/disable range invalidation support");
if we decide to enable the prop only along with accel, might be worth to
document it here.
>  }
>  
>  static int smmuv3_notify_flag_changed(IOMMUMemoryRegion *iommu,
> diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
> index 874cbaaf32..c555ea684e 100644
> --- a/include/hw/arm/smmuv3.h
> +++ b/include/hw/arm/smmuv3.h
> @@ -68,6 +68,7 @@ struct SMMUv3State {
>      bool accel;
>      struct SMMUv3AccelState  *s_accel;
>      Error  *migration_blocker;
> +    bool ril;
>  };
>  
>  typedef enum {
Thanks

Eric



  parent reply	other threads:[~2025-10-27 14:45 UTC|newest]

Thread overview: 161+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29 13:36 [PATCH v4 00/27] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 01/27] backends/iommufd: Introduce iommufd_backend_alloc_viommu Shameer Kolothum
2025-09-29 15:35   ` Jonathan Cameron via
2025-10-17 12:21   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 02/27] backends/iommufd: Introduce iommufd_vdev_alloc Shameer Kolothum
2025-09-29 15:40   ` Jonathan Cameron via
2025-09-29 17:52   ` Nicolin Chen
2025-09-30  8:14     ` Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 03/27] hw/arm/smmu-common: Factor out common helper functions and export Shameer Kolothum
2025-09-29 15:43   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 04/27] hw/arm/smmu-common:Make iommu ops part of SMMUState Shameer Kolothum
2025-09-29 15:45   ` Jonathan Cameron via
2025-09-29 21:53   ` Nicolin Chen via
2025-10-01 16:11   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 05/27] hw/arm/smmuv3-accel: Introduce smmuv3 accel device Shameer Kolothum
2025-09-29 15:53   ` Jonathan Cameron via
2025-09-29 22:24   ` Nicolin Chen
2025-10-01 16:25   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 06/27] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints with iommufd Shameer Kolothum
2025-09-29 16:08   ` Jonathan Cameron via
2025-09-30  8:03     ` Shameer Kolothum
2025-10-01 16:38       ` Eric Auger
2025-10-02  8:16         ` Shameer Kolothum
2025-09-30  0:11   ` Nicolin Chen
2025-10-02  7:29     ` Shameer Kolothum
2025-10-01 17:32   ` Eric Auger
2025-10-02  9:30     ` Shameer Kolothum
2025-10-17 12:47       ` Eric Auger
2025-10-17 13:15         ` Shameer Kolothum
2025-10-17 17:19           ` Eric Auger
2025-10-20 16:31   ` Eric Auger
2025-10-20 18:25     ` Nicolin Chen
2025-10-20 18:59       ` Shameer Kolothum
2025-10-21 15:28         ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 07/27] hw/arm/smmuv3: Implement get_viommu_cap() callback Shameer Kolothum
2025-09-29 16:13   ` Jonathan Cameron via
2025-10-01 17:36   ` Eric Auger
2025-10-02  9:38     ` Shameer Kolothum
2025-10-02 12:31       ` Eric Auger
2025-10-02  9:39     ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 08/27] hw/arm/smmuv3-accel: Add set/unset_iommu_device callback Shameer Kolothum
2025-09-29 16:25   ` Jonathan Cameron via
2025-09-30  8:13     ` Shameer Kolothum
2025-10-02  6:52   ` Eric Auger
2025-10-02 11:34     ` Shameer Kolothum
2025-10-02 16:44       ` Nicolin Chen
2025-10-02 18:35         ` Jason Gunthorpe
2025-10-17 12:06         ` Eric Auger
2025-10-27 11:56         ` Shameer Kolothum
2025-10-27 14:10           ` Eric Auger
2025-10-17 12:23   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 09/27] hw/arm/smmuv3-accel: Support nested STE install/uninstall support Shameer Kolothum
2025-09-29 16:41   ` Jonathan Cameron via
2025-10-02 10:04   ` Eric Auger
2025-10-02 12:08     ` Shameer Kolothum
2025-10-02 12:27       ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 10/27] hw/arm/smmuv3-accel: Allocate a vDEVICE object for device Shameer Kolothum
2025-09-29 16:42   ` Jonathan Cameron via
2025-10-17 13:08   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 11/27] hw/pci/pci: Introduce optional get_msi_address_space() callback Shameer Kolothum
2025-09-29 16:48   ` Jonathan Cameron via
2025-10-16 22:30   ` Nicolin Chen
2025-10-20 16:14     ` Eric Auger
2025-10-20 18:00       ` Nicolin Chen
2025-10-21 16:26         ` Eric Auger
2025-10-21 18:56           ` Nicolin Chen
2025-10-22 16:25             ` Eric Auger
2025-10-22 16:56               ` Shameer Kolothum
2025-10-20 16:21   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 12/27] hw/arm/smmuv3-accel: Make use of " Shameer Kolothum
2025-09-29 16:51   ` Jonathan Cameron via
2025-10-02  7:33     ` Shameer Kolothum
2025-10-16 23:28   ` Nicolin Chen
2025-10-20 16:43   ` Eric Auger
2025-10-21  8:15     ` Shameer Kolothum
2025-10-21 16:16       ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 13/27] hw/arm/smmuv3-accel: Add support to issue invalidation cmd to host Shameer Kolothum
2025-09-29 16:53   ` Jonathan Cameron via
2025-10-16 22:59   ` Nicolin Chen via
2025-10-27 10:13   ` Eric Auger
2025-10-27 12:20     ` Shameer Kolothum
2025-10-27 14:05       ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 14/27] hw/arm/smmuv3-accel: Get host SMMUv3 hw info and validate Shameer Kolothum
2025-10-01 12:56   ` Jonathan Cameron via
2025-10-02  7:37     ` Shameer Kolothum
2025-10-02  9:54       ` Jonathan Cameron via
2025-10-27 10:41     ` Eric Auger
2025-10-27 12:23       ` Shameer Kolothum
2025-10-27 10:46   ` Eric Auger
2025-10-27 12:24     ` Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 15/27] acpi/gpex: Fix PCI Express Slot Information function 0 returned value Shameer Kolothum
2025-10-01 12:59   ` Jonathan Cameron via
2025-10-02  7:39     ` Shameer Kolothum
2025-10-21 15:32       ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 16/27] hw/pci-host/gpex: Allow to generate preserve boot config DSM #5 Shameer Kolothum
2025-10-01 13:05   ` Jonathan Cameron via
2025-10-27 11:14     ` Eric Auger
2025-10-27 11:10   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 17/27] hw/arm/virt: Set PCI preserve_config for accel SMMUv3 Shameer Kolothum
2025-10-01 13:06   ` Jonathan Cameron via
2025-10-27 11:21   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 18/27] hw/arm/virt-acpi-build: Add IORT RMR regions to handle MSI nested binding Shameer Kolothum
2025-10-01 13:30   ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 19/27] hw/arm/smmuv3-accel: Install S1 bypass hwpt on reset Shameer Kolothum
2025-10-01 13:32   ` Jonathan Cameron via
2025-10-16 23:19   ` Nicolin Chen
2025-10-20 14:22     ` Shameer Kolothum
2025-10-27 14:26     ` Eric Auger
2025-10-27 14:51       ` Shameer Kolothum
2025-10-27 16:34       ` Nicolin Chen
2025-10-27 14:22   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 20/27] hw/arm/smmuv3: Add accel property for SMMUv3 device Shameer Kolothum
2025-10-16 21:48   ` Nicolin Chen
2025-10-27 14:28     ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 21/27] hw/arm/smmuv3-accel: Add a property to specify RIL support Shameer Kolothum
2025-10-01 13:39   ` Jonathan Cameron via
2025-10-17  8:48   ` Zhangfei Gao
2025-10-17  9:40     ` Shameer Kolothum
2025-10-17 14:05       ` Zhangfei Gao
2025-10-27 14:44   ` Eric Auger [this message]
2025-09-29 13:36 ` [PATCH v4 22/27] hw/arm/smmuv3-accel: Add support for ATS Shameer Kolothum
2025-10-01 13:43   ` Jonathan Cameron via
2025-10-27 16:59   ` Eric Auger
2025-10-27 17:13     ` Nicolin Chen via
2025-10-27 17:38       ` Eric Auger
2025-10-27 17:53         ` Nicolin Chen
2025-10-28 12:16           ` Jason Gunthorpe
2025-10-28 13:21             ` Eric Auger
2025-10-28 13:41               ` Jason Gunthorpe
2025-10-28 13:51                 ` Eric Auger
2025-10-28 14:03                   ` Jason Gunthorpe
2025-10-28 14:44                     ` Shameer Kolothum
2025-10-28 14:46                       ` Eric Auger
2025-10-28 14:59                     ` Eric Auger
2025-10-28 15:06                       ` Jason Gunthorpe
2025-10-27 17:54         ` Shameer Kolothum
2025-10-27 18:02           ` Eric Auger
2025-10-28 14:03             ` Shameer Kolothum
2025-10-27 17:13     ` Shameer Kolothum
2025-09-29 13:36 ` [PATCH v4 23/27] hw/arm/smmuv3-accel: Add property to specify OAS bits Shameer Kolothum
2025-10-01 13:46   ` Jonathan Cameron via
2025-10-27 14:57     ` Eric Auger
2025-10-27 14:55   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 24/27] backends/iommufd: Retrieve PASID width from iommufd_backend_get_device_info() Shameer Kolothum
2025-10-01 13:50   ` Jonathan Cameron via
2025-10-27 17:00     ` Eric Auger
2025-10-27 17:10   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 25/27] backends/iommufd: Add a callback helper to retrieve PASID support Shameer Kolothum
2025-10-01 13:52   ` Jonathan Cameron via
2025-10-27 17:28   ` Eric Auger
2025-09-29 13:36 ` [PATCH v4 26/27] vfio: Synthesize vPASID capability to VM Shameer Kolothum
2025-10-01 13:58   ` Jonathan Cameron via
2025-10-02  8:03     ` Shameer Kolothum
2025-10-02  9:58       ` Jonathan Cameron via
2025-09-29 13:36 ` [PATCH v4 27/27] hw.arm/smmuv3: Add support for PASID enable Shameer Kolothum
2025-10-01 14:01   ` Jonathan Cameron via
2025-10-27 18:15   ` Eric Auger
2025-10-27 18:40     ` Shameer Kolothum
2025-10-28 10:31       ` Eric Auger
2025-10-17  6:25 ` [PATCH v4 00/27] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Zhangfei Gao
2025-10-17  9:43   ` Shameer Kolothum

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=b6105534-4a17-4700-bb0b-e961babd10bb@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=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=shameerkolothum@gmail.com \
    --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).