Skip to contentSkip to conversation

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

PATCH Superseded Lu Baolu 2 participants 3 messages Mar 9, 2021 – Mar 19, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Lu Baolu

author maintainer
#0 lore raw

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

The private data field of a page group response descriptor is set then immediately cleared in prq_event_thread(). Fix this 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(-)
drivers/iommu/intel/svm.c +2 -2
index d76cc79f3496..f688c5f29b1a 100644
@@ -1021,12 +1021,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
#1 lore raw

Hi Baolu,

Quoted 8 lines · Lu Baolu

The private data field of a page group response descriptor is set then immediately cleared in prq_event_thread(). Fix this by moving clearing code up.

Fixes 5b438f4ba315d ("iommu/vt-d: Support page request in scalable mode")
Cc Jacob Pan <[email protected]>

Does this fix an actual bug? If so, please state it in the commit message and also fix the subject line to state what is set/cleared.

Thanks,

Joerg
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

author maintainer
#2 lore raw

Hi Joerg,

Quoted 7 lines · Joerg Roedel

Hi Baolu,

Quoted 4 lines · Lu Baolu

The private data field of a page group response descriptor is set then immediately cleared in prq_event_thread(). Fix this by moving clearing code up.

Quoted 6 lines
Quoted 4 lines
Fixes 5b438f4ba315d ("iommu/vt-d: Support page request in scalable mode")
Cc Jacob Pan <[email protected]>

Does this fix an actual bug? If so, please state it in the commit

It will cause real problem according to the VT-d spec. I haven't got a chance run this on a real hardware yet. I'll add a commit message to explain why this will cause problem.

Quoted 2 lines

message and also fix the subject line to state what is set/cleared.

Sure!

Quoted 4 lines

Thanks,

Joerg

Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu