From: Harald Mommer <harald.mommer@opensynergy.com>
To: Mark Brown <broonie@kernel.org>, Haixu Cui <quic_haixcui@quicinc.com>
Cc: virtio-dev@lists.oasis-open.org,
virtio-comment@lists.oasis-open.org, cohuck@redhat.com,
quic_ztu@quicinc.com
Subject: Re: [virtio-dev] [PATCH v4] virtio-spi: add the device specification
Date: Wed, 8 Nov 2023 19:37:18 +0100 [thread overview]
Message-ID: <59a014d3-5027-4a5c-836c-3a433dfad994@opensynergy.com> (raw)
In-Reply-To: <ZUuxfbkSboAFQIQF@finisterre.sirena.org.uk>
On 08.11.23 17:04, Mark Brown wrote:
> On Wed, Nov 08, 2023 at 11:42:40PM +0800, Haixu Cui wrote:
>> On 11/6/2023 9:33 PM, Mark Brown wrote:
>>> On Tue, Oct 24, 2023 at 08:53:46PM +0800, Haixu Cui wrote:
>>>> + le16 bus_num;
>>>> + le16 chip_select_max_number;
>>> That's a *lot* of potential buses and chip selects...
>> Here you mean the types of bus_num and chip_select_max_number are "le16"?
>> Here I use 16 bits because bus_num and num_chipselect in spi_controller
>> structure are both 16 bits.
> Yeah, I think that's more for padding/alignment reasons than anything
> else. TBH I wondered if just going for a standard int might be better,
> it's the combination of picking a smaller type but one that's relatively
> large for the domain.
We cannot use int at interfaces between device and driver in the virtio
world:
- "int" is machine dependent, sizeof may be 2, 4 or 8.
- It is signed which would be new for the virtio specification. Not done
for other devices.
- How are signs represented? 2s complement? Strange machines do not use
2s complement. Good is that most of those strange machines have still
tubes and are by now obsolete.
- The endianess is machine dependent and device and driver may use
internally a different native byte ordering. Strange but this is imaginable.
le16 is a well defined unsigned type with sizeof 2 bytes and endianess
defined as "little endian".
> What byte ordering are the multi-byte words in - CPU native or a
> particular endianness (eg, wire native)?
Virtio uses little endian. (Some data structures in the RPMB device use
big endian. But this is an exception and there this was done for a good
reason.)
---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org
next prev parent reply other threads:[~2023-11-08 18:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 12:53 [virtio-dev] [PATCH v4] virtio-spi: add the device specification Haixu Cui
2023-10-24 13:08 ` [virtio-dev] " Haixu Cui
2023-11-07 7:40 ` [virtio-dev] " Qiang Zhang
2023-11-09 2:52 ` Haixu Cui
2023-11-09 3:39 ` Qiang Zhang
2023-11-09 10:21 ` Haixu Cui
2023-11-13 1:37 ` Qiang Zhang
[not found] ` <56fbe6cc-d7a5-438f-1dd2-939f4197a970@opensynergy.com>
2023-11-07 17:10 ` [virtio-dev] " Haixu Cui
[not found] ` <ZUjrDjHpFVReDSgk@finisterre.sirena.org.uk>
2023-11-08 15:42 ` [virtio-dev] " Haixu Cui
[not found] ` <ZUuxfbkSboAFQIQF@finisterre.sirena.org.uk>
2023-11-08 18:37 ` Harald Mommer [this message]
2023-11-09 11:21 ` Haixu Cui
[not found] ` <ZUzaZt4flHQgsBzu@finisterre.sirena.org.uk>
2023-11-10 2:37 ` Haixu Cui
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=59a014d3-5027-4a5c-836c-3a433dfad994@opensynergy.com \
--to=harald.mommer@opensynergy.com \
--cc=broonie@kernel.org \
--cc=cohuck@redhat.com \
--cc=quic_haixcui@quicinc.com \
--cc=quic_ztu@quicinc.com \
--cc=virtio-comment@lists.oasis-open.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