From: Gautam Gala <ggala@linux.ibm.com>
To: borntraeger@linux.ibm.com, kvm@vger.kernel.org,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@kernel.org,
hca@linux.ibm.com, gor@linux.ibm.com, agordeev@linux.ibm.com,
svens@linux.ibm.com, akrowiak@linux.ibm.com, pasic@linux.ibm.com,
pmorel@linux.ibm.com
Subject: [PATCH v1 1/1] KVM: s390: pqap: fix AP status written to wrong half of GR1
Date: Tue, 20 Oct 2026 10:25:34 +0200 [thread overview]
Message-ID: <20261020082534.481867-1-ggala@linux.ibm.com> (raw)
The AP Queue Status Word (APQSW) occupies bit positions 32-63 of GR1,
i.e. the low 32 bits of the 64-bit register, while the upper 32 bits
are reserved.
The no-hook fallback path in handle_pqap() synthesizes an APQSW and
copies struct ap_queue_status directly into GPR1 using memcpy(). On
big-endian s390 this places the APQSW in the upper 32 bits of the
register rather than in the architecturally defined APQSW field.
Use union ap_queue_status_reg and assign its value directly to GPR1.
This places APQSW in the correct half of the register and aligns the
fallback path with the register layout used by the AP infrastructure.
Fixes: e5282de93105 ("s390: ap: kvm: add PQAP interception for AQIC")
Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Gautam Gala <ggala@linux.ibm.com>
---
arch/s390/kvm/s390/priv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/s390/kvm/s390/priv.c b/arch/s390/kvm/s390/priv.c
index b3cb2c2c3aa7..ccb2a7830265 100644
--- a/arch/s390/kvm/s390/priv.c
+++ b/arch/s390/kvm/s390/priv.c
@@ -592,7 +592,7 @@ EXPORT_SYMBOL_FOR_MODULES(kvm_s390_is_gpa_in_memslot, "vfio_ap");
*/
static int handle_pqap(struct kvm_vcpu *vcpu)
{
- struct ap_queue_status status = {};
+ union ap_queue_status_reg status = {};
crypto_hook pqap_hook;
unsigned long reg0;
int ret;
@@ -661,8 +661,8 @@ static int handle_pqap(struct kvm_vcpu *vcpu)
* No hook means no driver to enable the SIE CRYCB and no queues.
* We send this response to the guest.
*/
- status.response_code = 0x01;
- memcpy(&vcpu->run->s.regs.gprs[1], &status, sizeof(status));
+ status.status.response_code = 0x01;
+ vcpu->run->s.regs.gprs[1] = status.value;
kvm_s390_set_psw_cc(vcpu, 3);
return 0;
}
--
2.56.0
next reply other threads:[~2026-10-20 8:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 8:25 Gautam Gala [this message]
2026-10-20 8:48 ` [PATCH v1 1/1] KVM: s390: pqap: fix AP status written to wrong half of GR1 sashiko-bot
2026-10-20 9:18 ` 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=20261020082534.481867-1-ggala@linux.ibm.com \
--to=ggala@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=akrowiak@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@kernel.org \
--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-s390@vger.kernel.org \
--cc=pasic@linux.ibm.com \
--cc=pmorel@linux.ibm.com \
--cc=svens@linux.ibm.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 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.