Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3ECCFED2F0 for ; Thu, 12 Mar 2026 08:39:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w0bZu-00056Z-Q0; Thu, 12 Mar 2026 04:39:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0bZs-00055r-MV for qemu-devel@nongnu.org; Thu, 12 Mar 2026 04:39:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w0bZp-0004AJ-Sd for qemu-devel@nongnu.org; Thu, 12 Mar 2026 04:39:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773304769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=6keMSC1wIvTvN70FmLg3L5xmdRwuwEXhub7hUyjTJZM=; b=Gcl3AbYBVG8u6mc6fvt7UeNyx2dzvzaFNMnqIqV74Tw4ZCcmTpoBSsOYEADXHrBi7S6VZp CjBD3AKlNi/KEBKJQ9+h4uIV2vZO1PD4xcp42oTsB4TjanXMOs9zzZPVjF0nBuJIio2d+3 3vWbpudA5U3SW+lbHcSFvAMOTF3R8jk= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-528-J9y8pIIhPjWgO_vs0m7QEw-1; Thu, 12 Mar 2026 04:39:27 -0400 X-MC-Unique: J9y8pIIhPjWgO_vs0m7QEw-1 X-Mimecast-MFC-AGG-ID: J9y8pIIhPjWgO_vs0m7QEw_1773304766 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-439c794ec8eso888845f8f.1 for ; Thu, 12 Mar 2026 01:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773304766; x=1773909566; darn=nongnu.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=6keMSC1wIvTvN70FmLg3L5xmdRwuwEXhub7hUyjTJZM=; b=C97hSF/QLj1cXhkybyQJvjA4RvuYIlxNRkRpN4+g777mrl93bpU0hIxYOQaCQLJtFU LajtvdXkyhNmZ2AOoBtwwcX2dPvqOY3G9O3SlKNjKbZdFr1Ax99vYPvxPzCE+zzbWe6n Xw6Q90E+KzhTpOzeclERlcGPbK3iE/kua6WvEKoflaAVIToEdv3PsntJP4s961rQy4XP RNz8l9u/HZHnROl7XoBK1C3MekOH2UYOXmKkebxsl2Q7f+wZobjym+nkw0cm8ZbFK7jx qcWMomw5ZiMwXYn4BD2fxlF940hx4/puJYdhCtbXECF+gGXerWgo7HbdyEK7Vhv2Y4lc 1Xnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773304766; x=1773909566; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6keMSC1wIvTvN70FmLg3L5xmdRw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Fej1oasLFADfKmIdWpbn25aUzv7X4tRoZH3kRmyuq9U8xOT X-Received: by 2002:a05:6000:40c8:b0:439:f605:aff0 with SMTP id ffacd0b85a97d-439f8200ae7mr10364351f8f.18.1773304765851; Thu, 12 Mar 2026 01:39:25 -0700 (PDT) X-Received: by 2002:a05:6000:40c8:b0:439:f605:aff0 with SMTP id ffacd0b85a97d-439f8200ae7mr10364291f8f.18.1773304765319; Thu, 12 Mar 2026 01:39:25 -0700 (PDT) Received: from ?IPV6:2a01:e0a:280:24f0:9db0:474c:ff43:9f5c? ([2a01:e0a:280:24f0:9db0:474c:ff43:9f5c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe22529csm5643808f8f.31.2026.03.12.01.39.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Mar 2026 01:39:24 -0700 (PDT) Message-ID: Date: Thu, 12 Mar 2026 09:39:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 1/8] hw/arm/smmuv3-accel: Add helper for resolving auto parameters To: Shameer Kolothum Thodi , Markus Armbruster Cc: Nathan Chen , "qemu-devel@nongnu.org" , "qemu-arm@nongnu.org" , Yi Liu , Eric Auger , Zhenzhong Duan , Peter Maydell , Shannon Zhao , "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Paolo Bonzini , =?UTF-8?Q?Daniel_P=2EBerrang=C3=A9?= , Alex Williamson , Eric Blake References: <20260309192119.870186-1-nathanc@nvidia.com> <20260309192119.870186-2-nathanc@nvidia.com> <87tsuonp7r.fsf@pond.sub.org> <87v7f1xxv3.fsf@pond.sub.org> Content-Language: en-US, fr From: =?UTF-8?Q?C=C3=A9dric_Le_Goater?= Autocrypt: addr=clg@redhat.com; keydata= xsFNBFu8o3UBEADP+oJVJaWm5vzZa/iLgpBAuzxSmNYhURZH+guITvSySk30YWfLYGBWQgeo 8NzNXBY3cH7JX3/a0jzmhDc0U61qFxVgrPqs1PQOj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AECAAkFAlu8o3UCGwwACgkQUaNDx8/77KEhwg//WqVopd5k 8hQb9VVdk6RQOCTfo6wHhEqgjbXQGlaxKHoXywEQBi8eULbeMQf5l4+tHJWBxswQ93IHBQjK yKyNr4FXseUI5O20XVNYDJZUrhA4yn0e/Af0IX25d94HXQ5sMTWr1qlSK6Zu79lbH3R57w9j hQm9emQEp785ui3A5U2Lqp6nWYWXz0eUZ0Tad2zC71Gg9VazU9MXyWn749s0nXbVLcLS0yop s302Gf3ZmtgfXTX/W+M25hiVRRKCH88yr6it+OMJBUndQVAA/fE9hYom6t/zqA248j0QAV/p LHH3hSirE1mv+7jpQnhMvatrwUpeXrOiEw1nHzWCqOJUZ4SY+HmGFW0YirWV2mYKoaGO2YBU wYF7O9TI3GEEgRMBIRT98fHa0NPwtlTktVISl73LpgVscdW8yg9Gc82oe8FzU1uHjU8b10lU XOMHpqDDEV9//r4ZhkKZ9C4O+YZcTFu+mvAY3GlqivBNkmYsHYSlFsbxc37E1HpTEaSWsGfA HQoPn9qrDJgsgcbBVc1gkUT6hnxShKPp4PlsZVMNjvPAnr5TEBgHkk54HQRhhwcYv1T2QumQ izDiU6iOrUzBThaMhZO3i927SG2DwWDVzZltKrCMD1aMPvb3NU8FOYRhNmIFR3fcalYr+9gD uVKe8BVz4atMOoktmt0GWTOC8P4= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=170.10.133.124; envelope-from=clg@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 3/12/26 09:33, Shameer Kolothum Thodi wrote: > > >> -----Original Message----- >> From: Markus Armbruster >> Sent: 12 March 2026 08:21 >> To: Shameer Kolothum Thodi >> Cc: Nathan Chen ; qemu-devel@nongnu.org; qemu- >> arm@nongnu.org; Yi Liu ; Eric Auger >> ; Zhenzhong Duan ; >> Peter Maydell ; Shannon Zhao >> ; Michael S . Tsirkin ; Igor >> Mammedov ; Ani Sinha ; >> Paolo Bonzini ; Daniel P.Berrangé >> ; Alex Williamson ; Cédric Le >> Goater ; Eric Blake >> Subject: Re: [RFC PATCH 1/8] hw/arm/smmuv3-accel: Add helper for resolving >> auto parameters >> >> External email: Use caution opening links or attachments >> >> >> Shameer Kolothum Thodi writes: >> >>>> -----Original Message----- >>>> From: Markus Armbruster >> >> [...] >> >>>> Nathan Chen writes: >>>> >>>>> From: Nathan Chen >>>>> >>>>> 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 values, while avoiding triggering >>>>> auto-resolved values for hot-plugged devices. >>>>> >>>>> Auto mode requires at least one cold-plugged device to retrieve and >>>>> finalise these properties, and we fail boot if that is not the >>>>> case. >>>>> >>>>> 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 >>>>> Signed-off-by: Nathan Chen >>>>> --- >>>>> 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"); >>>> >>>> Why is this warning useful? >>>> >>>> Does @auto's meaning depend on whether the device is cold- or >>>> hot-plugged? >>> >>> If SMMUv3 accel=on and properties are set to "auto", we require at >>> least one cold-plugged vfio-pci device to retrieve the associated host >>> SMMUv3 information and finalise the QEMU SMMUv3 properties. >>> >>> In this series, "auto_mode" is set if any accel property is specified >>> as "auto". The properties are then finalised using the first >>> cold-plugged device and "auto_finalised" is set. >>> >>> Since we later fail the guest boot(see below) in the reset phase if >>> auto_mode is set but auto_finalised is still false, the above hotplug >>> case should not really happen. In that case the VM would not boot. >> >> Sounds complicated. >> >>> So likely we can get rid of the hotplug check above. Need to do a bit >>> more testing to confirm we cover all corner cases. >>> >>>> >>>>> + return; >>>>> + } >>>>> + >>>>> + accel->auto_finalised = true; >>>>> +} >> >> [...] >> >>>>> @@ -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."); >>>>> + exit(1); >>>> >>>> How can we get here? >>> >>> This is reached from the SMMUv3 reset handler when auto mode is >>> specified but no cold-plugged device has been attached to finalise the >>> accelerated SMMUv3 properties. >>> >>> If no such device is present, "auto_finalised" remains false and we hit >>> this path during reset. >>> >>> Cédric mentioned that we should not exit during the reset phase. If that >>> is the case, we likely need another way to handle the scenario where >>> auto mode is specified but no cold-plugged device is present. >> >> What exactly does the "auto" feature buy us? Is it worth the >> complexity? > > The requirement came from the KubeVirt folks. It is easier for them if > QEMU can probe the platform and set these values, instead of specifying > them for each platform. > > See: > https://lore.kernel.org/qemu-devel/d9192ae6-a94f-479a-b19f-734cc52a6be0@redhat.com/ > > Without "auto", the management layer needs to know the values supported > on each platform. > > eg: on a GB200, it will look like, > > -device arm-smmuv3,primary-bus=pcie.1,id=smmuv3.0,accel=on,ats=on,ril=off,ssidsize=20,oas=48 > > With "auto" it can simply be: > > -device arm-smmuv3,primary-bus=pcie.1,id=smmuv3.0,accel=on > > (provided a vfio-pci device is cold-plugged). how about, -device arm-smmuv3,primary-bus=pcie.1,id=smmuv3.0,accel=on,iommufd=iommufd0 and smmuv3_accel_init() would check that the conditions are correct. Thanks, C.