public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
	borntraeger@linux.ibm.com, akrowiak@linux.ibm.com
Subject: [PATCH] KVM: s390: Fix lpsw/e breaking event handling
Date: Tue, 17 Mar 2026 13:03:54 +0000	[thread overview]
Message-ID: <20260317130440.103576-2-frankja@linux.ibm.com> (raw)
In-Reply-To: <bc995033-1850-43f8-b04d-66f78ede157d@linux.ibm.com>

LPSW and LPSWE need to set the gbea on completion but currently don't.
Time to fix this up.

LPSWEY was designed to not set the bear.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Fixes: 48a3e950f4cee ("KVM: s390: Add support for machine checks.")
Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
---
 arch/s390/kvm/priv.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 3e764e6440d8..9d28b3fdba5b 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -710,12 +710,13 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
 {
 	psw_t *gpsw = &vcpu->arch.sie_block->gpsw;
 	psw32_t new_psw;
-	u64 addr;
+	u64 addr, iaddr;
 	int rc;
 	u8 ar;
 
 	vcpu->stat.instruction_lpsw++;
 
+	iaddr = gpsw->addr;
 	if (gpsw->mask & PSW_MASK_PSTATE)
 		return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
 
@@ -733,18 +734,20 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
 	gpsw->addr = new_psw.addr & ~PSW32_ADDR_AMODE;
 	if (!is_valid_psw(gpsw))
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
+	vcpu->arch.sie_block->gbea = iaddr;
 	return 0;
 }
 
 static int handle_lpswe(struct kvm_vcpu *vcpu)
 {
 	psw_t new_psw;
-	u64 addr;
+	u64 addr, iaddr;
 	int rc;
 	u8 ar;
 
 	vcpu->stat.instruction_lpswe++;
 
+	iaddr = vcpu->arch.sie_block->gpsw.addr;
 	if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
 		return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
 
@@ -757,6 +760,7 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
 	vcpu->arch.sie_block->gpsw = new_psw;
 	if (!is_valid_psw(&vcpu->arch.sie_block->gpsw))
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
+	vcpu->arch.sie_block->gbea = iaddr;
 	return 0;
 }
 
-- 
2.51.0


  parent reply	other threads:[~2026-03-17 13:05 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 16:23 [RFC 00/10] KVM: s390: spring cleanup Janosch Frank
2026-03-16 16:23 ` [RFC 01/10] KVM: s390: diag258: Pass absolute address to kvm_is_gpa_in_memslot() Janosch Frank
2026-03-16 18:34   ` Christian Borntraeger
2026-03-17 10:01   ` Christoph Schlameuss
2026-03-18 16:04   ` Claudio Imbrenda
2026-03-16 16:23 ` [RFC 02/10] KVM: s390: Consolidate lpswe variants Janosch Frank
2026-03-16 18:47   ` Christian Borntraeger
2026-03-17  8:13     ` Janosch Frank
2026-03-17 13:03     ` Janosch Frank [this message]
2026-03-17 13:30       ` [PATCH] KVM: s390: Fix lpsw/e breaking event handling Christian Borntraeger
2026-03-23 15:08       ` Hendrik Brueckner
2026-03-16 16:23 ` [RFC 03/10] KVM: s390: Convert shifts to gpa_to_gfn() Janosch Frank
2026-03-16 18:49   ` Christian Borntraeger
2026-03-17 10:38   ` Christoph Schlameuss
2026-03-18 14:26   ` Claudio Imbrenda
2026-03-16 16:23 ` [RFC 04/10] KVM: s390: kvm_s390_real_to_abs() should return gpa_t Janosch Frank
2026-03-16 18:53   ` Christian Borntraeger
2026-03-18  7:10   ` Christoph Schlameuss
2026-03-18 14:29   ` Claudio Imbrenda
2026-03-16 16:23 ` [RFC 05/10] KVM: s390: vsie: Cleanup and fixup of crycb handling Janosch Frank
2026-03-18 14:13   ` Christoph Schlameuss
2026-03-18 16:48   ` Claudio Imbrenda
2026-03-20 12:01   ` Anthony Krowiak
2026-03-23 15:54     ` Janosch Frank
2026-03-16 16:23 ` [RFC 06/10] KVM: s390: Rework lowcore access functions Janosch Frank
2026-03-18 14:25   ` Claudio Imbrenda
2026-03-23  9:11   ` Christoph Schlameuss
2026-03-16 16:23 ` [RFC 07/10] KVM: s390: Use gpa_t and gva_t in gaccess files Janosch Frank
2026-03-18 15:36   ` Claudio Imbrenda
2026-03-23  9:10   ` Christoph Schlameuss
2026-03-16 16:23 ` [RFC 08/10] KVM: s390: Use gpa_t in priv.c Janosch Frank
2026-03-18 16:02   ` Claudio Imbrenda
2026-03-23  9:28   ` Christoph Schlameuss
2026-03-16 16:23 ` [RFC 09/10] KVM: s390: Use gpa_t in pv.c Janosch Frank
2026-03-18 15:46   ` Claudio Imbrenda
2026-03-23  9:41   ` Christoph Schlameuss
2026-03-16 16:23 ` [RFC 10/10] KVM: s390: Cleanup kvm_s390_store_status_unloaded Janosch Frank
2026-03-18 15:51   ` Claudio Imbrenda
2026-03-23  9:47   ` Christoph Schlameuss

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=20260317130440.103576-2-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.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