From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 8/9] target/s390x: Replace legacy cpu_physical_memory_[un]map() calls (3/3)
Date: Fri, 10 Oct 2025 10:21:43 +0200 [thread overview]
Message-ID: <20251010082145.576222-9-thuth@redhat.com> (raw)
In-Reply-To: <20251010082145.576222-1-thuth@redhat.com>
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Commit b7ecba0f6f6 ("docs/devel/loads-stores.rst: Document our
various load and store APIs") mentioned cpu_physical_memory_*()
methods are legacy, the replacement being address_space_*().
Replace the *_map() / *_unmap() methods in s390_store_status()
and s390_store_adtl_status(). In s390_store_status(), replace
cpu_physical_memory_write() by address_space_stb(), restricting
@ar_id scope. No behavioral change expected.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251002091132.65703-10-philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
target/s390x/sigp.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
index 2487acdb49e..f5d7bc0fa22 100644
--- a/target/s390x/sigp.c
+++ b/target/s390x/sigp.c
@@ -13,6 +13,7 @@
#include "s390x-internal.h"
#include "hw/boards.h"
#include "system/hw_accel.h"
+#include "system/memory.h"
#include "system/runstate.h"
#include "system/address-spaces.h"
#include "exec/cputlb.h"
@@ -147,7 +148,8 @@ QEMU_BUILD_BUG_ON(sizeof(SigpSaveArea) != 512);
#define S390_STORE_STATUS_DEF_ADDR offsetof(LowCore, floating_pt_save_area)
static int s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch)
{
- static const uint8_t ar_id = 1;
+ const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
+ AddressSpace *as = CPU(cpu)->as;
SigpSaveArea *sa;
hwaddr len = sizeof(*sa);
int i;
@@ -157,17 +159,21 @@ static int s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch)
return 0;
}
- sa = cpu_physical_memory_map(addr, &len, true);
+ sa = address_space_map(as, addr, &len, true, attrs);
if (!sa) {
return -EFAULT;
}
if (len != sizeof(*sa)) {
- cpu_physical_memory_unmap(sa, len, 1, 0);
+ address_space_unmap(as, sa, len, true, 0);
return -EFAULT;
}
if (store_arch) {
- cpu_physical_memory_write(offsetof(LowCore, ar_access_id), &ar_id, 1);
+ static const uint8_t ar_id = 1;
+
+ address_space_stb(as, offsetof(LowCore, ar_access_id),
+ ar_id, attrs, NULL);
+
}
for (i = 0; i < 16; ++i) {
sa->fprs[i] = cpu_to_be64(*get_freg(&cpu->env, i));
@@ -189,7 +195,7 @@ static int s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch)
sa->crs[i] = cpu_to_be64(cpu->env.cregs[i]);
}
- cpu_physical_memory_unmap(sa, len, 1, len);
+ address_space_unmap(as, sa, len, true, len);
return 0;
}
@@ -251,16 +257,18 @@ QEMU_BUILD_BUG_ON(sizeof(SigpAdtlSaveArea) != 4096);
#define ADTL_GS_MIN_SIZE 2048 /* minimal size of adtl save area for GS */
static int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len)
{
+ const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
+ AddressSpace *as = CPU(cpu)->as;
SigpAdtlSaveArea *sa;
hwaddr save = len;
int i;
- sa = cpu_physical_memory_map(addr, &save, true);
+ sa = address_space_map(as, addr, &save, true, attrs);
if (!sa) {
return -EFAULT;
}
if (save != len) {
- cpu_physical_memory_unmap(sa, len, 1, 0);
+ address_space_unmap(as, sa, len, true, 0);
return -EFAULT;
}
@@ -276,7 +284,8 @@ static int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len)
}
}
- cpu_physical_memory_unmap(sa, len, 1, len);
+ address_space_unmap(as, sa, len, true, len);
+
return 0;
}
--
2.51.0
next prev parent reply other threads:[~2025-10-10 8:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-10 8:21 [PULL 0/9] s390x patches (+ 1 functional test patch) Thomas Huth
2025-10-10 8:21 ` [PULL 1/9] tests/functional: Drop the "Attempting to cache ..." log text Thomas Huth
2025-10-10 8:21 ` [PULL 2/9] s390x/pci: fix interrupt blocking by returning only the device's summary bit Thomas Huth
2025-10-10 8:21 ` [PULL 3/9] target/s390x: Replace legacy cpu_physical_memory_[un]map() calls (1/3) Thomas Huth
2025-10-10 8:21 ` [PULL 4/9] target/s390x: Propagate CPUS390XState to cpu_unmap_lowcore() Thomas Huth
2025-10-10 8:21 ` [PULL 5/9] target/s390x: Replace legacy cpu_physical_memory_[un]map() calls (2/3) Thomas Huth
2025-10-10 8:21 ` [PULL 6/9] target/s390x: Reduce s390_store_adtl_status() scope Thomas Huth
2025-10-10 8:21 ` [PULL 7/9] target/s390x: Reduce s390_store_status() scope Thomas Huth
2025-10-10 8:21 ` Thomas Huth [this message]
2025-10-10 8:21 ` [PULL 9/9] s390x/pci: set kvm_msi_via_irqfd_allowed Thomas Huth
2025-10-10 19:03 ` [PULL 0/9] s390x patches (+ 1 functional test patch) Richard Henderson
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=20251010082145.576222-9-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).