From: Cornelia Huck <cohuck@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
David Hildenbrand <david@redhat.com>,
Cornelia Huck <cohuck@redhat.com>
Subject: [Qemu-devel] [PULL 03/27] s390x/tcg: Save vregs to extended mchk save area
Date: Mon, 4 Mar 2019 13:01:46 +0100 [thread overview]
Message-ID: <20190304120210.31500-4-cohuck@redhat.com> (raw)
In-Reply-To: <20190304120210.31500-1-cohuck@redhat.com>
From: David Hildenbrand <david@redhat.com>
If we have vector registers and the designation is not zero, we have
to try to write the vector registers. If the designation is zero or
if storing fails, we must not indicate validity. s390_build_validity_mcic()
automatically already sets validity if the vector instruction facility
is installed.
As long as we don't support the guarded-storage facility, the alignment
and size of the area is always 1024 bytes.
Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20190222081153.14206-4-david@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
---
target/s390x/excp_helper.c | 46 ++++++++++++++++++++++++++++++++++++--
target/s390x/internal.h | 4 +++-
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
index a758649f47fe..f84bfb1284b4 100644
--- a/target/s390x/excp_helper.c
+++ b/target/s390x/excp_helper.c
@@ -347,10 +347,41 @@ static void do_io_interrupt(CPUS390XState *env)
load_psw(env, mask, addr);
}
+typedef struct MchkExtSaveArea {
+ uint64_t vregs[32][2]; /* 0x0000 */
+ uint8_t pad_0x0200[0x0400 - 0x0200]; /* 0x0200 */
+} MchkExtSaveArea;
+QEMU_BUILD_BUG_ON(sizeof(MchkExtSaveArea) != 1024);
+
+static int mchk_store_vregs(CPUS390XState *env, uint64_t mcesao)
+{
+ hwaddr len = sizeof(MchkExtSaveArea);
+ MchkExtSaveArea *sa;
+ int i;
+
+ sa = cpu_physical_memory_map(mcesao, &len, 1);
+ if (!sa) {
+ return -EFAULT;
+ }
+ if (len != sizeof(MchkExtSaveArea)) {
+ cpu_physical_memory_unmap(sa, len, 1, 0);
+ return -EFAULT;
+ }
+
+ for (i = 0; i < 32; i++) {
+ sa->vregs[i][0] = cpu_to_be64(env->vregs[i][0].ll);
+ sa->vregs[i][1] = cpu_to_be64(env->vregs[i][1].ll);
+ }
+
+ cpu_physical_memory_unmap(sa, len, 1, len);
+ return 0;
+}
+
static void do_mchk_interrupt(CPUS390XState *env)
{
QEMUS390FLICState *flic = QEMU_S390_FLIC(s390_get_flic());
- uint64_t mask, addr;
+ uint64_t mcic = s390_build_validity_mcic() | MCIC_SC_CP;
+ uint64_t mask, addr, mcesao = 0;
LowCore *lowcore;
int i;
@@ -362,6 +393,17 @@ static void do_mchk_interrupt(CPUS390XState *env)
lowcore = cpu_map_lowcore(env);
+ /* extended save area */
+ if (mcic & MCIC_VB_VR) {
+ /* length and alignment is 1024 bytes */
+ mcesao = be64_to_cpu(lowcore->mcesad) & ~0x3ffull;
+ }
+
+ /* try to store vector registers */
+ if (!mcesao || mchk_store_vregs(env, mcesao)) {
+ mcic &= ~MCIC_VB_VR;
+ }
+
/* we are always in z/Architecture mode */
lowcore->ar_access_id = 1;
@@ -377,7 +419,7 @@ static void do_mchk_interrupt(CPUS390XState *env)
lowcore->cpu_timer_save_area = cpu_to_be64(env->cputm);
lowcore->clock_comp_save_area = cpu_to_be64(env->ckc >> 8);
- lowcore->mcic = cpu_to_be64(s390_build_validity_mcic() | MCIC_SC_CP);
+ lowcore->mcic = cpu_to_be64(mcic);
lowcore->mcck_old_psw.mask = cpu_to_be64(get_psw_mask(env));
lowcore->mcck_old_psw.addr = cpu_to_be64(env->psw.addr);
mask = be64_to_cpu(lowcore->mcck_new_psw.mask);
diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index f2a771e2b444..b2966a3adcb8 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -101,7 +101,9 @@ typedef struct LowCore {
/* whether the kernel died with panic() or not */
uint32_t panic_magic; /* 0xe00 */
- uint8_t pad13[0x11b8 - 0xe04]; /* 0xe04 */
+ uint8_t pad13[0x11b0 - 0xe04]; /* 0xe04 */
+
+ uint64_t mcesad; /* 0x11B0 */
/* 64 bit extparam used for pfault, diag 250 etc */
uint64_t ext_params2; /* 0x11B8 */
--
2.17.2
next prev parent reply other threads:[~2019-03-04 12:02 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-04 12:01 [Qemu-devel] [PULL 00/27] s390x updates Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 01/27] s390x: Use cpu_to_be64 in SIGP STORE ADDITIONAL STATUS Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 02/27] s390x: use a QEMU-style typedef + name for SIGP save area struct Cornelia Huck
2019-03-04 12:01 ` Cornelia Huck [this message]
2019-03-04 12:01 ` [Qemu-devel] [PULL 04/27] s390x/vfio-ap: Implement hot plug/unplug of vfio-ap device Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 05/27] s390x/vfio-ap: document " Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 06/27] s390x/tcg: RXE has an optional M3 field Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 07/27] s390x/tcg: Simplify disassembler operands initialization Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 08/27] s390x/tcg: Clarify terminology in vec_reg_offset() Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 09/27] s390x/tcg: Factor out vec_full_reg_offset() Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 10/27] s390x/tcg: Factor out gen_addi_and_wrap_i64() from get_address() Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 11/27] s390x/tcg: Implement LOAD LENGTHENED short HFP to long HFP Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 12/27] s390x/tcg: Implement LOAD COUNT TO BLOCK BOUNDARY Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 13/27] s390x/tcg: Fix TEST DATA CLASS instructions Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 14/27] s390x/tcg: Fix rounding from float128 to uint64_t/uint32_t Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 15/27] s390x/tcg: Factor out conversion of softfloat exceptions Cornelia Huck
2019-03-04 12:01 ` [Qemu-devel] [PULL 16/27] s390x/tcg: Fix parts of IEEE exception handling Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 17/27] s390x/tcg: Hide IEEE underflows in some scenarios Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 18/27] s390x/tcg: Refactor SET FPC AND SIGNAL handling Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 19/27] s390x/tcg: Fix simulated-IEEE exceptions Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 20/27] s390x/tcg: Handle SET FPC AND LOAD FPC 3-bit BFP rounding modes Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 21/27] s390x/tcg: Check for exceptions in SET BFP ROUNDING MODE Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 22/27] s390x/tcg: Refactor saving/restoring the bfp rounding mode Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 23/27] s390x/tcg: Prepare for IEEE-inexact-exception control (XxC) Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 24/27] s390x/tcg: Implement XxC and checks for most FP instructions Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 25/27] s390x/tcg: Implement rounding mode and XxC for LOAD ROUNDED Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 26/27] s390x/tcg: Handle all rounding modes overwritten by BFP instructions Cornelia Huck
2019-03-04 12:02 ` [Qemu-devel] [PULL 27/27] s390x: Add floating-point extension facility to "qemu" cpu model Cornelia Huck
2019-03-04 14:29 ` [Qemu-devel] [PULL 00/27] s390x updates Peter Maydell
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=20190304120210.31500-4-cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=peter.maydell@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 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).