2019-11-18 19:40:10

by Jacob Pan

[permalink] [raw]
Subject: [PATCH v2 09/10] iommu/vt-d: Avoid sending invalid page response

Page responses should only be sent when last page in group (LPIG) or
private data is present in the page request. This patch avoids sending
invalid descriptors.

Fixes: 5d308fc1ecf53 ("iommu/vt-d: Add 256-bit invalidation descriptor
support")
Signed-off-by: Jacob Pan <[email protected]>
Acked-by: Lu Baolu <[email protected]>
---
drivers/iommu/intel-svm.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
index 26a2f57763ec..098c89246593 100644
--- a/drivers/iommu/intel-svm.c
+++ b/drivers/iommu/intel-svm.c
@@ -688,11 +688,10 @@ static irqreturn_t prq_event_thread(int irq, void *d)
if (req->priv_data_present)
memcpy(&resp.qw2, req->priv_data,
sizeof(req->priv_data));
+ resp.qw2 = 0;
+ resp.qw3 = 0;
+ qi_submit_sync(&resp, iommu);
}
- resp.qw2 = 0;
- resp.qw3 = 0;
- qi_submit_sync(&resp, iommu);
-
head = (head + sizeof(*req)) & PRQ_RING_MASK;
}

--
2.7.4


2019-11-18 21:29:15

by Eric Auger

[permalink] [raw]
Subject: Re: [PATCH v2 09/10] iommu/vt-d: Avoid sending invalid page response

Hi Jacob,

On 11/18/19 8:42 PM, Jacob Pan wrote:
> Page responses should only be sent when last page in group (LPIG) or
> private data is present in the page request. This patch avoids sending
> invalid descriptors.
>
> Fixes: 5d308fc1ecf53 ("iommu/vt-d: Add 256-bit invalidation descriptor
> support")
> Signed-off-by: Jacob Pan <[email protected]>
> Acked-by: Lu Baolu <[email protected]>
> ---
> drivers/iommu/intel-svm.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> index 26a2f57763ec..098c89246593 100644
> --- a/drivers/iommu/intel-svm.c
> +++ b/drivers/iommu/intel-svm.c
> @@ -688,11 +688,10 @@ static irqreturn_t prq_event_thread(int irq, void *d)
> if (req->priv_data_present)
> memcpy(&resp.qw2, req->priv_data,
> sizeof(req->priv_data));
> + resp.qw2 = 0;
> + resp.qw3 = 0;
> + qi_submit_sync(&resp, iommu);
OK so now all the qwords are initialized ;-)
> }
> - resp.qw2 = 0;
> - resp.qw3 = 0;
> - qi_submit_sync(&resp, iommu);
> -
> head = (head + sizeof(*req)) & PRQ_RING_MASK;
> }
>
>
Reviewed-by: Eric Auger <[email protected]>

Thanks

Eric