linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>, linux-kernel@vger.kernel.org
Cc: borntraeger@de.ibm.com, frankja@linux.ibm.com, cohuck@redhat.com,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v1 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO
Date: Mon, 22 Mar 2021 10:55:46 +0100	[thread overview]
Message-ID: <f7c8dd7d-34ab-95b9-dac4-bf2b9e37ae37@redhat.com> (raw)
In-Reply-To: <20210319193354.399587-3-imbrenda@linux.ibm.com>

On 19.03.21 20:33, Claudio Imbrenda wrote:
> Prefixing needs to be applied to the guest real address to translate it
> into a guest absolute address.
> 
> The value of MSO needs to be added to a guest-absolute address in order to
> obtain the host-virtual.
> 
> Fixes: 223ea46de9e79 ("s390/kvm: VSIE: correctly handle MVPG when in VSIE")
> Cc: stable@vger.kernel.org
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>   arch/s390/kvm/vsie.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 48aab6290a77..92864f9b3d84 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -1002,7 +1002,7 @@ static u64 vsie_get_register(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page,
>   static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>   {
>   	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
> -	unsigned long pei_dest, pei_src, src, dest, mask;
> +	unsigned long pei_dest, pei_src, r1, r2, src, dest, mask, mso, prefix;
>   	u64 *pei_block = &vsie_page->scb_o->mcic;
>   	int edat, rc_dest, rc_src;
>   	union ctlreg0 cr0;
> @@ -1010,9 +1010,13 @@ static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>   	cr0.val = vcpu->arch.sie_block->gcr[0];
>   	edat = cr0.edat && test_kvm_facility(vcpu->kvm, 8);
>   	mask = _kvm_s390_logical_to_effective(&scb_s->gpsw, PAGE_MASK);
> +	mso = READ_ONCE(vsie_page->scb_o->mso) & ~(1UL << 20);

I think we should use the one stored in the shadow page - this is what 
the SIE saw and will see when retrying.

> +	prefix = scb_s->prefix << GUEST_PREFIX_SHIFT;
>   
> -	dest = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 16) & mask;
> -	src = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 20) & mask;
> +	r1 = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 16);
> +	r2 = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 20);

Just reuse dest and src here?

> +	dest = _kvm_s390_real_to_abs(prefix, r1 & mask) + mso;
> +	src = _kvm_s390_real_to_abs(prefix, r2 & mask) + mso;
>   
>   	rc_dest = kvm_s390_shadow_fault(vcpu, vsie_page->gmap, dest, &pei_dest);
>   	rc_src = kvm_s390_shadow_fault(vcpu, vsie_page->gmap, src, &pei_src);
> 

Apart from that, looks good to me.

-- 
Thanks,

David / dhildenb


      reply	other threads:[~2021-03-22  9:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 19:33 [PATCH v1 0/2] s390/kvm: VSIE: fix prefixing and MSO for MVPG Claudio Imbrenda
2021-03-19 19:33 ` [PATCH v1 1/2] s390/kvm: split kvm_s390_real_to_abs Claudio Imbrenda
2021-03-20  4:57   ` Thomas Huth
2021-03-22  9:53     ` David Hildenbrand
2021-03-22 11:12       ` Heiko Carstens
2021-03-22 11:16         ` David Hildenbrand
2021-03-22 11:22           ` David Hildenbrand
2021-03-22 12:19         ` Christian Borntraeger
2021-03-19 19:33 ` [PATCH v1 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO Claudio Imbrenda
2021-03-22  9:55   ` David Hildenbrand [this message]

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=f7c8dd7d-34ab-95b9-dac4-bf2b9e37ae37@redhat.com \
    --to=david@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=frankja@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=stable@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;
as well as URLs for NNTP newsgroup(s).