From: Cornelia Huck <cohuck@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Halil Pasic <pasic@linux.vnet.ibm.com>,
virtio@lists.oasis-open.org, virtio-dev@lists.oasis-open.org,
Tiwei Bie <tiwei.bie@intel.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Dhanoa, Kully" <kully.dhanoa@intel.com>
Subject: [virtio] Re: [virtio-dev] Re: [virtio] Re: [PATCH v9 14/16] VIRTIO_F_NOTIFICATION_DATA: extra data to devices
Date: Fri, 9 Mar 2018 09:16:46 +0100 [thread overview]
Message-ID: <20180309091646.362231d7.cohuck@redhat.com> (raw)
In-Reply-To: <20180308180221-mutt-send-email-mst@kernel.org>
On Thu, 8 Mar 2018 18:19:39 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Thu, Mar 08, 2018 at 02:03:31PM +0100, Halil Pasic wrote:
> > One stray idea was something like
> >
> > be32 (A:16;B:15;C:1);
> >
> > With
> > * A occupying bits 0-15
> > * B occupying bits 16-30
> > * C occupying bit 30
> >
> > And bit n of B (n \in [0..15] being the n-16-th bit of the be32
> > subdivided into fields.
> >
> > The idea behind () is that it ain't unusual for tuples, and
> > also the most common grouping semantic is fitting in a sense
> > that all the fields are together the be32. The separation by
> > semicolon is to make it obvious that this has nothing to do
> > with C and that it's not intended to be implemented with C
> > bit-fields.
>
> OK let's look at a real life example:
>
> struct desc_event {
> le16 (
> desc_event_off : 15; /* Descriptor Event Offset */
> desc_event_wrap : 1; /* Descriptor Event Wrap Counter */
> );
> le16 (
> desc_event_flags : 2; /* Descriptor Event Flags */
> reserved : 14; /* Reserved, set to 0 */
> );
> };
>
> As an option (2), I suggest curly brackets which look a bit more
> consistent:
>
> struct desc_event {
> le16 {
> desc_event_off : 15; /* Descriptor Event Offset */
> desc_event_wrap : 1; /* Descriptor Event Wrap Counter */
> };
> le16 {
> desc_event_flags : 2; /* Descriptor Event Flags */
> reserved : 14; /* Reserved, set to 0 */
> };
> };
>
> Cornelia, Halil - any preferences? Ack on one of the above two?
OK, both make it more obvious what is going on there. I think I prefer
option 2 (curly braces).
>
> introduction text accordingly (using curly braces, will adopt
> accordingly):
>
> When documenting sub-byte data fields, C-like bitfield notation is used.
> Fields within an integer are always listed in order, with their lengths,
> from the least significant to the most significant bit. The fields
> are considered unsigned integers of the specified width with the next in
> significance relationship on the bits preserved.
>
> For example:
> \begin{lstlisting}
> struct S {
> be16 {
> A : 15;
> B : 1;
> };
> be16 C;
> }
> \end{lstlisting}
> documents the value A stored in the low 15 bit of a 16 bit
> integer and the value B stored in the high bit of the 16 bit
> integer, the integer in turn using the big-endian byte order
> and being stored at the beginning of the structure S,
> and being followed immediately by an unsigned integer C
add "in big-endian byte order"?
> stored at offset of 2 bytes (16 bits) from the beginning of
> the structure.
>
> Note that this notation somewhat resembles the C bitfield syntax but
> should not be naively converted to a bitfield notation for portable
> code: it matches the way bitfields are packed by C compilers on
> little-endian architectures but not the way bitfields are packed by C
> compilers on big-endian architectures.
>
> Assuming that CPU_TO_BE16 converts a 16-bit integer from a native
> CPU to the big-endian byte order, the following is the equivalent
> portable C code to generate a value in this format:
"(the first value in the example above)"?
> \begin{lstlisting}
> CPU_TO_BE16(B << 15 | A)
> \end{lstlisting}
Looks sane.
[I'll not be around for further discussions in the next two weeks, but
I'd vote on the issue on OASIS, should you decide to put up a vote.]
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that
generates this mail. Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
next prev parent reply other threads:[~2018-03-09 8:16 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 23:31 [virtio] [PATCH v9 00/16] packed ring layout spec Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 01/16] introduction: document bitfield notation Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 02/16] content: move 1.0 queue format out to a separate section Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 03/16] content: move ring text out to a separate file Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 04/16] content: move virtqueue operation description Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 05/16] content: len -> used length, used ring -> vq Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 06/16] content: generalize transport ring part naming Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 07/16] content: generalize rest of text Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 08/16] split-ring: generalize text Michael S. Tsirkin
2018-03-07 11:00 ` [virtio] " Cornelia Huck
2018-03-09 22:56 ` Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 09/16] split-ring: typo: aligment Michael S. Tsirkin
2018-03-07 10:56 ` [virtio] " Cornelia Huck
2018-02-28 23:31 ` [virtio] [PATCH v9 11/16] content: in-order buffer use Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 10/16] packed virtqueues: more efficient virtqueue layout Michael S. Tsirkin
2018-03-07 13:47 ` [virtio] " Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 13/16] split-ring: in order feature Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 12/16] packed-ring: add in order support Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 14/16] VIRTIO_F_NOTIFICATION_DATA: extra data to devices Michael S. Tsirkin
2018-03-07 11:11 ` [virtio] " Cornelia Huck
2018-03-07 14:09 ` Michael S. Tsirkin
2018-03-07 14:49 ` Cornelia Huck
2018-03-07 15:10 ` Michael S. Tsirkin
2018-03-07 15:13 ` Cornelia Huck
2018-03-07 16:05 ` Halil Pasic
2018-03-07 16:14 ` Cornelia Huck
2018-03-07 19:53 ` Michael S. Tsirkin
2018-03-08 13:03 ` [virtio] Re: [virtio-dev] " Halil Pasic
2018-03-08 16:19 ` Michael S. Tsirkin
2018-03-09 8:16 ` Cornelia Huck [this message]
2018-03-09 12:25 ` Halil Pasic
2018-03-09 16:52 ` Michael S. Tsirkin
2018-03-07 19:27 ` Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH v9 15/16] makediff: update to show diff from master Michael S. Tsirkin
2018-02-28 23:31 ` [virtio] [PATCH dont commit v9 16/16] REVISION: set to 1.1 packed wd09 Michael S. Tsirkin
2018-03-09 17:06 ` [virtio] Re: [PATCH v9 00/16] packed ring layout spec Michael S. Tsirkin
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=20180309091646.362231d7.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=kully.dhanoa@intel.com \
--cc=mst@redhat.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=stefanha@redhat.com \
--cc=tiwei.bie@intel.com \
--cc=virtio-dev@lists.oasis-open.org \
--cc=virtio@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