Linux IOMMU Development
 help / color / mirror / Atom feed
From: Yi Liu <yi.l.liu@intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>, Jason Gunthorpe <jgg@nvidia.com>
Cc: "joro@8bytes.org" <joro@8bytes.org>,
	"baolu.lu@linux.intel.com" <baolu.lu@linux.intel.com>,
	"alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"eric.auger@redhat.com" <eric.auger@redhat.com>,
	"nicolinc@nvidia.com" <nicolinc@nvidia.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"chao.p.peng@linux.intel.com" <chao.p.peng@linux.intel.com>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>,
	"Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
	"vasant.hegde@amd.com" <vasant.hegde@amd.com>,
	"will@kernel.org" <will@kernel.org>
Subject: Re: [PATCH v3 1/7] iommu: Prevent pasid attach if no ops->remove_dev_pasid
Date: Thu, 7 Nov 2024 18:02:33 +0800	[thread overview]
Message-ID: <62f72c3b-3b58-4536-9fb1-0d7df4eb836e@intel.com> (raw)
In-Reply-To: <BN9PR11MB527668F5E61584E5EBEB21B58C5C2@BN9PR11MB5276.namprd11.prod.outlook.com>

On 2024/11/7 17:33, Tian, Kevin wrote:
>> From: Jason Gunthorpe <jgg@nvidia.com>
>> Sent: Tuesday, November 5, 2024 11:42 PM
>>
>> On Mon, Nov 04, 2024 at 05:20:27AM -0800, Yi Liu wrote:
>>> driver should implement both set_dev_pasid and remove_dev_pasid op,
>> otherwise
>>> it is a problem how to detach pasid. In reality, it is impossible that an
>>> iommu driver implements set_dev_pasid() but no remove_dev_pasid() op.
>> However,
>>> it is better to check it.
>>>
>>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>>> ---
>>>   drivers/iommu/iommu.c | 4 +++-
>>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> I was wondering if we really needed this, but it does make the patches
>> a bit easier to understand
>>
>> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
>>
> 
> me too. btw when Vasant's series introduces the PASID flag to
> domain above checks can be moved to the domain alloc time
> then here just needs to check whether the domain allows
> pasid attach.

hmmm. Are we sure all the caller of iommu_attach_device_pasid() will
allocate domain with this flag? Besides iommufd, idxd driver would
also call iommu_attach_device_pasid(), and it uses the DMA domain of
the device. I suppose this domain is allocated with the pasid flag.

Given that Vasant's series has been queued and this series is based
on that. It might make sense to drop this patch. If the pasid capable
domain can be allocated successfully, the iommu driver already indicates
it has the ability to support set_dev_pasid and the undo op.

> for now,
> 
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> 
> and a nit - there is another reference to dev_iommu_ops in this
> function:
> 
> 	if (!dev_has_iommu(dev) || dev_iommu_ops(dev) != domain->owner ||
> 
> could be replaced with ops too.

If we decide to keep this patch, I'll add it.

-- 
Regards,
Yi Liu

  reply	other threads:[~2024-11-07  9:58 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04 13:20 [PATCH v3 0/7] Support attaching PASID to the blocked_domain Yi Liu
2024-11-04 13:20 ` [PATCH v3 1/7] iommu: Prevent pasid attach if no ops->remove_dev_pasid Yi Liu
2024-11-05 15:42   ` Jason Gunthorpe
2024-11-07  9:33     ` Tian, Kevin
2024-11-07 10:02       ` Yi Liu [this message]
2024-11-04 13:20 ` [PATCH v3 2/7] iommu: Consolidate the ops->remove_dev_pasid usage into a helper Yi Liu
2024-11-05 15:42   ` Jason Gunthorpe
2024-11-06  9:33   ` Vasant Hegde
2024-11-07  9:34   ` Tian, Kevin
2024-11-04 13:20 ` [PATCH v3 3/7] iommu: Detaching pasid by attaching to the blocked_domain Yi Liu
2024-11-05 15:42   ` Jason Gunthorpe
2024-11-06  9:37   ` Vasant Hegde
2024-11-07  9:35   ` Tian, Kevin
2024-11-07 10:04     ` Yi Liu
2024-11-04 13:20 ` [PATCH v3 4/7] iommu/arm-smmu-v3: Make the blocked domain support PASID Yi Liu
2024-11-04 13:20 ` [PATCH v3 5/7] iommu/vt-d: " Yi Liu
2024-11-05  3:46   ` Baolu Lu
2024-11-05  5:11     ` Yi Liu
2024-11-05  5:45       ` Baolu Lu
2024-11-05 15:43   ` Jason Gunthorpe
2024-11-04 13:20 ` [PATCH v3 6/7] iommu/amd: " Yi Liu
2024-11-05 15:44   ` Jason Gunthorpe
2024-11-06  9:27   ` Vasant Hegde
2024-11-07  9:36   ` Tian, Kevin
2024-11-04 13:20 ` [PATCH v3 7/7] iommu: Remove the remove_dev_pasid op Yi Liu
2024-11-05 15:44   ` Jason Gunthorpe
2024-11-06  9:39   ` Vasant Hegde
2024-11-07  9:37   ` Tian, Kevin

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=62f72c3b-3b58-4536-9fb1-0d7df4eb836e@intel.com \
    --to=yi.l.liu@intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=eric.auger@redhat.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=nicolinc@nvidia.com \
    --cc=vasant.hegde@amd.com \
    --cc=will@kernel.org \
    --cc=zhenzhong.duan@intel.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