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.
r~