mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francesco Valla <francesco@valla.it>
To: Bjorn Andersson <andersson@kernel.org>,
	 Mathieu Poirier <mathieu.poirier@linaro.org>,
	 Tanmay Shah <tanmay.shah@amd.com>,
	 Arnaud POULIQUEN <arnaud.pouliquen@foss.st.com>
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Francesco Valla <francesco@valla.it>
Subject: [PATCH] virtio_rpmsg: fix config space alignment
Date: Sun, 01 Nov 2026 14:54:03 +0100	[thread overview]
Message-ID: <20261101-rpmsg-config-size-v1-1-65686b445b22@valla.it> (raw)

The comment for virtio_rpmsg_config says that this structure is
naturally aligned to 32 bits, and this is desirable by some
architectures that don't get along with unaligned accesses.
The content of the structure itself however isn't aligned, and the
__packed attribute prevent the compiler to add this alignment.

Fix this by adding a padding byte.

Fixes: ca96ea25e51a ("rpmsg: virtio_rpmsg_bus: Get buffer size from config space")
Signed-off-by: Francesco Valla <francesco@valla.it>
---
Hello,

unfortunately I missed this when the original patch set was sent, but I
think it's worth fixing (or at least discussing) this now before it
enters a stable kernel.

The same support in open-amp has already been merged [1], but maybe it
can be fixed before the next release there too?

Another, lower-impact solution would be to fix the comment, but that can
then led to issues on architectures that does not support unaligned
accesses (e.g.: AMR Cortex-M0).

Thank you

Francesco

[1] https://github.com/OpenAMP/open-amp/commit/744376f566c3ec7e06a7d093d785295b78aa486f
---
 include/linux/rpmsg/virtio_rpmsg.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/rpmsg/virtio_rpmsg.h b/include/linux/rpmsg/virtio_rpmsg.h
index 0872cbca4593..d24fedb63023 100644
--- a/include/linux/rpmsg/virtio_rpmsg.h
+++ b/include/linux/rpmsg/virtio_rpmsg.h
@@ -23,6 +23,7 @@
  *
  * @version:	version of this structure, currently %RPMSG_VDEV_CONFIG_V1.
  * @size:	size of this structure in bytes.
+ * @reserved:	padding, reserved for future usage.
  * @txbuf_size:	Tx buf size from remote's view. For Linux this is rx buf size.
  * @rxbuf_size:	Rx buf size from remote's view. For Linux this is tx buf size.
  *
@@ -33,6 +34,7 @@
 struct virtio_rpmsg_config {
 	u8 version;
 	__virtio16 size;
+	u8 reserved;
 	/* The tx/rx individual buffer size (if VIRTIO_RPMSG_F_BUFSZ) */
 	__virtio32 txbuf_size;
 	__virtio32 rxbuf_size;

---
base-commit: cbbddb6b08cc9900a87cccaa9b22bbe06aa4f50a
change-id: 20261101-rpmsg-config-size-0dbe9ea63c6d

Best regards,
--  
Francesco Valla <francesco@valla.it>


             reply	other threads:[~2026-11-01 13:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-01 13:54 Francesco Valla [this message]
2026-11-06 17:37 ` Mathieu Poirier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261101-rpmsg-config-size-v1-1-65686b445b22@valla.it \
    --to=francesco@valla.it \
    --cc=andersson@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=tanmay.shah@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®