Re: [PATCH v3] dmaengine: Add basic debugfs support

From: Peter Ujfalusi
Date: Fri Feb 28 2020 - 05:01:45 EST


Hi Vinod,

On 28/02/2020 6.47, Vinod Koul wrote:
> Hi Peter,
>
> On 26-02-20, 14:10, Peter Ujfalusi wrote:
>
>>> do we really want a custom dbg_show()..? Drivers can add their own
>>> files...
>>
>> They could do that already ;)
>>
>> With the custom dbg_show() DMA drivers can save on the surrounding
>> code and just fill in the information regarding to their HW.
>> Again, on am654 the default information is:
>> # cat /sys/kernel/debug/dmaengine
>> dma0 (285c0000.dma-controller): number of channels: 96
>>
>> dma1 (31150000.dma-controller): number of channels: 267
>> dma1chan0 | 2b00000.mcasp:tx
>> dma1chan1 | 2b00000.mcasp:rx
>> dma1chan2 | in-use
>> dma1chan3 | in-use
>> dma1chan4 | in-use
>> dma1chan5 | in-use
>>
>> With my current .dbg_show implementation for k3-udma:
>> # cat /sys/kernel/debug/dmaengine
>> dma0 (285c0000.dma-controller): number of channels: 96
>>
>> dma1 (31150000.dma-controller): number of channels: 267
>> dma1chan0 | 2b00000.mcasp:tx (MEM_TO_DEV, tchan8 [0x1008 -> 0xc400], PDMA, TR mode)
>> dma1chan1 | 2b00000.mcasp:rx (DEV_TO_MEM, rchan8 [0x4400 -> 0x9008], PDMA, TR mode)
>> dma1chan2 | in-use (MEM_TO_MEM, chan2 pair [0x1002 -> 0x9002], PSI-L Native, TR mode)
>> dma1chan3 | in-use (MEM_TO_MEM, chan3 pair [0x1003 -> 0x9003], PSI-L Native, TR mode)
>> dma1chan4 | in-use (MEM_TO_MEM, chan4 pair [0x1004 -> 0x9004], PSI-L Native, TR mode)
>> dma1chan5 | in-use (MEM_TO_MEM, chan5 pair [0x1005 -> 0x9005], PSI-L Native, TR mode)
>>
>> For me this makes a huge difference.
>
> Ok
>
>>>> +DEFINE_SHOW_ATTRIBUTE(dmaengine_debugfs);
>>>> +
>>>> +static int __init dmaengine_debugfs_init(void)
>>>> +{
>>>> + /* /sys/kernel/debug/dmaengine */
>>>> + debugfs_create_file("dmaengine", 0444, NULL, NULL,
>>>> + &dmaengine_debugfs_fops);
>>>
>>> Should we add a directory? That way we can keep adding stuff into that
>>> one
>>
>> and have this file as 'summary' underneath?
>
> Correct

/sys/kernel/debug/dmaengine/summary, right?

>> I like the fact hat I can get all the information via one file.
>> Saves a lot of time (and explaining to users) on finding the correct
>> one to cat...
>
> But am sure we can come with more data to show, so having a directory
> helps :)

OK, so we need to store the dbgfs rootdir and add an API so DMA drivers
can get the dentry of it, so they can implement their custom
files/directories underneath.

- PÃter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki