From: Jason Gunthorpe <jgg@nvidia.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Will Deacon <will@kernel.org>,
acpica-devel@lists.linux.dev, iommu@lists.linux.dev,
Joerg Roedel <joro@8bytes.org>, Kevin Tian <kevin.tian@intel.com>,
kvm@vger.kernel.org, Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Robert Moore <robert.moore@intel.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Alex Williamson <alex.williamson@redhat.com>,
Donald Dutile <ddutile@redhat.com>,
Eric Auger <eric.auger@redhat.com>,
Hanjun Guo <guohanjun@huawei.com>,
Jean-Philippe Brucker <jean-philippe@linaro.org>,
Jerry Snitselaar <jsnitsel@redhat.com>,
Moritz Fischer <mdf@kernel.org>,
Michael Shavit <mshavit@google.com>,
Nicolin Chen <nicolinc@nvidia.com>,
patches@lists.linux.dev,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>,
Mostafa Saleh <smostafa@google.com>
Subject: Re: [PATCH v4 05/12] iommu/arm-smmu-v3: Support IOMMU_GET_HW_INFO via struct arm_smmu_hw_info
Date: Wed, 6 Nov 2024 14:05:31 -0400 [thread overview]
Message-ID: <20241106180531.GA520535@nvidia.com> (raw)
In-Reply-To: <8a5940b0-08f3-48b1-9498-f09f0527a964@arm.com>
On Wed, Nov 06, 2024 at 04:37:53PM +0000, Robin Murphy wrote:
> On 2024-11-04 12:41 pm, Jason Gunthorpe wrote:
> > On Mon, Nov 04, 2024 at 11:47:24AM +0000, Will Deacon wrote:
> > > > +/**
> > > > + * struct iommu_hw_info_arm_smmuv3 - ARM SMMUv3 hardware information
> > > > + * (IOMMU_HW_INFO_TYPE_ARM_SMMUV3)
> > > > + *
> > > > + * @flags: Must be set to 0
> > > > + * @__reserved: Must be 0
> > > > + * @idr: Implemented features for ARM SMMU Non-secure programming interface
> > > > + * @iidr: Information about the implementation and implementer of ARM SMMU,
> > > > + * and architecture version supported
> > > > + * @aidr: ARM SMMU architecture version
> > > > + *
> > > > + * For the details of @idr, @iidr and @aidr, please refer to the chapters
> > > > + * from 6.3.1 to 6.3.6 in the SMMUv3 Spec.
> > > > + *
> > > > + * User space should read the underlying ARM SMMUv3 hardware information for
> > > > + * the list of supported features.
> > > > + *
> > > > + * Note that these values reflect the raw HW capability, without any insight if
> > > > + * any required kernel driver support is present. Bits may be set indicating the
> > > > + * HW has functionality that is lacking kernel software support, such as BTM. If
> > > > + * a VMM is using this information to construct emulated copies of these
> > > > + * registers it should only forward bits that it knows it can support.
>
> But how *is* a VMM supposed to know what it can support?
I answered a related question to Mostafa with an example:
https://lore.kernel.org/linux-iommu/20240903235532.GJ3773488@nvidia.com/
"global" capabilities that are enabled directly from the CD entry
would follow the pattern.
> Are they all expected to grovel the host devicetree/ACPI tables and
> maintain their own knowledge of implementation errata to understand
> what's actually usable?
No, VMMs are expected to only implement base line features we have
working today and not blindly add new features based only HW registers
reported here.
Each future capability we want to enable at the VMM needs an analysis:
1) Does it require kernel SW changes, ie like BTM? Then it needs a
kernel_capabilities bit to say the kernel SW exists
2) Does it require data from ACPI/DT/etc? Then it needs a
kernel_capabilities bit
3) Does it need to be "turned on" per VM, ie with a VMS enablement?
Then it needs a new request flag in ALLOC_VIOMMU
4) Otherwise it can be read directly from the idr[] array
This is why the comment above is so stern that the VMM "should only
forward bits that it knows it can support".
> S2 tables it its own business. AFAICS, unless the VMM wants to do some
> fiddly CD shadowing, it's going to be kinda hard to prevent the SMMU seeing
> a guest CD with CD.HA and/or CD.HD set if the guest expects S1 HTTU to work.
If the VMM wrongly indicates HTTU support to the VM, because it
wrongly inspected those bits in the idr report, then it is just
broken.
> I would say it does. Advertising a feature when we already know it's not
> usable at all puts a non-trivial and unnecessary burden on the VMM and VM to
> then have to somehow derive that information from other sources, at the risk
> of being confused by unexpected behaviour if they don't.
That is not the purpose here, the register report is not to be used as
"advertising features". It describes details of the raw HW that the
VMM may need to use *some* of the fields.
There are quite a few fields that fit #4 today: OAS, VAX, GRAN, BBML,
CD2L, etc.
Basically we will pass most of the bits and mask a few. If we get the
masking wrong and pass something we shouldn't, then we've improved
nothing compared to this proposal. I think we are likely to get the
masking wrong :)
> We sanitise CPU ID registers for userspace and KVM, so I see no compelling
> reason for SMMU ID registers to be different.
We discussed this already:
https://lore.kernel.org/linux-iommu/20240904120103.GB3915968@nvidia.com
It is a false comparison, for KVM the kernel is responsible to control
the CPU ID registers. Reporting the registers the VM sees to the VMM
makes alot of sense. For SMMU the VMM exclusively controls the VM's ID
registers.
If you still feel strongly about this please let me know by Friday and
I will drop the idr[] array from this cycle. We can continue to
discuss a solution for the next cycle.
Regards,
Jason
next prev parent reply other threads:[~2024-11-06 18:09 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 0:20 [PATCH v4 00/12] Initial support for SMMUv3 nested translation Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 01/12] vfio: Remove VFIO_TYPE1_NESTING_IOMMU Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 02/12] ACPICA: IORT: Update for revision E.f Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 03/12] ACPI/IORT: Support CANWBS memory access flag Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 04/12] iommu/arm-smmu-v3: Report IOMMU_CAP_ENFORCE_CACHE_COHERENCY for CANWBS Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 05/12] iommu/arm-smmu-v3: Support IOMMU_GET_HW_INFO via struct arm_smmu_hw_info Jason Gunthorpe
2024-11-04 11:47 ` Will Deacon
2024-11-04 12:41 ` Jason Gunthorpe
2024-11-06 16:37 ` Robin Murphy
2024-11-06 18:05 ` Jason Gunthorpe [this message]
2024-11-06 21:05 ` Robin Murphy
2024-11-06 21:53 ` Nicolin Chen
2024-11-07 2:35 ` Jason Gunthorpe
2024-11-07 15:51 ` Jason Gunthorpe
2024-11-08 14:53 ` Will Deacon
2024-11-08 15:42 ` Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 06/12] iommu/arm-smmu-v3: Implement IOMMU_HWPT_ALLOC_NEST_PARENT Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 07/12] iommu/arm-smmu-v3: Expose the arm_smmu_attach interface Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 08/12] iommu/arm-smmu-v3: Support IOMMU_VIOMMU_ALLOC Jason Gunthorpe
2024-11-29 14:38 ` Shameerali Kolothum Thodi
2024-11-29 15:06 ` Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 09/12] iommu/arm-smmu-v3: Support IOMMU_DOMAIN_NESTED Jason Gunthorpe
2024-10-31 6:21 ` Zhangfei Gao
2024-11-04 17:19 ` Jason Gunthorpe
2024-11-06 5:39 ` Zhangfei Gao
2024-10-31 0:20 ` [PATCH v4 10/12] iommu/arm-smmu-v3: Use S2FWB for NESTED domains Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 11/12] iommu/arm-smmu-v3: Allow ATS for IOMMU_DOMAIN_NESTED Jason Gunthorpe
2024-10-31 0:20 ` [PATCH v4 12/12] iommu/arm-smmu-v3: Support IOMMU_HWPT_INVALIDATE using a VIOMMU object Jason Gunthorpe
2024-10-31 0:53 ` [PATCH v4 00/12] Initial support for SMMUv3 nested translation Nicolin Chen
2024-11-01 12:18 ` Will Deacon
2024-11-01 13:25 ` Jason Gunthorpe
2024-11-05 16:48 ` Will Deacon
2024-11-05 17:03 ` Jason Gunthorpe
2024-11-08 14:56 ` Will Deacon
2024-11-12 18:29 ` Jason Gunthorpe
2024-11-13 1:01 ` Zhangfei Gao
2024-11-13 1:23 ` Jason Gunthorpe
2024-11-13 2:55 ` Baolu Lu
2024-11-13 6:28 ` Zhangfei Gao
2024-11-13 16:43 ` Jason Gunthorpe
2024-11-14 0:51 ` Baolu Lu
2024-11-15 17:55 ` Jason Gunthorpe
2025-01-22 19:26 ` Jason Gunthorpe
2025-02-05 3:45 ` Baolu Lu
2025-02-13 11:57 ` Baolu Lu
2025-02-13 18:43 ` Jason Gunthorpe
2025-02-14 5:39 ` Baolu Lu
2025-02-14 12:41 ` Jason Gunthorpe
2025-02-15 9:53 ` Baolu Lu
2025-02-18 13:03 ` Jason Gunthorpe
2025-02-19 2:09 ` Baolu Lu
2025-02-19 8:34 ` Tian, Kevin
2025-02-20 2:10 ` Baolu Lu
2025-02-20 6:51 ` Tian, Kevin
2025-02-20 11:49 ` Baolu Lu
2025-02-21 4:28 ` Tian, Kevin
2025-02-21 13:04 ` Jason Gunthorpe
2025-02-22 7:13 ` Baolu Lu
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=20241106180531.GA520535@nvidia.com \
--to=jgg@nvidia.com \
--cc=acpica-devel@lists.linux.dev \
--cc=alex.williamson@redhat.com \
--cc=ddutile@redhat.com \
--cc=eric.auger@redhat.com \
--cc=guohanjun@huawei.com \
--cc=iommu@lists.linux.dev \
--cc=jean-philippe@linaro.org \
--cc=joro@8bytes.org \
--cc=jsnitsel@redhat.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=mdf@kernel.org \
--cc=mshavit@google.com \
--cc=nicolinc@nvidia.com \
--cc=patches@lists.linux.dev \
--cc=rafael.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=robert.moore@intel.com \
--cc=robin.murphy@arm.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=smostafa@google.com \
--cc=sudeep.holla@arm.com \
--cc=will@kernel.org \
/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).