Hello all,
I found out that there is discrepancy between remoteproc state
definition in kernel and open-amp library:
Linux kernel side definition:
https://github.com/torvalds/linux/blob/52da431bf03b5506203bca27fe14a97895c8…
enum rproc_state {
RPROC_OFFLINE = 0,
RPROC_SUSPENDED = 1,
RPROC_RUNNING = 2,
RPROC_CRASHED = 3,
RPROC_DELETED = 4,
RPROC_ATTACHED = 5,
RPROC_DETACHED = 6,
RPROC_LAST = 7,
};
open-amp library side definition:
https://github.com/OpenAMP/open-amp/blob/391671ba24840833d882c1a75c5d730770…
/**
* @brief Remote processor states
*/
enum remoteproc_state {
/** Remote is offline */
RPROC_OFFLINE = 0,
/** Remote is configured */
RPROC_CONFIGURED = 1,
/** Remote is ready to start */
RPROC_READY = 2,
/** Remote is up and running */
RPROC_RUNNING = 3,
/** Remote is suspended */
RPROC_SUSPENDED = 4,
/** Remote is has error; need to recover */
RPROC_ERROR = 5,
/** Remote is stopped */
RPROC_STOPPED = 6,
/** Just keep this one at the end */
RPROC_LAST = 7,
};
IIUC, both side state definition should match, so that if remote needs
to report crash error, it can use same name and mapped int value in the
code. Please let me know if I am missing something in this understanding.
Should we fix this?
If so, I believe it should be library side.
I am looking for suggestion to fix this without breaking backward
compatibility:
Approach 1: deprecate library side remoteproc_state definition.
deprecate current enum (with __deprecated attribute or add comment) and
introduce new one with same definition as in linux kernel. Then after 2
year (as per code of conduct policy) we can remove remoteproc_state.
Approach 2: Platform driver uses library side remoteproc state definition.
If we don't want to fix this, then another approach is, platform driver
in linux kernel should have library-side remoteproc state definition and
convert interprete it to kernel side remoteproc definition.
With this second approach we don't have to deprecate anything, but
platform drivers are responsible to maintain different remoteproc_state
definition. (Might create confusion).
I am open to any other suggestion regarding this.
Thanks,
Tanmay
[AMD Official Use Only - AMD Internal Distribution Only]
Hello All,
Presently for the OpenAMP Legacy Demos available in the community system reference repo the interrupt mechanism involves Libmetal APIs directly writing to control registers. This is an issue because it is clearly coupling the demos to vendor-specific logic.
If we could instead have a refactor of demos without the vendor-specific interrupt register writes this would be a code clean up.
[1] In one of the Libmetal-supported OS's, Zephyr there is already IPM support, though it is being deprecated as we have been told upstream.
[2][3] That being said, there is already mailbox support in Zephyr and AMD is upstreaming support for this too.
In order to (a) clean up the vendor-specific register writes and (b) add a generic mailbox support to Libmetal libraries below is a proposal for a patch series.
1. Add mailbox support - lib/mbox.h - descripe APIs for init, deinit, send and receive.
2. Add stubs for baremetal for the above APIs
3. Add stubs for freertos for the above APIs.
4. Add implementation for Zephyr with:
- init - As Zephyr OS statically defines mailbox structures today based on device tree, this will simply store the mailbox structure [4]
- deinit - free mailbox
- send/receive will simply wrap around the Zephyr APIs for mbox send/receive
1. https://github.com/OpenAMP/libmetal/tree/main/lib/system/zephyr
2. https://github.com/zephyrproject-rtos/zephyr/tree/main/drivers/mbox
3. (pull request pending)
4. https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/drivers/mbox
Branch: refs/heads/main
Home: https://github.com/OpenAMP/libmetal
Commit: 41c83bcffd61b36d4e2dc3d083bc5b98c1682f5e
https://github.com/OpenAMP/libmetal/commit/41c83bcffd61b36d4e2dc3d083bc5b98…
Author: Andrew Davis <afd(a)ti.com>
Date: 2025-06-20 (Fri, 20 Jun 2025)
Changed paths:
M lib/irq.h
M lib/system/freertos/CMakeLists.txt
R lib/system/freertos/irq.h
M lib/system/generic/CMakeLists.txt
R lib/system/generic/irq.h
M lib/system/linux/device.c
M lib/system/nuttx/CMakeLists.txt
M lib/system/nuttx/init.c
M lib/system/nuttx/irq.c
M lib/system/zephyr/CMakeLists.txt
R lib/system/zephyr/irq.h
Log Message:
-----------
lib: Remove system specific irq.h files
Many of the system specific irq.h files are empty, and those that
are not are only used by the internal IRQ handling functions.
Remove the empty ones and do not expose the contents of the
internal ones outside of the compilation unit that uses them.
Signed-off-by: Andrew Davis <afd(a)ti.com>
Commit: a2bf06dc3ee878edcad282d41d06e5b9c049f0e5
https://github.com/OpenAMP/libmetal/commit/a2bf06dc3ee878edcad282d41d06e5b9…
Author: Andrew Davis <afd(a)ti.com>
Date: 2025-06-20 (Fri, 20 Jun 2025)
Changed paths:
M lib/log.h
M lib/system/freertos/CMakeLists.txt
R lib/system/freertos/log.h
M lib/system/generic/CMakeLists.txt
R lib/system/generic/log.h
M lib/system/linux/CMakeLists.txt
R lib/system/linux/log.h
M lib/system/nuttx/CMakeLists.txt
R lib/system/nuttx/log.h
M lib/system/nuttx/sys.h
M lib/system/zephyr/sys.h
Log Message:
-----------
lib: Remove system specific log.h files
Most of the system specific log.h files are empty, and those that
are not are only used by the internal log handling functions.
Remove the empty ones and do not expose the contents of the
internal ones outside of the compilation unit that uses them.
Signed-off-by: Andrew Davis <afd(a)ti.com>
Compare: https://github.com/OpenAMP/libmetal/compare/96c7cd26dca9...a2bf06dc3ee8
To unsubscribe from these emails, change your notification settings at https://github.com/OpenAMP/libmetal/settings/notifications
On 6/19/25 10:53 AM, Mathieu Poirier wrote:
> Good morning,
>
> On Wed, 18 Jun 2025 at 10:44, Tanmay Shah <tanmay.shah(a)amd.com> wrote:
>>
>> Hello all,
>>
>> I found out that there is discrepancy between remoteproc state
>> definition in kernel and open-amp library:
>>
>> Linux kernel side definition:
>>
>> https://github.com/torvalds/linux/blob/52da431bf03b5506203bca27fe14a97895c8…
>>
>>
>> enum rproc_state {
>> RPROC_OFFLINE = 0,
>> RPROC_SUSPENDED = 1,
>> RPROC_RUNNING = 2,
>> RPROC_CRASHED = 3,
>> RPROC_DELETED = 4,
>> RPROC_ATTACHED = 5,
>> RPROC_DETACHED = 6,
>> RPROC_LAST = 7,
>> };
>>
>> open-amp library side definition:
>>
>> https://github.com/OpenAMP/open-amp/blob/391671ba24840833d882c1a75c5d730770…
>>
>> /**
>> * @brief Remote processor states
>> */
>> enum remoteproc_state {
>> /** Remote is offline */
>> RPROC_OFFLINE = 0,
>> /** Remote is configured */
>> RPROC_CONFIGURED = 1,
>> /** Remote is ready to start */
>> RPROC_READY = 2,
>> /** Remote is up and running */
>> RPROC_RUNNING = 3,
>> /** Remote is suspended */
>> RPROC_SUSPENDED = 4,
>> /** Remote is has error; need to recover */
>> RPROC_ERROR = 5,
>> /** Remote is stopped */
>> RPROC_STOPPED = 6,
>> /** Just keep this one at the end */
>> RPROC_LAST = 7,
>> };
>>
>> IIUC, both side state definition should match, so that if remote needs
>> to report crash error, it can use same name and mapped int value in the
>> code. Please let me know if I am missing something in this understanding.
>>
>> Should we fix this?
>>
>
> The kernel's remoteproc subsystem and openAMP library are two
> independent projects. OpenAMP does its own governance but I
> personally don't see a reason to harmonize the value of their internal
> states.
>
> Thanks,
> Mathieu
>
Thanks Mathieu for your response. Yes we are reaching the same conclusion.
>> If so, I believe it should be library side.
>>
>> I am looking for suggestion to fix this without breaking backward
>> compatibility:
>>
>> Approach 1: deprecate library side remoteproc_state definition.
>>
>> deprecate current enum (with __deprecated attribute or add comment) and
>> introduce new one with same definition as in linux kernel. Then after 2
>> year (as per code of conduct policy) we can remove remoteproc_state.
>>
>> Approach 2: Platform driver uses library side remoteproc state definition.
>>
>> If we don't want to fix this, then another approach is, platform driver
>> in linux kernel should have library-side remoteproc state definition and
>> convert interprete it to kernel side remoteproc definition.
>>
>> With this second approach we don't have to deprecate anything, but
>> platform drivers are responsible to maintain different remoteproc_state
>> definition. (Might create confusion).
>>
>>
>> I am open to any other suggestion regarding this.
>>
>> Thanks,
>> Tanmay
>>
Branch: refs/heads/main
Home: https://github.com/OpenAMP/libmetal
Commit: 96c7cd26dca9b99986441d5e4dced0bb66e0ea4f
https://github.com/OpenAMP/libmetal/commit/96c7cd26dca9b99986441d5e4dced0bb…
Author: Vincenzo Calabretta <vincenzo.calabretta(a)embedded-brains.de>
Date: 2025-06-02 (Mon, 02 Jun 2025)
Changed paths:
M test/system/linux/threads.c
Log Message:
-----------
system: linux: include missing headers
Do not rely on indirect includes since they may not be present on some
systems.
Signed-off-by: Vincenzo Calabretta <vincenzo.calabretta(a)embedded-brains.de>
To unsubscribe from these emails, change your notification settings at https://github.com/OpenAMP/libmetal/settings/notifications