Skip to contentSkip to conversation

system/memory: Mark ld/st_phys() API as legacy

PATCH In review Philippe Mathieu-Daudé 3 participants 22 messages Dec 24, 2025 – Dec 30, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover system/memory: Mark ld/st_phys() API as legacy

When using the ld/st_phys() API, when an access fail, no error is reported. Because if that we introduced the address_space_ld/st() API 10 years ago. There are few uses of the ld/st_phys() API left in the code base, time to mark it as legacy.
Allow targets to opt-out for the legacy API, by setting the TARGET_NOT_USING_LEGACY_LDST_PHYS_API definition.

First drop the _notdirty() variant, mark some targets clean of the legacy API, then rework virtio core layer a bit in order to clean more targets.

Targets left missing conversion:

 $ fgrep -L TARGET_NOT_USING_LEGACY_LDST_PHYS_API configs/targets/*softmmu*mak
 configs/targets/aarch64-softmmu.mak
 configs/targets/alpha-softmmu.mak
 configs/targets/arm-softmmu.mak
 configs/targets/hppa-softmmu.mak
 configs/targets/i386-softmmu.mak
 configs/targets/loongarch64-softmmu.mak
 configs/targets/m68k-softmmu.mak
 configs/targets/ppc-softmmu.mak
 configs/targets/ppc64-softmmu.mak
 configs/targets/s390x-softmmu.mak
 configs/targets/sparc-softmmu.mak
 configs/targets/x86_64-softmmu.mak

tag: https://gitlab.com/philmd/qemu/-/tags/legacy_ldst_phys-v1
CI: https://gitlab.com/philmd/qemu/-/pipelines/2231223066

Philippe Mathieu-Daudé (9):
target/i386: Remove x86_stl_phys_notdirty() leftover target/sparc: Update MMU page table using stl_phys() hw/arm: Avoid address_space_stl_notdirty() when generating bootloader system/memory: Remove address_space_stl_notdirty and stl_phys_notdirty system/memory: Allow restricting legacy ldst_phys() API usage configs/targets: Mark targets not using legacy ldst_phys() API hw/virtio: Remove unused ldst_phys() helpers
hw/virtio: Reduce virtio_lduw/stw_phys_cached() scope configs/targets: Mark targets not using legacy ldst_phys() API

 configs/targets/avr-softmmu.mak          |   1 +
 configs/targets/microblaze-softmmu.mak   |   1 +
 configs/targets/microblazeel-softmmu.mak |   1 +
 configs/targets/mips-softmmu.mak         |   1 +
 configs/targets/mips64-softmmu.mak       |   1 +
 configs/targets/mips64el-softmmu.mak     |   1 +
 configs/targets/mipsel-softmmu.mak       |   1 +
 configs/targets/or1k-softmmu.mak         |   1 +
 configs/targets/riscv32-softmmu.mak      |   1 +
 configs/targets/riscv64-softmmu.mak      |   1 +
 configs/targets/rx-softmmu.mak           |   1 +
 configs/targets/sh4-softmmu.mak          |   1 +
 configs/targets/sh4eb-softmmu.mak        |   1 +
 configs/targets/sparc64-softmmu.mak      |   1 +
 configs/targets/tricore-softmmu.mak      |   1 +
 configs/targets/xtensa-softmmu.mak       |   1 +
 configs/targets/xtensaeb-softmmu.mak     |   1 +
 include/hw/virtio/virtio-access.h        | 106 -----------------------
 include/system/memory.h                  |   8 +-
 target/i386/cpu.h                        |   1 -
 include/exec/memory_ldst.h.inc           |   2 -
 hw/arm/aspeed.c                          |   4 +-
 hw/arm/boot.c                            |   8 +-
 hw/virtio/virtio.c                       |  21 +++++
 target/i386/helper.c                     |  10 ---
 target/sparc/mmu_helper.c                |   2 +-
 system/memory_ldst.c.inc                 |  39 ---------
 scripts/make-config-poison.sh            |   1 +
 28 files changed, 48 insertions(+), 171 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH 1/9 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
index cee1f692a1c..4c0579a5678 100644
@@ -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
index 72b2e195a31..d14f14e0d4d 100644
@@ -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
#2 lore raw

PATCH 2/9 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
index 217580a4d8c..46bf500ea83 100644
@@ -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
#3 lore raw

PATCH 3/9 hw/arm: Avoid address_space_stl_notdirty() when generating bootloader

In reply to Philippe Mathieu-Daudé

When using the '-kernel' command line option, a bootloader is emitted, calling address_space_stl_notdirty().

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 address_space_stl() helper.

---
 hw/arm/aspeed.c | 4 ++--
 hw/arm/boot.c   | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
hw/arm/aspeed.c +2 -2
index 3a5071a3841..e3cd1519a81 100644
@@ -77,8 +77,8 @@ 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);
+    address_space_stl(as, AST_SMP_MBOX_FIELD_GOSIGN, 0,
+                         MEMTXATTRS_UNSPECIFIED, NULL);
     cpu_set_pc(cs, info->smp_loader_start);
 }
 
hw/arm/boot.c +4 -4
index b91660208f5..de22b8adf56 100644
@@ -266,8 +266,8 @@ 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);
+    address_space_stl(as, info->smp_bootreg_addr,
+                         0, MEMTXATTRS_UNSPECIFIED, NULL);
     cpu_set_pc(cs, info->smp_loader_start);
 }
 
@@ -277,8 +277,8 @@ 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);  \
+    address_space_stl(as, p, value, \
+                         MEMTXATTRS_UNSPECIFIED, NULL);  \
     p += 4;                       \
 } while (0)
 
Signature · 1 line
2.52.0
#4 lore raw

PATCH 4/9 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
index 3bd5ffa5e0d..e69171de05a 100644
@@ -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
index 7270235c600..173164fee3a 100644
@@ -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
index 333da209d1a..b45bfecd137 100644
@@ -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
#5 lore raw

PATCH 5/9 system/memory: Allow restricting legacy ldst_phys() API usage

In reply to Philippe Mathieu-Daudé

Commit 500131154d6 ("exec.c: Add new address_space_ld*/st* functions") added a new API to fix a shortcoming of the ld/st*_phys() API, which does blind bus access, not reporting failure (and it also allow to provide transaction attributes).

Later commit 42874d3a8c6 ("Switch non-CPU callers from ld/st*_phys to address_space_ld/st*") automatically converted the legacy uses to the new API, not precising transaction attributes (MEMTXATTRS_UNSPECIFIED) and ignoring the transation result (passing NULL pointer as MemTxResult).

While this is a faithful replacement, without any logical change, we later realized better is to not use MEMTXATTRS_UNSPECIFIED or NULL MemTxResult, and adapt each call site on a pair basis, looking at the device model datasheet to do the correct behavior (which is unlikely to ignore transaction failures).

Since this is quite some work, we defer that to device model maintainers. Meanwhile we introduce a definition, to allow a target which removed all legacy API call to prohibit further legacy API uses, named "TARGET_NOT_USING_LEGACY_LDST_PHYS_API".

Since all targets should be able to check this definition, we take care to not poison it.

---
 include/system/memory.h       | 2 ++
 scripts/make-config-poison.sh | 1 +
 2 files changed, 3 insertions(+)
include/system/memory.h +2 -0
index e69171de05a..d5c248f1794 100644
@@ -2850,10 +2850,12 @@ MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
 #define ARG1_DECL    AddressSpace *as
 #include "exec/memory_ldst.h.inc"
 
+#ifndef TARGET_NOT_USING_LEGACY_LDST_PHYS_API
 #define SUFFIX
 #define ARG1         as
 #define ARG1_DECL    AddressSpace *as
 #include "exec/memory_ldst_phys.h.inc"
+#endif
 
 struct MemoryRegionCache {
     uint8_t *ptr;
scripts/make-config-poison.sh +1 -0
index 2b36907e239..937357b3531 100755
@@ -10,6 +10,7 @@ exec sed -n \
   -e' /CONFIG_TCG/d' \
   -e '/CONFIG_USER_ONLY/d' \
   -e '/CONFIG_SOFTMMU/d' \
+  -e '/TARGET_NOT_USING_LEGACY_LDST_PHYS_API/d' \
   -e '/^#define / {' \
   -e    's///' \
   -e    's/ .*//' \
Signature · 1 line
2.52.0
Reviewed-by on v1 5/9
#6 lore raw

Re: [PATCH 5/9] system/memory: Allow restricting legacy ldst_phys() API usage

Quoted 18 lines · Philippe Mathieu-Daudé

Commit 500131154d6 ("exec.c: Add new address_space_ld*/st* functions") added a new API to fix a shortcoming of the ld/st*_phys() API, which does blind bus access, not reporting failure (and it also allow to provide transaction attributes).

Later commit 42874d3a8c6 ("Switch non-CPU callers from ld/st*_phys to address_space_ld/st*") automatically converted the legacy uses to the new API, not precising transaction attributes (MEMTXATTRS_UNSPECIFIED) and ignoring the transation result (passing NULL pointer as MemTxResult).

While this is a faithful replacement, without any logical change, we later realized better is to not use MEMTXATTRS_UNSPECIFIED or NULL MemTxResult, and adapt each call site on a pair basis, looking at the device model datasheet to do the correct behavior (which is unlikely to ignore transaction failures).

Quoted 5 lines

Since this is quite some work, we defer that to device model maintainers. Meanwhile we introduce a definition, to allow a target which removed all legacy API call to prohibit further legacy API uses, named "TARGET_NOT_USING_LEGACY_LDST_PHYS_API".

Personally the negation (i.e. TARGET_USING_LEGACY_LDST_PHYS_API) would make more sense since you're opting-in an API but that must be more complex to introduce I guess?

In any case:

Quoted 42 lines

Since all targets should be able to check this definition, we take care to not poison it.

---
 include/system/memory.h       | 2 ++
 scripts/make-config-poison.sh | 1 +
 2 files changed, 3 insertions(+)
include/system/memory.h +2 -0
index e69171de05a..d5c248f1794 100644
@@ -2850,10 +2850,12 @@ MemTxResult address_space_write_rom(AddressSpace *as, hwaddr addr,
 #define ARG1_DECL    AddressSpace *as
 #include "exec/memory_ldst.h.inc"
 
+#ifndef TARGET_NOT_USING_LEGACY_LDST_PHYS_API
 #define SUFFIX
 #define ARG1         as
 #define ARG1_DECL    AddressSpace *as
 #include "exec/memory_ldst_phys.h.inc"
+#endif
 
 struct MemoryRegionCache {
     uint8_t *ptr;
scripts/make-config-poison.sh +1 -1
index 2b36907e239..937357b3531 100755
@@ -10,6 +10,7 @@ exec sed -n \
   -e' /CONFIG_TCG/d' \
   -e '/CONFIG_USER_ONLY/d' \
   -e '/CONFIG_SOFTMMU/d' \
+  -e '/TARGET_NOT_USING_LEGACY_LDST_PHYS_API/d' \
   -e '/^#define / {' \
   -e    's///' \
   -e    's/ .*//' \
--

2.52.0

#7 lore raw

Re: [PATCH 5/9] system/memory: Allow restricting legacy ldst_phys() API usage

Quoted 26 lines · Manos Pitsidianakis
Quoted 18 lines · Philippe Mathieu-Daudé

Commit 500131154d6 ("exec.c: Add new address_space_ld*/st* functions") added a new API to fix a shortcoming of the ld/st*_phys() API, which does blind bus access, not reporting failure (and it also allow to provide transaction attributes).

Later commit 42874d3a8c6 ("Switch non-CPU callers from ld/st*_phys to address_space_ld/st*") automatically converted the legacy uses to the new API, not precising transaction attributes (MEMTXATTRS_UNSPECIFIED) and ignoring the transation result (passing NULL pointer as MemTxResult).

While this is a faithful replacement, without any logical change, we later realized better is to not use MEMTXATTRS_UNSPECIFIED or NULL MemTxResult, and adapt each call site on a pair basis, looking at the device model datasheet to do the correct behavior (which is unlikely to ignore transaction failures).

Quoted 5 lines

Since this is quite some work, we defer that to device model maintainers. Meanwhile we introduce a definition, to allow a target which removed all legacy API call to prohibit further legacy API uses, named "TARGET_NOT_USING_LEGACY_LDST_PHYS_API".

Quoted 3 lines

Personally the negation (i.e. TARGET_USING_LEGACY_LDST_PHYS_API) would make more sense since you're opting-in an API but that must be more complex to introduce I guess?

Not much more complex, this was the previous approach (allow all then opt out):
https://lore.kernel.org/qemu-devel/[email protected]/

But Pierrick suggested the less aggressive approach, opting in, disturbing maintainers a bit less. In term of code churn I expect the same lines of code amount to change.

Quoted 4 lines

In any case:

Thanks!

Reviewed-by on v1 5/9
#8 lore raw

Re: [PATCH 5/9] system/memory: Allow restricting legacy ldst_phys() API usage

In reply to Philippe Mathieu-Daudé
Quoted 25 lines · Philippe Mathieu-Daudé

Commit 500131154d6 ("exec.c: Add new address_space_ld*/st* functions") added a new API to fix a shortcoming of the ld/st*_phys() API, which does blind bus access, not reporting failure (and it also allow to provide transaction attributes).

Later commit 42874d3a8c6 ("Switch non-CPU callers from ld/st*_phys to address_space_ld/st*") automatically converted the legacy uses to the new API, not precising transaction attributes (MEMTXATTRS_UNSPECIFIED) and ignoring the transation result (passing NULL pointer as MemTxResult).

While this is a faithful replacement, without any logical change, we later realized better is to not use MEMTXATTRS_UNSPECIFIED or NULL MemTxResult, and adapt each call site on a pair basis, looking at the device model datasheet to do the correct behavior (which is unlikely to ignore transaction failures).

Since this is quite some work, we defer that to device model maintainers. Meanwhile we introduce a definition, to allow a target which removed all legacy API call to prohibit further legacy API uses, named "TARGET_NOT_USING_LEGACY_LDST_PHYS_API".

Since all targets should be able to check this definition, we take care to not poison it.

Quoted 6 lines
---
  include/system/memory.h       | 2 ++
  scripts/make-config-poison.sh | 1 +
  2 files changed, 3 insertions(+)

r~

#9 lore raw

PATCH 6/9 configs/targets: Mark targets not using legacy ldst_phys() API

In reply to Philippe Mathieu-Daudé

Luckily these targets don't use the legacy ldst_phys() API at all. Set the TARGET_NOT_USING_LEGACY_LDST_PHYS_API variable to hide the API to them, avoiding further API uses to creep in.

---
 configs/targets/avr-softmmu.mak          | 1 +
 configs/targets/microblaze-softmmu.mak   | 1 +
 configs/targets/microblazeel-softmmu.mak | 1 +
 configs/targets/rx-softmmu.mak           | 1 +
 configs/targets/tricore-softmmu.mak      | 1 +
 5 files changed, 5 insertions(+)
configs/targets/avr-softmmu.mak +1 -0
index b6157fc465d..baf20fb7f2f 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=avr
 TARGET_XML_FILES= gdb-xml/avr-cpu.xml
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/microblaze-softmmu.mak +1 -0
index bab7b498c24..cf635798c90 100644
@@ -4,3 +4,4 @@ TARGET_BIG_ENDIAN=y
 TARGET_NEED_FDT=y
 TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/microblazeel-softmmu.mak +1 -0
index 8aee7ebc5cf..52feb957b48 100644
@@ -3,3 +3,4 @@ TARGET_ARCH=microblaze
 TARGET_NEED_FDT=y
 TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/rx-softmmu.mak +1 -0
index 1c250a6450d..3a90f1b9977 100644
@@ -3,3 +3,4 @@ TARGET_XML_FILES= gdb-xml/rx-core.xml
 # all boards require libfdt
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/tricore-softmmu.mak +1 -0
index 781ce49a62f..5e018d81068 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=tricore
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
Signature · 1 line
2.52.0
Reviewed-by on v1 6/9
#10 lore raw

Re: [PATCH 6/9] configs/targets: Mark targets not using legacy ldst_phys() API

Quoted 7 lines · Philippe Mathieu-Daudé

Luckily these targets don't use the legacy ldst_phys() API at all. Set the TARGET_NOT_USING_LEGACY_LDST_PHYS_API variable to hide the API to them, avoiding further API uses to creep in.

---

Quoted 54 lines
 configs/targets/avr-softmmu.mak          | 1 +
 configs/targets/microblaze-softmmu.mak   | 1 +
 configs/targets/microblazeel-softmmu.mak | 1 +
 configs/targets/rx-softmmu.mak           | 1 +
 configs/targets/tricore-softmmu.mak      | 1 +
 5 files changed, 5 insertions(+)
configs/targets/avr-softmmu.mak +1 -0
index b6157fc465d..baf20fb7f2f 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=avr
 TARGET_XML_FILES= gdb-xml/avr-cpu.xml
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/microblaze-softmmu.mak +1 -0
index bab7b498c24..cf635798c90 100644
@@ -4,3 +4,4 @@ TARGET_BIG_ENDIAN=y
 TARGET_NEED_FDT=y
 TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/microblazeel-softmmu.mak +1 -0
index 8aee7ebc5cf..52feb957b48 100644
@@ -3,3 +3,4 @@ TARGET_ARCH=microblaze
 TARGET_NEED_FDT=y
 TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/rx-softmmu.mak +1 -0
index 1c250a6450d..3a90f1b9977 100644
@@ -3,3 +3,4 @@ TARGET_XML_FILES= gdb-xml/rx-core.xml
 # all boards require libfdt
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/tricore-softmmu.mak +1 -1
index 781ce49a62f..5e018d81068 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=tricore
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
--

2.52.0

Reviewed-by on v1 6/9
#11 lore raw

Re: [PATCH 6/9] configs/targets: Mark targets not using legacy ldst_phys() API

In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

Luckily these targets don't use the legacy ldst_phys() API at all. Set the TARGET_NOT_USING_LEGACY_LDST_PHYS_API variable to hide the API to them, avoiding further API uses to creep in.

Quoted 8 lines
---
  configs/targets/avr-softmmu.mak          | 1 +
  configs/targets/microblaze-softmmu.mak   | 1 +
  configs/targets/microblazeel-softmmu.mak | 1 +
  configs/targets/rx-softmmu.mak           | 1 +
  configs/targets/tricore-softmmu.mak      | 1 +
  5 files changed, 5 insertions(+)

r~

#12 lore raw

PATCH 7/9 hw/virtio: Remove unused ldst_phys() helpers

In reply to Philippe Mathieu-Daudé

None of the following virtio ldst_phys() inlined helpers are used:

- virtio_lduw_phys()
- virtio_ldl_phys[_cached]()
- virtio_ldq_phys[_cached]()
- virtio_stw_phys()
- virtio_stl_phys[_cached]()

Just remove them.

---
 include/hw/virtio/virtio-access.h | 85 -------------------------------
 1 file changed, 85 deletions(-)
include/hw/virtio/virtio-access.h +0 -85
index 07aae69042a..c866769cad8 100644
@@ -39,60 +39,6 @@ static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
 #endif
 }
 
-static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        return lduw_be_phys(dma_as, pa);
-    }
-    return lduw_le_phys(dma_as, pa);
-}
-
-static inline uint32_t virtio_ldl_phys(VirtIODevice *vdev, hwaddr pa)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldl_be_phys(dma_as, pa);
-    }
-    return ldl_le_phys(dma_as, pa);
-}
-
-static inline uint64_t virtio_ldq_phys(VirtIODevice *vdev, hwaddr pa)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldq_be_phys(dma_as, pa);
-    }
-    return ldq_le_phys(dma_as, pa);
-}
-
-static inline void virtio_stw_phys(VirtIODevice *vdev, hwaddr pa,
-                                   uint16_t value)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        stw_be_phys(dma_as, pa, value);
-    } else {
-        stw_le_phys(dma_as, pa, value);
-    }
-}
-
-static inline void virtio_stl_phys(VirtIODevice *vdev, hwaddr pa,
-                                   uint32_t value)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        stl_be_phys(dma_as, pa, value);
-    } else {
-        stl_le_phys(dma_as, pa, value);
-    }
-}
-
 static inline void virtio_stw_p(VirtIODevice *vdev, void *ptr, uint16_t v)
 {
     if (virtio_access_is_big_endian(vdev)) {
@@ -166,26 +112,6 @@ static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev,
     return lduw_le_phys_cached(cache, pa);
 }
 
-static inline uint32_t virtio_ldl_phys_cached(VirtIODevice *vdev,
-                                              MemoryRegionCache *cache,
-                                              hwaddr pa)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldl_be_phys_cached(cache, pa);
-    }
-    return ldl_le_phys_cached(cache, pa);
-}
-
-static inline uint64_t virtio_ldq_phys_cached(VirtIODevice *vdev,
-                                              MemoryRegionCache *cache,
-                                              hwaddr pa)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldq_be_phys_cached(cache, pa);
-    }
-    return ldq_le_phys_cached(cache, pa);
-}
-
 static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
                                           MemoryRegionCache *cache,
                                           hwaddr pa, uint16_t value)
@@ -197,17 +123,6 @@ static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
     }
 }
 
-static inline void virtio_stl_phys_cached(VirtIODevice *vdev,
-                                          MemoryRegionCache *cache,
-                                          hwaddr pa, uint32_t value)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        stl_be_phys_cached(cache, pa, value);
-    } else {
-        stl_le_phys_cached(cache, pa, value);
-    }
-}
-
 static inline void virtio_tswap16s(VirtIODevice *vdev, uint16_t *s)
 {
     *s = virtio_tswap16(vdev, *s);
Signature · 1 line
2.52.0
Reviewed-by on v1 7/9
#13 lore raw

Re: [PATCH 7/9] hw/virtio: Remove unused ldst_phys() helpers

Quoted 9 lines · Philippe Mathieu-Daudé

None of the following virtio ldst_phys() inlined helpers are used:

- virtio_lduw_phys()
- virtio_ldl_phys[_cached]()
- virtio_ldq_phys[_cached]()
- virtio_stw_phys()
- virtio_stl_phys[_cached]()

Quoted 4 lines

Just remove them.

---

Quoted 116 lines
 include/hw/virtio/virtio-access.h | 85 -------------------------------
 1 file changed, 85 deletions(-)
include/hw/virtio/virtio-access.h +0 -86
index 07aae69042a..c866769cad8 100644
@@ -39,60 +39,6 @@ static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
 #endif
 }
 
-static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        return lduw_be_phys(dma_as, pa);
-    }
-    return lduw_le_phys(dma_as, pa);
-}
-
-static inline uint32_t virtio_ldl_phys(VirtIODevice *vdev, hwaddr pa)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldl_be_phys(dma_as, pa);
-    }
-    return ldl_le_phys(dma_as, pa);
-}
-
-static inline uint64_t virtio_ldq_phys(VirtIODevice *vdev, hwaddr pa)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldq_be_phys(dma_as, pa);
-    }
-    return ldq_le_phys(dma_as, pa);
-}
-
-static inline void virtio_stw_phys(VirtIODevice *vdev, hwaddr pa,
-                                   uint16_t value)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        stw_be_phys(dma_as, pa, value);
-    } else {
-        stw_le_phys(dma_as, pa, value);
-    }
-}
-
-static inline void virtio_stl_phys(VirtIODevice *vdev, hwaddr pa,
-                                   uint32_t value)
-{
-    AddressSpace *dma_as = vdev->dma_as;
-
-    if (virtio_access_is_big_endian(vdev)) {
-        stl_be_phys(dma_as, pa, value);
-    } else {
-        stl_le_phys(dma_as, pa, value);
-    }
-}
-
 static inline void virtio_stw_p(VirtIODevice *vdev, void *ptr, uint16_t v)
 {
     if (virtio_access_is_big_endian(vdev)) {
@@ -166,26 +112,6 @@ static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev,
     return lduw_le_phys_cached(cache, pa);
 }
 
-static inline uint32_t virtio_ldl_phys_cached(VirtIODevice *vdev,
-                                              MemoryRegionCache *cache,
-                                              hwaddr pa)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldl_be_phys_cached(cache, pa);
-    }
-    return ldl_le_phys_cached(cache, pa);
-}
-
-static inline uint64_t virtio_ldq_phys_cached(VirtIODevice *vdev,
-                                              MemoryRegionCache *cache,
-                                              hwaddr pa)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        return ldq_be_phys_cached(cache, pa);
-    }
-    return ldq_le_phys_cached(cache, pa);
-}
-
 static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
                                           MemoryRegionCache *cache,
                                           hwaddr pa, uint16_t value)
@@ -197,17 +123,6 @@ static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
     }
 }
 
-static inline void virtio_stl_phys_cached(VirtIODevice *vdev,
-                                          MemoryRegionCache *cache,
-                                          hwaddr pa, uint32_t value)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        stl_be_phys_cached(cache, pa, value);
-    } else {
-        stl_le_phys_cached(cache, pa, value);
-    }
-}
-
 static inline void virtio_tswap16s(VirtIODevice *vdev, uint16_t *s)
 {
     *s = virtio_tswap16(vdev, *s);
--

2.52.0

Reviewed-by on v1 7/9
#14 lore raw

Re: [PATCH 7/9] hw/virtio: Remove unused ldst_phys() helpers

In reply to Philippe Mathieu-Daudé
Quoted 8 lines · Philippe Mathieu-Daudé

None of the following virtio ldst_phys() inlined helpers are used:

- virtio_lduw_phys()
- virtio_ldl_phys[_cached]()
- virtio_ldq_phys[_cached]()
- virtio_stw_phys()
- virtio_stl_phys[_cached]()

Quoted 6 lines

Just remove them.

---
  include/hw/virtio/virtio-access.h | 85 -------------------------------
  1 file changed, 85 deletions(-)

r~

#15 lore raw

PATCH 8/9 hw/virtio: Reduce virtio_lduw/stw_phys_cached() scope

In reply to Philippe Mathieu-Daudé

virtio_lduw_phys_cached() and virtio_stw_phys_cached() are only used within hw/virtio/virtio.c: reduce their scope by moving their definitions there.

---
 include/hw/virtio/virtio-access.h | 21 ---------------------
 hw/virtio/virtio.c                | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 21 deletions(-)
include/hw/virtio/virtio-access.h +0 -21
index c866769cad8..5b5fff5295e 100644
@@ -102,27 +102,6 @@ static inline uint16_t virtio_tswap16(VirtIODevice *vdev, uint16_t s)
 #endif
 }
 
-static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev,
-                                               MemoryRegionCache *cache,
-                                               hwaddr pa)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        return lduw_be_phys_cached(cache, pa);
-    }
-    return lduw_le_phys_cached(cache, pa);
-}
-
-static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
-                                          MemoryRegionCache *cache,
-                                          hwaddr pa, uint16_t value)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        stw_be_phys_cached(cache, pa, value);
-    } else {
-        stw_le_phys_cached(cache, pa, value);
-    }
-}
-
 static inline void virtio_tswap16s(VirtIODevice *vdev, uint16_t *s)
 {
     *s = virtio_tswap16(vdev, *s);
hw/virtio/virtio.c +21 -0
index 257cda506a4..fba9d347d17 100644
@@ -216,6 +216,27 @@ static void virtio_check_indirect_feature(VirtIODevice *vdev)
     }
 }
 
+static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev,
+                                               MemoryRegionCache *cache,
+                                               hwaddr pa)
+{
+    if (virtio_access_is_big_endian(vdev)) {
+        return lduw_be_phys_cached(cache, pa);
+    }
+    return lduw_le_phys_cached(cache, pa);
+}
+
+static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
+                                          MemoryRegionCache *cache,
+                                          hwaddr pa, uint16_t value)
+{
+    if (virtio_access_is_big_endian(vdev)) {
+        stw_be_phys_cached(cache, pa, value);
+    } else {
+        stw_le_phys_cached(cache, pa, value);
+    }
+}
+
 /* Called within call_rcu().  */
 static void virtio_free_region_cache(VRingMemoryRegionCaches *caches)
 {
Signature · 1 line
2.52.0
Reviewed-by on v1 8/9
#16 lore raw

Re: [PATCH 8/9] hw/virtio: Reduce virtio_lduw/stw_phys_cached() scope

Quoted 7 lines · Philippe Mathieu-Daudé

virtio_lduw_phys_cached() and virtio_stw_phys_cached() are only used within hw/virtio/virtio.c: reduce their scope by moving their definitions there.

---

Quoted 71 lines
 include/hw/virtio/virtio-access.h | 21 ---------------------
 hw/virtio/virtio.c                | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 21 deletions(-)
include/hw/virtio/virtio-access.h +0 -21
index c866769cad8..5b5fff5295e 100644
@@ -102,27 +102,6 @@ static inline uint16_t virtio_tswap16(VirtIODevice *vdev, uint16_t s)
 #endif
 }
 
-static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev,
-                                               MemoryRegionCache *cache,
-                                               hwaddr pa)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        return lduw_be_phys_cached(cache, pa);
-    }
-    return lduw_le_phys_cached(cache, pa);
-}
-
-static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
-                                          MemoryRegionCache *cache,
-                                          hwaddr pa, uint16_t value)
-{
-    if (virtio_access_is_big_endian(vdev)) {
-        stw_be_phys_cached(cache, pa, value);
-    } else {
-        stw_le_phys_cached(cache, pa, value);
-    }
-}
-
 static inline void virtio_tswap16s(VirtIODevice *vdev, uint16_t *s)
 {
     *s = virtio_tswap16(vdev, *s);
hw/virtio/virtio.c +21 -1
index 257cda506a4..fba9d347d17 100644
@@ -216,6 +216,27 @@ static void virtio_check_indirect_feature(VirtIODevice *vdev)
     }
 }
 
+static inline uint16_t virtio_lduw_phys_cached(VirtIODevice *vdev,
+                                               MemoryRegionCache *cache,
+                                               hwaddr pa)
+{
+    if (virtio_access_is_big_endian(vdev)) {
+        return lduw_be_phys_cached(cache, pa);
+    }
+    return lduw_le_phys_cached(cache, pa);
+}
+
+static inline void virtio_stw_phys_cached(VirtIODevice *vdev,
+                                          MemoryRegionCache *cache,
+                                          hwaddr pa, uint16_t value)
+{
+    if (virtio_access_is_big_endian(vdev)) {
+        stw_be_phys_cached(cache, pa, value);
+    } else {
+        stw_le_phys_cached(cache, pa, value);
+    }
+}
+
 /* Called within call_rcu().  */
 static void virtio_free_region_cache(VRingMemoryRegionCaches *caches)
 {
--

2.52.0

Reviewed-by on v1 8/9
#17 lore raw

Re: [PATCH 8/9] hw/virtio: Reduce virtio_lduw/stw_phys_cached() scope

In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

virtio_lduw_phys_cached() and virtio_stw_phys_cached() are only used within hw/virtio/virtio.c: reduce their scope by moving their definitions there.

---
  include/hw/virtio/virtio-access.h | 21 ---------------------
  hw/virtio/virtio.c                | 21 +++++++++++++++++++++
  2 files changed, 21 insertions(+), 21 deletions(-)

r~

#18 lore raw

PATCH 9/9 configs/targets: Mark targets not using legacy ldst_phys() API

In reply to Philippe Mathieu-Daudé

These targets were only using the legacy ldst_phys() API via the virtio load/store helpers, which got cleaned up.

Mark them not using the legacy ldst_phys() API to avoid further use, allowing to eventually remove it.

---
 configs/targets/mips-softmmu.mak     | 1 +
 configs/targets/mips64-softmmu.mak   | 1 +
 configs/targets/mips64el-softmmu.mak | 1 +
 configs/targets/mipsel-softmmu.mak   | 1 +
 configs/targets/or1k-softmmu.mak     | 1 +
 configs/targets/riscv32-softmmu.mak  | 1 +
 configs/targets/riscv64-softmmu.mak  | 1 +
 configs/targets/sh4-softmmu.mak      | 1 +
 configs/targets/sh4eb-softmmu.mak    | 1 +
 configs/targets/sparc64-softmmu.mak  | 1 +
 configs/targets/xtensa-softmmu.mak   | 1 +
 configs/targets/xtensaeb-softmmu.mak | 1 +
 12 files changed, 12 insertions(+)
configs/targets/mips-softmmu.mak +1 -0
index c9588066b8d..95397af9442 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=mips
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/mips64-softmmu.mak +1 -0
index 7202655fcac..f9cc41b9ed4 100644
@@ -2,3 +2,4 @@ TARGET_ARCH=mips64
 TARGET_BASE_ARCH=mips
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/mips64el-softmmu.mak +1 -0
index 3ebeadb29ea..4e7dedc5f30 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=mips64
 TARGET_BASE_ARCH=mips
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/mipsel-softmmu.mak +1 -0
index 90e09bdc3e5..b0fba8a9d0a 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=mips
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/or1k-softmmu.mak +1 -0
index 0e47d9878b0..89f81b75bf7 100644
@@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y
 # needed by boot.c and all boards
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/riscv32-softmmu.mak +1 -0
index db55275b868..7476e596082 100644
@@ -4,3 +4,4 @@ TARGET_XML_FILES= gdb-xml/riscv-32bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xm
 # needed by boot.c
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/riscv64-softmmu.mak +1 -0
index 2bdd4a62cd2..f836f08c5b9 100644
@@ -5,3 +5,4 @@ TARGET_XML_FILES= gdb-xml/riscv-64bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xm
 # needed by boot.c
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/sh4-softmmu.mak +1 -0
index 787d349b501..e0b51f8108d 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=sh4
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/sh4eb-softmmu.mak +1 -0
index cdea2c61c58..7850dac8191 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=sh4
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/sparc64-softmmu.mak +1 -0
index d9d51d21e59..8ee6d057682 100644
@@ -3,3 +3,4 @@ TARGET_BASE_ARCH=sparc
 TARGET_BIG_ENDIAN=y
 TARGET_XML_FILES=gdb-xml/sparc64-core.xml
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/xtensa-softmmu.mak +1 -0
index 2a9797338a6..6aad751e2ba 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=xtensa
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/xtensaeb-softmmu.mak +1 -0
index 5204729af8b..537407e11ae 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=xtensa
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
Signature · 1 line
2.52.0
Reviewed-by on v1 9/9
#19 lore raw

Re: [PATCH 9/9] configs/targets: Mark targets not using legacy ldst_phys() API

Quoted 9 lines · Philippe Mathieu-Daudé

These targets were only using the legacy ldst_phys() API via the virtio load/store helpers, which got cleaned up.

Mark them not using the legacy ldst_phys() API to avoid further use, allowing to eventually remove it.

---

Nice cleanup!

Quoted 122 lines
 configs/targets/mips-softmmu.mak     | 1 +
 configs/targets/mips64-softmmu.mak   | 1 +
 configs/targets/mips64el-softmmu.mak | 1 +
 configs/targets/mipsel-softmmu.mak   | 1 +
 configs/targets/or1k-softmmu.mak     | 1 +
 configs/targets/riscv32-softmmu.mak  | 1 +
 configs/targets/riscv64-softmmu.mak  | 1 +
 configs/targets/sh4-softmmu.mak      | 1 +
 configs/targets/sh4eb-softmmu.mak    | 1 +
 configs/targets/sparc64-softmmu.mak  | 1 +
 configs/targets/xtensa-softmmu.mak   | 1 +
 configs/targets/xtensaeb-softmmu.mak | 1 +
 12 files changed, 12 insertions(+)
configs/targets/mips-softmmu.mak +1 -0
index c9588066b8d..95397af9442 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=mips
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/mips64-softmmu.mak +1 -0
index 7202655fcac..f9cc41b9ed4 100644
@@ -2,3 +2,4 @@ TARGET_ARCH=mips64
 TARGET_BASE_ARCH=mips
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/mips64el-softmmu.mak +1 -0
index 3ebeadb29ea..4e7dedc5f30 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=mips64
 TARGET_BASE_ARCH=mips
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/mipsel-softmmu.mak +1 -0
index 90e09bdc3e5..b0fba8a9d0a 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=mips
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/or1k-softmmu.mak +1 -0
index 0e47d9878b0..89f81b75bf7 100644
@@ -3,3 +3,4 @@ TARGET_BIG_ENDIAN=y
 # needed by boot.c and all boards
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/riscv32-softmmu.mak +1 -0
index db55275b868..7476e596082 100644
@@ -4,3 +4,4 @@ TARGET_XML_FILES= gdb-xml/riscv-32bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xm
 # needed by boot.c
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/riscv64-softmmu.mak +1 -0
index 2bdd4a62cd2..f836f08c5b9 100644
@@ -5,3 +5,4 @@ TARGET_XML_FILES= gdb-xml/riscv-64bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xm
 # needed by boot.c
 TARGET_NEED_FDT=y
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/sh4-softmmu.mak +1 -0
index 787d349b501..e0b51f8108d 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=sh4
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/sh4eb-softmmu.mak +1 -0
index cdea2c61c58..7850dac8191 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=sh4
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/sparc64-softmmu.mak +1 -0
index d9d51d21e59..8ee6d057682 100644
@@ -3,3 +3,4 @@ TARGET_BASE_ARCH=sparc
 TARGET_BIG_ENDIAN=y
 TARGET_XML_FILES=gdb-xml/sparc64-core.xml
 TARGET_LONG_BITS=64
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/xtensa-softmmu.mak +1 -0
index 2a9797338a6..6aad751e2ba 100644
@@ -1,2 +1,3 @@
 TARGET_ARCH=xtensa
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
configs/targets/xtensaeb-softmmu.mak +1 -1
index 5204729af8b..537407e11ae 100644
@@ -1,3 +1,4 @@
 TARGET_ARCH=xtensa
 TARGET_BIG_ENDIAN=y
 TARGET_LONG_BITS=32
+TARGET_NOT_USING_LEGACY_LDST_PHYS_API=y
--

2.52.0

Reviewed-by on v1 9/9
#20 lore raw

Re: [PATCH 9/9] configs/targets: Mark targets not using legacy ldst_phys() API

In reply to Philippe Mathieu-Daudé
Quoted 7 lines · Philippe Mathieu-Daudé

These targets were only using the legacy ldst_phys() API via the virtio load/store helpers, which got cleaned up.

Mark them not using the legacy ldst_phys() API to avoid further use, allowing to eventually remove it.

Quoted 14 lines
---
  configs/targets/mips-softmmu.mak     | 1 +
  configs/targets/mips64-softmmu.mak   | 1 +
  configs/targets/mips64el-softmmu.mak | 1 +
  configs/targets/mipsel-softmmu.mak   | 1 +
  configs/targets/or1k-softmmu.mak     | 1 +
  configs/targets/riscv32-softmmu.mak  | 1 +
  configs/targets/riscv64-softmmu.mak  | 1 +
  configs/targets/sh4-softmmu.mak      | 1 +
  configs/targets/sh4eb-softmmu.mak    | 1 +
  configs/targets/sparc64-softmmu.mak  | 1 +
  configs/targets/xtensa-softmmu.mak   | 1 +
  configs/targets/xtensaeb-softmmu.mak | 1 +
  12 files changed, 12 insertions(+)

r~

#21 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Philippe Mathieu-Daudé (9):
target/i386: Remove x86_stl_phys_notdirty() leftover target/sparc: Update MMU page table using stl_phys() hw/arm: Avoid address_space_stl_notdirty() when generating bootloader system/memory: Remove address_space_stl_notdirty and stl_phys_notdirty system/memory: Allow restricting legacy ldst_phys() API usage configs/targets: Mark targets not using legacy ldst_phys() API hw/virtio: Remove unused ldst_phys() helpers
hw/virtio: Reduce virtio_lduw/stw_phys_cached() scope configs/targets: Mark targets not using legacy ldst_phys() API

Series queued, thanks.