lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be615881-1eb4-f8fe-a32d-04fabb6cb27b@ti.com>
Date:   Wed, 7 Oct 2020 11:08:06 +0300
From:   Peter Ujfalusi <peter.ujfalusi@...com>
To:     Vinod Koul <vkoul@...nel.org>
CC:     <nm@...com>, <ssantosh@...nel.org>, <robh+dt@...nel.org>,
        <vigneshr@...com>, <dan.j.williams@...el.com>, <t-kristo@...com>,
        <lokeshvutla@...com>, <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <dmaengine@...r.kernel.org>
Subject: Re: [PATCH 01/18] dmaengine: of-dma: Add support for optional router
 configuration callback



On 07/10/2020 8.44, Vinod Koul wrote:
> Hi Peter,
> 
> On 30-09-20, 12:13, Peter Ujfalusi wrote:
>> Additional configuration for the DMA event router might be needed for a
>> channel which can not be done during device_alloc_chan_resources callback
>> since the router information is not yet present for the drivers.
>>
>> If there is a need for additional configuration for the channel if DMA
>> router is in use, then the driver can implement the device_router_config
>> callback.
> 
> So what is the additional information you need, I am looking at the code
> below and xlate invokes device_router_config() which driver will
> implement..

The router driver is not yet ready due to external dependencies, it will
come a bit later.

> Are you using this to configure channels based on info from DT?

Not really. In DT an event triggered channel can be requested via router
(when this is used) for example:

dmas = <&inta_l2g a b c>;
a - the input number of the DMA request in l2g
b - edge or level trigger to be selected
c - ASEL number for the channel for coherency

The l2g router driver then translate this to:
<&main_bcdma 1 0 c>
1 - Global trigger 0 is used by the DMA
0 - ignored
c - ASEL number.

The router needs to send an event which is going to be received by the
channel we have picked up, this event number can only be known when we
do have the channel.

So the flow in this case:
router converts the dma_spec for the DMA, but it does not yet know what
is the event number it has to use.
The BCDMA driver will pick an available bchan and notes that the
transfers will be triggered by global event 0.
When we have the channel, the core saves the router information and
calls the device_router_config of BCDMA.
In there we call back to the router and give the event number it has to
use to send the trigger for the channel.

>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@...com>
>> ---
>>  drivers/dma/of-dma.c      | 10 ++++++++++
>>  include/linux/dmaengine.h |  2 ++
>>  2 files changed, 12 insertions(+)
>>
>> diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
>> index 8a4f608904b9..ec00b20ae8e4 100644
>> --- a/drivers/dma/of-dma.c
>> +++ b/drivers/dma/of-dma.c
>> @@ -75,8 +75,18 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec,
>>  		ofdma->dma_router->route_free(ofdma->dma_router->dev,
>>  					      route_data);
>>  	} else {
>> +		int ret = 0;
>> +
>>  		chan->router = ofdma->dma_router;
>>  		chan->route_data = route_data;
>> +
>> +		if (chan->device->device_router_config)
>> +			ret = chan->device->device_router_config(chan);
>> +
>> +		if (ret) {
>> +			dma_release_channel(chan);
>> +			chan = ERR_PTR(ret);
>> +		}
>>  	}
>>  
>>  	/*
>> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
>> index dd357a747780..d6197fe875af 100644
>> --- a/include/linux/dmaengine.h
>> +++ b/include/linux/dmaengine.h
>> @@ -800,6 +800,7 @@ struct dma_filter {
>>   *	by tx_status
>>   * @device_alloc_chan_resources: allocate resources and return the
>>   *	number of allocated descriptors
>> + * @device_router_config: optional callback for DMA router configuration
>>   * @device_free_chan_resources: release DMA channel's resources
>>   * @device_prep_dma_memcpy: prepares a memcpy operation
>>   * @device_prep_dma_xor: prepares a xor operation
>> @@ -874,6 +875,7 @@ struct dma_device {
>>  	enum dma_residue_granularity residue_granularity;
>>  
>>  	int (*device_alloc_chan_resources)(struct dma_chan *chan);
>> +	int (*device_router_config)(struct dma_chan *chan);
>>  	void (*device_free_chan_resources)(struct dma_chan *chan);
>>  
>>  	struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
>> -- 
>> Peter
>>
>> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
>> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

- Péter

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ