@samitouri / QOSamiQemu / commits / 2f5223527c

target/s390x: Replace legacy ld/st_phys -> address_space_ld/st (cpu)

Prefer the address_space_ld/st API over the legacy ld_phys() because it allow checking for bus access fault. This code however doesn't check for fault, so we simply inline the calls (not specifying any memory transaction attribute nor expecting transation result). No logical change intended. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Tested-by: Matthew Rosato <mjrosato@linux.ibm.com> Message-ID: <20260319185203.11799-2-philmd@linaro.org> Signed-off-by: Cornelia Huck <cohuck@redhat.com>

Philippe Mathieu-Daudé committed Mar 19, 2026 at 19:51 UTC 2f5223527c1f4658bcadba59f30b6cf84ce90f31
2 files changed +20 -13
target/s390x/tcg/excp_helper.c
+13 -8
@@ -54,8 +54,9 @@ G_NORETURN void tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
54 g_assert(dxc <= 0xff);
55 #if !defined(CONFIG_USER_ONLY)
56 /* Store the DXC into the lowcore */
57 - stl_be_phys(env_cpu(env)->as,
58 - env->psa + offsetof(LowCore, data_exc_code), dxc);
57 + address_space_stl_be(env_cpu(env)->as,
58 + env->psa + offsetof(LowCore, data_exc_code), dxc,
59 + MEMTXATTRS_UNSPECIFIED, NULL);
60 #endif
61
62 /* Store the DXC into the FPC if AFP is enabled */
@@ -71,8 +72,9 @@ G_NORETURN void tcg_s390_vector_exception(CPUS390XState *env, uint32_t vxc,
72 g_assert(vxc <= 0xff);
73 #if !defined(CONFIG_USER_ONLY)
74 /* Always store the VXC into the lowcore, without AFP it is undefined */
74 - stl_be_phys(env_cpu(env)->as,
75 - env->psa + offsetof(LowCore, data_exc_code), vxc);
75 + address_space_stl_be(env_cpu(env)->as,
76 + env->psa + offsetof(LowCore, data_exc_code), vxc,
77 + MEMTXATTRS_UNSPECIFIED, NULL);
78 #endif
79
80 /* Always store the VXC into the FPC, without AFP it is undefined */
@@ -619,11 +621,14 @@ void monitor_event(CPUS390XState *env,
621 uint64_t monitor_code,
622 uint8_t monitor_class, uintptr_t ra)
623 {
624 + const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
625 + AddressSpace *as = env_cpu(env)->as;
626 +
627 /* Store the Monitor Code and the Monitor Class Number into the lowcore */
623 - stq_be_phys(env_cpu(env)->as,
624 - env->psa + offsetof(LowCore, monitor_code), monitor_code);
625 - stw_be_phys(env_cpu(env)->as,
626 - env->psa + offsetof(LowCore, mon_class_num), monitor_class);
628 + address_space_stq_be(as, env->psa + offsetof(LowCore, monitor_code),
629 + monitor_code, attrs, NULL);
630 + address_space_stw_be(as, env->psa + offsetof(LowCore, mon_class_num),
631 + monitor_class, attrs, NULL);
632
633 tcg_s390_program_interrupt(env, PGM_MONITOR, ra);
634 }
target/s390x/tcg/mem_helper.c
+7 -5
@@ -41,6 +41,7 @@
41 #else
42 #include "hw/s390x/storage-keys.h"
43 #include "hw/core/boards.h"
44 +#include "system/memory.h"
45 #endif
46
47 #ifdef CONFIG_USER_ONLY
@@ -958,13 +959,14 @@ uint32_t HELPER(mvpg)(CPUS390XState *env, uint64_t r0, uint32_t r1, uint32_t r2)
959 inject_exc:
960 #if !defined(CONFIG_USER_ONLY)
961 if (exc != PGM_ADDRESSING) {
961 - stq_be_phys(env_cpu(env)->as,
962 - env->psa + offsetof(LowCore, trans_exc_code),
963 - env->tlb_fill_tec);
962 + address_space_stq_be(env_cpu(env)->as,
963 + env->psa + offsetof(LowCore, trans_exc_code),
964 + env->tlb_fill_tec, MEMTXATTRS_UNSPECIFIED, NULL);
965 }
966 if (exc == PGM_PAGE_TRANS) {
966 - stb_phys(env_cpu(env)->as, env->psa + offsetof(LowCore, op_access_id),
967 - r1 << 4 | r2);
967 + address_space_stb(env_cpu(env)->as,
968 + env->psa + offsetof(LowCore, op_access_id),
969 + r1 << 4 | r2, MEMTXATTRS_UNSPECIFIED, NULL);
970 }
971 #endif
972 tcg_s390_program_interrupt(env, exc, ra);