From: Baolu Lu <baolu.lu@linux.intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
David Woodhouse <dwmw2@infradead.org>,
iommu@lists.linux.dev, Joerg Roedel <joro@8bytes.org>,
Kevin Tian <kevin.tian@intel.com>,
linux-arm-kernel@lists.infradead.org,
Robin Murphy <robin.murphy@arm.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Will Deacon <will@kernel.org>
Cc: patches@lists.linux.dev
Subject: Re: [PATCH 1/2] iommu: Add ops->domain_alloc_nested()
Date: Fri, 15 Nov 2024 11:19:03 +0800 [thread overview]
Message-ID: <9c065d9d-ec97-4d3c-a2af-0dd4fe40ad5a@linux.intel.com> (raw)
In-Reply-To: <1-v1-c252ebdeb57b+329-iommu_paging_flags_jgg@nvidia.com>
On 11/15/24 03:55, Jason Gunthorpe wrote:
> It turns out all the drivers that are using this immediately call into
> another function, so just make that function directly into the op. This
> makes paging=NULL for domain_alloc_user and we can remove the argument in
> the next patch.
>
> The function mirrors the similar op in the viommu that allocates a nested
> domain on top of the viommu's nesting parent. This version supports cases
> where a viommu is not being used.
>
> Signed-off-by: Jason Gunthorpe<jgg@nvidia.com>
> ---
> drivers/iommu/intel/iommu.c | 9 +++------
> drivers/iommu/intel/iommu.h | 6 ++++--
> drivers/iommu/intel/nested.c | 11 +++++++++--
> drivers/iommu/iommufd/hw_pagetable.c | 8 ++++----
> drivers/iommu/iommufd/selftest.c | 7 ++++---
> include/linux/iommu.h | 9 +++++----
> 6 files changed, 29 insertions(+), 21 deletions(-)
>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
with below minor suggestion.
[...]
> diff --git a/drivers/iommu/intel/nested.c b/drivers/iommu/intel/nested.c
> index 42c4533a6ea21d..aba92c00b42740 100644
> --- a/drivers/iommu/intel/nested.c
> +++ b/drivers/iommu/intel/nested.c
> @@ -186,14 +186,21 @@ static const struct iommu_domain_ops intel_nested_domain_ops = {
> .cache_invalidate_user = intel_nested_cache_invalidate_user,
> };
>
> -struct iommu_domain *intel_nested_domain_alloc(struct iommu_domain *parent,
> - const struct iommu_user_data *user_data)
> +struct iommu_domain *
> +intel_iommu_domain_alloc_nested(struct device *dev, struct iommu_domain *parent,
> + u32 flags,
> + const struct iommu_user_data *user_data)
> {
> + struct device_domain_info *info = dev_iommu_priv_get(dev);
> struct dmar_domain *s2_domain = to_dmar_domain(parent);
> + struct intel_iommu *iommu = info->iommu;
> struct iommu_hwpt_vtd_s1 vtd;
> struct dmar_domain *domain;
> int ret;
>
> + if (!nested_supported(iommu) || flags)
> + return ERR_PTR(-EOPNOTSUPP);
How about making it like
if (!nested_supported(iommu) || (flags &
~IOMMU_HWPT_FAULT_ID_VALID))
return ERR_PTR(-EOPNOTSUPP);
if ((flags & IOMMU_HWPT_FAULT_ID_VALID) && !info->pri_supported)
return ERR_PTR(-EOPNOTSUPP);
?
--
baolu
next prev parent reply other threads:[~2024-11-15 3:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 19:55 [PATCH 0/2] Rename ops->domain_alloc_user() to domain_alloc_paging_flags() Jason Gunthorpe
2024-11-14 19:55 ` [PATCH 1/2] iommu: Add ops->domain_alloc_nested() Jason Gunthorpe
2024-11-15 3:19 ` Baolu Lu [this message]
2024-11-15 14:48 ` Jason Gunthorpe
2024-11-14 19:55 ` [PATCH 2/2] iommu: Rename ops->domain_alloc_user() to domain_alloc_paging_flags() Jason Gunthorpe
2024-11-15 3:22 ` Baolu Lu
2024-11-15 14:01 ` Jason Gunthorpe
2024-11-22 19:00 ` [PATCH 0/2] " Jason Gunthorpe
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=9c065d9d-ec97-4d3c-a2af-0dd4fe40ad5a@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=patches@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=suravee.suthikulpanit@amd.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