linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/vt-d: Don't set then immediately clear in prq_event_thread()
@ 2021-03-09  0:46 Lu Baolu
  2021-03-18 10:10 ` Joerg Roedel
  0 siblings, 1 reply; 3+ messages in thread
From: Lu Baolu @ 2021-03-09  0:46 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon
  Cc: ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu, sanjay.k.kumar,
	iommu, linux-kernel, Lu Baolu, Jacob Pan

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 <jacob.jun.pan@linux.intel.com>
Reviewed-by: Liu Yi L <yi.l.liu@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel/svm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
index d76cc79f3496..f688c5f29b1a 100644
--- a/drivers/iommu/intel/svm.c
+++ b/drivers/iommu/intel/svm.c
@@ -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:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] iommu/vt-d: Don't set then immediately clear in prq_event_thread()
  2021-03-09  0:46 [PATCH 1/1] iommu/vt-d: Don't set then immediately clear in prq_event_thread() Lu Baolu
@ 2021-03-18 10:10 ` Joerg Roedel
  2021-03-19  1:07   ` Lu Baolu
  0 siblings, 1 reply; 3+ messages in thread
From: Joerg Roedel @ 2021-03-18 10:10 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan, yi.l.liu,
	sanjay.k.kumar, iommu, linux-kernel, Jacob Pan

Hi Baolu,

On Tue, Mar 09, 2021 at 08:46:41AM +0800, Lu Baolu wrote:
> 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 <jacob.jun.pan@linux.intel.com>
> Reviewed-by: Liu Yi L <yi.l.liu@intel.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] iommu/vt-d: Don't set then immediately clear in prq_event_thread()
  2021-03-18 10:10 ` Joerg Roedel
@ 2021-03-19  1:07   ` Lu Baolu
  0 siblings, 0 replies; 3+ messages in thread
From: Lu Baolu @ 2021-03-19  1:07 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: baolu.lu, Will Deacon, ashok.raj, kevin.tian, jacob.jun.pan,
	yi.l.liu, sanjay.k.kumar, iommu, linux-kernel, Jacob Pan

Hi Joerg,

On 3/18/21 6:10 PM, Joerg Roedel wrote:
> Hi Baolu,
> 
> On Tue, Mar 09, 2021 at 08:46:41AM +0800, Lu Baolu wrote:
>> 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 <jacob.jun.pan@linux.intel.com>
>> Reviewed-by: Liu Yi L <yi.l.liu@intel.com>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> 
> 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.

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

Sure!

> Thanks,
> 
> 	Joerg
> 

Best regards,
baolu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-19  1:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  0:46 [PATCH 1/1] iommu/vt-d: Don't set then immediately clear in prq_event_thread() Lu Baolu
2021-03-18 10:10 ` Joerg Roedel
2021-03-19  1:07   ` Lu Baolu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).