public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Some fixes for idxd driver
@ 2023-10-29  8:00 'Guanjun'
  2023-10-29  8:00 ` [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor 'Guanjun'
  2023-10-29  8:00 ` [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions 'Guanjun'
  0 siblings, 2 replies; 7+ messages in thread
From: 'Guanjun' @ 2023-10-29  8:00 UTC (permalink / raw)
  To: dave.jiang, dmaengine, linux-kernel, vkoul, tony.luck, fenghua.yu
  Cc: jing.lin, ashok.raj, sanjay.k.kumar, megha.dey, jacob.jun.pan,
	yi.l.liu, tglx

From: Guanjun <guanjun@linux.alibaba.com>

This two patches fix the some issues for idxd driver.
Please help to review.

Thanks,
Guanjun

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

 drivers/dma/idxd/registers.h | 13 ++++++++-----
 drivers/dma/idxd/submit.c    | 14 +++++++-------
 2 files changed, 15 insertions(+), 12 deletions(-)

-- 
2.39.3


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

* [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor
  2023-10-29  8:00 [PATCH v1 0/2] Some fixes for idxd driver 'Guanjun'
@ 2023-10-29  8:00 ` 'Guanjun'
  2023-10-30 15:58   ` Dave Jiang
  2023-10-30 18:56   ` Fenghua Yu
  2023-10-29  8:00 ` [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions 'Guanjun'
  1 sibling, 2 replies; 7+ messages in thread
From: 'Guanjun' @ 2023-10-29  8:00 UTC (permalink / raw)
  To: dave.jiang, dmaengine, linux-kernel, vkoul, tony.luck, fenghua.yu
  Cc: jing.lin, ashok.raj, sanjay.k.kumar, megha.dey, jacob.jun.pan,
	yi.l.liu, tglx

From: Guanjun <guanjun@linux.alibaba.com>

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

Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
---
 drivers/dma/idxd/submit.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c
index c01db23e3333..3f922518e3a5 100644
--- a/drivers/dma/idxd/submit.c
+++ b/drivers/dma/idxd/submit.c
@@ -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 {
-- 
2.39.3


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

* [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions
  2023-10-29  8:00 [PATCH v1 0/2] Some fixes for idxd driver 'Guanjun'
  2023-10-29  8:00 ` [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor 'Guanjun'
@ 2023-10-29  8:00 ` 'Guanjun'
  2023-10-30 16:00   ` Dave Jiang
  2023-10-30 19:20   ` Fenghua Yu
  1 sibling, 2 replies; 7+ messages in thread
From: 'Guanjun' @ 2023-10-29  8:00 UTC (permalink / raw)
  To: dave.jiang, dmaengine, linux-kernel, vkoul, tony.luck, fenghua.yu
  Cc: jing.lin, ashok.raj, sanjay.k.kumar, megha.dey, jacob.jun.pan,
	yi.l.liu, tglx

From: Guanjun <guanjun@linux.alibaba.com>

Fix the incorrect descriptions for the GRPCFG register.
No functional changes

Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
---
 drivers/dma/idxd/registers.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h
index 7b54a3939ea1..385a162a55f2 100644
--- a/drivers/dma/idxd/registers.h
+++ b/drivers/dma/idxd/registers.h
@@ -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 different types, that
+ * includes GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index in each group
+ * allows us to move to the register group that's for that particular wq,
+ * engine or group flag.
+ * Each register is 64bits. And the ofs in GRPWQCFG gives us the number
+ * of register to access.
  */
 #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\
 					   (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))
-- 
2.39.3


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

* Re: [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor
  2023-10-29  8:00 ` [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor 'Guanjun'
@ 2023-10-30 15:58   ` Dave Jiang
  2023-10-30 18:56   ` Fenghua Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Dave Jiang @ 2023-10-30 15:58 UTC (permalink / raw)
  To: 'Guanjun', dmaengine, linux-kernel, vkoul, tony.luck,
	fenghua.yu
  Cc: jing.lin, ashok.raj, sanjay.k.kumar, megha.dey, jacob.jun.pan,
	yi.l.liu, tglx



On 10/29/23 01:00, 'Guanjun' wrote:
> From: Guanjun <guanjun@linux.alibaba.com>
> 
> The int_handle field in hw descriptor should also be protected
> by wmb() before possibly triggering a DMA read.
> 
> Signed-off-by: Guanjun <guanjun@linux.alibaba.com>

Can you please provide a Fix tag? Otherwise
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/dma/idxd/submit.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/idxd/submit.c b/drivers/dma/idxd/submit.c
> index c01db23e3333..3f922518e3a5 100644
> --- a/drivers/dma/idxd/submit.c
> +++ b/drivers/dma/idxd/submit.c
> @@ -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 {

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

* Re: [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions
  2023-10-29  8:00 ` [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions 'Guanjun'
@ 2023-10-30 16:00   ` Dave Jiang
  2023-10-30 19:20   ` Fenghua Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Dave Jiang @ 2023-10-30 16:00 UTC (permalink / raw)
  To: 'Guanjun', dmaengine, linux-kernel, vkoul, tony.luck,
	fenghua.yu
  Cc: jing.lin, ashok.raj, sanjay.k.kumar, megha.dey, jacob.jun.pan,
	yi.l.liu, tglx



On 10/29/23 01:00, 'Guanjun' wrote:
> From: Guanjun <guanjun@linux.alibaba.com>
> 
> Fix the incorrect descriptions for the GRPCFG register.
> No functional changes
> 
> Signed-off-by: Guanjun <guanjun@linux.alibaba.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

Thanks!

> ---
>  drivers/dma/idxd/registers.h | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h
> index 7b54a3939ea1..385a162a55f2 100644
> --- a/drivers/dma/idxd/registers.h
> +++ b/drivers/dma/idxd/registers.h
> @@ -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 different types, that
> + * includes GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index in each group
> + * allows us to move to the register group that's for that particular wq,
> + * engine or group flag.
> + * Each register is 64bits. And the ofs in GRPWQCFG gives us the number
> + * of register to access.
>   */
>  #define GRPWQCFG_OFFSET(idxd_dev, n, ofs) ((idxd_dev)->grpcfg_offset +\
>  					   (n) * GRPCFG_SIZE + sizeof(u64) * (ofs))

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

* Re: [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor
  2023-10-29  8:00 ` [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor 'Guanjun'
  2023-10-30 15:58   ` Dave Jiang
@ 2023-10-30 18:56   ` Fenghua Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Fenghua Yu @ 2023-10-30 18:56 UTC (permalink / raw)
  To: 'Guanjun', dave.jiang, dmaengine, linux-kernel, vkoul,
	tony.luck
  Cc: jing.lin, ashok.raj, sanjay.k.kumar, megha.dey, jacob.jun.pan,
	yi.l.liu, tglx



On 10/29/23 01:00, 'Guanjun' wrote:
> From: Guanjun <guanjun@linux.alibaba.com>
> 
> The int_handle field in hw descriptor should also be protected
> by wmb() before possibly triggering a DMA read.
> 
> Signed-off-by: Guanjun <guanjun@linux.alibaba.com>

As Dave said, need to add fixes tag.

Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>

Thanks.

-Fenghua Yu

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

* Re: [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions
  2023-10-29  8:00 ` [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions 'Guanjun'
  2023-10-30 16:00   ` Dave Jiang
@ 2023-10-30 19:20   ` Fenghua Yu
  1 sibling, 0 replies; 7+ messages in thread
From: Fenghua Yu @ 2023-10-30 19:20 UTC (permalink / raw)
  To: 'Guanjun', dave.jiang, dmaengine, linux-kernel, vkoul,
	tony.luck
  Cc: jing.lin, ashok.raj, sanjay.k.kumar, megha.dey, jacob.jun.pan,
	yi.l.liu, tglx

Hi, Guanjun,

On 10/29/23 01:00, 'Guanjun' wrote:
> From: Guanjun <guanjun@linux.alibaba.com>
> 

The subject may be changed to:
dmaengine: idxd: Fix incorrect descriptions for GRPWQCFG_OFFSET

> Fix the incorrect descriptions for the GRPCFG register.
> No functional changes
> 
> Signed-off-by: Guanjun <guanjun@linux.alibaba.com>
> ---
>   drivers/dma/idxd/registers.h | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/dma/idxd/registers.h b/drivers/dma/idxd/registers.h
> index 7b54a3939ea1..385a162a55f2 100644
> --- a/drivers/dma/idxd/registers.h
> +++ b/drivers/dma/idxd/registers.h
> @@ -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 different types, that

s/different types/sub-registers/

> + * includes GRPWQCFG, GRPENGCFG and GRPFLGCFG. The n index in each group

s/that includes/which are/

> + * allows us to move to the register group that's for that particular wq,
> + * engine or group flag.

s/that particular wq, engine or group flag./that contains the three 
sub-registers/

> + * Each register is 64bits. And the ofs in GRPWQCFG gives us the number
> + * of register to access.

s/the number of register to access/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))

Thanks.

-Fenghua

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

end of thread, other threads:[~2023-10-30 19:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-29  8:00 [PATCH v1 0/2] Some fixes for idxd driver 'Guanjun'
2023-10-29  8:00 ` [PATCH v1 1/2] dmaengine: idxd: Protect int_handle field in hw descriptor 'Guanjun'
2023-10-30 15:58   ` Dave Jiang
2023-10-30 18:56   ` Fenghua Yu
2023-10-29  8:00 ` [PATCH v1 2/2] dmaengine: idxd: Fix the incorrect descriptions 'Guanjun'
2023-10-30 16:00   ` Dave Jiang
2023-10-30 19:20   ` Fenghua Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox