From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
"acpica-devel@lists.linux.dev" <acpica-devel@lists.linux.dev>,
"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
Joerg Roedel <joro@8bytes.org>, Kevin Tian <kevin.tian@intel.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Len Brown" <lenb@kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Lorenzo Pieralisi <lpieralisi@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Robert Moore" <robert.moore@intel.com>,
Robin Murphy <robin.murphy@arm.com>,
"Sudeep Holla" <sudeep.holla@arm.com>,
Will Deacon <will@kernel.org>
Cc: Alex Williamson <alex.williamson@redhat.com>,
Donald Dutile <ddutile@redhat.com>,
Eric Auger <eric.auger@redhat.com>,
"Guohanjun (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" <patches@lists.linux.dev>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Mostafa Saleh <smostafa@google.com>
Subject: RE: [PATCH v4 08/12] iommu/arm-smmu-v3: Support IOMMU_VIOMMU_ALLOC
Date: Fri, 29 Nov 2024 14:38:10 +0000 [thread overview]
Message-ID: <8128e648ad014485a7db9771a94194de@huawei.com> (raw)
In-Reply-To: <8-v4-9e99b76f3518+3a8-smmuv3_nesting_jgg@nvidia.com>
Hi Jason,
> -----Original Message-----
> From: Jason Gunthorpe <jgg@nvidia.com>
> Sent: Thursday, October 31, 2024 12:21 AM
> To: 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>; Robin Murphy
> <robin.murphy@arm.com>; Sudeep Holla <sudeep.holla@arm.com>; Will
> Deacon <will@kernel.org>
> Cc: Alex Williamson <alex.williamson@redhat.com>; Donald Dutile
> <ddutile@redhat.com>; Eric Auger <eric.auger@redhat.com>; Guohanjun
> (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: [PATCH v4 08/12] iommu/arm-smmu-v3: Support
> IOMMU_VIOMMU_ALLOC
[...]
> +struct iommufd_viommu *arm_vsmmu_alloc(struct device *dev,
> + struct iommu_domain *parent,
> + struct iommufd_ctx *ictx,
> + unsigned int viommu_type)
> +{
> + struct arm_smmu_device *smmu =
> + iommu_get_iommu_dev(dev, struct arm_smmu_device,
> iommu);
> + struct arm_smmu_master *master = dev_iommu_priv_get(dev);
> + struct arm_smmu_domain *s2_parent = to_smmu_domain(parent);
> + struct arm_vsmmu *vsmmu;
> +
> + if (viommu_type != IOMMU_VIOMMU_TYPE_ARM_SMMUV3)
> + return ERR_PTR(-EOPNOTSUPP);
> +
> + if (!(smmu->features & ARM_SMMU_FEAT_NESTING))
> + return ERR_PTR(-EOPNOTSUPP);
> +
> + if (s2_parent->smmu != master->smmu)
> + return ERR_PTR(-EINVAL);
> +
> + /*
> + * Must support some way to prevent the VM from bypassing the
> cache
> + * because VFIO currently does not do any cache maintenance.
> canwbs
> + * indicates the device is fully coherent and no cache maintenance
> is
> + * ever required, even for PCI No-Snoop."
> + */
> + if (!arm_smmu_master_canwbs(master))
> + return ERR_PTR(-EOPNOTSUPP);
> +
> + vsmmu = iommufd_viommu_alloc(ictx, struct arm_vsmmu, core,
> + &arm_vsmmu_ops);
> + if (IS_ERR(vsmmu))
> + return ERR_CAST(vsmmu);
> +
> + vsmmu->smmu = smmu;
> + vsmmu->s2_parent = s2_parent;
> + /* FIXME Move VMID allocation from the S2 domain allocation to
> here */
I am planning to respin the " iommu/arm-smmu-v3: Use pinned KVM VMID for
stage 2" [0] based on the latest IOMMUF code. One of the comment on that
RFC was, we should associate the KVM pointer to the sub objects like viommu
instead of iommufd itself[1]. But at present the s2 domain is already finalized
with a VMID before a viommu object is allocated.
So does the above comment indicates that we plan to do another
S2 VMID allocation here and replace the old one?
Please let me know your thoughts on this.
Thanks,
Shameer
[0] https://lore.kernel.org/linux-iommu/20240208151837.35068-1-shameerali.kolothum.thodi@huawei.com/
[1] https://lore.kernel.org/linux-iommu/BN9PR11MB527662A2AB0A9BABD5E20E6D8CD52@BN9PR11MB5276.namprd11.prod.outlook.com/
next prev parent reply other threads:[~2024-11-29 14:38 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
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 [this message]
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=8128e648ad014485a7db9771a94194de@huawei.com \
--to=shameerali.kolothum.thodi@huawei.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=jgg@nvidia.com \
--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=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