memattrs: Convert unspecified member to bool
Convert `unspecified` member of MemTxAttrs from bit field to bool, so that bindgen could generate more ergonomic Rust binding with bool type. As a result, MemTxAttrs needs to be expanded from 4 bytes to 8 bytes. Therefore, move `unspecified` to after the bit fields and add reserved members to ensure that the whole structure is packed into 8 bytes. Suggested-by: Richard Henderson <richard.henderson@linaro.org> Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250121151322.171832-2-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
06a1cfb555
commit
5014e33b1e
@ -23,12 +23,6 @@
|
|||||||
* different semantics.
|
* different semantics.
|
||||||
*/
|
*/
|
||||||
typedef struct MemTxAttrs {
|
typedef struct MemTxAttrs {
|
||||||
/* Bus masters which don't specify any attributes will get this
|
|
||||||
* (via the MEMTXATTRS_UNSPECIFIED constant), so that we can
|
|
||||||
* distinguish "all attributes deliberately clear" from
|
|
||||||
* "didn't specify" if necessary.
|
|
||||||
*/
|
|
||||||
unsigned int unspecified:1;
|
|
||||||
/*
|
/*
|
||||||
* ARM/AMBA: TrustZone Secure access
|
* ARM/AMBA: TrustZone Secure access
|
||||||
* x86: System Management Mode access
|
* x86: System Management Mode access
|
||||||
@ -57,6 +51,17 @@ typedef struct MemTxAttrs {
|
|||||||
* PID (PCI PASID) support: Limited to 8 bits process identifier.
|
* PID (PCI PASID) support: Limited to 8 bits process identifier.
|
||||||
*/
|
*/
|
||||||
unsigned int pid:8;
|
unsigned int pid:8;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bus masters which don't specify any attributes will get this
|
||||||
|
* (via the MEMTXATTRS_UNSPECIFIED constant), so that we can
|
||||||
|
* distinguish "all attributes deliberately clear" from
|
||||||
|
* "didn't specify" if necessary.
|
||||||
|
*/
|
||||||
|
bool unspecified;
|
||||||
|
|
||||||
|
uint8_t _reserved1;
|
||||||
|
uint16_t _reserved2;
|
||||||
} MemTxAttrs;
|
} MemTxAttrs;
|
||||||
|
|
||||||
/* Bus masters which don't specify any attributes will get this,
|
/* Bus masters which don't specify any attributes will get this,
|
||||||
@ -64,7 +69,7 @@ typedef struct MemTxAttrs {
|
|||||||
* (so that we can distinguish "all attributes deliberately clear"
|
* (so that we can distinguish "all attributes deliberately clear"
|
||||||
* from "didn't specify" if necessary).
|
* from "didn't specify" if necessary).
|
||||||
*/
|
*/
|
||||||
#define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) { .unspecified = 1 })
|
#define MEMTXATTRS_UNSPECIFIED ((MemTxAttrs) { .unspecified = true })
|
||||||
|
|
||||||
/* New-style MMIO accessors can indicate that the transaction failed.
|
/* New-style MMIO accessors can indicate that the transaction failed.
|
||||||
* A zero (MEMTX_OK) response means success; anything else is a failure
|
* A zero (MEMTX_OK) response means success; anything else is a failure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user