Skip to content

examples: libmetal: amd_rpu: Fix dynamic config setup#102

Open
bentheredonethat wants to merge 6 commits into
OpenAMP:mainfrom
bentheredonethat:libmetal-rpu-shel-update
Open

examples: libmetal: amd_rpu: Fix dynamic config setup#102
bentheredonethat wants to merge 6 commits into
OpenAMP:mainfrom
bentheredonethat:libmetal-rpu-shel-update

Conversation

@bentheredonethat
Copy link
Copy Markdown
Contributor

Linux side allows user to specify non-cotniguous descriptor and data regions

ensure RPU side does the same

also include some stylistic fixes and 1 MPU fix

@arnopo arnopo requested review from arnopo, edmooring and tnmysh April 8, 2026 07:56
metal_irq_disable(ch->irq_vector_id);
metal_irq_unregister(ch->irq_vector_id);
memset(&ch, 0, sizeof(ch));
memset(ch, 0, sizeof(*ch));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is a fix of existing code. could you create a specific commit for this, please?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bentheredonethat: Does my comment make sense? Does it fix a bug in the existing code, or should we consider that the code does not work without the entire PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @arnopo your comment makes sense. As this is in cleanup, not init it does not 'break' the demo :) but still valid yes?

Comment thread examples/libmetal/machine/remote/amd_rpu/platform_init.c
Comment thread examples/libmetal/demos/irq_shmem_demo/remote/irq_shmem_demo.c Outdated
@bentheredonethat bentheredonethat force-pushed the libmetal-rpu-shel-update branch from 7d6939c to 50b0d63 Compare April 8, 2026 15:01
Comment thread examples/libmetal/machine/remote/amd_rpu/system/freertos/amp_demo_os.h Outdated
Use members of channel struct when able as opposed to locals

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Cosmetic change for remote side - have libraries ordered
alphabetically

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
As the host application now uses 3 shared mem areas that can be non-contiguous
ensure that remote side accounts for this too.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Set first 2G MPU Region as same flags as libmetal demo
to ensure MPU regions dont get incorrectly created
by BSP

This will go away once overlapping region adjustment
is fixed in BSP

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Fix bug in call to memset(), pass struct channel_s *,
not struct channel_s **

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
Move the shared irq_shmem_demo channel definition into a demo-level
header and keep platform-specific state behind a machine_ctx pointer.

This removes the duplicated channel_s definitions from the host and
remote OS headers and makes the separation between common transport
state and platform-private state clearer.

Also export the demo common include directory through CMake so the
shared header can be included directly as irq_shmem_demo.h instead of
using deep relative include paths.

Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
@bentheredonethat bentheredonethat force-pushed the libmetal-rpu-shel-update branch from 50b0d63 to b735d10 Compare April 20, 2026 16:16
@bentheredonethat
Copy link
Copy Markdown
Contributor Author

Hi @arnopo i have incorporated the machine context changes - thanks

Copy link
Copy Markdown
Collaborator

@arnopo arnopo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems close to be good to go, one comment ( with several instances) + a pending comment from my previous review

int ret;

metal_assert(ch);
metal_assert(ch->machine_ctx);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use local variable here:

struct channel_machine_ctx_s *machine = channel_machine_ctx(ch);

metal_assert(task);

ch->task = task;
channel_machine_ctx(ch)->task = task;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

metal _assert(ch) already executed in channel_machine_ctx(ch)

metal_assert(ch);

ch->irq_pending = (atomic_flag)ATOMIC_FLAG_INIT;
channel_machine_ctx(ch)->irq_pending = (atomic_flag)ATOMIC_FLAG_INIT;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here use a local variable and remove assert

@@ -73,7 +77,7 @@ static inline void system_suspend(struct channel_s *ch)
static inline void system_resume(struct channel_s *ch)
{
metal_assert(ch);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useless as done in channel_machine_ctx

metal_irq_disable(ch->irq_vector_id);
metal_irq_unregister(ch->irq_vector_id);
memset(&ch, 0, sizeof(ch));
memset(ch, 0, sizeof(*ch));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bentheredonethat: Does my comment make sense? Does it fix a bug in the existing code, or should we consider that the code does not work without the entire PR?

Copy link
Copy Markdown
Contributor Author

@bentheredonethat bentheredonethat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see review comment -- i can fix cleanup

metal_irq_disable(ch->irq_vector_id);
metal_irq_unregister(ch->irq_vector_id);
memset(&ch, 0, sizeof(ch));
memset(ch, 0, sizeof(*ch));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @arnopo your comment makes sense. As this is in cleanup, not init it does not 'break' the demo :) but still valid yes?

@bentheredonethat
Copy link
Copy Markdown
Contributor Author

Hi @arnopo thanks for this cycle of review -- will fix each comment

@bentheredonethat
Copy link
Copy Markdown
Contributor Author

Hi @arnopo can i also send in a patch for linux side we have for internally working case where linux does not do lopper / SDT stuff? just have a script to setup linux side via a Device tree crawl + discovery script

@nathalie-ckc
Copy link
Copy Markdown
Collaborator

Ben will submit PR to libmetal library to avoid need for script

@bentheredonethat
Copy link
Copy Markdown
Contributor Author

bentheredonethat commented May 6, 2026

related libmetal PR OpenAMP/libmetal#365 -- let us please review and agree on this then i can come back to pick this up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants