[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC 06/13] rust: add bindings for memattrs
From: |
Peter Maydell |
Subject: |
Re: [RFC 06/13] rust: add bindings for memattrs |
Date: |
Fri, 6 Dec 2024 10:59:35 +0000 |
On Thu, 5 Dec 2024 at 18:30, Paolo Bonzini <pbonzini@redhat.com> 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.
The old struct is 4 bytes, and the new one is 8 bytes. We do
a lot of directly passing 'struct MemTxAttrs' arguments around
as arguments to functions (i.e. not passing pointers to them),
so increasing it in size is not completely free.
thanks
-- PMM
- [RFC 05/13] rust: add a bit operation binding for deposit64, (continued)
- [RFC 06/13] rust: add bindings for memattrs, Zhao Liu, 2024/12/05
- Re: [RFC 06/13] rust: add bindings for memattrs,
Peter Maydell <=
- 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