* [virtio-dev] Correct way to specify virtio_foo_config structures?
@ 2022-12-20 14:51 Marcel Holtmann
2022-12-24 18:26 ` Michael S. Tsirkin
0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2022-12-20 14:51 UTC (permalink / raw)
To: virtio-dev
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
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [virtio-dev] Correct way to specify virtio_foo_config structures?
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
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2022-12-24 18:26 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: virtio-dev
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-24 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox