system/memory: Clean ups around address_space_ldst() endian variants
cover system/memory: Clean ups around address_space_ldst() endian variants
Hi,
This series is preliminary on unifying endianness for the single binary. The goal is to have a clean API ready for harder refactor.
First we remove the _notdirty() and leul_to_cpu() helpers, then we prepare the subpage_ops[] MemoryRegionOps to handle distinct endianness in the same binary, and finally we add a pair of ldm()/stm() variants to directly infer the access size and endianness from a MemOp argument.
(As a bonus we also moved MemoryRegionCache out of memory.h).
Please review,
Phil.
Philippe Mathieu-Daudé (14):
target/i386: Remove x86_stl_phys_notdirty() leftover target/sparc: Update MMU page table using stl_phys() hw/arm: Update bootloader generated with '-kernel' using stl_phys() system/memory: Remove address_space_stl_notdirty and stl_phys_notdirty system/physmem: Inline and remove leul_to_cpu() system/physmem: Use explicit endianness in subpage_ops::read/write() system/memory: Split MemoryRegionCache API to 'memory_cached.h' system/memory: Inline address_space_stq_internal() system/memory: Define address_space_ldst[W] endian variants via
template
system/memory: Define address_space_ldst[L] endian variants via
template
system/memory: Define address_space_ldst[Q] endian variants via
template
system/memory: Factor address_space_ldst[M]_internal() helper out system/memory: Pass device_endian argument as MemOp bit system/memory: Sort methods in memory_ldst.c.inc file
MAINTAINERS | 3 + include/hw/virtio/virtio-access.h | 1 + include/qemu/bswap.h | 11 - include/system/memory.h | 191 ------- include/system/memory_cached.h | 207 ++++++++ target/i386/cpu.h | 1 - include/exec/memory_ldst.h.inc | 52 +- include/exec/memory_ldst_phys.h.inc | 111 +--- include/system/memory_ldst_endian.h.inc | 33 ++ include/system/memory_ldst_phys_endian.h.inc | 57 ++ hw/arm/aspeed.c | 3 +- hw/arm/boot.c | 6 +- system/physmem.c | 87 +++- target/i386/helper.c | 10 - target/sparc/mmu_helper.c | 2 +- system/memory_ldst.c.inc | 514 ++++--------------- system/memory_ldst_endian.c.inc | 64 +++ 17 files changed, 546 insertions(+), 807 deletions(-) create mode 100644 include/system/memory_cached.h create mode 100644 include/system/memory_ldst_endian.h.inc create mode 100644 include/system/memory_ldst_phys_endian.h.inc create mode 100644 system/memory_ldst_endian.c.inc
Signature · 1 line
2.52.0
PATCH 1/14 target/i386: Remove x86_stl_phys_notdirty() leftover
Last use of x86_stl_phys_notdirty() was removed in commit 4a1e9d4d11c ("target/i386: Use atomic operations for pte updates"), let's remove.
--- target/i386/cpu.h | 1 - target/i386/helper.c | 10 ---------- 2 files changed, 11 deletions(-)
target/i386/cpu.h +0 -1
@@ -2623,7 +2623,6 @@ uint32_t x86_lduw_phys(CPUState *cs, hwaddr addr);uint32_t x86_ldl_phys (CPUState *cs,hwaddr addr);uint64_t x86_ldq_phys (CPUState *cs,hwaddr addr);void x86_stb_phys (CPUState *cs,hwaddr addr,uint8_t val); -void x86_stl_phys_notdirty (CPUState *cs,hwaddr addr,uint32_t val);void x86_stw_phys (CPUState *cs,hwaddr addr,uint32_t val);void x86_stl_phys (CPUState *cs,hwaddr addr,uint32_t val);void x86_stq_phys (CPUState *cs,hwaddr addr,uint64_t val);
target/i386/helper.c +0 -10
@@ -690,16 +690,6 @@ void x86_stb_phys(CPUState *cs, hwaddr addr, uint8_t val)address_space_stb (as, addr, val, attrs,NULL ); } -void x86_stl_phys_notdirty (CPUState *cs,hwaddr addr,uint32_t val) -{ -X86CPU *cpu =X86_CPU (cs); -CPUX86State *env = &cpu->env; -MemTxAttrs attrs =cpu_get_mem_attrs (env); -AddressSpace *as =cpu_addressspace (cs, attrs); - -address_space_stl_notdirty (as, addr, val, attrs,NULL ); -} -void x86_stw_phys (CPUState *cs,hwaddr addr,uint32_t val) {X86CPU *cpu =X86_CPU (cs);
Signature · 1 line
2.52.0
Re: [PATCH 01/14] target/i386: Remove x86_stl_phys_notdirty() leftover
Quoted 8 lines · Philippe Mathieu-Daudé
Last use of
x86_stl_phys_notdirty()was removed in commit4a1e9d4d11c("target/i386: Use atomic operations for pte updates"), let's remove.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 1 - target/i386/helper.c | 10 ---------- 2 files changed, 11 deletions(-)
Re: [PATCH 01/14] target/i386: Remove x86_stl_phys_notdirty() leftover
In reply to Philippe Mathieu-DaudéQuoted 8 lines · Philippe Mathieu-Daudé
Last use of
x86_stl_phys_notdirty()was removed in commit4a1e9d4d11c("target/i386: Use atomic operations for pte updates"), let's remove.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/i386/cpu.h | 1 - target/i386/helper.c | 10 ---------- 2 files changed, 11 deletions(-)
r~
Re: [PATCH 01/14] target/i386: Remove x86_stl_phys_notdirty() leftover
In reply to Philippe Mathieu-DaudéQuoted 5 lines · Philippe Mathieu-Daudé
Date: Wed, 17 Dec 2025 15:31:37 +0100
From: Philippe Mathieu-Daudé <[email protected]>
Subject: [PATCH 01/14] target/i386: Removex86_stl_phys_notdirty()leftover
X-Mailer: git-send-email 2.52.0
Quoted 8 lines
Last use of
x86_stl_phys_notdirty()was removed in commit4a1e9d4d11c("target/i386: Use atomic operations for pte updates"), let's remove.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.h | 1 - target/i386/helper.c | 10 ---------- 2 files changed, 11 deletions(-)
PATCH 2/14 target/sparc: Update MMU page table using stl_phys()
In reply to Philippe Mathieu-Daudéstl_phys_notdirty() is supposed to do an optimized CODE path store. Here we update the page table via the DATA path, so can use the normal stl_phys() helper.
--- target/sparc/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/sparc/mmu_helper.c +1 -1
@@ -189,7 +189,7 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,if (is_dirty) { pde |=PG_MODIFIED_MASK ; } -stl_phys_notdirty (cs->as, pde_ptr, pde); +stl_phys (cs->as, pde_ptr, pde); }/* the page can be put in the TLB */
Signature · 1 line
2.52.0
Re: [PATCH 02/14] target/sparc: Update MMU page table using stl_phys()
Quoted 8 lines · Philippe Mathieu-Daudé
stl_phys_notdirty()is supposed to do an optimized CODE path store. Here we update the page table via the DATA path, so can use the normalstl_phys()helper.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sparc/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 02/14] target/sparc: Update MMU page table using stl_phys()
In reply to Philippe Mathieu-DaudéQuoted 14 lines · Philippe Mathieu-Daudé
stl_phys_notdirty()is supposed to do an optimized CODE path store. Here we update the page table via the DATA path, so can use the normalstl_phys()helper.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/sparc/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/sparc/mmu_helper.c +0
-0
target/sparc/mmu_helper.c static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full, · line 195
Quoted 8 lines
target/sparc/mmu_helper.c +1
-1@@ -189,7 +189,7 @@ static int get_physical_address(CPUSPARCState *env, CPUTLBEntryFull *full,if (is_dirty) { pde |=PG_MODIFIED_MASK ; } -stl_phys_notdirty (cs->as, pde_ptr, pde); +stl_phys (cs->as, pde_ptr, pde); }/* the page can be put in the TLB */
I didn't recall that we had this in Sparc.
I suspect that this needs to be reorganized to use atomic operations, like arm.
That said, there's nothing we need from notdirty.
r~
PATCH 3/14 hw/arm: Update bootloader generated with '-kernel' using stl_phys()
In reply to Philippe Mathieu-DaudéWhen the MemTxAttrs value is not specified and no MemTxResult provided, address_space_ld/st() is equivalent to the simpler ld/st_phys() API variant. Use the latter.
The _notdirty() variant is supposed to /not/ mark the updated CODE page as dirty, to not re-translate it. However this code is only used with the '-kernel' CLI option after the machine is created and /before/ the vCPUs run, and *only* during the first (cold) reset; not during following (hot) resets. The optimisation is totally not justified, since we haven't translated any guest code yet. Replace by the normal stl_phys() helper.
--- hw/arm/aspeed.c | 3 +-- hw/arm/boot.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-)
hw/arm/aspeed.c +1 -2
@@ -77,8 +77,7 @@ static void aspeed_reset_secondary(ARMCPU *cpu,CPUState *cs =CPU (cpu);/* info->smp_bootreg_addr */ -address_space_stl_notdirty (as,AST_SMP_MBOX_FIELD_GOSIGN ,0 , -MEMTXATTRS_UNSPECIFIED ,NULL ); +stl_phys (as,AST_SMP_MBOX_FIELD_GOSIGN ,0 );cpu_set_pc (cs, info->smp_loader_start); }
hw/arm/boot.c +2 -4
@@ -266,8 +266,7 @@ static void default_reset_secondary(ARMCPU *cpu,AddressSpace *as =arm_boot_address_space (cpu, info);CPUState *cs =CPU (cpu); -address_space_stl_notdirty (as, info->smp_bootreg_addr, -0 ,MEMTXATTRS_UNSPECIFIED ,NULL ); +stl_phys (as, info->smp_bootreg_addr,0 );cpu_set_pc (cs, info->smp_loader_start); }
@@ -277,8 +276,7 @@ static inline bool have_dtb(const struct arm_boot_info *info) }#define WRITE_WORD (p, value) do { \ - address_space_stl_notdirty(as, p, value, \ - MEMTXATTRS_UNSPECIFIED, NULL); \ + stl_phys(as, p, value); \ p += 4; \ } while (0)
Signature · 1 line
2.52.0
Re: [PATCH 03/14] hw/arm: Update bootloader generated with '-kernel' using stl_phys()
Quoted 13 lines · Philippe Mathieu-Daudé
When the MemTxAttrs value is not specified and no MemTxResult provided, address_space_ld/st() is equivalent to the simpler ld/st_phys() API variant. Use the latter.
The
_notdirty()variant is supposed to /not/ mark the updated CODE page as dirty, to not re-translate it. However this code is only used with the '-kernel' CLI option after the machine is created and /before/ the vCPUs run, and *only* during the first (cold) reset; not during following (hot) resets. The optimisation is totally not justified, since we haven't translated any guest code yet. Replace by the normalstl_phys()helper.
Quoted 6 lines
Suggested-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/arm/aspeed.c | 3 +-- hw/arm/boot.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-)
Re: [PATCH 03/14] hw/arm: Update bootloader generated with '-kernel' using stl_phys()
In reply to Philippe Mathieu-DaudéQuoted 13 lines · Philippe Mathieu-Daudé
When the MemTxAttrs value is not specified and no MemTxResult provided, address_space_ld/st() is equivalent to the simpler ld/st_phys() API variant. Use the latter.
The
_notdirty()variant is supposed to/not/ mark the updated CODE page as dirty, to not re-translate it. However this code is only used with the '-kernel' CLI option after the machine is created and/before/ the vCPUs run, and*only* during the first (cold) reset; not during following (hot) resets. The optimisation is totally not justified, since we haven't translated any guest code yet. Replace by the normalstl_phys()helper.
Quoted 6 lines
Suggested-by Richard Henderson<[email protected]>Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- hw/arm/aspeed.c | 3 +-- hw/arm/boot.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-)
r~
PATCH 4/14 system/memory: Remove address_space_stl_notdirty and stl_phys_notdirty
In reply to Philippe Mathieu-Daudéstl_phys_notdirty() was added in commit 8df1cd076cc ("physical memory access functions") as a (premature?) optimisation for the CODE path. Meanwhile 20 years passed, we might never have understood / used it properly; the code evolved and now the recommended way to access the CODE path is via the cpu_ld/st_mmu*() API.
Remove both address_space_stl_notdirty() and stl_phys_notdirty() leftovers.
--- include/system/memory.h | 6 ------ include/exec/memory_ldst.h.inc | 2 -- system/memory_ldst.c.inc | 39 ---------------------------------- 3 files changed, 47 deletions(-)
include/system/memory.h +0 -6
@@ -2850,12 +2850,6 @@ MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,#define ARG1_DECL AddressSpace *as#include "exec/memory_ldst.h.inc" -static inline void stl_phys_notdirty (AddressSpace *as,hwaddr addr,uint32_t val) -{ -address_space_stl_notdirty (as, addr, val, -MEMTXATTRS_UNSPECIFIED ,NULL ); -} -#define SUFFIX #define ARG1 as#define ARG1_DECL AddressSpace *as
include/exec/memory_ldst.h.inc +0 -2
@@ -25,8 +25,6 @@ uint32_t glue(address_space_ldl, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint64_t glue(address_space_ldq, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stw, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stl, SUFFIX)(ARG1_DECL,
system/memory_ldst.c.inc +0 -39
@@ -261,45 +261,6 @@ uint16_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -/* warning: addr must be aligned. The ram page is not masked as dirty - and the code inside is not invalidated. It is useful if the dirty - bits are used to track modified PTEs */ -void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) -{ - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 4; - hwaddr addr1; - MemTxResult r; - uint8_t dirty_log_mask; - bool release_lock = false; - - RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, true, attrs); - if (l < 4 || !memory_access_is_direct(mr, true, attrs)) { - release_lock |= prepare_mmio_access(mr); - - r = memory_region_dispatch_write(mr, addr1, val, MO_32, attrs); - } else { - ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - stl_p(ptr, val); - - dirty_log_mask = memory_region_get_dirty_log_mask(mr); - dirty_log_mask &= ~(1 << DIRTY_MEMORY_CODE); - physical_memory_set_dirty_range(memory_region_get_ram_addr(mr) + addr, - 4, dirty_log_mask); - r = MEMTX_OK; - } - if (result) { - *result = r; - } - if (release_lock) { - bql_unlock(); - } - RCU_READ_UNLOCK(); -} - /* warning: addr must be aligned */ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs,
Signature · 1 line
2.52.0
Re: [PATCH 04/14] system/memory: Remove address_space_stl_notdirty and stl_phys_notdirty
Quoted 9 lines · Philippe Mathieu-Daudé
stl_phys_notdirty()was added in commit8df1cd076cc("physical memory access functions") as a (premature?) optimisation for the CODE path. Meanwhile 20 years passed, we might never have understood / used it properly; the code evolved and now the recommended way to access the CODE path is via the cpu_ld/st_mmu*() API.Remove both
address_space_stl_notdirty()andstl_phys_notdirty()leftovers.
Quoted 7 lines
Suggested-by Pierrick Bouvier <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/system/memory.h | 6 ------ include/exec/memory_ldst.h.inc | 2 -- system/memory_ldst.c.inc | 39 ---------------------------------- 3 files changed, 47 deletions(-)
Re: [PATCH 04/14] system/memory: Remove address_space_stl_notdirty and stl_phys_notdirty
In reply to Philippe Mathieu-DaudéQuoted 9 lines · Philippe Mathieu-Daudé
stl_phys_notdirty()was added in commit8df1cd076cc("physical memory access functions") as a (premature?) optimisation for the CODE path. Meanwhile 20 years passed, we might never have understood / used it properly; the code evolved and now the recommended way to access the CODE path is via the cpu_ld/st_mmu*() API.Remove both
address_space_stl_notdirty()andstl_phys_notdirty()leftovers.
Quoted 7 lines
Suggested-by Pierrick Bouvier<[email protected]>Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/system/memory.h | 6 ------ include/exec/memory_ldst.h.inc | 2 -- system/memory_ldst.c.inc | 39 ---------------------------------- 3 files changed, 47 deletions(-)
r~
PATCH 5/14 system/physmem: Inline and remove leul_to_cpu()
In reply to Philippe Mathieu-Daudéleul_to_cpu() is only used within physmem.c: inline it and remove.
Since @bitmap is of 'unsigned long' type, use its size with ldn_le_p() instead of using HOST_LONG_BITS.
--- include/qemu/bswap.h | 11 ----------- system/physmem.c | 5 +++-- 2 files changed, 3 insertions(+), 13 deletions(-)
include/qemu/bswap.h +0 -11
@@ -375,17 +375,6 @@ static inline void stq_be_p(void *ptr, uint64_t v)stq_he_p (ptr,be_bswap (v,64 )); } -static inline unsigned long leul_to_cpu (unsigned long v) -{ -#if HOST_LONG_BITS ==32 -return le_bswap (v,32 ); -#elif HOST_LONG_BITS ==64 -return le_bswap (v,64 ); -#else -# error Unknown sizeof long -#endif -} -/* Store v to p as a sz byte value in host order */ #define DO_STN_LDN_P (END ) \ static inline void stn_## END ## _p(void *ptr, int sz, uint64_t v) \
system/physmem.c +3 -2
@@ -1254,7 +1254,8 @@ uint64_t physical_memory_set_dirty_lebitmap(unsigned long *bitmap,for (k =0 ; k < nr; k++) {if (bitmap[k]) { -unsigned long temp =leul_to_cpu (bitmap[k]); +unsigned long temp =ldn_le_p (&bitmap[k], +sizeof (bitmap[k])); nbits =ctpopl (temp);qatomic_or (&blocks[DIRTY_MEMORY_VGA ][idx][offset], temp);
@@ -1301,7 +1302,7 @@ uint64_t physical_memory_set_dirty_lebitmap(unsigned long *bitmap,*/ for (i =0 ; i < len; i++) {if (bitmap[i] !=0 ) { - c =leul_to_cpu (bitmap[i]); + c =ldn_le_p (&bitmap[i],sizeof (bitmap[i])); nbits =ctpopl (c);if (unlikely (global_dirty_tracking &GLOBAL_DIRTY_DIRTY_RATE )) { total_dirty_pages += nbits;
Signature · 1 line
2.52.0
Re: [PATCH 05/14] system/physmem: Inline and remove leul_to_cpu()
Quoted 10 lines · Philippe Mathieu-Daudé
leul_to_cpu()is only used withinphysmem.c: inline it and remove.
Since @bitmap is of 'unsigned long' type, use its size withldn_le_p()instead of usingHOST_LONG_BITS.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/qemu/bswap.h | 11 ----------- system/physmem.c | 5 +++-- 2 files changed, 3 insertions(+), 13 deletions(-)
Re: [PATCH 05/14] system/physmem: Inline and remove leul_to_cpu()
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
leul_to_cpu()is only used withinphysmem.c: inline it and remove.
Since @bitmap is of 'unsigned long' type, use its size withldn_le_p()instead of usingHOST_LONG_BITS.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/qemu/bswap.h | 11 ----------- system/physmem.c | 5 +++-- 2 files changed, 3 insertions(+), 13 deletions(-)
r~
PATCH 6/14 system/physmem: Use explicit endianness in subpage_ops::read/write()
In reply to Philippe Mathieu-DaudéReplace the ldn_p/stn_p() calls by their explicit endianness variants. Duplicate the MemoryRegionOps, replacing the single DEVICE_NATIVE_ENDIAN entry by a pair of LITTLE and BIG ones. Select the proper MemoryRegionOps in subpage_init().
--- system/physmem.c | 81 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 17 deletions(-)
system/physmem.c +64 -17
@@ -2896,8 +2896,8 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,static bool flatview_access_valid (FlatView *fv,hwaddr addr,hwaddr len,bool is_write,MemTxAttrs attrs); -static MemTxResult subpage_read (void *opaque,hwaddr addr,uint64_t *data, -unsigned len,MemTxAttrs attrs) +static MemTxResult subpage_read_le (void *opaque,hwaddr addr,uint64_t *data, +unsigned len,MemTxAttrs attrs) {subpage_t *subpage = opaque;uint8_t buf[8 ];
@@ -2911,12 +2911,32 @@ static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,if (res) {return res; } - *data =ldn_p (buf, len); + *data =ldn_le_p (buf, len);return MEMTX_OK ; } -static MemTxResult subpage_write (void *opaque,hwaddr addr, -uint64_t value,unsigned len,MemTxAttrs attrs) +static MemTxResult subpage_read_be (void *opaque,hwaddr addr,uint64_t *data, +unsigned len,MemTxAttrs attrs) +{ +subpage_t *subpage = opaque; +uint8_t buf[8 ]; +MemTxResult res; + +#if defined(DEBUG_SUBPAGE ) +printf ("%s: subpage %p len %u addr " HWADDR_FMT_plx"\n" , __func__, + subpage, len, addr); +#endif + res =flatview_read (subpage->fv, addr + subpage->base, attrs, buf, len); +if (res) { +return res; + } + *data =ldn_be_p (buf, len); +return MEMTX_OK ; +} + +static MemTxResult subpage_write_le (void *opaque,hwaddr addr, +uint64_t value,unsigned len, +MemTxAttrs attrs) {subpage_t *subpage = opaque;uint8_t buf[8 ];
@@ -2926,7 +2946,23 @@ static MemTxResult subpage_write(void *opaque, hwaddr addr," value %" PRIx64"\n" , __func__, subpage, len, addr, value);#endif -stn_p (buf, len, value); +stn_le_p (buf, len, value); +return flatview_write (subpage->fv, addr + subpage->base, attrs, buf, len); +} + +static MemTxResult subpage_write_be (void *opaque,hwaddr addr, +uint64_t value,unsigned len, +MemTxAttrs attrs) +{ +subpage_t *subpage = opaque; +uint8_t buf[8 ]; + +#if defined(DEBUG_SUBPAGE ) +printf ("%s: subpage %p len %u addr " HWADDR_FMT_plx +" value %" PRIx64"\n" , + __func__, subpage, len, addr, value); +#endif +stn_be_p (buf, len, value);return flatview_write (subpage->fv, addr + subpage->base, attrs, buf, len); }
@@ -2944,15 +2980,26 @@ static bool subpage_accepts(void *opaque, hwaddr addr, len, is_write, attrs); } -static const MemoryRegionOps subpage_ops = { - .read_with_attrs = subpage_read, - .write_with_attrs = subpage_write, - .impl.min_access_size =1 , - .impl.max_access_size =8 , - .valid.min_access_size =1 , - .valid.max_access_size =8 , - .valid.accepts = subpage_accepts, - .endianness =DEVICE_NATIVE_ENDIAN , +static const MemoryRegionOps subpage_ops[2 ] = { + [0 ...1 ] = { + .impl = { + .min_access_size =1 , + .max_access_size =8 , + }, + .valid = { + .min_access_size =1 , + .max_access_size =8 , + .accepts = subpage_accepts, + }, + }, + + [0 ].endianness =DEVICE_LITTLE_ENDIAN , + [0 ].read_with_attrs = subpage_read_le, + [0 ].write_with_attrs = subpage_write_le, + + [1 ].endianness =DEVICE_BIG_ENDIAN , + [1 ].read_with_attrs = subpage_read_be, + [1 ].write_with_attrs = subpage_write_be, }; static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end,
@@ -2983,8 +3030,8 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr base) mmio =g_malloc0 (sizeof (subpage_t) +TARGET_PAGE_SIZE *sizeof (uint16_t )); mmio->fv = fv; mmio->base = base; -memory_region_init_io (&mmio->iomem,NULL , &subpage_ops, mmio, -NULL ,TARGET_PAGE_SIZE ); +memory_region_init_io (&mmio->iomem,NULL , &subpage_ops[target_big_endian ()], + mmio,NULL ,TARGET_PAGE_SIZE ); mmio->iomem.subpage = true;#if defined(DEBUG_SUBPAGE ) printf("%s: %p base " HWADDR_FMT_plx " len %08x\n", __func__,
Signature · 1 line
2.52.0
Re: [PATCH 06/14] system/physmem: Use explicit endianness in subpage_ops::read/write()
Quoted 37 lines · Philippe Mathieu-Daudé
Replace the ldn_p/stn_p() calls by their explicit endianness variants. Duplicate the MemoryRegionOps, replacing the single
DEVICE_NATIVE_ENDIANentry by a pair of LITTLE and BIG ones. Select the proper MemoryRegionOps insubpage_init().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- system/physmem.c | 81 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 64 insertions(+), 17 deletions(-)system/physmem.c +4
-5@@ -2896,8 +2896,8 @@ static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,static bool flatview_access_valid (FlatView *fv,hwaddr addr,hwaddr len,bool is_write,MemTxAttrs attrs); -static MemTxResult subpage_read (void *opaque,hwaddr addr,uint64_t *data, -unsigned len,MemTxAttrs attrs) +static MemTxResult subpage_read_le (void *opaque,hwaddr addr,uint64_t *data, +unsigned len,MemTxAttrs attrs) {subpage_t *subpage = opaque;uint8_t buf[8 ];@@ -2911,12 +2911,32 @@ static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data,if (res) {return res; } - *data =ldn_p (buf, len); + *data =ldn_le_p (buf, len);return MEMTX_OK ; } -static MemTxResult subpage_write (void *opaque,hwaddr addr, -uint64_t value,unsigned len,MemTxAttrs attrs) +static MemTxResult subpage_read_be(void *opaque, hwaddr addr, uint64_t *data,
system/physmem.c static MemTxResult subpage_read(void *opaque, hwaddr addr, uint64_t *data, · line 2928
Quoted 10 lines
system/physmem.c +10
-0+ unsigned len, MemTxAttrs attrs) +{ +subpage_t *subpage = opaque; +uint8_t buf[8 ]; +MemTxResult res; + +#if defined(DEBUG_SUBPAGE ) +printf ("%s: subpage %p len %u addr " HWADDR_FMT_plx"\n" , __func__, + subpage, len, addr); +#endif
It would be worth converting these to trace points before replicating.
Otherwise,
r~
Quoted 86 lines
system/physmem.c +50
-12+ res =flatview_read (subpage->fv, addr + subpage->base, attrs, buf, len); +if (res) { +return res; + } + *data =ldn_be_p (buf, len); +return MEMTX_OK ; +} + +static MemTxResult subpage_write_le (void *opaque,hwaddr addr, +uint64_t value,unsigned len, +MemTxAttrs attrs) {subpage_t *subpage = opaque;uint8_t buf[8 ];@@ -2926,7 +2946,23 @@ static MemTxResult subpage_write(void *opaque, hwaddr addr," value %" PRIx64"\n" , __func__, subpage, len, addr, value);#endif -stn_p (buf, len, value); +stn_le_p (buf, len, value); +return flatview_write (subpage->fv, addr + subpage->base, attrs, buf, len); +} + +static MemTxResult subpage_write_be (void *opaque,hwaddr addr, +uint64_t value,unsigned len, +MemTxAttrs attrs) +{ +subpage_t *subpage = opaque; +uint8_t buf[8 ]; + +#if defined(DEBUG_SUBPAGE ) +printf ("%s: subpage %p len %u addr " HWADDR_FMT_plx +" value %" PRIx64"\n" , + __func__, subpage, len, addr, value); +#endif +stn_be_p (buf, len, value);return flatview_write (subpage->fv, addr + subpage->base, attrs, buf, len); }@@ -2944,15 +2980,26 @@ static bool subpage_accepts(void *opaque, hwaddr addr, len, is_write, attrs); } -static const MemoryRegionOps subpage_ops = { - .read_with_attrs = subpage_read, - .write_with_attrs = subpage_write, - .impl.min_access_size =1 , - .impl.max_access_size =8 , - .valid.min_access_size =1 , - .valid.max_access_size =8 , - .valid.accepts = subpage_accepts, - .endianness =DEVICE_NATIVE_ENDIAN , +static const MemoryRegionOps subpage_ops[2 ] = { + [0 ...1 ] = { + .impl = { + .min_access_size =1 , + .max_access_size =8 , + }, + .valid = { + .min_access_size =1 , + .max_access_size =8 , + .accepts = subpage_accepts, + }, + }, + + [0 ].endianness =DEVICE_LITTLE_ENDIAN , + [0 ].read_with_attrs = subpage_read_le, + [0 ].write_with_attrs = subpage_write_le, + + [1 ].endianness =DEVICE_BIG_ENDIAN , + [1 ].read_with_attrs = subpage_read_be, + [1 ].write_with_attrs = subpage_write_be, }; static int subpage_register(subpage_t *mmio, uint32_t start, uint32_t end,@@ -2983,8 +3030,8 @@ static subpage_t *subpage_init(FlatView *fv, hwaddr base) mmio =g_malloc0 (sizeof (subpage_t) +TARGET_PAGE_SIZE *sizeof (uint16_t )); mmio->fv = fv; mmio->base = base; -memory_region_init_io (&mmio->iomem,NULL , &subpage_ops, mmio, -NULL ,TARGET_PAGE_SIZE ); +memory_region_init_io (&mmio->iomem,NULL , &subpage_ops[target_big_endian ()], + mmio,NULL ,TARGET_PAGE_SIZE ); mmio->iomem.subpage = true;#if defined(DEBUG_SUBPAGE ) printf("%s: %p base " HWADDR_FMT_plx " len %08x\n", __func__,
PATCH 7/14 system/memory: Split MemoryRegionCache API to 'memory_cached.h'
In reply to Philippe Mathieu-DaudéWe have 115 direct inclusions of "system/memory.h", and 91 headers in include/ use it: hundreds of files have to process it. However only one single header really uses the MemoryRegionCache
API: "hw/virtio/virtio-access.h". Split it out to a new header, avoiding processing unused inlined functions hundreds of times.
--- MAINTAINERS | 1 + include/hw/virtio/virtio-access.h | 1 + include/system/memory.h | 185 -------------------------- include/system/memory_cached.h | 207 ++++++++++++++++++++++++++++++ system/physmem.c | 1 + 5 files changed, 210 insertions(+), 185 deletions(-) create mode 100644 include/system/memory_cached.h
MAINTAINERS +1 -0
@@ -3255,6 +3255,7 @@ S: Supported F: include/system/ioport.h F: include/exec/memop.h F: include/system/memory.h +F: include/system/memory_cached.h F: include/system/physmem.h F: include/system/ram_addr.h F: include/system/ramblock.h
include/hw/virtio/virtio-access.h +1 -0
@@ -17,6 +17,7 @@#define QEMU_VIRTIO_ACCESS_H #include "exec/hwaddr.h" +#include "system/memory_cached.h" #include "hw/virtio/virtio.h" #include "hw/virtio/virtio-bus.h"
include/system/memory.h +0 -185
203 lines not on this page · raw message
include/system/memory_cached.h new file +207 -0
207 lines not on this page · raw message
system/physmem.c +1 -0
@@ -53,6 +53,7 @@#include "qemu/memalign.h" #include "qemu/memfd.h" #include "system/memory.h" +#include "system/memory_cached.h" #include "system/ioport.h" #include "system/dma.h" #include "system/hostmem.h"
Signature · 1 line
2.52.0
Re: [PATCH 07/14] system/memory: Split MemoryRegionCache API to 'memory_cached.h'
Quoted 7 lines · Philippe Mathieu-Daudé
We have 115 direct inclusions of "
system/memory.h", and 91 headers ininclude/use it: hundreds of files have to process it. However only one single header really uses the MemoryRegionCache
API: "hw/virtio/virtio-access.h". Split it out to a new header, avoiding processing unused inlined functions hundreds of times.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 8 lines
--- MAINTAINERS | 1 + include/hw/virtio/virtio-access.h | 1 + include/system/memory.h | 185 -------------------------- include/system/memory_cached.h | 207 ++++++++++++++++++++++++++++++ system/physmem.c | 1 + 5 files changed, 210 insertions(+), 185 deletions(-)create mode 100644
include/system/memory_cached.h
Re: [PATCH 07/14] system/memory: Split MemoryRegionCache API to 'memory_cached.h'
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
We have 115 direct inclusions of "
system/memory.h", and 91 headers ininclude/use it: hundreds of files have to process it. However only one single header really uses the MemoryRegionCache
API: "hw/virtio/virtio-access.h". Split it out to a new header, avoiding processing unused inlined functions hundreds of times.Signed-off-by Philippe Mathieu-Daudé<[email protected]>
Quoted 8 lines
--- MAINTAINERS | 1 + include/hw/virtio/virtio-access.h | 1 + include/system/memory.h | 185 -------------------------- include/system/memory_cached.h | 207 ++++++++++++++++++++++++++++++ system/physmem.c | 1 + 5 files changed, 210 insertions(+), 185 deletions(-)create mode 100644
include/system/memory_cached.h
r~
PATCH 8/14 system/memory: Inline address_space_stq_internal()
In reply to Philippe Mathieu-DaudéAs its name suggests, address_space_stq_internal() is an internal method which can be inlined like all the other ones in this file.
--- system/memory_ldst.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
system/memory_ldst.c.inc +1 -1
@@ -422,7 +422,7 @@ void glue(address_space_stw_be, SUFFIX)(ARG1_DECL, DEVICE_BIG_ENDIAN); } -static void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, +static inline void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) {
Signature · 1 line
2.52.0
Re: [PATCH 08/14] system/memory: Inline address_space_stq_internal()
Quoted 8 lines · Philippe Mathieu-Daudé
As its name suggests,
address_space_stq_internal()is an internal method which can be inlined like all the other ones in this file.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- system/memory_ldst.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 08/14] system/memory: Inline address_space_stq_internal()
In reply to Philippe Mathieu-DaudéQuoted 8 lines · Philippe Mathieu-Daudé
As its name suggests,
address_space_stq_internal()is an internal method which can be inlined like all the other ones in this file.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- system/memory_ldst.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 9/14 system/memory: Define address_space_ldst[W] endian variants via template
In reply to Philippe Mathieu-DaudéLike we do for other LD/ST APIs, use one template to declare and define all endianness variants of the address_space_lduw() methods.
--- MAINTAINERS | 2 + include/exec/memory_ldst.h.inc | 21 ++++---- include/exec/memory_ldst_phys.h.inc | 45 ++++------------ include/system/memory_ldst_endian.h.inc | 25 +++++++++ include/system/memory_ldst_phys_endian.h.inc | 37 ++++++++++++++ system/memory_ldst.c.inc | 54 +++++--------------- system/memory_ldst_endian.c.inc | 42 +++++++++++++++ 7 files changed, 136 insertions(+), 90 deletions(-) create mode 100644 include/system/memory_ldst_endian.h.inc create mode 100644 include/system/memory_ldst_phys_endian.h.inc create mode 100644 system/memory_ldst_endian.c.inc
MAINTAINERS +2 -0
@@ -3256,6 +3256,7 @@ F: include/system/ioport.h F: include/exec/memop.h F: include/system/memory.h F: include/system/memory_cached.h +F: include/system/memory_ldst* F: include/system/physmem.h F: include/system/ram_addr.h F: include/system/ramblock.h
@@ -3265,6 +3266,7 @@ F: system/ioport.c F: system/memory.c F: system/memory_mapping.c F: system/physmem.c +F: system/memory_ldst* F: system/memory-internal.h F: system/ram-block-attributes.c F: scripts/coccinelle/memory-region-housekeeping.cocci
include/exec/memory_ldst.h.inc +9 -12
@@ -19,24 +19,16 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -uint16_t glue(address_space_lduw, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint32_t glue(address_space_ldl, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint64_t glue(address_space_ldq, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stw, SUFFIX)(ARG1_DECL, - hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stl, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stq, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -uint16_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -uint16_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint32_t glue(address_space_ldl_le, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint32_t glue(address_space_ldl_be, SUFFIX)(ARG1_DECL,
@@ -47,10 +39,6 @@ uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stb, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stw_le, SUFFIX)(ARG1_DECL, - hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stw_be, SUFFIX)(ARG1_DECL, - hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stl_le, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stl_be, SUFFIX)(ARG1_DECL,
@@ -60,6 +48,15 @@ void glue(address_space_stq_le, SUFFIX)(ARG1_DECL, void glue(address_space_stq_be, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); +#define ENDIANNESS +#include "system/memory_ldst_endian.h.inc" + +#define ENDIANNESS _le +#include "system/memory_ldst_endian.h.inc" + +#define ENDIANNESS _be +#include "system/memory_ldst_endian.h.inc" + #undef ARG1_DECL #undef ARG1 #undef SUFFIX
include/exec/memory_ldst_phys.h.inc +9 -36
75 lines not on this page · raw message
include/system/memory_ldst_endian.h.inc new file +25 -0
@@ -0,0 +1,25 @@ +/* + * Physical memory access endian templates + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2015 Linaro, Inc. + * Copyright (c) 2016 Red Hat, Inc. + * Copyright (c) 2025 Linaro Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#define ADDRESS_SPACE_LD(size) \ + glue(glue(address_space_ld, size), glue(ENDIANNESS, SUFFIX)) +#define ADDRESS_SPACE_ST(size) \ + glue(glue(address_space_st, size), glue(ENDIANNESS, SUFFIX)) + +uint16_t ADDRESS_SPACE_LD(uw)(ARG1_DECL, hwaddr addr, + MemTxAttrs attrs, MemTxResult *result); +void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, + MemTxAttrs attrs, MemTxResult *result); + +#undef ADDRESS_SPACE_LD +#undef ADDRESS_SPACE_ST + +#undef ENDIANNESS
include/system/memory_ldst_phys_endian.h.inc new file +37 -0
@@ -0,0 +1,37 @@ +/* + * Physical memory access endian templates + * + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2015 Linaro, Inc. + * Copyright (c) 2016 Red Hat, Inc. + * Copyright (c) 2025 Linaro Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#define LD_PHYS(size) \ + glue(glue(ld, size), glue(ENDIANNESS, glue(_phys, SUFFIX))) +#define ADDRESS_SPACE_LD(size) \ + glue(glue(address_space_ld, size), glue(ENDIANNESS, SUFFIX)) + +#define ST_PHYS(size) \ + glue(glue(st, size), glue(ENDIANNESS, glue(_phys, SUFFIX))) +#define ADDRESS_SPACE_ST(size) \ + glue(glue(address_space_st, size), glue(ENDIANNESS, SUFFIX)) + +static inline uint16_t LD_PHYS(uw)(ARG1_DECL, hwaddr addr) +{ + return ADDRESS_SPACE_LD(uw)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); +} + +static inline void ST_PHYS(w)(ARG1_DECL, hwaddr addr, uint16_t val) +{ + ADDRESS_SPACE_ST(w)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); +} + +#undef LD_PHYS +#undef ST_PHYS +#undef ADDRESS_SPACE_LD +#undef ADDRESS_SPACE_ST + +#undef ENDIANNESS
system/memory_ldst.c.inc +12 -42
72 lines not on this page · raw message
system/memory_ldst_endian.c.inc new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.52.0
Re: [PATCH 09/14] system/memory: Define address_space_ldst[W] endian variants via template
Quoted 13 lines · Philippe Mathieu-Daudé
Like we do for other LD/ST APIs, use one template to declare and define all endianness variants of the
address_space_lduw()methods.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- MAINTAINERS | 2 + include/exec/memory_ldst.h.inc | 21 ++++---- include/exec/memory_ldst_phys.h.inc | 45 ++++------------ include/system/memory_ldst_endian.h.inc | 25 +++++++++ include/system/memory_ldst_phys_endian.h.inc | 37 ++++++++++++++ system/memory_ldst.c.inc | 54 +++++--------------- system/memory_ldst_endian.c.inc | 42 +++++++++++++++ 7 files changed, 136 insertions(+), 90 deletions(-)
Quoted 3 lines
create mode 100644
include/system/memory_ldst_endian.h.inccreate mode 100644include/system/memory_ldst_phys_endian.h.inccreate mode 100644 system/memory_ldst_endian.c.inc
r~
PATCH 10/14 system/memory: Define address_space_ldst[L] endian variants via template
In reply to Philippe Mathieu-Daudé--- include/exec/memory_ldst.h.inc | 12 ------ include/exec/memory_ldst_phys.h.inc | 36 ----------------- include/system/memory_ldst_endian.h.inc | 4 ++ include/system/memory_ldst_phys_endian.h.inc | 10 +++++ system/memory_ldst.c.inc | 42 -------------------- system/memory_ldst_endian.c.inc | 14 +++++++ 6 files changed, 28 insertions(+), 90 deletions(-)
include/exec/memory_ldst.h.inc +0 -12
@@ -19,30 +19,18 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -uint32_t glue(address_space_ldl, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint64_t glue(address_space_ldq, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stl, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stq, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -uint32_t glue(address_space_ldl_le, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -uint32_t glue(address_space_ldl_be, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint64_t glue(address_space_ldq_le, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stb, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stl_le, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stl_be, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stq_le, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); void glue(address_space_stq_be, SUFFIX)(ARG1_DECL,
include/exec/memory_ldst_phys.h.inc +0 -36
@@ -19,24 +19,12 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -static inline uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldl, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_ldq, SUFFIX)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) { glue(address_space_stq, SUFFIX)(ARG1, addr, val,
@@ -49,18 +37,6 @@ static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) MEMTXATTRS_UNSPECIFIED, NULL); } -static inline uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldl_le, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline uint32_t glue(ldl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldl_be, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline uint64_t glue(ldq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_ldq_le, SUFFIX)(ARG1, addr,
@@ -79,18 +55,6 @@ static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val) MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl_le, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val) -{ - glue(address_space_stl_be, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) { glue(address_space_stq_le, SUFFIX)(ARG1, addr, val,
include/system/memory_ldst_endian.h.inc +4 -0
@@ -16,8 +16,12 @@ uint16_t ADDRESS_SPACE_LD(uw)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +uint32_t ADDRESS_SPACE_LD(l)(ARG1_DECL, hwaddr addr, + MemTxAttrs attrs, MemTxResult *result); void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); +void ADDRESS_SPACE_ST(l)(ARG1_DECL, hwaddr addr, uint32_t val, + MemTxAttrs attrs, MemTxResult *result); #undef ADDRESS_SPACE_LD #undef ADDRESS_SPACE_ST
include/system/memory_ldst_phys_endian.h.inc +10 -0
@@ -24,11 +24,21 @@ static inline uint16_t LD_PHYS(uw)(ARG1_DECL, hwaddr addr) return ADDRESS_SPACE_LD(uw)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); } +static inline uint32_t LD_PHYS(l)(ARG1_DECL, hwaddr addr) +{ + return ADDRESS_SPACE_LD(l)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); +} + static inline void ST_PHYS(w)(ARG1_DECL, hwaddr addr, uint16_t val) { ADDRESS_SPACE_ST(w)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } +static inline void ST_PHYS(l)(ARG1_DECL, hwaddr addr, uint32_t val) +{ + ADDRESS_SPACE_ST(l)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); +} + #undef LD_PHYS #undef ST_PHYS #undef ADDRESS_SPACE_LD
system/memory_ldst.c.inc +0 -42
54 lines not on this page · raw message
system/memory_ldst_endian.c.inc +14 -0
@@ -26,6 +26,13 @@ uint16_t ADDRESS_SPACE_LD(uw)(ARG1_DECL, hwaddr addr, DEVICE_ENDIANNESS); } +uint32_t ADDRESS_SPACE_LD(l)(ARG1_DECL, hwaddr addr, + MemTxAttrs attrs, MemTxResult *result) +{ + return ADDRESS_SPACE_LD_INTERNAL(l)(ARG1, addr, attrs, result, + DEVICE_ENDIANNESS); +} + void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) {
@@ -33,6 +40,13 @@ void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, DEVICE_ENDIANNESS); } +void ADDRESS_SPACE_ST(l)(ARG1_DECL, hwaddr addr, uint32_t val, + MemTxAttrs attrs, MemTxResult *result) +{ + ADDRESS_SPACE_ST_INTERNAL(l)(ARG1, addr, val, attrs, result, + DEVICE_ENDIANNESS); +} + #undef ADDRESS_SPACE_LD #undef ADDRESS_SPACE_LD_INTERNAL #undef ADDRESS_SPACE_ST
Signature · 1 line
2.52.0
Re: [PATCH 10/14] system/memory: Define address_space_ldst[L] endian variants via template
Quoted 9 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/exec/memory_ldst.h.inc | 12 ------ include/exec/memory_ldst_phys.h.inc | 36 ----------------- include/system/memory_ldst_endian.h.inc | 4 ++ include/system/memory_ldst_phys_endian.h.inc | 10 +++++ system/memory_ldst.c.inc | 42 -------------------- system/memory_ldst_endian.c.inc | 14 +++++++ 6 files changed, 28 insertions(+), 90 deletions(-)
r~
PATCH 11/14 system/memory: Define address_space_ldst[Q] endian variants via template
In reply to Philippe Mathieu-Daudé--- include/exec/memory_ldst.h.inc | 17 ++------ include/exec/memory_ldst_phys.h.inc | 36 ----------------- include/system/memory_ldst_endian.h.inc | 4 ++ include/system/memory_ldst_phys_endian.h.inc | 10 +++++ system/memory_ldst.c.inc | 42 -------------------- system/memory_ldst_endian.c.inc | 14 +++++++ 6 files changed, 31 insertions(+), 92 deletions(-)
include/exec/memory_ldst.h.inc +3 -14
@@ -19,22 +19,11 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -uint64_t glue(address_space_ldq, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stq, SUFFIX)(ARG1_DECL, - hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -uint64_t glue(address_space_ldq_le, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); -uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result); + hwaddr addr, MemTxAttrs attrs, MemTxResult *result); + void glue(address_space_stb, SUFFIX)(ARG1_DECL, - hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stq_le, SUFFIX)(ARG1_DECL, - hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); -void glue(address_space_stq_be, SUFFIX)(ARG1_DECL, - hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result); + hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result); #define ENDIANNESS #include "system/memory_ldst_endian.h.inc"
include/exec/memory_ldst_phys.h.inc +0 -36
@@ -19,54 +19,18 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldq, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) -{ - glue(address_space_stq, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr) { return glue(address_space_ldub, SUFFIX)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); } -static inline uint64_t glue(ldq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldq_le, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr) -{ - return glue(address_space_ldq_be, SUFFIX)(ARG1, addr, - MEMTXATTRS_UNSPECIFIED, NULL); -} - static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val) { glue(address_space_stb, SUFFIX)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } -static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) -{ - glue(address_space_stq_le, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - -static inline void glue(stq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val) -{ - glue(address_space_stq_be, SUFFIX)(ARG1, addr, val, - MEMTXATTRS_UNSPECIFIED, NULL); -} - #define ENDIANNESS #include "system/memory_ldst_phys_endian.h.inc"
include/system/memory_ldst_endian.h.inc +4 -0
@@ -18,10 +18,14 @@ uint16_t ADDRESS_SPACE_LD(uw)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); uint32_t ADDRESS_SPACE_LD(l)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result); +uint64_t ADDRESS_SPACE_LD(q)(ARG1_DECL, hwaddr addr, + MemTxAttrs attrs, MemTxResult *result); void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result); void ADDRESS_SPACE_ST(l)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result); +void ADDRESS_SPACE_ST(q)(ARG1_DECL, hwaddr addr, uint64_t val, + MemTxAttrs attrs, MemTxResult *result); #undef ADDRESS_SPACE_LD #undef ADDRESS_SPACE_ST
include/system/memory_ldst_phys_endian.h.inc +10 -0
@@ -29,6 +29,11 @@ static inline uint32_t LD_PHYS(l)(ARG1_DECL, hwaddr addr) return ADDRESS_SPACE_LD(l)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); } +static inline uint64_t LD_PHYS(q)(ARG1_DECL, hwaddr addr) +{ + return ADDRESS_SPACE_LD(q)(ARG1, addr, MEMTXATTRS_UNSPECIFIED, NULL); +} + static inline void ST_PHYS(w)(ARG1_DECL, hwaddr addr, uint16_t val) { ADDRESS_SPACE_ST(w)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL);
@@ -39,6 +44,11 @@ static inline void ST_PHYS(l)(ARG1_DECL, hwaddr addr, uint32_t val) ADDRESS_SPACE_ST(l)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); } +static inline void ST_PHYS(q)(ARG1_DECL, hwaddr addr, uint64_t val) +{ + ADDRESS_SPACE_ST(q)(ARG1, addr, val, MEMTXATTRS_UNSPECIFIED, NULL); +} + #undef LD_PHYS #undef ST_PHYS #undef ADDRESS_SPACE_LD
system/memory_ldst.c.inc +0 -42
54 lines not on this page · raw message
system/memory_ldst_endian.c.inc +14 -0
@@ -33,6 +33,13 @@ uint32_t ADDRESS_SPACE_LD(l)(ARG1_DECL, hwaddr addr, DEVICE_ENDIANNESS); } +uint64_t ADDRESS_SPACE_LD(q)(ARG1_DECL, hwaddr addr, + MemTxAttrs attrs, MemTxResult *result) +{ + return ADDRESS_SPACE_LD_INTERNAL(q)(ARG1, addr, attrs, result, + DEVICE_ENDIANNESS); +} + void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) {
@@ -47,6 +54,13 @@ void ADDRESS_SPACE_ST(l)(ARG1_DECL, hwaddr addr, uint32_t val, DEVICE_ENDIANNESS); } +void ADDRESS_SPACE_ST(q)(ARG1_DECL, hwaddr addr, uint64_t val, + MemTxAttrs attrs, MemTxResult *result) +{ + ADDRESS_SPACE_ST_INTERNAL(q)(ARG1, addr, val, attrs, result, + DEVICE_ENDIANNESS); +} + #undef ADDRESS_SPACE_LD #undef ADDRESS_SPACE_LD_INTERNAL #undef ADDRESS_SPACE_ST
Signature · 1 line
2.52.0
Re: [PATCH 11/14] system/memory: Define address_space_ldst[Q] endian variants via template
Quoted 9 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/exec/memory_ldst.h.inc | 17 ++------ include/exec/memory_ldst_phys.h.inc | 36 ----------------- include/system/memory_ldst_endian.h.inc | 4 ++ include/system/memory_ldst_phys_endian.h.inc | 10 +++++ system/memory_ldst.c.inc | 42 -------------------- system/memory_ldst_endian.c.inc | 14 +++++++ 6 files changed, 31 insertions(+), 92 deletions(-)
r~
PATCH 12/14 system/memory: Factor address_space_ldst[M]_internal() helper out
In reply to Philippe Mathieu-DaudéAll the LD/ST[W,L,Q] variants use the same template, only modifying the access size used. Unify as a single pair of LD/ST methods taking a MemOp argument. Thus use the 'm' suffix for MemOp.
--- system/memory_ldst.c.inc | 289 ++++++++------------------------------- 1 file changed, 58 insertions(+), 231 deletions(-)
system/memory_ldst.c.inc +58 -231
@@ -20,39 +20,43 @@ */ /* warning: addr must be aligned */ -static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result, - enum device_endian endian) +static inline +uint64_t glue(address_space_ldm_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, + MemTxAttrs attrs, + MemTxResult *result, + enum device_endian endian) { + const unsigned size = memop_size(mop); uint8_t *ptr; uint64_t val; MemoryRegion *mr; - hwaddr l = 4; + hwaddr l = size; hwaddr addr1; MemTxResult r; bool release_lock = false; RCU_READ_LOCK(); mr = TRANSLATE(addr, &addr1, &l, false, attrs); - if (l < 4 || !memory_access_is_direct(mr, false, attrs)) { + if (l < size || !memory_access_is_direct(mr, false, attrs)) { release_lock |= prepare_mmio_access(mr); /* I/O case */ r = memory_region_dispatch_read(mr, addr1, &val, - MO_32 | devend_memop(endian), attrs); + mop | devend_memop(endian), attrs); } else { /* RAM case */ - fuzz_dma_read_cb(addr, 4, mr); + fuzz_dma_read_cb(addr, size, mr); ptr = qemu_map_ram_ptr(mr->ram_block, addr1); switch (endian) { case DEVICE_LITTLE_ENDIAN: - val = ldl_le_p(ptr); + val = ldn_le_p(ptr, size); break; case DEVICE_BIG_ENDIAN: - val = ldl_be_p(ptr); + val = ldn_be_p(ptr, size); break; default: - val = ldl_p(ptr); + val = ldn_p(ptr, size); break; } r = MEMTX_OK;
@@ -67,87 +71,30 @@ static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, return val; } +/* warning: addr must be aligned */ +static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result, + enum device_endian endian) +{ + return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_32, addr, + attrs, result, endian); +} + /* warning: addr must be aligned */ static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) { - uint8_t *ptr; - uint64_t val; - MemoryRegion *mr; - hwaddr l = 8; - hwaddr addr1; - MemTxResult r; - bool release_lock = false; - - RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, false, attrs); - if (l < 8 || !memory_access_is_direct(mr, false, attrs)) { - release_lock |= prepare_mmio_access(mr); - - /* I/O case */ - r = memory_region_dispatch_read(mr, addr1, &val, - MO_64 | devend_memop(endian), attrs); - } else { - /* RAM case */ - fuzz_dma_read_cb(addr, 8, mr); - ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - switch (endian) { - case DEVICE_LITTLE_ENDIAN: - val = ldq_le_p(ptr); - break; - case DEVICE_BIG_ENDIAN: - val = ldq_be_p(ptr); - break; - default: - val = ldq_p(ptr); - break; - } - r = MEMTX_OK; - } - if (result) { - *result = r; - } - if (release_lock) { - bql_unlock(); - } - RCU_READ_UNLOCK(); - return val; + return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_64, addr, + attrs, result, endian); } uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { - uint8_t *ptr; - uint64_t val; - MemoryRegion *mr; - hwaddr l = 1; - hwaddr addr1; - MemTxResult r; - bool release_lock = false; - - RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, false, attrs); - if (!memory_access_is_direct(mr, false, attrs)) { - release_lock |= prepare_mmio_access(mr); - - /* I/O case */ - r = memory_region_dispatch_read(mr, addr1, &val, MO_8, attrs); - } else { - /* RAM case */ - fuzz_dma_read_cb(addr, 1, mr); - ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - val = ldub_p(ptr); - r = MEMTX_OK; - } - if (result) { - *result = r; - } - if (release_lock) { - bql_unlock(); - } - RCU_READ_UNLOCK(); - return val; + return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_8, addr, + attrs, result, + DEVICE_NATIVE_ENDIAN); } /* warning: addr must be aligned */
@@ -155,37 +102,46 @@ static inline uint16_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) { + return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_16, addr, + attrs, result, endian); +} + +static inline +void glue(address_space_stm_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, uint64_t val, + MemTxAttrs attrs, + MemTxResult *result, + enum device_endian endian) +{ + const unsigned size = memop_size(mop); uint8_t *ptr; - uint64_t val; MemoryRegion *mr; - hwaddr l = 2; + hwaddr l = size; hwaddr addr1; MemTxResult r; bool release_lock = false; RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, false, attrs); - if (l < 2 || !memory_access_is_direct(mr, false, attrs)) { + mr = TRANSLATE(addr, &addr1, &l, true, attrs); + if (l < size || !memory_access_is_direct(mr, true, attrs)) { release_lock |= prepare_mmio_access(mr); - - /* I/O case */ - r = memory_region_dispatch_read(mr, addr1, &val, - MO_16 | devend_memop(endian), attrs); + r = memory_region_dispatch_write(mr, addr1, val, + mop | devend_memop(endian), attrs); } else { /* RAM case */ - fuzz_dma_read_cb(addr, 2, mr); ptr = qemu_map_ram_ptr(mr->ram_block, addr1); switch (endian) { case DEVICE_LITTLE_ENDIAN: - val = lduw_le_p(ptr); + stn_le_p(ptr, size, val); break; case DEVICE_BIG_ENDIAN: - val = lduw_be_p(ptr); + stn_be_p(ptr, size, val); break; default: - val = lduw_p(ptr); + stn_p(ptr, size, val); break; } + invalidate_and_set_dirty(mr, addr1, size); r = MEMTX_OK; } if (result) {
@@ -195,7 +151,6 @@ static inline uint16_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, bql_unlock(); } RCU_READ_UNLOCK(); - return val; } /* warning: addr must be aligned */
@@ -203,74 +158,16 @@ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) { - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 4; - hwaddr addr1; - MemTxResult r; - bool release_lock = false; - - RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, true, attrs); - if (l < 4 || !memory_access_is_direct(mr, true, attrs)) { - release_lock |= prepare_mmio_access(mr); - r = memory_region_dispatch_write(mr, addr1, val, - MO_32 | devend_memop(endian), attrs); - } else { - /* RAM case */ - ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - switch (endian) { - case DEVICE_LITTLE_ENDIAN: - stl_le_p(ptr, val); - break; - case DEVICE_BIG_ENDIAN: - stl_be_p(ptr, val); - break; - default: - stl_p(ptr, val); - break; - } - invalidate_and_set_dirty(mr, addr1, 4); - r = MEMTX_OK; - } - if (result) { - *result = r; - } - if (release_lock) { - bql_unlock(); - } - RCU_READ_UNLOCK(); + glue(address_space_stm_internal, SUFFIX)(ARG1, MO_32, addr, val, + attrs, result, endian); } void glue(address_space_stb, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result) { - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 1; - hwaddr addr1; - MemTxResult r; - bool release_lock = false; - - RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, true, attrs); - if (!memory_access_is_direct(mr, true, attrs)) { - release_lock |= prepare_mmio_access(mr); - r = memory_region_dispatch_write(mr, addr1, val, MO_8, attrs); - } else { - /* RAM case */ - ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - stb_p(ptr, val); - invalidate_and_set_dirty(mr, addr1, 1); - r = MEMTX_OK; - } - if (result) { - *result = r; - } - if (release_lock) { - bql_unlock(); - } - RCU_READ_UNLOCK(); + glue(address_space_stm_internal, SUFFIX)(ARG1, MO_8, addr, val, + attrs, result, + DEVICE_NATIVE_ENDIAN); } /* warning: addr must be aligned */
@@ -278,86 +175,16 @@ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) { - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 2; - hwaddr addr1; - MemTxResult r; - bool release_lock = false; - - RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, true, attrs); - if (l < 2 || !memory_access_is_direct(mr, true, attrs)) { - release_lock |= prepare_mmio_access(mr); - r = memory_region_dispatch_write(mr, addr1, val, - MO_16 | devend_memop(endian), attrs); - } else { - /* RAM case */ - ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - switch (endian) { - case DEVICE_LITTLE_ENDIAN: - stw_le_p(ptr, val); - break; - case DEVICE_BIG_ENDIAN: - stw_be_p(ptr, val); - break; - default: - stw_p(ptr, val); - break; - } - invalidate_and_set_dirty(mr, addr1, 2); - r = MEMTX_OK; - } - if (result) { - *result = r; - } - if (release_lock) { - bql_unlock(); - } - RCU_READ_UNLOCK(); + glue(address_space_stm_internal, SUFFIX)(ARG1, MO_16, addr, val, + attrs, result, endian); } static inline void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result, enum device_endian endian) { - uint8_t *ptr; - MemoryRegion *mr; - hwaddr l = 8; - hwaddr addr1; - MemTxResult r; - bool release_lock = false; - - RCU_READ_LOCK(); - mr = TRANSLATE(addr, &addr1, &l, true, attrs); - if (l < 8 || !memory_access_is_direct(mr, true, attrs)) { - release_lock |= prepare_mmio_access(mr); - r = memory_region_dispatch_write(mr, addr1, val, - MO_64 | devend_memop(endian), attrs); - } else { - /* RAM case */ - ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - switch (endian) { - case DEVICE_LITTLE_ENDIAN: - stq_le_p(ptr, val); - break; - case DEVICE_BIG_ENDIAN: - stq_be_p(ptr, val); - break; - default: - stq_p(ptr, val); - break; - } - invalidate_and_set_dirty(mr, addr1, 8); - r = MEMTX_OK; - } - if (result) { - *result = r; - } - if (release_lock) { - bql_unlock(); - } - RCU_READ_UNLOCK(); + glue(address_space_stm_internal, SUFFIX)(ARG1, MO_64, addr, val, + attrs, result, endian); } #define ENDIANNESS
Signature · 1 line
2.52.0
Re: [PATCH 12/14] system/memory: Factor address_space_ldst[M]_internal() helper out
Quoted 72 lines · Philippe Mathieu-Daudé
All the LD/ST[W,L,Q] variants use the same template, only modifying the access size used. Unify as a single pair of LD/ST methods taking a MemOp argument. Thus use the 'm' suffix for MemOp.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- system/memory_ldst.c.inc | 289 ++++++++------------------------------- 1 file changed, 58 insertions(+), 231 deletions(-)system/memory_ldst.c.inc +14
-10@@ -20,39 +20,43 @@ */ /* warning: addr must be aligned */ -static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result, - enum device_endian endian) +static inline +uint64_t glue(address_space_ldm_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, + MemTxAttrs attrs, + MemTxResult *result, + enum device_endian endian) { + const unsigned size = memop_size(mop); uint8_t *ptr; uint64_t val; MemoryRegion *mr; - hwaddr l = 4; + hwaddr l = size; hwaddr addr1; MemTxResult r; bool release_lock = false; RCU_READ_LOCK(); mr = TRANSLATE(addr, &addr1, &l, false, attrs); - if (l < 4 || !memory_access_is_direct(mr, false, attrs)) { + if (l < size || !memory_access_is_direct(mr, false, attrs)) { release_lock |= prepare_mmio_access(mr); /* I/O case */ r = memory_region_dispatch_read(mr, addr1, &val, - MO_32 | devend_memop(endian), attrs); + mop | devend_memop(endian), attrs); } else { /* RAM case */ - fuzz_dma_read_cb(addr, 4, mr); + fuzz_dma_read_cb(addr, size, mr); ptr = qemu_map_ram_ptr(mr->ram_block, addr1); switch (endian) { case DEVICE_LITTLE_ENDIAN: - val = ldl_le_p(ptr); + val = ldn_le_p(ptr, size); break; case DEVICE_BIG_ENDIAN: - val = ldl_be_p(ptr); + val = ldn_be_p(ptr, size); break; default: - val = ldl_p(ptr); + val = ldn_p(ptr, size); break; } r = MEMTX_OK;@@ -67,87 +71,30 @@ static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, return val; }
system/memory_ldst.c.inc static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, · line 83
Quoted 10 lines
system/memory_ldst.c.inc +9
-0+/* warning: addr must be aligned */ +static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, + hwaddr addr, MemTxAttrs attrs, MemTxResult *result, + enum device_endian endian) +{ + return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_32, addr, + attrs, result, endian); +} + /* warning: addr must be aligned */
Do we know why this warning is here?
Do we know why we aren't asserting alignment?
It makes me wonder if the ldn_*_p above shouldn't be qatomic_ld. And more so for the stores.
But that's an existing problem, not new with the refactor, so
r~
PATCH 13/14 system/memory: Pass device_endian argument as MemOp bit
In reply to Philippe Mathieu-DaudéUse the MemOp argument to hold both the access size and its endianness.
--- system/memory_ldst.c.inc | 86 ++++++++++++--------------------- system/memory_ldst_endian.c.inc | 20 +++----- 2 files changed, 38 insertions(+), 68 deletions(-)
system/memory_ldst.c.inc +31 -55
@@ -24,8 +24,7 @@ static inline uint64_t glue(address_space_ldm_internal, SUFFIX)(ARG1_DECL, MemOp mop, hwaddr addr, MemTxAttrs attrs, - MemTxResult *result, - enum device_endian endian) + MemTxResult *result) { const unsigned size = memop_size(mop); uint8_t *ptr;
@@ -42,22 +41,15 @@ uint64_t glue(address_space_ldm_internal, SUFFIX)(ARG1_DECL, MemOp mop, release_lock |= prepare_mmio_access(mr); /* I/O case */ - r = memory_region_dispatch_read(mr, addr1, &val, - mop | devend_memop(endian), attrs); + r = memory_region_dispatch_read(mr, addr1, &val, mop, attrs); } else { /* RAM case */ fuzz_dma_read_cb(addr, size, mr); ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - switch (endian) { - case DEVICE_LITTLE_ENDIAN: + if ((mop & MO_BSWAP) == MO_LE) { val = ldn_le_p(ptr, size); - break; - case DEVICE_BIG_ENDIAN: + } else { val = ldn_be_p(ptr, size); - break; - default: - val = ldn_p(ptr, size); - break; } r = MEMTX_OK; }
@@ -73,45 +65,40 @@ uint64_t glue(address_space_ldm_internal, SUFFIX)(ARG1_DECL, MemOp mop, /* warning: addr must be aligned */ static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result, - enum device_endian endian) + MemOp mop, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { - return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_32, addr, - attrs, result, endian); + return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_32, addr, + attrs, result); } /* warning: addr must be aligned */ static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result, - enum device_endian endian) + MemOp mop, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { - return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_64, addr, - attrs, result, endian); + return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_64, addr, + attrs, result); } uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_8, addr, - attrs, result, - DEVICE_NATIVE_ENDIAN); + attrs, result); } /* warning: addr must be aligned */ static inline uint16_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result, - enum device_endian endian) + MemOp mop, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { - return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_16, addr, - attrs, result, endian); + return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_16, addr, + attrs, result); } static inline void glue(address_space_stm_internal, SUFFIX)(ARG1_DECL, MemOp mop, hwaddr addr, uint64_t val, MemTxAttrs attrs, - MemTxResult *result, - enum device_endian endian) + MemTxResult *result) { const unsigned size = memop_size(mop); uint8_t *ptr;
@@ -125,21 +112,14 @@ void glue(address_space_stm_internal, SUFFIX)(ARG1_DECL, MemOp mop, mr = TRANSLATE(addr, &addr1, &l, true, attrs); if (l < size || !memory_access_is_direct(mr, true, attrs)) { release_lock |= prepare_mmio_access(mr); - r = memory_region_dispatch_write(mr, addr1, val, - mop | devend_memop(endian), attrs); + r = memory_region_dispatch_write(mr, addr1, val, mop, attrs); } else { /* RAM case */ ptr = qemu_map_ram_ptr(mr->ram_block, addr1); - switch (endian) { - case DEVICE_LITTLE_ENDIAN: + if ((mop & MO_BSWAP) == MO_LE) { stn_le_p(ptr, size, val); - break; - case DEVICE_BIG_ENDIAN: + } else { stn_be_p(ptr, size, val); - break; - default: - stn_p(ptr, size, val); - break; } invalidate_and_set_dirty(mr, addr1, size); r = MEMTX_OK;
@@ -155,48 +135,44 @@ void glue(address_space_stm_internal, SUFFIX)(ARG1_DECL, MemOp mop, /* warning: addr must be aligned */ static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, uint32_t val, MemTxAttrs attrs, - MemTxResult *result, enum device_endian endian) + MemOp mop, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) { - glue(address_space_stm_internal, SUFFIX)(ARG1, MO_32, addr, val, - attrs, result, endian); + glue(address_space_stm_internal, SUFFIX)(ARG1, mop | MO_32, addr, val, + attrs, result); } void glue(address_space_stb, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result) { glue(address_space_stm_internal, SUFFIX)(ARG1, MO_8, addr, val, - attrs, result, - DEVICE_NATIVE_ENDIAN); + attrs, result); } /* warning: addr must be aligned */ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, uint16_t val, MemTxAttrs attrs, - MemTxResult *result, enum device_endian endian) + MemOp mop, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) { - glue(address_space_stm_internal, SUFFIX)(ARG1, MO_16, addr, val, - attrs, result, endian); + glue(address_space_stm_internal, SUFFIX)(ARG1, mop | MO_16, addr, val, + attrs, result); } static inline void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, - hwaddr addr, uint64_t val, MemTxAttrs attrs, - MemTxResult *result, enum device_endian endian) + MemOp mop, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result) { - glue(address_space_stm_internal, SUFFIX)(ARG1, MO_64, addr, val, - attrs, result, endian); + glue(address_space_stm_internal, SUFFIX)(ARG1, mop | MO_64, addr, val, + attrs, result); } #define ENDIANNESS -#define DEVICE_ENDIANNESS DEVICE_NATIVE_ENDIAN +#define MO_ENDIAN (target_big_endian() ? MO_BE : MO_LE) #include "memory_ldst_endian.c.inc" #define ENDIANNESS _le -#define DEVICE_ENDIANNESS DEVICE_LITTLE_ENDIAN +#define MO_ENDIAN MO_LE #include "memory_ldst_endian.c.inc" #define ENDIANNESS _be -#define DEVICE_ENDIANNESS DEVICE_BIG_ENDIAN +#define MO_ENDIAN MO_BE #include "memory_ldst_endian.c.inc" #undef ARG1_DECL
system/memory_ldst_endian.c.inc +7 -13
@@ -22,43 +22,37 @@ uint16_t ADDRESS_SPACE_LD(uw)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { - return ADDRESS_SPACE_LD_INTERNAL(uw)(ARG1, addr, attrs, result, - DEVICE_ENDIANNESS); + return ADDRESS_SPACE_LD_INTERNAL(uw)(ARG1, MO_ENDIAN, addr, attrs, result); } uint32_t ADDRESS_SPACE_LD(l)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { - return ADDRESS_SPACE_LD_INTERNAL(l)(ARG1, addr, attrs, result, - DEVICE_ENDIANNESS); + return ADDRESS_SPACE_LD_INTERNAL(l)(ARG1, MO_ENDIAN, addr, attrs, result); } uint64_t ADDRESS_SPACE_LD(q)(ARG1_DECL, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) { - return ADDRESS_SPACE_LD_INTERNAL(q)(ARG1, addr, attrs, result, - DEVICE_ENDIANNESS); + return ADDRESS_SPACE_LD_INTERNAL(q)(ARG1, MO_ENDIAN, addr, attrs, result); } void ADDRESS_SPACE_ST(w)(ARG1_DECL, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) { - ADDRESS_SPACE_ST_INTERNAL(w)(ARG1, addr, val, attrs, result, - DEVICE_ENDIANNESS); + ADDRESS_SPACE_ST_INTERNAL(w)(ARG1, MO_ENDIAN, addr, val, attrs, result); } void ADDRESS_SPACE_ST(l)(ARG1_DECL, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) { - ADDRESS_SPACE_ST_INTERNAL(l)(ARG1, addr, val, attrs, result, - DEVICE_ENDIANNESS); + ADDRESS_SPACE_ST_INTERNAL(l)(ARG1, MO_ENDIAN, addr, val, attrs, result); } void ADDRESS_SPACE_ST(q)(ARG1_DECL, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result) { - ADDRESS_SPACE_ST_INTERNAL(q)(ARG1, addr, val, attrs, result, - DEVICE_ENDIANNESS); + ADDRESS_SPACE_ST_INTERNAL(q)(ARG1, MO_ENDIAN, addr, val, attrs, result); } #undef ADDRESS_SPACE_LD
@@ -67,4 +61,4 @@ void ADDRESS_SPACE_ST(q)(ARG1_DECL, hwaddr addr, uint64_t val, #undef ADDRESS_SPACE_ST_INTERNAL #undef ENDIANNESS -#undef DEVICE_ENDIANNESS +#undef MO_ENDIAN
Signature · 1 line
2.52.0
Re: [PATCH 13/14] system/memory: Pass device_endian argument as MemOp bit
Quoted 8 lines · Philippe Mathieu-Daudé
Use the MemOp argument to hold both the access size and its endianness.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- system/memory_ldst.c.inc | 86 ++++++++++++--------------------- system/memory_ldst_endian.c.inc | 20 +++----- 2 files changed, 38 insertions(+), 68 deletions(-)
r~
PATCH 14/14 system/memory: Sort methods in memory_ldst.c.inc file
In reply to Philippe Mathieu-DaudéFor clarity, sort methods by access size (B, W, L, Q). Fix coding style. Only code movement, no logical change.
--- system/memory_ldst.c.inc | 86 ++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 34 deletions(-)
system/memory_ldst.c.inc +52 -34
@@ -63,37 +63,46 @@ uint64_t glue(address_space_ldm_internal, SUFFIX)(ARG1_DECL, MemOp mop, return val; } -/* warning: addr must be aligned */ -static inline uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, - MemOp mop, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) -{ - return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_32, addr, - attrs, result); -} - -/* warning: addr must be aligned */ -static inline uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL, - MemOp mop, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) -{ - return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_64, addr, - attrs, result); -} - -uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, - hwaddr addr, MemTxAttrs attrs, MemTxResult *result) +uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL, hwaddr addr, + MemTxAttrs attrs, MemTxResult *result) { return glue(address_space_ldm_internal, SUFFIX)(ARG1, MO_8, addr, attrs, result); } /* warning: addr must be aligned */ -static inline uint16_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, - MemOp mop, hwaddr addr, MemTxAttrs attrs, MemTxResult *result) +static inline +uint16_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, + MemTxAttrs attrs, + MemTxResult *result) { return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_16, addr, attrs, result); } +/* warning: addr must be aligned */ +static inline +uint32_t glue(address_space_ldl_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, + MemTxAttrs attrs, + MemTxResult *result) +{ + return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_32, addr, + attrs, result); +} + +/* warning: addr must be aligned */ +static inline +uint64_t glue(address_space_ldq_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, + MemTxAttrs attrs, + MemTxResult *result) +{ + return glue(address_space_ldm_internal, SUFFIX)(ARG1, mop | MO_64, addr, + attrs, result); +} + static inline void glue(address_space_stm_internal, SUFFIX)(ARG1_DECL, MemOp mop, hwaddr addr, uint64_t val,
@@ -133,31 +142,40 @@ void glue(address_space_stm_internal, SUFFIX)(ARG1_DECL, MemOp mop, RCU_READ_UNLOCK(); } -/* warning: addr must be aligned */ -static inline void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, - MemOp mop, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) -{ - glue(address_space_stm_internal, SUFFIX)(ARG1, mop | MO_32, addr, val, - attrs, result); -} - -void glue(address_space_stb, SUFFIX)(ARG1_DECL, - hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result) +void glue(address_space_stb, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val, + MemTxAttrs attrs, MemTxResult *result) { glue(address_space_stm_internal, SUFFIX)(ARG1, MO_8, addr, val, attrs, result); } /* warning: addr must be aligned */ -static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, - MemOp mop, hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result) +static inline +void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, uint16_t val, + MemTxAttrs attrs, + MemTxResult *result) { glue(address_space_stm_internal, SUFFIX)(ARG1, mop | MO_16, addr, val, attrs, result); } -static inline void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, - MemOp mop, hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result) +/* warning: addr must be aligned */ +static inline +void glue(address_space_stl_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, uint32_t val, + MemTxAttrs attrs, + MemTxResult *result) +{ + glue(address_space_stm_internal, SUFFIX)(ARG1, mop | MO_32, addr, val, + attrs, result); +} + +static inline +void glue(address_space_stq_internal, SUFFIX)(ARG1_DECL, MemOp mop, + hwaddr addr, uint64_t val, + MemTxAttrs attrs, + MemTxResult *result) { glue(address_space_stm_internal, SUFFIX)(ARG1, mop | MO_64, addr, val, attrs, result);
Signature · 1 line
2.52.0
Re: [PATCH 14/14] system/memory: Sort methods in memory_ldst.c.inc file
Quoted 7 lines · Philippe Mathieu-Daudé
For clarity, sort methods by access size (B, W, L, Q). Fix coding style. Only code movement, no logical change.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- system/memory_ldst.c.inc | 86 ++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 34 deletions(-)
r~