Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: robin.murphy@arm.com, jgg@nvidia.com, joro@8bytes.org,
	kevin.tian@intel.com, praan@google.com, nathan@kernel.org,
	yi.l.liu@intel.com, peterz@infradead.org, mshavit@google.com,
	jsnitsel@redhat.com, smostafa@google.com,
	jeff.johnson@oss.qualcomm.com, zhangzekun11@huawei.com,
	linux-arm-kernel@lists.infradead.org, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	shameerali.kolothum.thodi@huawei.com
Subject: Re: [PATCH v2 02/11] iommu/arm-smmu-v3: Pass in smmu/iommu_domain to __arm_smmu_tlb_inv_range()
Date: Thu, 15 May 2025 16:06:32 +0100	[thread overview]
Message-ID: <20250515150629.GD12165@willie-the-truck> (raw)
In-Reply-To: <ed8b2837e5ea63f6ee98663761d4f1ebe66a6d41.1744692494.git.nicolinc@nvidia.com>

On Mon, Apr 14, 2025 at 09:57:37PM -0700, Nicolin Chen wrote:
> What __arm_smmu_tlb_inv_range() really needs is the smmu and iommu_domain
> pointers from the smmu_domain.
> 
> For a nest_parent smmu_domain, it will no longer store an smmu pointer as
> it can be shared across vSMMU instances. A vSMMU structure sharing the S2
> smmu_domain instead would hold the smmu pointer.
> 
> Pass them in explicitly to fit both !nest_parent and nest_parent cases.
> 
> While changing it, share it in the header with arm-smmu-v3-iommmufd that
> will call it too.
> 
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h |  4 ++++
>  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 17 +++++++++--------
>  2 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> index d4837a33fb81..5dbdc61558a9 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h
> @@ -955,6 +955,10 @@ void arm_smmu_tlb_inv_range_asid(unsigned long iova, size_t size, int asid,
>  				 struct arm_smmu_domain *smmu_domain);
>  int arm_smmu_atc_inv_domain(struct arm_smmu_domain *smmu_domain,
>  			    unsigned long iova, size_t size);
> +void __arm_smmu_tlb_inv_range(struct arm_smmu_device *smmu,
> +			      struct arm_smmu_cmdq_ent *cmd, unsigned long iova,
> +			      size_t size, size_t granule,
> +			      struct iommu_domain *domain);

I don't think this function makes a particularly good "public" API --
the caller even sets the cmd opcode!

Can we expose some TLB invalidation helpers instead rather than the
low-level helpers?

Will


  reply	other threads:[~2025-05-15 15:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15  4:57 [PATCH v2 00/11] iommu/arm-smmu-v3: Allocate vmid per vsmmu instead of s2_parent Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 01/11] iommu/arm-smmu-v3: Pass in vmid to arm_smmu_make_s2_domain_ste() Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 02/11] iommu/arm-smmu-v3: Pass in smmu/iommu_domain to __arm_smmu_tlb_inv_range() Nicolin Chen
2025-05-15 15:06   ` Will Deacon [this message]
2025-04-15  4:57 ` [PATCH v2 03/11] iommu/arm-smmu-v3: Share cmdq/cmd helpers with arm-smmu-v3-iommufd Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 04/11] iommu/arm-smmu-v3: Add an inline arm_smmu_tlb_inv_vmid helper Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 05/11] iommu/arm-smmu-v3: Rename arm_smmu_attach_prepare_vmaster Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 06/11] iommu/arm-smmu-v3: Introduce arm_smmu_s2_parent_tlb_ invalidation helpers Nicolin Chen
2025-04-15 12:50   ` Jason Gunthorpe
2025-04-15 20:10     ` Nicolin Chen
2025-04-15 23:46       ` Jason Gunthorpe
2025-04-15  4:57 ` [PATCH v2 07/11] iommu/arm-smmu-v3: Introduce arm_vsmmu_atc_inv_domain() Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 08/11] iommu/arm-smmu-v3: Use vSMMU helpers for S2 and ATC invalidations Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 09/11] iommu/arm-smmu-v3: Clean up nested_ats_flush from master_domain Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 10/11] iommu/arm-smmu-v3: Decouple vmid from S2 nest_parent domain Nicolin Chen
2025-04-15  4:57 ` [PATCH v2 11/11] iommu/arm-smmu-v3: Allow to share S2 nest_parent domain across vSMMUs Nicolin Chen

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=20250515150629.GD12165@willie-the-truck \
    --to=will@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=jeff.johnson@oss.qualcomm.com \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=jsnitsel@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mshavit@google.com \
    --cc=nathan@kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=peterz@infradead.org \
    --cc=praan@google.com \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=smostafa@google.com \
    --cc=yi.l.liu@intel.com \
    --cc=zhangzekun11@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox