public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Halil Pasic <pasic@linux.ibm.com>
To: Eric Farman <farman@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Tony Krowiak <akrowiak@linux.ibm.com>,
	Jason Herne <jjherne@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org,
	Halil Pasic <pasic@linux.ibm.com>
Subject: Re: [PATCH] KVM: s390: fix cc for successful PQAP
Date: Mon, 4 Dec 2023 12:48:39 +0100	[thread overview]
Message-ID: <20231204124839.093f4f76.pasic@linux.ibm.com> (raw)
In-Reply-To: <20231201181657.1614645-1-farman@linux.ibm.com>

On Fri,  1 Dec 2023 19:16:57 +0100
Eric Farman <farman@linux.ibm.com> wrote:

> 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>

Reviewed-by: Halil Pasic <pasic@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);

Maybe a comment that tells pqap_hook() returns 0 or -EOPNOTSUPP
that singnals this should be handled by QEMU. But that can certainly
be done on top, and it is not a part of a minimal fix.

> +		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;
>  	}


  reply	other threads:[~2023-12-04 11:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 18:16 [PATCH] KVM: s390: fix cc for successful PQAP Eric Farman
2023-12-04 11:48 ` Halil Pasic [this message]
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

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=20231204124839.093f4f76.pasic@linux.ibm.com \
    --to=pasic@linux.ibm.com \
    --cc=akrowiak@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --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=jjherne@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox