Skip to content

Enhance rpmsg buf config#684

Open
tnmysh wants to merge 1 commit into
OpenAMP:mainfrom
tnmysh:enhance_rpmsg_buf_config
Open

Enhance rpmsg buf config#684
tnmysh wants to merge 1 commit into
OpenAMP:mainfrom
tnmysh:enhance_rpmsg_buf_config

Conversation

@tnmysh

@tnmysh tnmysh commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

@tnmysh

tnmysh commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator Author

@arnopo

we can review this one after the release.

@tnmysh tnmysh force-pushed the enhance_rpmsg_buf_config branch 2 times, most recently from 7310369 to 3474c42 Compare May 29, 2026 20:12
@tnmysh tnmysh marked this pull request as ready for review May 29, 2026 20:13
@tnmysh tnmysh requested a review from wmamills May 29, 2026 20:13
@tnmysh tnmysh force-pushed the enhance_rpmsg_buf_config branch 2 times, most recently from 6ddcf11 to 7c0b658 Compare May 30, 2026 02:47
Comment thread lib/rpmsg/rpmsg_virtio.c Outdated
return status;

if (features & (1 << VIRTIO_RPMSG_F_BUFSZ))
rvdev->config = *config;

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 you should use virtio_read_config to retrieve the config from the transport layer
Did you have a look to @xiaoxiang781216 work in #155 ?
Seems to me the good approach

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@arnopo done in latest push.

@arnopo arnopo requested a review from edmooring June 2, 2026 09:06
@tnmysh tnmysh force-pushed the enhance_rpmsg_buf_config branch 2 times, most recently from 24613a3 to 8289cfd Compare June 16, 2026 15:27
Introduce new feature bit that allows rpmsg buffer size via virtio
device config space. If the feature is available then, driver will set
single rpmsg buffer size from virtio device config space in the resource
table.

New virtio feature allows to configure rpmsg single buffer size via
virtio device config space. Hence, rx buffer size can be provided by
vdev device config space as well. If BUFSZ feature bit is set, then use
rx buffer size from the virtio config space in the resource table.

Signed-off-by: Tanmay Shah <tanmay.shah@amd.com>
@tnmysh tnmysh force-pushed the enhance_rpmsg_buf_config branch from 8289cfd to a361586 Compare June 16, 2026 15:28

@edmooring edmooring left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to go.

@wmamills wmamills requested a review from iuliana-prodan June 17, 2026 16:53
Comment thread lib/rpmsg/rpmsg_virtio.c

if (features & (1 << VIRTIO_RPMSG_F_BUFSZ))
virtio_write_config(rvdev->vdev, 0, (void *)config,
sizeof(*config));

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.

The config could be read by the virtio driver before this code is executed. For instance the Linux probes the rpmsg in parallel of the start of the remoteproc firmware based on the resource table that should contain the config.
For my here we should only read the config if VIRTIO_RPMSG_F_BUFSZ feature bit is set else we should rely on *config.
One question is: should we also mange the config write or should we consider that it is part of the resource table.

I propose to discuss this in next OpenAMP meeting

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

7/1 OpenAMP System Reference call:

  • Arnaud to confirm it is a standard pattern w/ MMIO
  • Tanmay to confirm would work to have read instead of write for current use case & update accordingly.

Allow write only for use case when it is compiled as driver.

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.

Extracted from virtio spec 1 .4:

2.5.2 Device Requirements: Device Configuration Space
The device MUST allow reading of any device-specific configuration field before FEATURES_OK is set by the driver. This includes fields which are conditional on feature bits, as long as those feature bits are offered by the device.
3.2 Device Operation
When operating the device, each field in the device configuration space can be changed by either the driver or the device.

Whenever such a configuration change is triggered by the device, driver is notified. This makes it possible for drivers to cache device configuration, avoiding expensive configuration reads unless notified.

So it seems that having a static configuration as first step is quite simple and reliable

  1. the device provides a static configuration space (in the resource table).
  2. the driver can update it until FEATURES_OK is set
  3. the device read the configuration space when DRIVER_OK is set

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.

4 participants