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] [day] [month] [year] [list]
Date:   Mon, 3 Aug 2020 15:56:44 +0300
From:   Peter Ujfalusi <peter.ujfalusi@...com>
To:     Vinod Koul <vkoul@...nel.org>
CC:     <dmaengine@...r.kernel.org>, <dan.j.williams@...el.com>,
        <linux-arm-kernel@...ts.infradead.org>, <nm@...com>,
        <grygorii.strashko@...com>, <lokeshvutla@...com>, <nsekhar@...com>,
        <kishon@...com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] dmaengine: ti: k3-psil: Use soc_device_match to get
 the psil map



On 03/08/2020 14.14, Vinod Koul wrote:
> On 03-08-20, 13:11, Peter Ujfalusi wrote:
>> Instead of separate of_machine_is_compatible() it is better to use
>> soc_device_match() and soc_device_attribute struct to get the PSI-L map
>> for the booted device.
>>
>> By using soc_device_match() it is easier to add support for new devices.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@...com>
>> ---
>>  drivers/dma/ti/k3-psil.c | 19 ++++++++++++++-----
>>  1 file changed, 14 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/dma/ti/k3-psil.c b/drivers/dma/ti/k3-psil.c
>> index fb7c8150b0d1..3ca29aabac93 100644
>> --- a/drivers/dma/ti/k3-psil.c
>> +++ b/drivers/dma/ti/k3-psil.c
>> @@ -9,11 +9,18 @@
>>  #include <linux/init.h>
>>  #include <linux/mutex.h>
>>  #include <linux/of.h>
>> +#include <linux/sys_soc.h>
>>  
>>  #include "k3-psil-priv.h"
>>  
>>  static DEFINE_MUTEX(ep_map_mutex);
>> -static struct psil_ep_map *soc_ep_map;
>> +static const struct psil_ep_map *soc_ep_map;
>> +
>> +static const struct soc_device_attribute k3_soc_devices[] = {
>> +	{ .family = "AM65X", .data = &am654_ep_map },
>> +	{ .family = "J721E", .data = &j721e_ep_map },
>> +	{ /* sentinel */ }
>> +};
>>  
>>  struct psil_endpoint_config *psil_get_ep_config(u32 thread_id)
>>  {
>> @@ -21,15 +28,17 @@ struct psil_endpoint_config *psil_get_ep_config(u32 thread_id)
>>  
>>  	mutex_lock(&ep_map_mutex);
>>  	if (!soc_ep_map) {
>> -		if (of_machine_is_compatible("ti,am654")) {
>> -			soc_ep_map = &am654_ep_map;
>> -		} else if (of_machine_is_compatible("ti,j721e")) {
>> -			soc_ep_map = &j721e_ep_map;
>> +		const struct soc_device_attribute *soc;
>> +
>> +		soc = soc_device_match(k3_soc_devices);
>> +		if (soc) {
>> +			soc_ep_map = soc->data;
>>  		} else {
>>  			pr_err("PSIL: No compatible machine found for map\n");
>>  			mutex_unlock(&ep_map_mutex);
>>  			return ERR_PTR(-ENOTSUPP);
>>  		}
>> +
> 
> not related

True, I'll drop it.

> 
>>  		pr_debug("%s: Using map for %s\n", __func__, soc_ep_map->name);
>>  	}
>>  	mutex_unlock(&ep_map_mutex);

Thanks,
- 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