Skip to contentSkip to conversation

Some fixes for idxd driver

PATCH Superseded 'Guanjun' 2 participants 4 messages Oct 31, 2023

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

'Guanjun'

author
#0 lore raw

v2 cover Some fixes for idxd driver

From: Guanjun <[email protected]>

Hi Dave, Fenghua,
As we talked in v1, I add fixes tag in patch 0 and change some descriptions in patch 1.
If there are no other issues, please queue it up.

Thanks,
Guanjun

Guanjun (2):
dmaengine: idxd: Protect int_handle field in hw descriptor
dmaengine: idxd: Fix incorrect descriptions for GRPCFG register

 drivers/dma/idxd/registers.h | 13 ++++++++-----
 drivers/dma/idxd/submit.c    | 14 +++++++-------
 2 files changed, 15 insertions(+), 12 deletions(-)
Signature · 1 line
2.39.3
author
#1 lore raw

PATCH v2 1/2 dmaengine: idxd: Protect int_handle field in hw descriptor

From: Guanjun <[email protected]>

The int_handle field in hw descriptor should also be protected by wmb() before possibly triggering a DMA read.

Fixes ec0d64231615 (dmaengine: idxd: embed irq_entry in idxd_wq struct)
---
 drivers/dma/idxd/submit.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/dma/idxd/submit.c +7 -7
index c01db23e3333..3f922518e3a5 100644
@@ -182,13 +182,6 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
 
 	portal = idxd_wq_portal_addr(wq);
 
-	/*
-	 * The wmb() flushes writes to coherent DMA data before
-	 * possibly triggering a DMA read. The wmb() is necessary
-	 * even on UP because the recipient is a device.
-	 */
-	wmb();
-
 	/*
 	 * Pending the descriptor to the lockless list for the irq_entry
 	 * that we designated the descriptor to.
@@ -199,6 +192,13 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
 		llist_add(&desc->llnode, &ie->pending_llist);
 	}
 
+	/*
+	 * The wmb() flushes writes to coherent DMA data before
+	 * possibly triggering a DMA read. The wmb() is necessary
+	 * even on UP because the recipient is a device.
+	 */
+	wmb();
+
 	if (wq_dedicated(wq)) {
 		iosubmit_cmds512(portal, desc->hw, 1);
 	} else {
Signature · 1 line
2.39.3
author
#2 lore raw

PATCH v2 2/2 dmaengine: idxd: Fix incorrect descriptions for GRPCFG register

In reply to 'Guanjun'

From: Guanjun <[email protected]>

Fix incorrect descriptions for the GRPCFG register which has three sub-registers (GRPWQCFG, GRPENGCFG and GRPFLGCFG).
No functional changes

---
 drivers/dma/idxd/registers.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/dma/idxd/registers.h +8 -5
index 7b54a3939ea1..133bd0c170ae 100644
@@ -440,12 +440,15 @@ union wqcfg {
 /*
  * This macro calculates the offset into the GRPCFG register
  * idxd - struct idxd *
- * n - wq id
- * ofs - the index of the 32b dword for the config register
+ * n - group id
+ * ofs - the index of the 64b qword for the config register
  *
- * The WQCFG register block is divided into groups per each wq. The n index
- * allows us to move to the register group that's for that particular wq.
- * Each register is 32bits. The ofs gives us the number of register to access.
+ * The GRPCFG register block is divided into three sub-registers, which
+ * are GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index in each group
+ * allows us to move to the register group that's for that contains the
+ * three sub-registers.
+ * Each register is 64bits. And the ofs in GRPWQCFG gives us the offset
+ * within the GRPCFG register to access.
  */
 #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\
 					   (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))
Signature · 1 line
2.39.3
#3 lore raw

Re: [PATCH v2 2/2] dmaengine: idxd: Fix incorrect descriptions for GRPCFG register

Hi, Guanjun,

Quoted 20 lines · Guanjun

From: Guanjun <[email protected]>

Fix incorrect descriptions for the GRPCFG register which has three sub-registers (GRPWQCFG, GRPENGCFG and GRPFLGCFG).
No functional changes

---
  drivers/dma/idxd/registers.h | 13 ++++++++-----
  1 file changed, 8 insertions(+), 5 deletions(-)
drivers/dma/idxd/registers.h +0 -0
index 7b54a3939ea1..133bd0c170ae 100644
@@ -440,12 +440,15 @@ union wqcfg {
  /*
   * This macro calculates the offset into the GRPCFG register
   * idxd - struct idxd *

drivers/dma/idxd/registers.h union wqcfg { · line 447

Quoted 10 lines
drivers/dma/idxd/registers.h +4 -5
- * n - wq id
- * ofs - the index of the 32b dword for the config register
+ * n - group id
+ * ofs - the index of the 64b qword for the config register
   *
- * The WQCFG register block is divided into groups per each wq. The n index
- * allows us to move to the register group that's for that particular wq.
- * Each register is 32bits. The ofs gives us the number of register to access.
+ * The GRPCFG register block is divided into three sub-registers, which
+ * are GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index in each group

s/in each group//

drivers/dma/idxd/registers.h union wqcfg { · line 448

Quoted 1 line
drivers/dma/idxd/registers.h +1 -0
+ * allows us to move to the register group that's for that contains the

s/group/block/

s/that's for//

drivers/dma/idxd/registers.h union wqcfg { · line 450

Quoted 2 lines
drivers/dma/idxd/registers.h +2 -0
+ * three sub-registers.
+ * Each register is 64bits. And the ofs in GRPWQCFG gives us the offset

s/Each register/Each register block/

s/GRPWQCFG//

drivers/dma/idxd/registers.h union wqcfg { · line 454

Quoted 4 lines
drivers/dma/idxd/registers.h +1 -0
+ * within the GRPCFG register to access.
   */
  #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\
  					   (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))

Thanks.

-Fenghua