Skip to contentSkip to conversation

iommu/vt-d: Don't set then clear private data in prq_event_thread()

PATCH Applied Lu Baolu 2 participants 2 messages Mar 20, 2021 – Apr 7, 2021

Subsystems (2)
lore
Share & tools
lore

Lu Baolu

author maintainer
#0 lore raw

PATCH v2 1/1 iommu/vt-d: Don't set then clear private data in prq_event_thread()

The VT-d specification (section 7.6) requires that the value in the Private Data field of a Page Group Response Descriptor must match the value in the Private Data field of the respective Page Request Descriptor.

The private data field of a page group response descriptor is set then immediately cleared in prq_event_thread(). This breaks the rule defined by the VT-d specification. Fix it by moving clearing code up.

Fixes 5b438f4ba315d ("iommu/vt-d: Support page request in scalable mode")
Cc Jacob Pan <[email protected]>
---
 drivers/iommu/intel/svm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Log:
v1->v2:
- v1: https://lore.kernel.org/linux-iommu/[email protected]/
- Refine the commit title to make the affected field clear.
- Refine the commit message to declare why the change matters.

drivers/iommu/intel/svm.c +2 -2
index 677d7f6b43bb..5d590d63ab52 100644
@@ -1034,12 +1034,12 @@ static irqreturn_t prq_event_thread(int irq, void *d)
 				QI_PGRP_RESP_TYPE;
 			resp.qw1 = QI_PGRP_IDX(req->prg_index) |
 				QI_PGRP_LPIG(req->lpig);
+			resp.qw2 = 0;
+			resp.qw3 = 0;
 
 			if (req->priv_data_present)
 				memcpy(&resp.qw2, req->priv_data,
 				       sizeof(req->priv_data));
-			resp.qw2 = 0;
-			resp.qw3 = 0;
 			qi_submit_sync(iommu, &resp, 1, 0);
 		}
 prq_advance:
Signature · 6 lines
2.25.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer Applied
#1 lore raw
Quoted 2 lines · Lu Baolu
 drivers/iommu/intel/svm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.