From: Janosch Frank <frankja@linux.ibm.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@kernel.org,
borntraeger@linux.ibm.com, cohuck@redhat.com,
linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
Yvan Janssens <yvanj@cyber.gent>,
stable@vger.kernel.org
Subject: [GIT PULL 3/4] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format
Date: Wed, 2 Dec 2026 13:14:09 +0100 [thread overview]
Message-ID: <20261202122437.289764-4-frankja@linux.ibm.com> (raw)
In-Reply-To: <20261202122437.289764-1-frankja@linux.ibm.com>
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
next prev parent reply other threads:[~2026-12-02 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:14 [GIT PULL 0/4] KVM: s390: Third round of fixes for 7.4 Janosch Frank
2026-12-02 12:14 ` [GIT PULL 1/4] KVM: s390: reserve mmu cache before stopping migration mode Janosch Frank
2026-12-02 12:14 ` [GIT PULL 2/4] KVM: s390: vsie: Do not overwrite guest 3 state on early validity icpt Janosch Frank
2026-12-02 12:14 ` Janosch Frank [this message]
2026-12-02 12:14 ` [GIT PULL 4/4] KVM: s390: Don't kick vcpus for floating IRQs that are no longer pending Janosch Frank
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=20261202122437.289764-4-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@kernel.org \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
--cc=yvanj@cyber.gent \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.