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]
Message-ID: <108d4a2d-a26e-43b5-9e8c-6f9bcd0d9129@foss.st.com>
Date: Wed, 4 Feb 2026 09:21:04 +0100
From: Arnaud POULIQUEN <arnaud.pouliquen@...s.st.com>
To: Peng Fan <peng.fan@....nxp.com>
CC: Bjorn Andersson <andersson@...nel.org>, Mathieu Poirier
	<mathieu.poirier@...aro.org>, <linux-remoteproc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux-stm32@...md-mailman.stormreply.com>,
	Andrew Davis <afd@...com>
Subject: Re: [PATCH v2 1/2] remoteproc: core: support fixed device index from
 DT aliases

Hi Peng,

On 2/4/26 01:57, Peng Fan wrote:
> On Wed, Jan 28, 2026 at 11:31:17AM +0100, Arnaud Pouliquen wrote:
>> On systems with multiple remote processors, the remoteproc device
>> enumeration is not stable as it depends on the probe ordering.
>> As a result, the /sys/class/remoteproc/remoteproc<x> entries do not
>> always refer to the same remote processor instance, which complicates
>> userspace applications.
>>
>> Inspired by the SPI implementation, this commit allows board-specific
>> numbering to be defined in device tree while still supporting dynamically
>> registered remote processors.
>>
>> For instance, on STM32MP25 Soc this can be used by defining:
>>
>>     aliases {
>>         rproc0 = &m33_rproc;
>>         rproc1 = &m0_rproc;
>>     };
>>
>> When a "rproc<x>" DT alias is present, use it to assign a fixed
>> "/sys/class/remoteproc/remoteproc<x>" entry.
>> If no remoteproc alias is defined, keep the legacy index allocation.
>> If only some remoteproc instances have an alias, allocate dynamic
>> index starting after the highest alias index declared.
>>
>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@...s.st.com>
> 
> Tested this patch on i.MX943-EVK(patches for this platform still in my local)
> with dual CM7 and one CM33S:
> /sys/devices/platform/imx943-cm70/remoteproc/remoteproc1/firmware
> /sys/devices/platform/imx943-cm33s/remoteproc/remoteproc0/firmware
> /sys/devices/platform/imx943-cm71/remoteproc/remoteproc2/firmware
> 
> Tested-by: Peng Fan <peng.fan@....com>
> 
> One nit below:
> 
>> ---
>> V2:
>> - Introduces rproc_get_index based on Mathieu Poirier's suggestion.
>>   An update compared to Mathieu's version is that the call to
>>   ida_alloc_range is retained if an alias is found for the remote device,
>>   to balance with ida_free().
>> - Rename DT alias stem from "remoteproc" to "rproc" to be consistent with
>>   keytone driver.
>> ---
>> drivers/remoteproc/remoteproc_core.c | 40 ++++++++++++++++++++++++++--
>> include/linux/remoteproc.h           |  3 +++
>> 2 files changed, 41 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
>> index aada2780b343..38d6eb1c9483 100644
>> --- a/drivers/remoteproc/remoteproc_core.c
>> +++ b/drivers/remoteproc/remoteproc_core.c
>> @@ -2433,6 +2433,43 @@ static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops)
>> 	return 0;
>> }
>>
>> +/**
>> + * rproc_get_index - assign a unique device index for a remote processor
>> + * @dev: device associated with the remote processor
>> + *
>> + * Look for a static index coming from the "rproc" DT alias
>> + * (e.g. "rproc0"). If none is found, start allocating
>> + * dynamic IDs after the highest alias in use.
>> + *
>> + * Return: a non-negative index on success, or a negative error code on failure.
>> + */
>> +static int rproc_get_index(struct device *dev)
>> +{
>> +	int index;
>> +
>> +	/* No DT to deal with */
>> +	if (!dev->of_node)
>> +		goto legacy;
>> +
>> +	/* See if an alias has been assigned to this remoteproc */
>> +	index = of_alias_get_id(dev->of_node, RPROC_ALIAS);
>> +	if (index >= 0)
>> +		return  ida_alloc_range(&rproc_dev_index, index, index,
>> +					GFP_KERNEL);
> 
> Nit: "return ida_alloc_range"

Thanks for the test and the review!
I will send a V3

Arnaud

> 
> Regards,
> Peng


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ