Where appropriate initialise with MEMTXATTRS_CPU otherwise use MEMTXATTRS_UNSPECIFIED instead of the null initialiser. Signed-off-by: Alex Bennée <alex.bennee@xxxxxxxxxx> --- target/i386/cpu.h | 4 +++- target/i386/hax/hax-all.c | 2 +- target/i386/nvmm/nvmm-all.c | 2 +- target/i386/sev.c | 2 +- target/i386/whpx/whpx-all.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index d4bc19577a..04ab96b076 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2246,7 +2246,9 @@ static inline uint32_t cpu_compute_eflags(CPUX86State *env) static inline MemTxAttrs cpu_get_mem_attrs(CPUX86State *env) { - return ((MemTxAttrs) { .secure = (env->hflags & HF_SMM_MASK) != 0 }); + MemTxAttrs attrs = MEMTXATTRS_CPU(env_cpu(env)); + attrs.secure = (env->hflags & HF_SMM_MASK) != 0; + return attrs; } static inline int32_t x86_get_a20_mask(CPUX86State *env) diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c index b185ee8de4..337090e16f 100644 --- a/target/i386/hax/hax-all.c +++ b/target/i386/hax/hax-all.c @@ -385,7 +385,7 @@ static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, { uint8_t *ptr; int i; - MemTxAttrs attrs = { 0 }; + MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; if (!df) { ptr = (uint8_t *) buffer; diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c index b75738ee9c..cb0720a6fa 100644 --- a/target/i386/nvmm/nvmm-all.c +++ b/target/i386/nvmm/nvmm-all.c @@ -502,7 +502,7 @@ nvmm_vcpu_post_run(CPUState *cpu, struct nvmm_vcpu_exit *exit) static void nvmm_io_callback(struct nvmm_io *io) { - MemTxAttrs attrs = { 0 }; + MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; int ret; ret = address_space_rw(&address_space_io, io->port, attrs, io->data, diff --git a/target/i386/sev.c b/target/i386/sev.c index 32f7dbac4e..292cbcdd92 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1274,7 +1274,7 @@ bool sev_add_kernel_loader_hashes(SevKernelLoaderContext *ctx, Error **errp) uint8_t *hashp; size_t hash_len = HASH_SIZE; hwaddr mapped_len = sizeof(*padded_ht); - MemTxAttrs attrs = { 0 }; + MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; bool ret = true; /* diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index e738d83e81..42846144dd 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -791,7 +791,7 @@ static HRESULT CALLBACK whpx_emu_ioport_callback( void *ctx, WHV_EMULATOR_IO_ACCESS_INFO *IoAccess) { - MemTxAttrs attrs = { 0 }; + MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED; address_space_rw(&address_space_io, IoAccess->Port, attrs, &IoAccess->Data, IoAccess->AccessSize, IoAccess->Direction); -- 2.34.1