Repository navigation
schedule: implement DMA scheduling domain - #1850
Conversation
|
I need to understand these changes more. So a couple questions:
I also need to understand them because build currently fails on i.MX. I suppose a dummy function which I should afterwards fill in may be needed. |
420597f to
72603a5
Compare
|
So my driver should just have an entry in there and have the .interrupt callback so that the channel itself can register the correct interrupt number? (On the i.MX the EDMA controllers may use different interrupt numbers for different channels)
So now there's only reload and end. Reload for getting the next elem and end would automatically trigger a stop?
So this will, for example, run pipeline_copy(). Ok, this one makes sense. |
|
SOFCI TEST |
Just implement .interrupt() API and it should work automatically. If you need to e.g. load next element in DMA do it in dma_copy.
Yes, basically RELOAD means that we should proceed normally and END means that we should not proceed with the transfer e.g. do not reload next elem. Pipeline should automatically handle stopping the DMA.
|
So this means that within my dma_copy() function I should check for what the callback says and, if it says "RELOAD" I will set the next descriptor (essentially set the registers for EDMA and do nothing for Dummy DMA), while for "END" I would skip these actions? My current implementation does the copy first and then runs the callback. |
|
@paulstelian97 DW-DMA also copies the data first and then executes action based on RELOAD/END, so this sounds correct. This new implementation should resolve your issue with scheduling task not yet done. |
|
Alright, waiting for this one to be merged so I can update my own. Even Dummy DMA needs to be updated even if it cannot support IRQs (I'd just return some -EINVAL on the .interrupt callback, right?) |
Yes, but you only register your scheduling DMAs, so it won't change anything anyway. |
72603a5 to
c3509f8
Compare
I have discussed this one internally and that's actually not a preferable solution (the EDMA controller can also be used by the ARM core, it's not reserved to the DSP). If we used the global interrupt we may get interrupts for other, uninteresting channels. Those interrupts would wake the DSP for no reason so we would need a good reason to switch to global interrupt per controller (each EDMA instance will have separate interrupts anyway). In our use case, we have two flavors of the i.MX (support for the second flavor will come later), which differ in a few respects (some addresses and the other flavor will have a second ESAI controller which connects to channels in EDMA1 instead of EDMA0). The IRQs for Tx and Rx for both ESAI controllers do match but I don't get how it will handle the different channels like that (Tx happens on one channel, Rx on another, depending on Playback vs Capture). Also, handling 2ms of continuous transfer... Sounds like a nice idea actually. There are discussions on features that I didn't think could be implemented such as avoiding the double buffering and using the DAI FIFO as the second buffer. Would your future change allow something like that to be done? |
|
SOFCI TEST |
Adds comp_is_scheduling_source function, which checks whether component is the one used as a scheduling source for the pipeline. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds scheduling_source field and dma_is_scheduling_source function. It allows for easy identification whether particular DMA channel is the source of pipeline scheduling. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
There can be many potential low latency scheduling domains, so let be more specific here. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds SOF_SCHEDULE_LL_DMA as the new low latency scheduling domain type. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Moves CAVS_PLATFORM_NUM_DMACS definition to specific platforms and renames it to PLATFORM_NUM_DMACS. This way we can access to the number of platform DMAs from generic code. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Removes HDA_DMA_MAX_CHANS definition as it's not needed. We can directly use the number of allocated channels. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds PLATFORM_MAX_DMA_CHAN definition to every platform. This way generic API can retrieve this information. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Implements DMA scheduling domain. It allows to initialize another low latency scheduler and schedule on any DMA channel. The functionality stays the same as the one already done in DMA drivers e.g. DW-DMA. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds PLATFORM_NUM_DW_DMACS definition. This way generic API can access this information. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Extracts dma array to be accessible from the generic API. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Renames DMA_AGGREGATED_IRQ to DW_DMA_AGGREGATED_IRQ definition. This is more appropriate as it's not generic DMA setting. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Adds PLATFORM_DW_DMA_INDEX definition. This allows to access this value from the generic API. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Registers low latency scheduler with DMA multi channel domain as scheduling source. This way we can finally get rid of scheduling code from DW-DMA driver and DAI component. Functionally it works the same as the previous implementation, but transfers scheduling layer to the right places. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Removes double channel index assignment in dw_dma_probe. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Cleanups DW-DMA driver and removes any code related to interrupt handling. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Removes DMA_CB_STATUS_IGNORE, which is no longer used. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Removes unused DMA_CB_STATUS_SPLIT and related code. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
Next has this status set by default, so there is no need to set it explicitly. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
6d40b85 to
ebe4749
Compare
|
SOFCI TEST |
|
@tlauda I have rebased my working branch on top of this one and my issue is that, due to having the need to use different IRQs per channel (not having shared IRQ as a real option, due to the DMA controller being also used for other things unrelated to the DSP) the rebase breaks the currently working code. I forgot how I was supposed to set the correct interrupt number per-channel with this change. Right now I'm registering a custom IRQ handler every time set_config() is called per channel, and unregistering it during channel_put() (the system knows not to keep duplicate registrations so this was fine). The IRQ number I am currently storing in a handshake although I could change it (the thing is it CANNOT be unique to all channels). Can you remind me how I was supposed to do this? Other than simply doing the hack of using the IRQ number as a controller IRQ number (I will do that right now for the moment to make it work but I will need a better solution) |
@tlauda Do you have some patches for this? |
|
@paulstelian97 I think setting @dbaluta Just started rebase. |
|
@tlauda Does this mean I would need to have a table for the channel numbers so I can implement dma_chan_irq()? Also what if the channel numbers map to different interrupt controllers? (for various reasons I had to split IRQ_STEER into 8 controllers from the SOF point of view; what if the channel IRQ numbers will eventually be from different such splits? Would I need to either update IRQ_STEER (and the interrupt framework overall) to support one controller with all 512 interrupts? (coming on 8 HW lines, that's why I actually did the split) Would I need to precompute the interrupt numbers manually or in that macro so that the name itself could return as empty? One previous implementation of the EDMA driver had such a table however it was considered a hardcoding. Would I need to go back to it? (issue is: interrupt numbers for EDMA channels are not even nearly sequential but they go all over the place and seem to be close to the interrupt for the served device -- for example 441 for ESAI and 442 for the channels which serve the ESAI) |
|
@paulstelian97 Channel numbers from different controllers shouldn't be an issue. Your interrupt.c implementation should handle cascaded interrupts with many children. This DMA schedule domain just enables certain interrupt numbers. Your irq API should take care of the rest. |
My issue is that the per-channel interrupts may not map nicely on the actual child controllers in my subsystem (the thing is that I have only one controller but it outputs 8 interrupt lines depending on which shared interrupt is triggered). I have one for 0-63, one for 64-127, one for 128-191 etc until one for 384-447 (which seems to capture the interrupts for now) and one for 448-511. They are separate due to using separate DSP interrupts. Each channel has its own interrupt number. Channels 6 and 7 in particular which tie to the ESAI do share the same interrupt number 442, SPDIF uses 437/438, the SAI uses several between 429 and 436 and I think I'm also getting from other audio IP interrupts outside the 384-447 range (though the manual is hard to read). They would require different names or hardcoding the SOF interrupt itself (losing out on the SOF support for cascaded interrupts at least for the lookup). The dma_name() (or similar, can't look up the macro name right now) doesn't give a channel as a parameter but the DMAC itself, which means it assumes all channels of a DMAC must have their interrupts under the same interrupt controller (which may break in our case) |
Implements DMA scheduling domain. It allows to initialize
another low latency scheduler and schedule on any DMA channel.
The functionality stays the same as the one already done in
DMA drivers e.g. DW-DMA.
Signed-off-by: Tomasz Lauda tomasz.lauda@linux.intel.com