[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230428094017.715dda3f@jacob-builder>
Date: Fri, 28 Apr 2023 09:40:17 -0700
From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
To: "Tian, Kevin" <kevin.tian@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
Robin Murphy <robin.murphy@....com>,
Jason Gunthorpe <jgg@...dia.com>,
Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>,
"vkoul@...nel.org" <vkoul@...nel.org>,
Will Deacon <will@...nel.org>,
David Woodhouse <dwmw2@...radead.org>,
"Raj, Ashok" <ashok.raj@...el.com>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"Yu, Fenghua" <fenghua.yu@...el.com>,
"Jiang, Dave" <dave.jiang@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"Zanussi, Tom" <tom.zanussi@...el.com>,
"Ranganathan, Narayan" <narayan.ranganathan@...el.com>,
jacob.jun.pan@...ux.intel.com
Subject: Re: [PATCH v5 3/7] iommu: Move global PASID allocation from SVA to
core
Hi Kevin,
On Fri, 28 Apr 2023 09:46:25 +0000, "Tian, Kevin" <kevin.tian@...el.com>
wrote:
> > From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
> > Sent: Friday, April 28, 2023 1:50 AM
> >
> > Devices that use Intel ENQCMD to submit work must use global PASIDs in
> > that the PASID are stored in a per CPU MSR. When such device need to
> > submit work for in-kernel DMA with PASID, it must allocate PASIDs from
> > the same global number space to avoid conflict.
>
> well the device itself cannot submit work to itself. It's software to
> submit work to the device. 😊
will rephrase, how about:
Intel ENQCMD work submission requires the use of global PASIDs in ...
> > that the PASID are stored in a per CPU MSR
>
> > /* Allocate a PASID for the mm within range (inclusive) */
> > -static int iommu_sva_alloc_pasid(struct mm_struct *mm, ioasid_t min,
> > ioasid_t max)
> > +static int iommu_sva_alloc_pasid(struct mm_struct *mm, struct device
> > *dev) {
> > int ret = 0;
> >
> > - if (!pasid_valid(min) || !pasid_valid(max) ||
> > - min == 0 || max < min)
> > - return -EINVAL;
> > -
> > mutex_lock(&iommu_sva_lock);
> > /* Is a PASID already associated with this mm? */
> > - if (pasid_valid(mm->pasid)) {
> > - if (mm->pasid < min || mm->pasid > max)
> > - ret = -EOVERFLOW;
> > + if (pasid_valid(mm->pasid))
> > goto out;
>
> emmm here you still want to check whether mm->pasid exceeds
> the max pasid width of the bound device.
good point, existing mm->pasid could be from another device that has a
larger pasid range.
Thanks,
Jacob
Powered by blists - more mailing lists