2014-07-08 10:47:17

by Peter Ujfalusi

[permalink] [raw]
Subject: [PATCH 0/3] ARM/dma: edma: Serve cyclic clients via high priority queue

Hi,

It is preferred that audio is served with the highest priority queue in order to
avoid delays in data transfer between memory and audio IP.

The following series will add an API to arch code to assign a channel to a given
queue.
The default queue is changed from 0 (highest priority) to lowest priority.
In the dmaengine driver we move the cyclic channel to queue0 (highest priority)
and move it back to default queue when the channel is terminated.

Regards,
Peter
---
Peter Ujfalusi (3):
ARM: edma: Set default queue to lowest priority
ARM: edma: Add edma_assign_channel_eventq() to move channel to a give
queue
dma: edma: Serve cyclic (audio) channels with high priority queue

arch/arm/common/edma.c | 31 ++++++++++++++++++++++++++++++-
drivers/dma/edma.c | 8 ++++++++
include/linux/platform_data/edma.h | 2 ++
3 files changed, 40 insertions(+), 1 deletion(-)

--
2.0.0


2014-07-08 10:47:29

by Peter Ujfalusi

[permalink] [raw]
Subject: [PATCH 3/3] dma: edma: Serve cyclic (audio) channels with high priority queue

Move the DMA channel used in cyclic mode (audio) to the highest priority
event queue which helps to reduce audio problems.
When the channel is terminated, move it back to the default queue.

Signed-off-by: Peter Ujfalusi <[email protected]>
---
drivers/dma/edma.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index b512caf46944..fe55f78ea137 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -256,8 +256,13 @@ static int edma_terminate_all(struct edma_chan *echan)
* echan->edesc is NULL and exit.)
*/
if (echan->edesc) {
+ int cyclic = echan->edesc->cyclic;
echan->edesc = NULL;
edma_stop(echan->ch_num);
+ /* Move the cyclic channel back to default queue */
+ if (cyclic)
+ edma_assign_channel_eventq(echan->ch_num,
+ EVENTQ_DEFAULT);
}

vchan_get_all_descriptors(&echan->vchan, &head);
@@ -724,6 +729,9 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
edesc->pset[i].param.opt |= TCINTEN;
}

+ /* Place the cyclic channel to highest priority queue */
+ edma_assign_channel_eventq(echan->ch_num, EVENTQ_0);
+
return vchan_tx_prep(&echan->vchan, &edesc->vdesc, tx_flags);
}

--
2.0.0

2014-07-08 10:47:27

by Peter Ujfalusi

[permalink] [raw]
Subject: [PATCH 2/3] ARM: edma: Add edma_assign_channel_eventq() to move channel to a give queue

In some cases it is desired to move a channel to a specific event queue.
Such a use case is audio, where it is preferred that it is served with
highest priority compared to other DMA clients.

Signed-off-by: Peter Ujfalusi <[email protected]>
---
arch/arm/common/edma.c | 28 ++++++++++++++++++++++++++++
include/linux/platform_data/edma.h | 2 ++
2 files changed, 30 insertions(+)

diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index f834aae7720f..88099175fc56 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1414,6 +1414,34 @@ void edma_clear_event(unsigned channel)
}
EXPORT_SYMBOL(edma_clear_event);

+/*
+ * edma_assign_channel_eventq - move given channel to desired eventq
+ * Arguments:
+ * channel - channel number
+ * eventq_no - queue to move the channel
+ *
+ * Can be used to move a channel to a selected event queue.
+ */
+void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no)
+{
+ unsigned ctlr;
+
+ ctlr = EDMA_CTLR(channel);
+ channel = EDMA_CHAN_SLOT(channel);
+
+ if (channel >= edma_cc[ctlr]->num_channels)
+ return;
+
+ /* default to low priority queue */
+ if (eventq_no == EVENTQ_DEFAULT)
+ eventq_no = edma_cc[ctlr]->default_queue;
+ if (eventq_no >= edma_cc[ctlr]->num_tc)
+ return;
+
+ map_dmach_queue(ctlr, channel, eventq_no);
+}
+EXPORT_SYMBOL(edma_assign_channel_eventq);
+
static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
struct edma *edma_cc)
{
diff --git a/include/linux/platform_data/edma.h b/include/linux/platform_data/edma.h
index eb8d5627d080..bdb2710e2aab 100644
--- a/include/linux/platform_data/edma.h
+++ b/include/linux/platform_data/edma.h
@@ -150,6 +150,8 @@ void edma_clear_event(unsigned channel);
void edma_pause(unsigned channel);
void edma_resume(unsigned channel);

+void edma_assign_channel_eventq(unsigned channel, enum dma_event_q eventq_no);
+
struct edma_rsv_info {

const s16 (*rsv_chans)[2];
--
2.0.0

2014-07-08 10:47:57

by Peter Ujfalusi

[permalink] [raw]
Subject: [PATCH 1/3] ARM: edma: Set default queue to lowest priority

Use the lowest priority queue as default for clients.

Signed-off-by: Peter Ujfalusi <[email protected]>
---
arch/arm/common/edma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 485be42519b9..f834aae7720f 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1470,7 +1470,8 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
queue_priority_map[i][1] = -1;

pdata->queue_priority_mapping = queue_priority_map;
- pdata->default_queue = 0;
+ /* Default queue has the lowest priority */
+ pdata->default_queue = i - 1;

return 0;
}
--
2.0.0

2014-07-28 06:13:16

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM/dma: edma: Serve cyclic clients via high priority queue

On 07/08/2014 01:46 PM, Peter Ujfalusi wrote:
> Hi,
>
> It is preferred that audio is served with the highest priority queue in order to
> avoid delays in data transfer between memory and audio IP.
>
> The following series will add an API to arch code to assign a channel to a given
> queue.
> The default queue is changed from 0 (highest priority) to lowest priority.
> In the dmaengine driver we move the cyclic channel to queue0 (highest priority)
> and move it back to default queue when the channel is terminated.

ping?

>
> Regards,
> Peter
> ---
> Peter Ujfalusi (3):
> ARM: edma: Set default queue to lowest priority
> ARM: edma: Add edma_assign_channel_eventq() to move channel to a give
> queue
> dma: edma: Serve cyclic (audio) channels with high priority queue
>
> arch/arm/common/edma.c | 31 ++++++++++++++++++++++++++++++-
> drivers/dma/edma.c | 8 ++++++++
> include/linux/platform_data/edma.h | 2 ++
> 3 files changed, 40 insertions(+), 1 deletion(-)
>


--
P?ter

2014-07-28 06:32:52

by Sekhar Nori

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM/dma: edma: Serve cyclic clients via high priority queue

On Monday 28 July 2014 11:42 AM, Peter Ujfalusi wrote:
> On 07/08/2014 01:46 PM, Peter Ujfalusi wrote:
>> Hi,
>>
>> It is preferred that audio is served with the highest priority queue in order to
>> avoid delays in data transfer between memory and audio IP.
>>
>> The following series will add an API to arch code to assign a channel to a given
>> queue.
>> The default queue is changed from 0 (highest priority) to lowest priority.

This should not really change any performance behavior as everything at
highest priority is same as everything at lowest priority.

>> In the dmaengine driver we move the cyclic channel to queue0 (highest priority)
>> and move it back to default queue when the channel is terminated.
>
> ping?

For 1/3 and 2/3:

Acked-by: Sekhar Nori <[email protected]>

Vinod, can you take the series together with your tree (if you are happy
with the series, that is)? I don't have anything else queued for this
merge window.

Thanks,
Sekhar

2014-07-28 11:42:31

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 0/3] ARM/dma: edma: Serve cyclic clients via high priority queue

On Tue, Jul 08, 2014 at 01:46:35PM +0300, Peter Ujfalusi wrote:
> Hi,
>
> It is preferred that audio is served with the highest priority queue in order to
> avoid delays in data transfer between memory and audio IP.
>
> The following series will add an API to arch code to assign a channel to a given
> queue.
> The default queue is changed from 0 (highest priority) to lowest priority.
> In the dmaengine driver we move the cyclic channel to queue0 (highest priority)
> and move it back to default queue when the channel is terminated.

Applied, thanks

--
~Vinod

>
> Regards,
> Peter
> ---
> Peter Ujfalusi (3):
> ARM: edma: Set default queue to lowest priority
> ARM: edma: Add edma_assign_channel_eventq() to move channel to a give
> queue
> dma: edma: Serve cyclic (audio) channels with high priority queue
>
> arch/arm/common/edma.c | 31 ++++++++++++++++++++++++++++++-
> drivers/dma/edma.c | 8 ++++++++
> include/linux/platform_data/edma.h | 2 ++
> 3 files changed, 40 insertions(+), 1 deletion(-)
>
> --
> 2.0.0
>

--