aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-10-02 11:11:30 +0200
committerThomas Huth <thuth@redhat.com>2025-10-10 10:02:51 +0200
commit1819902285177c8781ab4ef92cc44e0882c0dec5 (patch)
treefcbb563bec36ace8cb7c905e961bcba848d49271
parent64321858d0735191b6160ba78f2282a67df6d9d9 (diff)
downloadqemu-1819902285177c8781ab4ef92cc44e0882c0dec5.zip
qemu-1819902285177c8781ab4ef92cc44e0882c0dec5.tar.gz
qemu-1819902285177c8781ab4ef92cc44e0882c0dec5.tar.bz2
target/s390x: Reduce s390_store_adtl_status() scope
s390_store_adtl_status() is only called within sigp.c, move it and the SigpAdtlSaveArea structure definition there where it belongs, with other SIGP handling code. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-ID: <20251002091132.65703-8-philmd@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r--target/s390x/helper.c40
-rw-r--r--target/s390x/s390x-internal.h1
-rw-r--r--target/s390x/sigp.c40
3 files changed, 40 insertions, 41 deletions
diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index b01b7d9..84321e1 100644
--- a/target/s390x/helper.c
+++ b/target/s390x/helper.c
@@ -248,43 +248,3 @@ int s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch)
return 0;
}
-
-typedef struct SigpAdtlSaveArea {
- uint64_t vregs[32][2]; /* 0x0000 */
- uint8_t pad_0x0200[0x0400 - 0x0200]; /* 0x0200 */
- uint64_t gscb[4]; /* 0x0400 */
- uint8_t pad_0x0420[0x1000 - 0x0420]; /* 0x0420 */
-} SigpAdtlSaveArea;
-QEMU_BUILD_BUG_ON(sizeof(SigpAdtlSaveArea) != 4096);
-
-#define ADTL_GS_MIN_SIZE 2048 /* minimal size of adtl save area for GS */
-int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len)
-{
- SigpAdtlSaveArea *sa;
- hwaddr save = len;
- int i;
-
- sa = cpu_physical_memory_map(addr, &save, true);
- if (!sa) {
- return -EFAULT;
- }
- if (save != len) {
- cpu_physical_memory_unmap(sa, len, 1, 0);
- return -EFAULT;
- }
-
- if (s390_has_feat(S390_FEAT_VECTOR)) {
- for (i = 0; i < 32; i++) {
- sa->vregs[i][0] = cpu_to_be64(cpu->env.vregs[i][0]);
- sa->vregs[i][1] = cpu_to_be64(cpu->env.vregs[i][1]);
- }
- }
- if (s390_has_feat(S390_FEAT_GUARDED_STORAGE) && len >= ADTL_GS_MIN_SIZE) {
- for (i = 0; i < 4; i++) {
- sa->gscb[i] = cpu_to_be64(cpu->env.gscb[i]);
- }
- }
-
- cpu_physical_memory_unmap(sa, len, 1, len);
- return 0;
-}
diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h
index 1fb752a..a49dca9 100644
--- a/target/s390x/s390x-internal.h
+++ b/target/s390x/s390x-internal.h
@@ -325,7 +325,6 @@ hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
#define S390_STORE_STATUS_DEF_ADDR offsetof(LowCore, floating_pt_save_area)
int s390_store_status(S390CPU *cpu, hwaddr addr, bool store_arch);
-int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len);
LowCore *cpu_map_lowcore(CPUS390XState *env);
void cpu_unmap_lowcore(CPUS390XState *env, LowCore *lowcore);
#endif /* CONFIG_USER_ONLY */
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
index 5e95c497..1464be7 100644
--- a/target/s390x/sigp.c
+++ b/target/s390x/sigp.c
@@ -172,6 +172,46 @@ static void sigp_store_status_at_address(CPUState *cs, run_on_cpu_data arg)
si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
}
+typedef struct SigpAdtlSaveArea {
+ uint64_t vregs[32][2]; /* 0x0000 */
+ uint8_t pad_0x0200[0x0400 - 0x0200]; /* 0x0200 */
+ uint64_t gscb[4]; /* 0x0400 */
+ uint8_t pad_0x0420[0x1000 - 0x0420]; /* 0x0420 */
+} SigpAdtlSaveArea;
+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)
+{
+ SigpAdtlSaveArea *sa;
+ hwaddr save = len;
+ int i;
+
+ sa = cpu_physical_memory_map(addr, &save, true);
+ if (!sa) {
+ return -EFAULT;
+ }
+ if (save != len) {
+ cpu_physical_memory_unmap(sa, len, 1, 0);
+ return -EFAULT;
+ }
+
+ if (s390_has_feat(S390_FEAT_VECTOR)) {
+ for (i = 0; i < 32; i++) {
+ sa->vregs[i][0] = cpu_to_be64(cpu->env.vregs[i][0]);
+ sa->vregs[i][1] = cpu_to_be64(cpu->env.vregs[i][1]);
+ }
+ }
+ if (s390_has_feat(S390_FEAT_GUARDED_STORAGE) && len >= ADTL_GS_MIN_SIZE) {
+ for (i = 0; i < 4; i++) {
+ sa->gscb[i] = cpu_to_be64(cpu->env.gscb[i]);
+ }
+ }
+
+ cpu_physical_memory_unmap(sa, len, 1, len);
+ return 0;
+}
+
#define ADTL_SAVE_LC_MASK 0xfUL
static void sigp_store_adtl_status(CPUState *cs, run_on_cpu_data arg)
{