[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ujexsgcpvcjux2ugfes6mzjxl53j3icarfbu25imhzliqskyv6@l7f42nv4fhmy>
Date: Mon, 28 Oct 2024 11:24:14 +0100
From: Joel Granados <joel.granados@...nel.org>
To: Yi Liu <yi.l.liu@...el.com>
Cc: David Woodhouse <dwmw2@...radead.org>,
Lu Baolu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>, Jason Gunthorpe <jgg@...pe.ca>,
Kevin Tian <kevin.tian@...el.com>, Klaus Jensen <its@...elevant.dk>, linux-kernel@...r.kernel.org,
iommu@...ts.linux.dev, Klaus Jensen <k.jensen@...sung.com>
Subject: Re: Re: [PATCH v4 2/5] iommu/vt-d: Remove the pasid present check in
prq_event_thread
On Mon, Oct 28, 2024 at 03:50:46PM +0800, Yi Liu wrote:
> On 2024/10/16 05:08, Joel Granados wrote:
> > From: Klaus Jensen <k.jensen@...sung.com>
> >
> > PASID is not strictly needed when handling a PRQ event; remove the check
> > for the pasid present bit in the request. This change was not included
> > in the creation of prq.c to emphasize the change in capability checks
> > when handing PRQ events.
> >
> > Signed-off-by: Klaus Jensen <k.jensen@...sung.com>
> > Reviewed-by: Kevin Tian <kevin.tian@...el.com>
> > Signed-off-by: Joel Granados <joel.granados@...nel.org>
>
> looks like the PRQ draining is missed for the PRI usage. When a pasid
> entry is destroyed, it might need to add helper similar to the
> intel_drain_pasid_prq() to drain PRQ for the non-pasid usage.
These types of user space PRIs (non-pasid, non-svm) are created by
making use of iommufd_hwpt_replace_device. Which adds an entry to the
pasid_array indexed on IOMMU_NO_PASID (0U) via the following path:
iommufd_hwpt_replace_device
-> iommufd_fault_domain_repalce_dev
-> __fault_domain_replace_dev
-> iommu_replace_group_handle
-> xa_reserve(&group->pasid_array, IOMMU_NO_PASID, GFP_KERNEL);
It is my understanding that this will provide the needed relation
between the device and the prq in such a way that when remove_dev_pasid
is called, intel_iommu_drain_pasid_prq will be called with the
appropriate pasid value set to IOMMU_NO_PASID. Please correct me if I'm
mistaken.
Does this answer your question? Do you have a specific path that you are
looking at where a specific non-pasid drain is needed?
Best
>
> > ---
> > drivers/iommu/intel/prq.c | 12 +++---------
> > 1 file changed, 3 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/iommu/intel/prq.c b/drivers/iommu/intel/prq.c
> > index d4f18eb46475..3c50c848893f 100644
> > --- a/drivers/iommu/intel/prq.c
> > +++ b/drivers/iommu/intel/prq.c
> > @@ -223,18 +223,12 @@ static irqreturn_t prq_event_thread(int irq, void *d)
> > req = &iommu->prq[head / sizeof(*req)];
> > address = (u64)req->addr << VTD_PAGE_SHIFT;
> >
> > - if (unlikely(!req->pasid_present)) {
> > - pr_err("IOMMU: %s: Page request without PASID\n",
> > - iommu->name);
> > -bad_req:
> > - handle_bad_prq_event(iommu, req, QI_RESP_INVALID);
> > - goto prq_advance;
> > - }
> > -
> > if (unlikely(!is_canonical_address(address))) {
> > pr_err("IOMMU: %s: Address is not canonical\n",
> > iommu->name);
> > - goto bad_req;
> > +bad_req:
> > + handle_bad_prq_event(iommu, req, QI_RESP_INVALID);
> > + goto prq_advance;
> > }
> >
> > if (unlikely(req->pm_req && (req->rd_req | req->wr_req))) {
> >
>
> --
> Regards,
> Yi Liu
--
Joel Granados
Powered by blists - more mailing lists