[PATCH RFC PREVIEW 6/6] iommu/vt-d: do not require a PASID in page requests

Klaus Jensen posted 6 patches 1 year, 3 months ago
[PATCH RFC PREVIEW 6/6] iommu/vt-d: do not require a PASID in page requests
Posted by Klaus Jensen 1 year, 3 months ago
From: Klaus Jensen <k.jensen@samsung.com>

PRQ events can now be handled without a PASID being present. Remove the
restriction.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 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 2814373e95d8..cc36198ebf91 100644
--- a/drivers/iommu/intel/prq.c
+++ b/drivers/iommu/intel/prq.c
@@ -101,18 +101,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))) {

-- 
2.45.2
Re: [PATCH RFC PREVIEW 6/6] iommu/vt-d: do not require a PASID in page requests
Posted by Joel Granados 1 year, 3 months ago
On Mon, Aug 26, 2024 at 01:40:32PM +0200, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
> 
> PRQ events can now be handled without a PASID being present. Remove the
> restriction.
> 
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
>  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 2814373e95d8..cc36198ebf91 100644
> --- a/drivers/iommu/intel/prq.c
> +++ b/drivers/iommu/intel/prq.c
> @@ -101,18 +101,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))) {
> 
> -- 
> 2.45.2
> 

I'll squash this commit with the one that introduces the prq.c file.

Best

-- 

Joel Granados
Re: [PATCH RFC PREVIEW 6/6] iommu/vt-d: do not require a PASID in page requests
Posted by Joel Granados 1 year, 3 months ago
On Wed, Sep 04, 2024 at 12:19:16PM +0200, Joel Granados wrote:
> On Mon, Aug 26, 2024 at 01:40:32PM +0200, Klaus Jensen wrote:
> > From: Klaus Jensen <k.jensen@samsung.com>
> > 
> > PRQ events can now be handled without a PASID being present. Remove the
> > restriction.
> > 
> > Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> > ---
> >  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 2814373e95d8..cc36198ebf91 100644
> > --- a/drivers/iommu/intel/prq.c
> > +++ b/drivers/iommu/intel/prq.c
> > @@ -101,18 +101,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))) {
> > 
> > -- 
> > 2.45.2
> > 
> 
> I'll squash this commit with the one that introduces the prq.c file.
On second thought. I'll leave it as a separate commit. The first one
will be the "copy all the code to a new file" commit and the second one
will be "remove the pasid check" I'll change the commit message a bit so
it is clear why they are not together.

Best

-- 

Joel Granados