public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: s390: fix cc for successful PQAP
@ 2023-12-01 18:16 Eric Farman
  2023-12-04 11:48 ` Halil Pasic
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Eric Farman @ 2023-12-01 18:16 UTC (permalink / raw)
  To: Christian Borntraeger, Janosch Frank, Claudio Imbrenda,
	Tony Krowiak, Halil Pasic, Jason Herne
  Cc: Sven Schnelle, Heiko Carstens, Vasily Gorbik, linux-s390, kvm,
	Eric Farman

The various errors that are possible when processing a PQAP
instruction (the absence of a driver hook, an error FROM that
hook), all correctly set the PSW condition code to 3. But if
that processing works successfully, CC0 needs to be set to
convey that everything was fine.

Fix the check so that the guest can examine the condition code
to determine whether GPR1 has meaningful data.

Fixes: e5282de93105 ("s390: ap: kvm: add PQAP interception for AQIC")
Signed-off-by: Eric Farman <farman@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 621a17fd1a1b..f875a404a0a0 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -676,8 +676,12 @@ static int handle_pqap(struct kvm_vcpu *vcpu)
 	if (vcpu->kvm->arch.crypto.pqap_hook) {
 		pqap_hook = *vcpu->kvm->arch.crypto.pqap_hook;
 		ret = pqap_hook(vcpu);
-		if (!ret && vcpu->run->s.regs.gprs[1] & 0x00ff0000)
-			kvm_s390_set_psw_cc(vcpu, 3);
+		if (!ret) {
+			if (vcpu->run->s.regs.gprs[1] & 0x00ff0000)
+				kvm_s390_set_psw_cc(vcpu, 3);
+			else
+				kvm_s390_set_psw_cc(vcpu, 0);
+		}
 		up_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem);
 		return ret;
 	}
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-01-03 15:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-01 18:16 [PATCH] KVM: s390: fix cc for successful PQAP Eric Farman
2023-12-04 11:48 ` Halil Pasic
2023-12-07 15:39 ` Anthony Krowiak
2023-12-07 16:11   ` Eric Farman
2023-12-07 20:31     ` Anthony Krowiak
2023-12-08 10:31 ` Janosch Frank
2023-12-08 11:24   ` Eric Farman
2023-12-08 14:21     ` Anthony Krowiak
2023-12-13 12:43       ` Eric Farman
2024-01-03 15:26 ` Janosch Frank

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox