dmaengine: dw-edma: Add Simple Mode Support
Subsystems (2)
PATCH RESEND 1/1 dmaengine: dw-edma: Add Simple Mode Support
The HDMA IP supports the simple mode (non-linked list). In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param of dma_slave_config param.
--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53 ++++++++++++++++++++++++++- include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)
drivers/dma/dw-edma/dw-edma-core.c +10 -0
@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan *dchan, struct dma_slave_config *config) {struct dw_edma_chan *chan =dchan2dw_edma_chan (dchan); +struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false; chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }
drivers/dma/dw-edma/dw-edma-core.h +2 -0
@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;struct dma_slave_config config; + +bool non_ll_en; };struct dw_edma_irq {
drivers/dma/dw-edma/dw-hdma-v0-core.c +52 -1
65 lines not on this page · raw message
include/linux/dma/edma.h +8 -0
@@ -101,6 +101,14 @@ struct dw_edma_chip {struct dw_edma *dw; }; +/** +* struct dw_edma_peripheral_config - peripheral spicific configurations +* @non_ll_en: enable non-linked list mode of operations +*/ +struct dw_edma_peripheral_config { +bool non_ll_en; +}; +/* Export to the platform drivers */ #if IS_REACHABLE (CONFIG_DW_EDMA )int dw_edma_probe (struct dw_edma_chip *chip);
Signature · 1 line
2.43.0
Vinod Koul
maintainerQuoted 42 lines · Devendra K Verma
The HDMA IP supports the simple mode (non-linked list). In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param of
dma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53 ++++++++++++++++++++++++++- include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +10
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan *dchan, struct dma_slave_config *config) {struct dw_edma_chan *chan =dchan2dw_edma_chan (dchan); +struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false; chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }drivers/dma/dw-edma/dw-edma-core.h +0
-0
drivers/dma/dw-edma/dw-edma-core.h struct dw_edma_chan { · line 90
Quoted 5 lines
drivers/dma/dw-edma/dw-edma-core.h +2
-0@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;struct dma_slave_config config; + +bool non_ll_en;
why do you need this? What is the decision to use non ll vs ll one?
Quoted 95 lines
drivers/dma/dw-edma/dw-edma-core.h +0
-0};struct dw_edma_irq {drivers/dma/dw-edma/dw-hdma-v0-core.c +52
-1@@ -225,7 +225,7 @@ static void dw_hdma_v0_sync_ll_data(struct dw_edma_chunk *chunk)readl (chunk->ll_region.vaddr.io); } -static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool first) +static void dw_hdma_v0_ll_start (struct dw_edma_chunk *chunk,bool first) {struct dw_edma_chan *chan = chunk->chan;struct dw_edma *dw = chan->dw;@@ -263,6 +263,57 @@ static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)SET_CH_32 (dw, chan->dir, chan->id, doorbell,HDMA_V0_DOORBELL_START ); } +static void dw_hdma_v0_non_ll_start (struct dw_edma_chunk *chunk) +{ +struct dw_edma_chan *chan = chunk->chan; +struct dw_edma *dw = chan->dw; +struct dw_edma_burst *child; +u32 val; + +list_for_each_entry (child, &chunk->burst->list, list) { +SET_CH_32 (dw, chan->dir, chan->id, ch_en,BIT (0 )); + +/* Source address */ +SET_CH_32 (dw, chan->dir, chan->id, sar.lsb,lower_32_bits (child->sar)); +SET_CH_32 (dw, chan->dir, chan->id, sar.msb,upper_32_bits (child->sar)); + +/* Destination address */ +SET_CH_32 (dw, chan->dir, chan->id, dar.lsb,lower_32_bits (child->dar)); +SET_CH_32 (dw, chan->dir, chan->id, dar.msb,upper_32_bits (child->dar)); + +/* Transfer size */ +SET_CH_32 (dw, chan->dir, chan->id, transfer_size, child->sz); + +/* Interrupt setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, int_setup) | +HDMA_V0_STOP_INT_MASK |HDMA_V0_ABORT_INT_MASK | +HDMA_V0_LOCAL_STOP_INT_EN |HDMA_V0_LOCAL_ABORT_INT_EN ; + +if (!(dw->chip->flags &DW_EDMA_CHIP_LOCAL )) + val |=HDMA_V0_REMOTE_STOP_INT_EN |HDMA_V0_REMOTE_ABORT_INT_EN ; + +SET_CH_32 (dw, chan->dir, chan->id, int_setup, val); + +/* Channel control setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, control1); + val &= ~HDMA_V0_LINKLIST_EN ; +SET_CH_32 (dw, chan->dir, chan->id, control1, val); + +/* Ring the doorbell */ +SET_CH_32 (dw, chan->dir, chan->id, doorbell,HDMA_V0_DOORBELL_START ); + } +} + +static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool first) +{ +struct dw_edma_chan *chan = chunk->chan; + +if (!chan->non_ll_en) +dw_hdma_v0_ll_start (chunk, first); +else +dw_hdma_v0_non_ll_start (chunk); +} +static void dw_hdma_v0_core_ch_config (struct dw_edma_chan *chan) {struct dw_edma *dw = chan->dw;include/linux/dma/edma.h +8
-0@@ -101,6 +101,14 @@ struct dw_edma_chip {struct dw_edma *dw; }; +/** +* struct dw_edma_peripheral_config - peripheral spicific configurations +* @non_ll_en: enable non-linked list mode of operations +*/ +struct dw_edma_peripheral_config { +bool non_ll_en; +}; +/* Export to the platform drivers */ #if IS_REACHABLE (CONFIG_DW_EDMA )int dw_edma_probe (struct dw_edma_chip *chip);Signature · 1 line
2.43.0
Signature · 1 line
~Vinod
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Vinod
Thanks for the review.
Quoted 59 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Friday, June 27, 2025 03:37
To: Verma, Devendra <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH] dmaengine: dw-edma: Add Simple Mode SupportCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 10 lines · Devendra K Verma
The HDMA IP supports the simple mode (non-linked list).
In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param ofdma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53++++++++++++++++++++++++++-
drivers/dma/dw-edma/dw-edma-core.c static int dw_edma_device_config(struct dma_chan
Quoted 9 lines
include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +0
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan*dchan,
Quoted 26 lines
drivers/dma/dw-edma/dw-edma-core.c +10
-0struct dma_slave_config *config) {struct dw_edma_chan *chan =dchan2dw_edma_chan (dchan); +struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false; chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }drivers/dma/dw-edma/dw-edma-core.h +0
-0@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;
Quoted 6 lines
drivers/dma/dw-edma/dw-edma-core.h struct dw_edma_chan { · line 90
Quoted 3 lines
drivers/dma/dw-edma/dw-edma-core.h +2
-0struct dma_slave_config config; + +bool non_ll_en;why do you need this? What is the decision to use non ll vs ll one?
The IP supports both the modes, LL mode and non-LL mode.
In the current driver code, the support for non-LL mode is not present. This patch enables the non-LL aka simple mode support by means of the peripheral_config option in the dmaengine_slave_config.
Quoted 106 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_sync_ll_data(struct
Quoted 9 lines
drivers/dma/dw-edma/dw-edma-core.h +0
-0};struct dw_edma_irq {drivers/dma/dw-edma/dw-hdma-v0-core.c +0
-0@@ -225,7 +225,7 @@ static void dw_hdma_v0_sync_ll_data(struct
dw_edma_chunk*chunk)drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +2
-1readl (chunk->ll_region.vaddr.io); } -static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool first) +static void dw_hdma_v0_ll_start(struct dw_edma_chunk *chunk, bool +first) {struct dw_edma_chan *chan = chunk->chan;struct dw_edma *dw = chan->dw;@@ -263,6 +263,57 @@ static void dw_hdma_v0_core_start(struct
dw_edma_chunk*chunk, bool first)Quoted 19 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +16
-0SET_CH_32 (dw, chan->dir, chan->id, doorbell,HDMA_V0_DOORBELL_START ); } +static void dw_hdma_v0_non_ll_start (struct dw_edma_chunk *chunk) { +struct dw_edma_chan *chan = chunk->chan; +struct dw_edma *dw = chan->dw; +struct dw_edma_burst *child; +u32 val; + +list_for_each_entry (child, &chunk->burst->list, list) { +SET_CH_32 (dw, chan->dir, chan->id, ch_en,BIT (0 )); + +/* Source address */ +SET_CH_32 (dw, chan->dir, chan->id, sar.lsb,lower_32_bits (child->sar)); +SET_CH_32 (dw, chan->dir, chan->id, sar.msb, +upper_32_bits (child->sar)); + +/* Destination address */ +SET_CH_32 (dw, chan->dir, chan->id, dar.lsb,lower_32_bits (child->dar));drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +10
-0+SET_CH_32 (dw, chan->dir, chan->id, dar.msb, +upper_32_bits (child->dar)); + +/* Transfer size */ +SET_CH_32 (dw, chan->dir, chan->id, transfer_size, + child->sz); + +/* Interrupt setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, int_setup) | + HDMA_V0_STOP_INT_MASK |
HDMA_V0_ABORT_INT_MASK|Quoted 6 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +6
-0+HDMA_V0_LOCAL_STOP_INT_EN | +HDMA_V0_LOCAL_ABORT_INT_EN ; + +if (!(dw->chip->flags &DW_EDMA_CHIP_LOCAL )) + val |=HDMA_V0_REMOTE_STOP_INT_EN | +HDMA_V0_REMOTE_ABORT_INT_EN ;drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +10
-0+ +SET_CH_32 (dw, chan->dir, chan->id, int_setup, val); + +/* Channel control setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, control1); + val &= ~HDMA_V0_LINKLIST_EN ; +SET_CH_32 (dw, chan->dir, chan->id, control1, val); + +/* Ring the doorbell */ + SET_CH_32(dw, chan->dir, chan->id, doorbell,
HDMA_V0_DOORBELL_START);Quoted 34 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +12
-0+ } +} + +static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool +first) { +struct dw_edma_chan *chan = chunk->chan; + +if (!chan->non_ll_en) +dw_hdma_v0_ll_start (chunk, first); +else +dw_hdma_v0_non_ll_start (chunk); } +static void dw_hdma_v0_core_ch_config (struct dw_edma_chan *chan) {struct dw_edma *dw = chan->dw;include/linux/dma/edma.h index renamed from include/linux/dma/edma.h +0
-0
3080747689f6..82d808013a66100644include/linux/dma/edma.h +8
-1@@ -101,6 +101,14 @@ struct dw_edma_chip {struct dw_edma *dw; }; +/** +* struct dw_edma_peripheral_config - peripheral spicific configurations +* @non_ll_en: enable non-linked list mode of operations +*/ +struct dw_edma_peripheral_config { +bool non_ll_en; +}; +/* Export to the platform drivers */ #if IS_REACHABLE (CONFIG_DW_EDMA )int dw_edma_probe (struct dw_edma_chip *chip); --Quoted 1 line
2.43.0
--
~Vinod
[AMD Official Use Only - AMD Internal Distribution Only]
Gentle reminder!
Regards,
Devendra
Quoted 194 lines
-----Original Message-----
From: Verma, Devendra
Sent: Wednesday, July 2, 2025 15:09
To: Vinod Koul <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: RE: [RESEND PATCH] dmaengine: dw-edma: Add Simple Mode SupportHi Vinod
Thanks for the review.
Quoted 62 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Friday, June 27, 2025 03:37
To: Verma, Devendra <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH] dmaengine: dw-edma: Add Simple Mode SupportCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 10 lines · Devendra K Verma
The HDMA IP supports the simple mode (non-linked list). In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param of
dma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53++++++++++++++++++++++++++-
Quoted 10 lines
include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +0
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct
dma_chan*dchan,
Quoted 26 lines
struct dma_slave_config *config) { struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan);drivers/dma/dw-edma/dw-edma-core.c +10
-0+struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false; chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }drivers/dma/dw-edma/dw-edma-core.h +0
-0@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;Quoted 6 lines
drivers/dma/dw-edma/dw-edma-core.h struct dw_edma_chan { · line 90
Quoted 3 lines
drivers/dma/dw-edma/dw-edma-core.h +2
-0struct dma_slave_config config; + +bool non_ll_en;why do you need this? What is the decision to use non ll vs ll one?
The IP supports both the modes, LL mode and non-LL mode.
In the current driver code, the support for non-LL mode is not present. This patch enables the non-LL aka simple mode support by means of theperipheral_configoption in thedmaengine_slave_config.Quoted 92 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_sync_ll_data(struct
Quoted 9 lines
drivers/dma/dw-edma/dw-edma-core.h +0
-0};struct dw_edma_irq {drivers/dma/dw-edma/dw-hdma-v0-core.c +0
-0@@ -225,7 +225,7 @@ static void dw_hdma_v0_sync_ll_data(struct
dw_edma_chunk*chunk)Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +2
-1readl (chunk->ll_region.vaddr.io); } -static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool first) +static void dw_hdma_v0_ll_start(struct dw_edma_chunk *chunk, bool +first) {struct dw_edma_chan *chan = chunk->chan; struct dw_edma *dw = chan->dw; @@ -263,6 +263,57 @@ staticvoid dw_hdma_v0_core_start(struct
dw_edma_chunk*chunk, bool first)Quoted 4 lines
SET_CH_32(dw, chan->dir, chan->id, doorbell,
HDMA_V0_DOORBELL_START); }drivers/dma/dw-edma/dw-hdma-v0-core.c +1
-0+static void dw_hdma_v0_non_ll_start (struct dw_edma_chunk *chunk) {drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +10
-0+struct dw_edma_chan *chan = chunk->chan; +struct dw_edma *dw = chan->dw; +struct dw_edma_burst *child; +u32 val; + +list_for_each_entry (child, &chunk->burst->list, list) { +SET_CH_32 (dw, chan->dir, chan->id, ch_en,BIT (0 )); + +/* Source address */ + SET_CH_32(dw, chan->dir, chan->id, sar.lsb, lower_32_bits(child-sar));
drivers/dma/dw-edma/dw-hdma-v0-core.c
Quoted 5 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +5
-0+SET_CH_32 (dw, chan->dir, chan->id, sar.msb, +upper_32_bits (child->sar)); + +/* Destination address */ + SET_CH_32(dw, chan->dir, chan->id, dar.lsb, lower_32_bits(child-dar));
drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +10
-0+SET_CH_32 (dw, chan->dir, chan->id, dar.msb, +upper_32_bits (child->dar)); + +/* Transfer size */ +SET_CH_32 (dw, chan->dir, chan->id, transfer_size, + child->sz); + +/* Interrupt setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, int_setup) | + HDMA_V0_STOP_INT_MASK |
HDMA_V0_ABORT_INT_MASK|Quoted 6 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +6
-0+HDMA_V0_LOCAL_STOP_INT_EN | +HDMA_V0_LOCAL_ABORT_INT_EN ; + +if (!(dw->chip->flags &DW_EDMA_CHIP_LOCAL )) + val |=HDMA_V0_REMOTE_STOP_INT_EN | +HDMA_V0_REMOTE_ABORT_INT_EN ;drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +10
-0+ +SET_CH_32 (dw, chan->dir, chan->id, int_setup, val); + +/* Channel control setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, control1); + val &= ~HDMA_V0_LINKLIST_EN ; +SET_CH_32 (dw, chan->dir, chan->id, control1, val); + +/* Ring the doorbell */ + SET_CH_32(dw, chan->dir, chan->id, doorbell,
HDMA_V0_DOORBELL_START);Quoted 22 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +12
-0+ } +} + +static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool +first) { +struct dw_edma_chan *chan = chunk->chan; + +if (!chan->non_ll_en) +dw_hdma_v0_ll_start (chunk, first); +else +dw_hdma_v0_non_ll_start (chunk); } +static void dw_hdma_v0_core_ch_config (struct dw_edma_chan *chan) { struct dw_edma *dw = chan->dw; diff --git
a/include/linux/dma/edma.hb/include/linux/dma/edma.hindex3080747689f6..82d808013a66100644include/linux/dma/edma.h +0
-0@@ -101,6 +101,14 @@ struct dw_edma_chip {struct dw_edma *dw; };Quoted 10 lines
Quoted 10 lines
include/linux/dma/edma.h +8
-0+/** +* struct dw_edma_peripheral_config - peripheral spicific configurations +* @non_ll_en: enable non-linked list mode of operations +*/ +struct dw_edma_peripheral_config { +bool non_ll_en; +}; + /* Export to the platform drivers */ #if
IS_REACHABLE(CONFIG_DW_EDMA)int dw_edma_probe(struct
dw_edma_chipQuoted 6 lines
Quoted 3 lines
*chip);
--
2.43.0--
~Vinod
Vinod Koul
maintainerQuoted 54 lines · Devendra
Quoted 48 lines · Devendra K Verma
Quoted 10 lines
The HDMA IP supports the simple mode (non-linked list).
In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param ofdma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53++++++++++++++++++++++++++-
drivers/dma/dw-edma/dw-edma-core.c static int dw_edma_device_config(struct dma_chan
Quoted 9 lines
include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +0
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan*dchan,
Quoted 26 lines
drivers/dma/dw-edma/dw-edma-core.c +10
-0struct dma_slave_config *config) {struct dw_edma_chan *chan =dchan2dw_edma_chan (dchan); +struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false; chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }drivers/dma/dw-edma/dw-edma-core.h +0
-0@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;Quoted 5 lines
drivers/dma/dw-edma/dw-edma-core.h struct dw_edma_chan { · line 90
Quoted 3 lines
drivers/dma/dw-edma/dw-edma-core.h +2
-0struct dma_slave_config config; + +bool non_ll_en;why do you need this? What is the decision to use non ll vs ll one?
Quoted 4 lines
The IP supports both the modes, LL mode and non-LL mode.
In the current driver code, the support for non-LL mode is not present. This patch enables the non-LL aka simple mode support by means of theperipheral_configoption in thedmaengine_slave_config.
That does not answer my question, what decides which mode should be used?
Signature · 1 line
~Vinod
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Vinod
Please check the response inline.
Regards,
Devendra
Quoted 67 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Wednesday, July 23, 2025 12:51
To: Verma, Devendra <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH] dmaengine: dw-edma: Add Simple Mode SupportCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 55 lines · Devendra
Quoted 54 lines · Devendra K Verma
Quoted 10 lines
The HDMA IP supports the simple mode (non-linked list). In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param of
dma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53++++++++++++++++++++++++++-
Quoted 10 lines
include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +0
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct
dma_chan*dchan,
Quoted 24 lines
struct dma_slave_config *config) { struct dw_edma_chan *chan = dchan2dw_edma_chan(dchan);drivers/dma/dw-edma/dw-edma-core.c +10
-0+struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false; chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }drivers/dma/dw-edma/dw-edma-core.h +0
-0drivers/dma/dw-edma/dw-edma-core.h struct dw_edma_chan { · line 90
Quoted 5 lines
drivers/dma/dw-edma/dw-edma-core.h +2
-0@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;struct dma_slave_config config; + +bool non_ll_en;why do you need this? What is the decision to use non ll vs ll one?
Quoted 7 lines
Quoted 4 lines
The IP supports both the modes, LL mode and non-LL mode. In the current driver code, the support for non-LL mode is not present. This patch enables the non-LL aka simple mode support by means of the
peripheral_configoption in thedmaengine_slave_config.That does not answer my question, what decides which mode should be used?
Simple HDMA mode is useful when there is no need for scatter-gather and one big chunk of data from contiguous location is to be moved. It saves the effort of preparing a linked list of descriptors as DMA channel registers can be programmed directly.
Quoted 2 lines
--
~Vinod
Manivannan Sadhasivam
maintainerQuoted 22 lines · Devendra K Verma
The HDMA IP supports the simple mode (non-linked list). In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param of
dma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53 ++++++++++++++++++++++++++- include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +1
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan *dchan, struct dma_slave_config *config) {struct dw_edma_chan *chan =dchan2dw_edma_chan (dchan); +struct dw_edma_peripheral_config *pconfig = config->peripheral_config;
drivers/dma/dw-edma/dw-edma-core.c static int dw_edma_device_config(struct dma_chan *dchan, · line 248
Quoted 10 lines
drivers/dma/dw-edma/dw-edma-core.c +8
-0+unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false;
Who is allocating 'dw_edma_peripheral_config' and setting 'non_ll_en' flag? We cannot introduce a flag without anyone using it in upstream.
- Mani
Quoted 111 lines
drivers/dma/dw-edma/dw-edma-core.c +1
-0chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }drivers/dma/dw-edma/dw-edma-core.h +2
-0@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;struct dma_slave_config config; + +bool non_ll_en; };struct dw_edma_irq {drivers/dma/dw-edma/dw-hdma-v0-core.c +52
-1@@ -225,7 +225,7 @@ static void dw_hdma_v0_sync_ll_data(struct dw_edma_chunk *chunk)readl (chunk->ll_region.vaddr.io); } -static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool first) +static void dw_hdma_v0_ll_start (struct dw_edma_chunk *chunk,bool first) {struct dw_edma_chan *chan = chunk->chan;struct dw_edma *dw = chan->dw;@@ -263,6 +263,57 @@ static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)SET_CH_32 (dw, chan->dir, chan->id, doorbell,HDMA_V0_DOORBELL_START ); } +static void dw_hdma_v0_non_ll_start (struct dw_edma_chunk *chunk) +{ +struct dw_edma_chan *chan = chunk->chan; +struct dw_edma *dw = chan->dw; +struct dw_edma_burst *child; +u32 val; + +list_for_each_entry (child, &chunk->burst->list, list) { +SET_CH_32 (dw, chan->dir, chan->id, ch_en,BIT (0 )); + +/* Source address */ +SET_CH_32 (dw, chan->dir, chan->id, sar.lsb,lower_32_bits (child->sar)); +SET_CH_32 (dw, chan->dir, chan->id, sar.msb,upper_32_bits (child->sar)); + +/* Destination address */ +SET_CH_32 (dw, chan->dir, chan->id, dar.lsb,lower_32_bits (child->dar)); +SET_CH_32 (dw, chan->dir, chan->id, dar.msb,upper_32_bits (child->dar)); + +/* Transfer size */ +SET_CH_32 (dw, chan->dir, chan->id, transfer_size, child->sz); + +/* Interrupt setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, int_setup) | +HDMA_V0_STOP_INT_MASK |HDMA_V0_ABORT_INT_MASK | +HDMA_V0_LOCAL_STOP_INT_EN |HDMA_V0_LOCAL_ABORT_INT_EN ; + +if (!(dw->chip->flags &DW_EDMA_CHIP_LOCAL )) + val |=HDMA_V0_REMOTE_STOP_INT_EN |HDMA_V0_REMOTE_ABORT_INT_EN ; + +SET_CH_32 (dw, chan->dir, chan->id, int_setup, val); + +/* Channel control setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, control1); + val &= ~HDMA_V0_LINKLIST_EN ; +SET_CH_32 (dw, chan->dir, chan->id, control1, val); + +/* Ring the doorbell */ +SET_CH_32 (dw, chan->dir, chan->id, doorbell,HDMA_V0_DOORBELL_START ); + } +} + +static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool first) +{ +struct dw_edma_chan *chan = chunk->chan; + +if (!chan->non_ll_en) +dw_hdma_v0_ll_start (chunk, first); +else +dw_hdma_v0_non_ll_start (chunk); +} +static void dw_hdma_v0_core_ch_config (struct dw_edma_chan *chan) {struct dw_edma *dw = chan->dw;include/linux/dma/edma.h +8
-0@@ -101,6 +101,14 @@ struct dw_edma_chip {struct dw_edma *dw; }; +/** +* struct dw_edma_peripheral_config - peripheral spicific configurations +* @non_ll_en: enable non-linked list mode of operations +*/ +struct dw_edma_peripheral_config { +bool non_ll_en; +}; +/* Export to the platform drivers */ #if IS_REACHABLE (CONFIG_DW_EDMA )int dw_edma_probe (struct dw_edma_chip *chip);Signature · 1 line
2.43.0
Signature · 1 line
மணிவண்ணன் சதாசிவம்
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Manivannan
Please check my response inline.
Regards,
Devendra
Quoted 50 lines
-----Original Message-----
From: Manivannan Sadhasivam <[email protected]>
Sent: Wednesday, July 23, 2025 19:26
To: Verma, Devendra <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH] dmaengine: dw-edma: Add Simple Mode SupportCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 10 lines · Devendra K Verma
The HDMA IP supports the simple mode (non-linked list).
In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param ofdma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53++++++++++++++++++++++++++-
drivers/dma/dw-edma/dw-edma-core.c static int dw_edma_device_config(struct dma_chan
Quoted 9 lines
include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +0
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan*dchan,
drivers/dma/dw-edma/dw-edma-core.c static int dw_edma_device_config(struct dma_chan *dchan, · line 248
Quoted 13 lines
drivers/dma/dw-edma/dw-edma-core.c +9
-0struct dma_slave_config *config) {struct dw_edma_chan *chan =dchan2dw_edma_chan (dchan); +struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false;Who is allocating '
dw_edma_peripheral_config' and setting 'non_ll_en' flag? We cannot introduce a flag without anyone using it in upstream.
Quoted 2 lines
- Mani
The caller of the DMA engine client APIs will be responsible for allocating and setting the non_ll_en flag. This flag helps in setting the channel in to non-Linked-List mode. This functionality is supported by the DMA controller. The peripheral_config is just configuring the peripheral (DMA) in to the modes it supports based on user discretion. As this functionality is used by the clients to differentiate between the modes supported by the controller it may not require the equivalent code in upstream.
Quoted 125 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_sync_ll_data(struct
Quoted 25 lines
drivers/dma/dw-edma/dw-edma-core.c +1
-0chan->configured = true; +spin_unlock_irqrestore (&chan->vc.lock, flags);return 0 ; }drivers/dma/dw-edma/dw-edma-core.h +2
-0@@ -86,6 +86,8 @@ struct dw_edma_chan {u8 configured;struct dma_slave_config config; + +bool non_ll_en; };struct dw_edma_irq {drivers/dma/dw-edma/dw-hdma-v0-core.c +0
-0@@ -225,7 +225,7 @@ static void dw_hdma_v0_sync_ll_data(struct
dw_edma_chunk*chunk)drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +2
-1readl (chunk->ll_region.vaddr.io); } -static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool first) +static void dw_hdma_v0_ll_start(struct dw_edma_chunk *chunk, bool +first) {struct dw_edma_chan *chan = chunk->chan;struct dw_edma *dw = chan->dw;@@ -263,6 +263,57 @@ static void dw_hdma_v0_core_start(struct
dw_edma_chunk*chunk, bool first)Quoted 21 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +16
-0SET_CH_32 (dw, chan->dir, chan->id, doorbell,HDMA_V0_DOORBELL_START ); } +static void dw_hdma_v0_non_ll_start (struct dw_edma_chunk *chunk) { +struct dw_edma_chan *chan = chunk->chan; +struct dw_edma *dw = chan->dw; +struct dw_edma_burst *child; +u32 val; + +list_for_each_entry (child, &chunk->burst->list, list) { +SET_CH_32 (dw, chan->dir, chan->id, ch_en,BIT (0 )); + +/* Source address */ +SET_CH_32 (dw, chan->dir, chan->id, sar.lsb,lower_32_bits (child- sar)); +SET_CH_32 (dw, chan->dir, chan->id, sar.msb, +upper_32_bits (child->sar)); + +/* Destination address */ +SET_CH_32 (dw, chan->dir, chan->id, dar.lsb,lower_32_bits (child- dar));drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +10
-0+SET_CH_32 (dw, chan->dir, chan->id, dar.msb, +upper_32_bits (child->dar)); + +/* Transfer size */ +SET_CH_32 (dw, chan->dir, chan->id, transfer_size, + child->sz); + +/* Interrupt setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, int_setup) | + HDMA_V0_STOP_INT_MASK |
HDMA_V0_ABORT_INT_MASK|Quoted 6 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +6
-0+HDMA_V0_LOCAL_STOP_INT_EN | +HDMA_V0_LOCAL_ABORT_INT_EN ; + +if (!(dw->chip->flags &DW_EDMA_CHIP_LOCAL )) + val |=HDMA_V0_REMOTE_STOP_INT_EN | +HDMA_V0_REMOTE_ABORT_INT_EN ;drivers/dma/dw-edma/dw-hdma-v0-core.c static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first)
Quoted 10 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +10
-0+ +SET_CH_32 (dw, chan->dir, chan->id, int_setup, val); + +/* Channel control setup */ + val =GET_CH_32 (dw, chan->dir, chan->id, control1); + val &= ~HDMA_V0_LINKLIST_EN ; +SET_CH_32 (dw, chan->dir, chan->id, control1, val); + +/* Ring the doorbell */ + SET_CH_32(dw, chan->dir, chan->id, doorbell,
HDMA_V0_DOORBELL_START);Quoted 34 lines
drivers/dma/dw-edma/dw-hdma-v0-core.c +12
-0+ } +} + +static void dw_hdma_v0_core_start (struct dw_edma_chunk *chunk,bool +first) { +struct dw_edma_chan *chan = chunk->chan; + +if (!chan->non_ll_en) +dw_hdma_v0_ll_start (chunk, first); +else +dw_hdma_v0_non_ll_start (chunk); } +static void dw_hdma_v0_core_ch_config (struct dw_edma_chan *chan) {struct dw_edma *dw = chan->dw;include/linux/dma/edma.h index renamed from include/linux/dma/edma.h +0
-0
3080747689f6..82d808013a66100644include/linux/dma/edma.h +8
-1@@ -101,6 +101,14 @@ struct dw_edma_chip {struct dw_edma *dw; }; +/** +* struct dw_edma_peripheral_config - peripheral spicific configurations +* @non_ll_en: enable non-linked list mode of operations +*/ +struct dw_edma_peripheral_config { +bool non_ll_en; +}; +/* Export to the platform drivers */ #if IS_REACHABLE (CONFIG_DW_EDMA )int dw_edma_probe (struct dw_edma_chip *chip); --Quoted 2 lines
2.43.0
--
மணிவண்ணன் சதாசிவம்
Manivannan Sadhasivam
maintainerQuoted 62 lines · Devendra
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Manivannan
Please check my response inline.
Regards,
DevendraQuoted 50 lines
-----Original Message-----
From: Manivannan Sadhasivam <[email protected]>
Sent: Wednesday, July 23, 2025 19:26
To: Verma, Devendra <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH] dmaengine: dw-edma: Add Simple Mode SupportCaution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 10 lines · Devendra K Verma
The HDMA IP supports the simple mode (non-linked list).
In this mode the channel registers are configured to initiate a single DMA data transfer. The channel can be configured in simple mode via peripheral param ofdma_slave_configparam.Signed-off-by Devendra K Verma <[email protected]>--- drivers/dma/dw-edma/dw-edma-core.c | 10 +++++ drivers/dma/dw-edma/dw-edma-core.h | 2 + drivers/dma/dw-edma/dw-hdma-v0-core.c | 53++++++++++++++++++++++++++-
drivers/dma/dw-edma/dw-edma-core.c static int dw_edma_device_config(struct dma_chan
Quoted 9 lines
include/linux/dma/edma.h | 8 ++++ 4 files changed, 72 insertions(+), 1 deletion(-)drivers/dma/dw-edma/dw-edma-core.c +0
-0@@ -235,9 +235,19 @@ static int dw_edma_device_config(struct dma_chan*dchan,
drivers/dma/dw-edma/dw-edma-core.c static int dw_edma_device_config(struct dma_chan *dchan, · line 248
Quoted 13 lines
drivers/dma/dw-edma/dw-edma-core.c +9
-0struct dma_slave_config *config) {struct dw_edma_chan *chan =dchan2dw_edma_chan (dchan); +struct dw_edma_peripheral_config *pconfig = config->peripheral_config; +unsigned long flags; + +if (WARN_ON (config->peripheral_config && + config->peripheral_size !=sizeof (*pconfig))) +return -EINVAL ; +spin_lock_irqsave (&chan->vc.lock, flags);memcpy (&chan->config, config,sizeof (*config)); + + chan->non_ll_en = pconfig ? pconfig->non_ll_en : false;Who is allocating '
dw_edma_peripheral_config' and setting 'non_ll_en' flag? We cannot introduce a flag without anyone using it in upstream.Quoted 2 lines
- Mani
Quoted 8 lines
The caller of the DMA engine client APIs will be responsible for allocating and setting the
non_ll_enflag. This flag helps in setting the channel in to non-Linked-List mode. This functionality is supported by the DMA controller. Theperipheral_configis just configuring the peripheral (DMA) in to the modes it supports based on user discretion. As this functionality is used by the clients to differentiate between the modes supported by the controller it may not require the equivalent code in upstream.
As I stated above, we *must not* have an unused interface in upstream drivers. I understand that fact that your downstream driver is setting this flag and you want to keep your driver downstream. But the flag would be unused in upstream and that is not acceptable, sorry.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்