From: Nathan Chen <nathanc@nvidia.com>
To: eric.auger@redhat.com, qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Yi Liu" <yi.l.liu@intel.com>,
"Zhenzhong Duan" <zhenzhong.duan@intel.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Yanan Wang" <wangyanan55@huawei.com>,
"Zhao Liu" <zhao1.liu@intel.com>,
"Alex Williamson" <alex@shazbot.org>,
"Cédric Le Goater" <clg@redhat.com>,
"Shameer Kolothum" <skolothumtho@nvidia.com>,
"Matt Ochs" <mochs@nvidia.com>,
"Nicolin Chen" <nicolinc@nvidia.com>
Subject: Re: [PATCH 01/11] hw/arm/smmuv3-accel: Add helper for resolving auto parameters
Date: Fri, 10 Apr 2026 11:53:11 -0700 [thread overview]
Message-ID: <2e63174a-d426-4c79-92fc-ae38f82ef2be@nvidia.com> (raw)
In-Reply-To: <d68d889f-2257-45ba-87f7-7948ef0da478@redhat.com>
On 4/10/2026 12:37 AM, Eric Auger wrote:
>
> On 4/1/26 3:02 AM, Nathan Chen wrote:
>> From: Nathan Chen<nathanc@nvidia.com>
>>
>> Introduce smmuv3_accel_auto_finalise() to resolve properties that are
>> set to 'auto' for accelerated SMMUv3. This helper function allows
>> properties such as ats, ril, ssidsize, and oas support to be resolved
>> from host IOMMU capabilities via IOMMU_GET_HW_INFO.
>>
>> Auto mode requires at least one cold-plugged device to retrieve and
>> finalise these properties. Register a machine_init_done notifier to
>> verify this requirement and fail boot if it is not met.
>>
>> Hot-plugged devices into an accel SMMUv3-associated bus will re-use
>> the resolved host values from the initial cold-plug.
>>
>> Subsequent patches will make use of this helper to resolve 'auto' to
>> what is reported by host IOMMU capabilities.
>>
>> Suggested-by: Shameer Kolothum<skolothumtho@nvidia.com>
>> Signed-off-by: Nathan Chen<nathanc@nvidia.com>
>> ---
>> hw/arm/smmuv3-accel.c | 14 ++++++++++++++
>> hw/arm/smmuv3-accel.h | 2 ++
>> hw/arm/smmuv3.c | 20 ++++++++++++++++++++
>> include/hw/arm/smmuv3.h | 2 ++
>> 4 files changed, 38 insertions(+)
>>
>> diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
>> index 65c2f44880..a0146c8d31 100644
>> --- a/hw/arm/smmuv3-accel.c
>> +++ b/hw/arm/smmuv3-accel.c
>> @@ -35,11 +35,25 @@ static int smmuv3_oas_bits(uint32_t oas)
>> return map[oas];
>> }
>>
>> +static void smmuv3_accel_auto_finalise(SMMUv3State *s,
>> + struct iommu_hw_info_arm_smmuv3 *info) {
>> + SMMUv3AccelState *accel = s->s_accel;
>> +
>> + /* Return if no auto for any or finalised already */
>> + if (!accel->auto_mode || accel->auto_finalised) {
>> + return;
>> + }
>> +
>> + accel->auto_finalised = true;
>> +}
>> +
>> static bool
>> smmuv3_accel_check_hw_compatible(SMMUv3State *s,
>> struct iommu_hw_info_arm_smmuv3 *info,
>> Error **errp)
>> {
>> + smmuv3_accel_auto_finalise(s, info);
>> +
>> /* QEMU SMMUv3 supports both linear and 2-level stream tables */
>> if (FIELD_EX32(info->idr[0], IDR0, STLEVEL) !=
>> FIELD_EX32(s->idr[0], IDR0, STLEVEL)) {
>> diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
>> index dba6c71de5..3c1cd55714 100644
>> --- a/hw/arm/smmuv3-accel.h
>> +++ b/hw/arm/smmuv3-accel.h
>> @@ -26,6 +26,8 @@ typedef struct SMMUv3AccelState {
>> uint32_t bypass_hwpt_id;
>> uint32_t abort_hwpt_id;
>> QLIST_HEAD(, SMMUv3AccelDevice) device_list;
>> + bool auto_mode;
>> + bool auto_finalised;
>> } SMMUv3AccelState;
>>
>> typedef struct SMMUS1Hwpt {
>> diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
>> index 7fead1c3cf..09ea08eb18 100644
>> --- a/hw/arm/smmuv3.c
>> +++ b/hw/arm/smmuv3.c
>> @@ -37,6 +37,7 @@
>> #include "smmuv3-accel.h"
>> #include "smmuv3-internal.h"
>> #include "smmu-internal.h"
>> +#include "system/system.h"
>>
>> #define PTW_RECORD_FAULT(ptw_info, cfg) (((ptw_info).stage == SMMU_STAGE_1 && \
>> (cfg)->record_faults) || \
>> @@ -2020,6 +2021,22 @@ static bool smmu_validate_property(SMMUv3State *s, Error **errp)
>> return true;
>> }
>>
>> +static void smmuv3_machine_done(Notifier *notifier, void *data)
>> +{
>> + SMMUv3State *s = container_of(notifier, SMMUv3State, machine_done);
>> + SMMUv3AccelState *accel = s->s_accel;
>> +
>> + if (!s->accel) {
>> + return;
>> + }
>> +
>> + if (accel->auto_mode && !accel->auto_finalised) {
>> + error_report("arm-smmuv3 accel=on with 'auto' properties requires "
>> + "at least one cold-plugged VFIO device");
>> + exit(1);
>> + }
>> +}
>> +
>> static void smmu_realize(DeviceState *d, Error **errp)
>> {
>> SMMUState *sys = ARM_SMMU(d);
>> @@ -2058,6 +2075,9 @@ static void smmu_realize(DeviceState *d, Error **errp)
>>
>> smmu_init_irq(s, dev);
>> smmuv3_init_id_regs(s);
>> +
>> + s->machine_done.notify = smmuv3_machine_done;
>> + qemu_add_machine_init_done_notifier(&s->machine_done);
> you might also register the machine done notifier only in case auto_mode
> is set
Yes, I'll incorporate this in the next revision.
Thanks,
Nathan
next prev parent reply other threads:[~2026-04-10 18:53 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 1:02 [PATCH 00/11] hw/arm/smmuv3-accel: Resolve AUTO properties Nathan Chen
2026-04-01 1:02 ` [PATCH 01/11] hw/arm/smmuv3-accel: Add helper for resolving auto parameters Nathan Chen
2026-04-10 7:26 ` Eric Auger
2026-04-10 18:50 ` Nathan Chen
2026-04-10 7:37 ` Eric Auger
2026-04-10 18:53 ` Nathan Chen [this message]
2026-04-01 1:02 ` [PATCH 02/11] hw/arm/smmuv3-accel: Implement "auto" value for "ats" Nathan Chen
2026-04-10 7:36 ` Eric Auger
2026-04-10 18:53 ` Nathan Chen
2026-04-01 1:02 ` [PATCH 03/11] hw/arm/smmuv3: Change the default ats support to match the host Nathan Chen
2026-04-10 7:42 ` Eric Auger
2026-04-10 18:54 ` Nathan Chen
2026-04-01 1:02 ` [PATCH 04/11] vfio/pci: Add ats property and mask ATS cap when not exposed Nathan Chen
2026-04-10 21:09 ` Cédric Le Goater
2026-04-11 1:52 ` Nathan Chen
2026-04-11 12:45 ` Cédric Le Goater
2026-04-13 19:11 ` Nathan Chen
2026-04-16 13:58 ` Cédric Le Goater
2026-04-16 20:04 ` Nathan Chen
2026-04-16 13:43 ` Shameer Kolothum Thodi
2026-04-16 21:39 ` Nathan Chen
2026-04-01 1:02 ` [PATCH 05/11] hw/arm/smmuv3-accel: Implement "auto" value for "ril" Nathan Chen
2026-04-10 7:47 ` Eric Auger
2026-04-10 18:58 ` Nathan Chen
2026-04-01 1:02 ` [PATCH 06/11] hw/arm/smmuv3: Change the default ril support to match the host Nathan Chen
2026-04-10 7:41 ` Eric Auger
2026-04-10 18:59 ` Nathan Chen
2026-04-01 1:02 ` [PATCH 07/11] hw/arm/smmuv3-accel: Implement "auto" value for "ssidsize" Nathan Chen
2026-04-10 7:56 ` Eric Auger
2026-04-10 19:01 ` Nathan Chen
2026-04-01 1:02 ` [PATCH 08/11] hw/arm/smmuv3: Change the default ssidsize to match the host Nathan Chen
2026-04-01 1:02 ` [PATCH 09/11] hw/arm/smmuv3-accel: Implement "auto" value for "oas" Nathan Chen
2026-04-10 7:48 ` Eric Auger
2026-04-16 14:08 ` Shameer Kolothum Thodi
2026-04-16 20:02 ` Nathan Chen
2026-04-20 22:31 ` Nathan Chen
2026-04-21 9:30 ` Shameer Kolothum Thodi
2026-04-01 1:02 ` [PATCH 10/11] hw/arm/smmuv3: Change the default oas to match the host Nathan Chen
2026-04-01 1:02 ` [PATCH 11/11] qemu-options.hx: Support "auto" for accel SMMUv3 properties Nathan Chen
2026-04-16 14:19 ` Shameer Kolothum Thodi
2026-04-16 19:54 ` 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=2e63174a-d426-4c79-92fc-ae38f82ef2be@nvidia.com \
--to=nathanc@nvidia.com \
--cc=alex@shazbot.org \
--cc=clg@redhat.com \
--cc=eric.auger@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mochs@nvidia.com \
--cc=nicolinc@nvidia.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=skolothumtho@nvidia.com \
--cc=wangyanan55@huawei.com \
--cc=yi.l.liu@intel.com \
--cc=zhao1.liu@intel.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.