* [GIT PULL 3/4] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format
[not found] <20261202122437.289764-1-frankja@linux.ibm.com>
@ 2026-12-02 12:14 ` Janosch Frank
0 siblings, 0 replies; only message in thread
From: Janosch Frank @ 2026-12-02 12:14 UTC (permalink / raw)
To: pbonzini
Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda,
Yvan Janssens, stable
From: Yvan Janssens <yvanj@cyber.gent>
ESA-mode guests in vsie have existed since commit b0ad874d9852 ("KVM:
s390: vsie: Allow non-zarch guests"); they use the 8-byte short PSW -
the mask and instruction address share one doubleword.
vsie's PSW rewind originally still changed the second doubleword, which
is unused in ESA mode, so the instruction is skipped instead of
repeated. One visible effect is that the first STFLE after entering SIE
does nothing in a nested guest.
This patch adds a vsie-specific rewind function that handles both
formats; no short-PSW type is introduced - for ESA guests mask and
address are written into the mask field.
Fixes: b0ad874d9852 ("KVM: s390: vsie: Allow non-zarch guests")
Cc: stable@vger.kernel.org # 7.1+
Signed-off-by: Yvan Janssens <yvanj@cyber.gent>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
[frankja@de.ibm.com: Changed commit message as suggested by Christian]
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
arch/s390/kvm/s390/vsie.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kvm/s390/vsie.c b/arch/s390/kvm/s390/vsie.c
index e2cb9bd411fd..426724830c58 100644
--- a/arch/s390/kvm/s390/vsie.c
+++ b/arch/s390/kvm/s390/vsie.c
@@ -958,6 +958,20 @@ static inline void clear_vsie_icpt(struct vsie_page *vsie_page)
vsie_page->scb_s.icptcode = 0;
}
+static void vsie_rewind_psw(struct kvm_s390_sie_block *scb, int ilen)
+{
+ u64 addr_mask;
+
+ if (atomic_read(&scb->cpuflags) & CPUSTAT_ZARCH) {
+ scb->gpsw.addr = __rewind_psw(scb->gpsw, ilen);
+ return;
+ }
+ /* ESA short PSW: mask and address both live in gpsw.mask */
+ addr_mask = scb->gpsw.mask & PSW32_ADDR_AMODE ? PSW32_ADDR_INSN : 0x00ffffffUL;
+ scb->gpsw.mask = (scb->gpsw.mask & ~PSW32_ADDR_INSN) |
+ ((scb->gpsw.mask - ilen) & addr_mask);
+}
+
/* rewind the psw and clear the vsie icpt, so we can retry execution */
static void retry_vsie_icpt(struct vsie_page *vsie_page)
{
@@ -970,7 +984,7 @@ static void retry_vsie_icpt(struct vsie_page *vsie_page)
if (!ilen)
ilen = 4;
}
- scb_s->gpsw.addr = __rewind_psw(scb_s->gpsw, ilen);
+ vsie_rewind_psw(scb_s, ilen);
clear_vsie_icpt(vsie_page);
}
@@ -1423,7 +1437,7 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
scb_s->icptcode = ICPT_PROGI;
scb_s->iprcc = PGM_ADDRESSING;
scb_s->pgmilc = 4;
- scb_s->gpsw.addr = __rewind_psw(scb_s->gpsw, 4);
+ vsie_rewind_psw(scb_s, 4);
rc = 1;
}
return rc;
--
2.56.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 12:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261202122437.289764-1-frankja@linux.ibm.com>
2026-12-02 12:14 ` [GIT PULL 3/4] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format Janosch Frank
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox