From: "Michael S. Tsirkin" <mst@redhat.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: virtio-dev@lists.oasis-open.org
Subject: Re: [virtio-dev] Correct way to specify virtio_foo_config structures?
Date: Sat, 24 Dec 2022 13:26:05 -0500 [thread overview]
Message-ID: <20221224131902-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <809854E1-BB69-4639-8B53-C33E88C78E85@holtmann.org>
On Tue, Dec 20, 2022 at 03:51:13PM +0100, Marcel Holtmann wrote:
> Hi,
>
> what is the correct way for a VIRTIO_F_VERSION_1 modern device to specify the
> virtio_foo_config structure. Should I make it __attribute__((packed))? What field
> types should be used. Everything __virtio{16,32} or better __le{16,32}? Can we
> have __u8 and do they have to 16-bit or 32-bit aligned.
>
> When looking at the various examples, I see multiple combinations. What is the
> prefered virtio_cread accessor method to be used. For example the virtio_cread_le
> states something like “modern” in his comment. So the preference is to specify
> the virtio_foo_config in little-endian?
>
> Any insights are appreciated.
>
> Regards
>
> Marcel
__leXX and __u8 and things have to be size aligned (so no alignment
requirements for u8 arrays). Add explicit padding as necessary.
__attribute__((packed)) should be generally avoided.
For config access virtio_cread_le/virtio_cwrite_le are preferred.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
> For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
prev parent reply other threads:[~2022-12-24 18:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 14:51 [virtio-dev] Correct way to specify virtio_foo_config structures? Marcel Holtmann
2022-12-24 18:26 ` Michael S. Tsirkin [this message]
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=20221224131902-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=marcel@holtmann.org \
--cc=virtio-dev@lists.oasis-open.org \
/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