From: David Hildenbrand <david@redhat.com>
To: kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Janosch Frank" <frankja@linux.ibm.com>,
"David Hildenbrand" <david@redhat.com>
Subject: [kvm-unit-tests PULL 07/12] s390x: Load reset psw on diag308 reset
Date: Mon, 18 Nov 2019 11:07:14 +0100 [thread overview]
Message-ID: <20191118100719.7968-8-david@redhat.com> (raw)
In-Reply-To: <20191118100719.7968-1-david@redhat.com>
From: Janosch Frank <frankja@linux.ibm.com>
On a diag308 subcode 0 CRs will be reset, so we need a PSW mask
without DAT. Also we need to set the short psw indication to be
compliant with the architecture.
Let's therefore define a reset PSW mask with 64 bit addressing and
short PSW indication that is compliant with architecture and use it.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20191113112403.7664-1-frankja@linux.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
lib/s390x/asm-offsets.c | 1 +
lib/s390x/asm/arch_def.h | 4 +++-
s390x/cstart64.S | 24 +++++++++++++++++-------
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/lib/s390x/asm-offsets.c b/lib/s390x/asm-offsets.c
index 4b213f8..61d2658 100644
--- a/lib/s390x/asm-offsets.c
+++ b/lib/s390x/asm-offsets.c
@@ -58,6 +58,7 @@ int main(void)
OFFSET(GEN_LC_SW_INT_FPRS, lowcore, sw_int_fprs);
OFFSET(GEN_LC_SW_INT_FPC, lowcore, sw_int_fpc);
OFFSET(GEN_LC_SW_INT_CRS, lowcore, sw_int_crs);
+ OFFSET(GEN_LC_SW_INT_PSW, lowcore, sw_int_psw);
OFFSET(GEN_LC_MCCK_EXT_SA_ADDR, lowcore, mcck_ext_sa_addr);
OFFSET(GEN_LC_FPRS_SA, lowcore, fprs_sa);
OFFSET(GEN_LC_GRS_SA, lowcore, grs_sa);
diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 07d4e5e..cf6e1ca 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -79,7 +79,8 @@ struct lowcore {
uint32_t sw_int_fpc; /* 0x0300 */
uint8_t pad_0x0304[0x0308 - 0x0304]; /* 0x0304 */
uint64_t sw_int_crs[16]; /* 0x0308 */
- uint8_t pad_0x0310[0x11b0 - 0x0388]; /* 0x0388 */
+ struct psw sw_int_psw; /* 0x0388 */
+ uint8_t pad_0x0310[0x11b0 - 0x0398]; /* 0x0398 */
uint64_t mcck_ext_sa_addr; /* 0x11b0 */
uint8_t pad_0x11b8[0x1200 - 0x11b8]; /* 0x11b8 */
uint64_t fprs_sa[16]; /* 0x1200 */
@@ -98,6 +99,7 @@ struct lowcore {
uint8_t pad_0x1400[0x1800 - 0x1400]; /* 0x1400 */
uint8_t pgm_int_tdb[0x1900 - 0x1800]; /* 0x1800 */
} __attribute__ ((__packed__));
+_Static_assert(sizeof(struct lowcore) == 0x1900, "Lowcore size");
#define PGM_INT_CODE_OPERATION 0x01
#define PGM_INT_CODE_PRIVILEGED_OPERATION 0x02
diff --git a/s390x/cstart64.S b/s390x/cstart64.S
index 4be20fc..86dd4c4 100644
--- a/s390x/cstart64.S
+++ b/s390x/cstart64.S
@@ -126,13 +126,18 @@ memsetxc:
.globl diag308_load_reset
diag308_load_reset:
SAVE_REGS
- /* Save the first PSW word to the IPL PSW */
+ /* Backup current PSW mask, as we have to restore it on success */
epsw %r0, %r1
- st %r0, 0
- /* Store the address and the bit for 31 bit addressing */
- larl %r0, 0f
- oilh %r0, 0x8000
- st %r0, 0x4
+ st %r0, GEN_LC_SW_INT_PSW
+ st %r1, GEN_LC_SW_INT_PSW + 4
+ /* Load reset psw mask (short psw, 64 bit) */
+ lg %r0, reset_psw
+ /* Load the success label address */
+ larl %r1, 0f
+ /* Or it to the mask */
+ ogr %r0, %r1
+ /* Store it at the reset PSW location (real 0x0) */
+ stg %r0, 0
/* Do the reset */
diag %r0,%r2,0x308
/* Failure path */
@@ -144,7 +149,10 @@ diag308_load_reset:
lctlg %c0, %c0, 0(%r1)
RESTORE_REGS
lhi %r2, 1
- br %r14
+ larl %r0, 1f
+ stg %r0, GEN_LC_SW_INT_PSW + 8
+ lpswe GEN_LC_SW_INT_PSW
+1: br %r14
.globl smp_cpu_setup_state
smp_cpu_setup_state:
@@ -184,6 +192,8 @@ svc_int:
lpswe GEN_LC_SVC_OLD_PSW
.align 8
+reset_psw:
+ .quad 0x0008000180000000
initial_psw:
.quad 0x0000000180000000, clear_bss_start
pgm_int_psw:
--
2.21.0
next prev parent reply other threads:[~2019-11-18 10:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-18 10:07 [kvm-unit-tests PULL 00/12] s390x and Travis CI updates David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 01/12] s390x: Use loop to save and restore fprs David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 02/12] s390x: remove redundant defines David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 03/12] s390x: improve error reporting for interrupts David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 04/12] s390x: sclp: expose ram_size and max_ram_size David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 05/12] s390x: Fix initial cr0 load comments David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 06/12] s390x: Add CR save area David Hildenbrand
2019-11-18 10:07 ` David Hildenbrand [this message]
2019-11-18 10:07 ` [kvm-unit-tests PULL 08/12] travis.yml: Re-arrange the test matrix David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 09/12] travis.yml: Install only the required packages for each entry in the matrix David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 10/12] travis.yml: Test with KVM instead of TCG (on x86) David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 11/12] travis.yml: Test the i386 build, too David Hildenbrand
2019-11-18 10:07 ` [kvm-unit-tests PULL 12/12] travis.yml: Expect that at least one test succeeds David Hildenbrand
2019-11-18 10:18 ` [kvm-unit-tests PULL 00/12] s390x and Travis CI updates Paolo Bonzini
2019-11-18 11:11 ` Christian Borntraeger
2019-11-18 11:21 ` Thomas Huth
2019-11-18 11:32 ` Christian Borntraeger
2019-11-18 11:36 ` Thomas Huth
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=20191118100719.7968-8-david@redhat.com \
--to=david@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=thuth@redhat.com \
/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