From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Yvan Janssens <yvanj@cyber.gent>,
Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: David Hildenbrand <david@kernel.org>,
Eric Farman <farman@linux.ibm.com>,
Hendrik Brueckner <brueckner@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
Shuah Khan <shuah@kernel.org>,
kvm@vger.kernel.org, linux-s390@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format
Date: Thu, 26 Nov 2026 09:32:41 +0100 [thread overview]
Message-ID: <de93466c-42fc-4f1a-a69c-6e29809a2494@linux.ibm.com> (raw)
In-Reply-To: <20261125165604.3074595-2-yvanj@cyber.gent>
Am 25.11.26 um 17:56 schrieb Yvan Janssens:
> 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. The visible effect is that the first STFLE after entering SIE
> does nothing in a nested guest.
There might be other cases as well that we skip. So when applying maybe
replace "The visible" with "One visible"
>
> 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: Christian Borntraeger <borntraeger@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 3ce133f20fa2..ed40d40d89e4 100644
> --- a/arch/s390/kvm/s390/vsie.c
> +++ b/arch/s390/kvm/s390/vsie.c
> @@ -948,6 +948,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)
> {
> @@ -960,7 +974,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);
> }
>
> @@ -1413,7 +1427,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;
next prev parent reply other threads:[~2026-11-26 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 16:56 [PATCH v2 0/2] KVM: s390: vsie: fix instruction retry for nested guests in ESA mode Yvan Janssens
2026-11-25 16:56 ` [PATCH v2 1/2] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format Yvan Janssens
2026-11-26 8:32 ` Christian Borntraeger [this message]
2026-11-26 12:35 ` Janosch Frank
2026-11-25 16:56 ` [PATCH v2 2/2] KVM: s390: selftests: Add a test for nested guests in ESA mode Yvan Janssens
2026-11-26 9:13 ` Christian Borntraeger
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=de93466c-42fc-4f1a-a69c-6e29809a2494@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=brueckner@linux.ibm.com \
--cc=david@kernel.org \
--cc=farman@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
--cc=svens@linux.ibm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®