From: Cornelia Huck <cohuck@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Cornelia Huck" <cohuck@redhat.com>
Subject: [PULL v2 02/11] target/s390x: Replace legacy ld/st_phys -> address_space_ld/st (cpu)
Date: Thu, 30 Apr 2026 18:02:58 +0200 [thread overview]
Message-ID: <20260430160307.634093-3-cohuck@redhat.com> (raw)
In-Reply-To: <20260430160307.634093-1-cohuck@redhat.com>
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
---
target/s390x/tcg/excp_helper.c | 21 +++++++++++++--------
target/s390x/tcg/mem_helper.c | 12 +++++++-----
2 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c
index 41b0017d767c..05e448d3f20c 100644
--- a/target/s390x/tcg/excp_helper.c
+++ b/target/s390x/tcg/excp_helper.c
@@ -54,8 +54,9 @@ G_NORETURN void tcg_s390_data_exception(CPUS390XState *env, uint32_t dxc,
g_assert(dxc <= 0xff);
#if !defined(CONFIG_USER_ONLY)
/* Store the DXC into the lowcore */
- stl_be_phys(env_cpu(env)->as,
- env->psa + offsetof(LowCore, data_exc_code), dxc);
+ address_space_stl_be(env_cpu(env)->as,
+ env->psa + offsetof(LowCore, data_exc_code), dxc,
+ MEMTXATTRS_UNSPECIFIED, NULL);
#endif
/* 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,
g_assert(vxc <= 0xff);
#if !defined(CONFIG_USER_ONLY)
/* Always store the VXC into the lowcore, without AFP it is undefined */
- stl_be_phys(env_cpu(env)->as,
- env->psa + offsetof(LowCore, data_exc_code), vxc);
+ address_space_stl_be(env_cpu(env)->as,
+ env->psa + offsetof(LowCore, data_exc_code), vxc,
+ MEMTXATTRS_UNSPECIFIED, NULL);
#endif
/* Always store the VXC into the FPC, without AFP it is undefined */
@@ -619,11 +621,14 @@ void monitor_event(CPUS390XState *env,
uint64_t monitor_code,
uint8_t monitor_class, uintptr_t ra)
{
+ const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
+ AddressSpace *as = env_cpu(env)->as;
+
/* Store the Monitor Code and the Monitor Class Number into the lowcore */
- stq_be_phys(env_cpu(env)->as,
- env->psa + offsetof(LowCore, monitor_code), monitor_code);
- stw_be_phys(env_cpu(env)->as,
- env->psa + offsetof(LowCore, mon_class_num), monitor_class);
+ address_space_stq_be(as, env->psa + offsetof(LowCore, monitor_code),
+ monitor_code, attrs, NULL);
+ address_space_stw_be(as, env->psa + offsetof(LowCore, mon_class_num),
+ monitor_class, attrs, NULL);
tcg_s390_program_interrupt(env, PGM_MONITOR, ra);
}
diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c
index 2a79a789f639..8474a6941107 100644
--- a/target/s390x/tcg/mem_helper.c
+++ b/target/s390x/tcg/mem_helper.c
@@ -41,6 +41,7 @@
#else
#include "hw/s390x/storage-keys.h"
#include "hw/core/boards.h"
+#include "system/memory.h"
#endif
#ifdef CONFIG_USER_ONLY
@@ -958,13 +959,14 @@ uint32_t HELPER(mvpg)(CPUS390XState *env, uint64_t r0, uint32_t r1, uint32_t r2)
inject_exc:
#if !defined(CONFIG_USER_ONLY)
if (exc != PGM_ADDRESSING) {
- stq_be_phys(env_cpu(env)->as,
- env->psa + offsetof(LowCore, trans_exc_code),
- env->tlb_fill_tec);
+ address_space_stq_be(env_cpu(env)->as,
+ env->psa + offsetof(LowCore, trans_exc_code),
+ env->tlb_fill_tec, MEMTXATTRS_UNSPECIFIED, NULL);
}
if (exc == PGM_PAGE_TRANS) {
- stb_phys(env_cpu(env)->as, env->psa + offsetof(LowCore, op_access_id),
- r1 << 4 | r2);
+ address_space_stb(env_cpu(env)->as,
+ env->psa + offsetof(LowCore, op_access_id),
+ r1 << 4 | r2, MEMTXATTRS_UNSPECIFIED, NULL);
}
#endif
tcg_s390_program_interrupt(env, exc, ra);
--
2.53.0
next prev parent reply other threads:[~2026-04-30 16:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 16:02 [PULL v2 00/11] First batch of s390x updates for 11.1 Cornelia Huck
2026-04-30 16:02 ` [PULL v2 01/11] target/s390x/kvm: Simplify the async pfault handling code Cornelia Huck
2026-04-30 16:02 ` Cornelia Huck [this message]
2026-04-30 16:02 ` [PULL v2 03/11] target/s390x: Replace legacy ld/st_phys -> address_space_ld/st (mmu) Cornelia Huck
2026-04-30 16:03 ` [PULL v2 04/11] target/s390x: Replace legacy ld/st_phys -> address_space_ld/st (tcg) Cornelia Huck
2026-04-30 16:03 ` [PULL v2 05/11] target/s390x: Replace legacy ld/st_phys -> address_space_ld/st (kvm) Cornelia Huck
2026-04-30 16:03 ` [PULL v2 06/11] configs/targets: Restrict the legacy ldst_phys() API on s390x target Cornelia Huck
2026-04-30 16:03 ` [PULL v2 07/11] tests/functional/s390x: Add test for booting from a disk with 4k sectors Cornelia Huck
2026-04-30 16:03 ` [PULL v2 08/11] target/s390x: Prefer MO_128 definition over magic value Cornelia Huck
2026-04-30 16:03 ` [PULL v2 09/11] MAINTAINERS: Update s390 trees Cornelia Huck
2026-04-30 16:03 ` [PULL v2 10/11] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+) Cornelia Huck
2026-04-30 16:03 ` [PULL v2 11/11] tests/functional/s390x: Update expected virtio-pci IDs Cornelia Huck
2026-05-02 10:49 ` [PULL v2 00/11] First batch of s390x updates for 11.1 Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260430160307.634093-3-cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=mjrosato@linux.ibm.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.