All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chen <nathanc@nvidia.com>
To: "Cédric Le Goater" <clg@redhat.com>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org
Cc: "Yi Liu" <yi.l.liu@intel.com>,
	"Eric Auger" <eric.auger@redhat.com>,
	"Zhenzhong Duan" <zhenzhong.duan@intel.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Shannon Zhao" <shannon.zhaosl@gmail.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Ani Sinha" <anisinha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Alex Williamson" <alex@shazbot.org>,
	"Eric Blake" <eblake@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Shameer Kolothum" <skolothumtho@nvidia.com>
Subject: Re: [RFC PATCH 1/8] hw/arm/smmuv3-accel: Add helper for resolving auto parameters
Date: Tue, 10 Mar 2026 10:13:50 -0700	[thread overview]
Message-ID: <c9b3d7ab-e497-4af6-b6af-201c8f351bf6@nvidia.com> (raw)
In-Reply-To: <b76df308-6731-4d30-9665-34d4cb71159d@redhat.com>



On 3/10/2026 12:42 AM, Cédric Le Goater wrote:
>>
>> Subsequent patches will make use of this helper to set the
>> values when we convert the values to OnOffAuto. New auto_mode
>> and auto_finalised bool members are added to SMMUv3AccelState.
>> smmuv3_accel_init() will set auto_mode to true when 'auto' is
>> detected for the accel SMMUv3 properties.
>> smmuv3_accel_auto_finalise() will set auto_finalised to true
>> after all 'auto' properties are resolved, and subsequent
>> calls to this function will return early if auto_finalised is
>> set to true.
>>
>> Suggested-by: Shameer Kolothum <skolothumtho@nvidia.com>
>> Signed-off-by: Nathan Chen <nathanc@nvidia.com>
>> ---
>>   hw/arm/smmuv3-accel.c | 38 +++++++++++++++++++++++++++++++++-----
>>   hw/arm/smmuv3-accel.h |  2 ++
>>   2 files changed, 35 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
>> index 17306cd04b..617629bacd 100644
>> --- a/hw/arm/smmuv3-accel.c
>> +++ b/hw/arm/smmuv3-accel.c
>> @@ -35,11 +35,34 @@ static int smmuv3_oas_bits(uint32_t oas)
>>       return map[oas];
>>   }
>> +static void smmuv3_accel_auto_finalise(SMMUv3State *s, PCIDevice *pdev,
>> +                                       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;
>> +    }
>> +
>> +    /* We can't update if device is hotplugged */
>> +    if (DEVICE(pdev)->hotplugged) {
>> +        warn_report("arm-smmuv3: 'auto' feature property detected, 
>> but host "
>> +                    "value cannot be applied for hot-plugged device; 
>> using "
>> +                    "existing value");
> 
> Please add an 'Error **' parameter instead.

Ok, if we decide to keep this hotplug check I will use the 'Error **' 
parameter instead here in the next revision. Per Shameer's reply to 
Markus on this patch, we may end up removing this check as we plan to 
fail boot if auto_mode is set but auto_finalised is still false from the 
lack of a cold-plugged device.

> 
>> +        return;
>> +    }
>> +
>> +    accel->auto_finalised = true;
>> +}
>> +
>>   static bool
>>   smmuv3_accel_check_hw_compatible(SMMUv3State *s,
>>                                    struct iommu_hw_info_arm_smmuv3 *info,
>> +                                 PCIDevice *pdev,
>>                                    Error **errp)
>>   {
>> +    smmuv3_accel_auto_finalise(s, pdev, 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)) {
>> @@ -124,7 +147,7 @@ smmuv3_accel_check_hw_compatible(SMMUv3State *s,
>>   static bool
>>   smmuv3_accel_hw_compatible(SMMUv3State *s, HostIOMMUDeviceIOMMUFD 
>> *idev,
>> -                           Error **errp)
>> +                           PCIDevice *pdev, Error **errp)
>>   {
>>       struct iommu_hw_info_arm_smmuv3 info;
>>       uint32_t data_type;
>> @@ -142,7 +165,7 @@ smmuv3_accel_hw_compatible(SMMUv3State *s, 
>> HostIOMMUDeviceIOMMUFD *idev,
>>           return false;
>>       }
>> -    if (!smmuv3_accel_check_hw_compatible(s, &info, errp)) {
>> +    if (!smmuv3_accel_check_hw_compatible(s, &info, pdev, errp)) {
>>           return false;
>>       }
>>       return true;
>> @@ -595,6 +618,7 @@ static bool smmuv3_accel_set_iommu_device(PCIBus 
>> *bus, void *opaque, int devfn,
>>       SMMUv3State *s = ARM_SMMUV3(bs);
>>       SMMUPciBus *sbus = smmu_get_sbus(bs, bus);
>>       SMMUv3AccelDevice *accel_dev = smmuv3_accel_get_dev(bs, sbus, 
>> bus, devfn);
>> +    PCIDevice *pdev = pci_find_device(bus, pci_bus_num(bus), devfn);
>>       if (!idev) {
>>           return true;
>> @@ -613,7 +637,7 @@ static bool smmuv3_accel_set_iommu_device(PCIBus 
>> *bus, void *opaque, int devfn,
>>        * Check the host SMMUv3 associated with the dev is compatible 
>> with the
>>        * QEMU SMMUv3 accel.
>>        */
>> -    if (!smmuv3_accel_hw_compatible(s, idev, errp)) {
>> +    if (!smmuv3_accel_hw_compatible(s, idev, pdev, errp)) {
>>           return false;
>>       }
>> @@ -867,8 +891,12 @@ bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State 
>> *s, Error **errp)
>>   void smmuv3_accel_reset(SMMUv3State *s)
>>   {
>> -     /* Attach a HWPT based on GBPA reset value */
>> -     smmuv3_accel_attach_gbpa_hwpt(s, NULL);
>> +    if (s->s_accel && s->s_accel->auto_mode && !s->s_accel- 
>> >auto_finalised) {
>> +        error_report("AUTO mode specified but properties not 
>> finalised.");
> 
> This is not a very friendly message for the user.

Agreed, instead of 'properties not finalised' we will note that the 
properties were not introspected from host IDR registers, and that a 
cold-plugged device attached to the SMMUv3 must be present to do so.

Thanks,
Nathan


  parent reply	other threads:[~2026-03-10 17:14 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 19:21 [RFC PATCH 0/8] hw/arm/smmuv3-accel: Support AUTO properties Nathan Chen
2026-03-09 19:21 ` [RFC PATCH 1/8] hw/arm/smmuv3-accel: Add helper for resolving auto parameters Nathan Chen
2026-03-10  7:00   ` Markus Armbruster
2026-03-10  9:01     ` Shameer Kolothum Thodi
2026-03-12  8:20       ` Markus Armbruster
2026-03-12  8:33         ` Shameer Kolothum Thodi
2026-03-12  8:39           ` Cédric Le Goater
2026-03-12  8:44             ` Shameer Kolothum Thodi
2026-03-10  7:42   ` Cédric Le Goater
2026-03-10  8:40     ` Shameer Kolothum Thodi
2026-03-12  8:37       ` Cédric Le Goater
2026-03-12  9:29         ` Shameer Kolothum Thodi
2026-03-10 17:13     ` Nathan Chen [this message]
2026-03-09 19:21 ` [RFC PATCH 2/8] hw/arm/smmuv3-accel: Introduce _AUTO support for ATS Nathan Chen
2026-03-10  7:05   ` Markus Armbruster
2026-03-10 17:35     ` Nathan Chen
2026-03-11 15:31     ` Eric Auger
2026-03-11 17:08       ` Nathan Chen
2026-03-11 17:16         ` Eric Auger
2026-03-11 18:09           ` Pavel Hrdina
2026-03-12  8:39           ` Markus Armbruster
2026-03-12  8:51             ` Eric Auger
2026-03-12  9:20               ` Markus Armbruster
2026-03-12  9:25                 ` Eric Auger
2026-03-12 16:35                   ` Nathan Chen
2026-03-12  8:52             ` Eric Auger
2026-03-11 17:24         ` Eric Auger
2026-03-11 17:46   ` Eric Auger
2026-03-11 17:53     ` Nathan Chen
2026-03-11 18:10   ` Eric Auger
2026-03-11 18:21     ` Nathan Chen
2026-03-09 19:21 ` [RFC PATCH 3/8] vfio/pci: Add ats property and mask ATS cap when not exposed Nathan Chen
2026-03-09 19:21 ` [RFC PATCH 4/8] hw/arm/smmuv3-accel: Introduce _AUTO support for RIL Nathan Chen
2026-03-10  7:06   ` Markus Armbruster
2026-03-09 19:21 ` [RFC PATCH 5/8] qdev: Add a SsidSizeMode property Nathan Chen
2026-03-10  7:14   ` Markus Armbruster
2026-03-09 19:21 ` [RFC PATCH 6/8] hw/arm/smmuv3-accel: Introduce _AUTO support for SSID size Nathan Chen
2026-03-10  7:21   ` Markus Armbruster
2026-03-10 17:44     ` Nathan Chen
2026-03-09 19:21 ` [RFC PATCH 7/8] qdev: Add an OasMode property Nathan Chen
2026-03-11 18:20   ` Eric Auger
2026-03-11 18:24     ` Nathan Chen
2026-03-12  9:29       ` Eric Auger
2026-03-12 16:32         ` Nathan Chen
2026-03-09 19:21 ` [RFC PATCH 8/8] hw/arm/smmuv3-accel: Introduce _AUTO support for OAS Nathan Chen
2026-03-10  7:23   ` Markus Armbruster
2026-03-11 17:43 ` [RFC PATCH 0/8] hw/arm/smmuv3-accel: Support AUTO properties Eric Auger
2026-03-11 17:55   ` Nathan Chen
2026-03-11 18:25     ` 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=c9b3d7ab-e497-4af6-b6af-201c8f351bf6@nvidia.com \
    --to=nathanc@nvidia.com \
    --cc=alex@shazbot.org \
    --cc=anisinha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=clg@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.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 \
    --cc=yi.l.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.