[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC 06/13] rust: add bindings for memattrs
From: |
Zhao Liu |
Subject: |
Re: [RFC 06/13] rust: add bindings for memattrs |
Date: |
Fri, 6 Dec 2024 16:41:29 +0800 |
On Thu, Dec 05, 2024 at 05:51:42PM -0600, Richard Henderson wrote:
> Date: Thu, 5 Dec 2024 17:51:42 -0600
> From: Richard Henderson <richard.henderson@linaro.org>
> Subject: Re: [RFC 06/13] rust: add bindings for memattrs
>
> On 12/5/24 12:30, Paolo Bonzini wrote:
> > On 12/5/24 19:15, Richard Henderson wrote:
> > > On 12/5/24 00:07, Zhao Liu wrote:
> > > > The MemTxAttrs structure is composed of bitfield members, and bindgen is
> > > > unable to generate an equivalent macro definition for
> > > > MEMTXATTRS_UNSPECIFIED.
> > >
> > > I'm happy to move away from bit fields to uint32_t or suchlike to
> > > enable MEMTXATTRS_UNSPECIFIED be a compile-time constant.
> >
> > Yeah, if we go from
> >
> > typedef struct MemTxAttrs {
> > unsigned int unspecified:1;
> > unsigned int secure:1;
> > unsigned int space:2;
> > unsigned int user:1;
> > unsigned int memory:1;
> > unsigned int requester_id:16;
> > unsigned int pid:8;
> > } MemTxAttrs;
> >
> > to
> >
> > typedef struct MemTxAttrs {
> > uint8_t unspecified;
> > uint8_t secure;
> > uint8_t space;
> > uint8_t user;
> > uint8_t memory;
> > uint8_t pid;
> > uint16_t requester_id;
> > } MemTxAttrs;
> >
> > is still decently packed and simplifies things a lot. Zhao, can you
> > submit that as an independent patch?
> Hmm. I'd been thinking of uint32_t and hw/registerfields.h, but I have not
> scoped the size of that conversion.
>
> But short of that, please use 'bool' not 'uint8_t' for those single-bit flags.
>
Sure! Thank u both!
BTW, may I ask why you favor bool over uint8_t, and is it because they
are indeed just 0/1 as well? :)
Thanks,
Zhao
- Re: [RFC 04/13] rust: add bindings for gpio_{in|out} initialization, (continued)
[RFC 05/13] rust: add a bit operation binding for deposit64, Zhao Liu, 2024/12/05
[RFC 06/13] rust: add bindings for memattrs, Zhao Liu, 2024/12/05
Re: [RFC 06/13] rust: add bindings for memattrs, Peter Maydell, 2024/12/06
Re: [RFC 06/13] rust: add bindings for memattrs, Paolo Bonzini, 2024/12/06
Re: [RFC 06/13] rust: add bindings for memattrs, Peter Maydell, 2024/12/06
Re: [RFC 06/13] rust: add bindings for memattrs, Paolo Bonzini, 2024/12/06
Re: [RFC 06/13] rust: add bindings for memattrs, Philippe Mathieu-Daudé, 2024/12/07
Re: [RFC 06/13] rust: add bindings for memattrs, Paolo Bonzini, 2024/12/08
Re: [RFC 06/13] rust: add bindings for memattrs, Zhao Liu, 2024/12/08
[RFC 07/13] rust: add bindings for timer, Zhao Liu, 2024/12/05