[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527627410352E6DE921755898C959@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Mon, 25 Jul 2022 07:46:43 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>,
Jason Gunthorpe <jgg@...dia.com>
CC: Joerg Roedel <joro@...tes.org>,
Christoph Hellwig <hch@...radead.org>,
"Raj, Ashok" <ashok.raj@...el.com>, Will Deacon <will@...nel.org>,
"Robin Murphy" <robin.murphy@....com>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
"Jiang, Dave" <dave.jiang@...el.com>,
Vinod Koul <vkoul@...nel.org>,
Eric Auger <eric.auger@...hat.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"Pan, Jacob jun" <jacob.jun.pan@...el.com>,
"Zhangfei Gao" <zhangfei.gao@...aro.org>,
"Zhu, Tony" <tony.zhu@...el.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Jean-Philippe Brucker" <jean-philippe@...aro.org>
Subject: RE: [PATCH v10 04/12] iommu: Add attach/detach_dev_pasid iommu
interface
> From: Baolu Lu <baolu.lu@...ux.intel.com>
> Sent: Sunday, July 24, 2022 5:14 PM
>
> On 2022/7/23 22:11, Jason Gunthorpe wrote:
> >> +void iommu_detach_device_pasid(struct iommu_domain *domain,
> struct device *dev,
> >> + ioasid_t pasid)
> >> +{
> >> + struct iommu_group *group = iommu_group_get(dev);
> >> +
> >> + mutex_lock(&group->mutex);
> >> + domain->ops->block_dev_pasid(domain, dev, pasid);
> > I still really this OP, it is nonsense to invoke 'block_dev_pasid' on
> > a domain, it should be on the iommu ops and it should not take in a
> > domain parameter. This is why I prefer we write it as
> >
> > domain->ops->set_dev_pasid(group->blocking_domain, dev, pasid);
> >
>
> I originally plan to refactor this after both Intel and ARM SMMUv3
> drivers have real blocking domain supports. After revisiting this, it
> seems that the only difficulty is how to check whether a domain is a
> blocking domain. I am going to use below checking code:
>
> + /*
> + * Detach the domain if a blocking domain is set. Check the
> + * right domain type once the IOMMU driver supports a real
> + * blocking domain.
> + */
> + if (!domain || domain->type == IOMMU_DOMAIN_UNMANAGED) {
>
> Does this work for you?
>
Or you can call __iommu_group_alloc_blocking_domain() in the sva
path and then just check whether the domain is equal to
group->blocking_domain here.
Powered by blists - more mailing lists