Skip to contentSkip to conversation

s390/kvm: VSIE: fix prefixing and MSO for MVPG

PATCH In review Claudio Imbrenda 3 participants 12 messages Mar 22, 2021 – Mar 23, 2021

Subsystems (4)
lore
Share & tools
lore

Claudio Imbrenda

author maintainer
#0 lore raw

v2 cover s390/kvm: VSIE: fix prefixing and MSO for MVPG

The guest real address needs to pass through prefixing in order to yield the absolute address.

The absolute address needs to be offset by the MSO in order to get the host virtual address.

v1->v2
* use the MSO from the shadow SIE page instead of the original one
* reuse src and dest variabled to improve readability

Claudio Imbrenda (2):
s390/kvm: split kvm_s390_real_to_abs
s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

 arch/s390/kvm/gaccess.h | 23 +++++++++++++++++------
 arch/s390/kvm/vsie.c    |  6 +++++-
 2 files changed, 22 insertions(+), 7 deletions(-)
Signature · 1 line
2.26.2
author maintainer
#1 lore raw

PATCH v2 1/2 s390/kvm: split kvm_s390_real_to_abs

A new function _kvm_s390_real_to_abs will apply prefixing to a real address with a given prefix value.

The old kvm_s390_real_to_abs becomes now a wrapper around the new function.

This is needed to avoid code duplication in vSIE.

---
 arch/s390/kvm/gaccess.h | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
arch/s390/kvm/gaccess.h +17 -6
index daba10f76936..7c72a5e3449f 100644
@@ -18,17 +18,14 @@
 
 /**
  * kvm_s390_real_to_abs - convert guest real address to guest absolute address
- * @vcpu - guest virtual cpu
+ * @prefix - guest prefix
  * @gra - guest real address
  *
  * Returns the guest absolute address that corresponds to the passed guest real
- * address @gra of a virtual guest cpu by applying its prefix.
+ * address @gra of by applying the given prefix.
  */
-static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
-						 unsigned long gra)
+static inline unsigned long _kvm_s390_real_to_abs(u32 prefix, unsigned long gra)
 {
-	unsigned long prefix  = kvm_s390_get_prefix(vcpu);
-
 	if (gra < 2 * PAGE_SIZE)
 		gra += prefix;
 	else if (gra >= prefix && gra < prefix + 2 * PAGE_SIZE)
@@ -36,6 +33,20 @@ static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
 	return gra;
 }
 
+/**
+ * kvm_s390_real_to_abs - convert guest real address to guest absolute address
+ * @vcpu - guest virtual cpu
+ * @gra - guest real address
+ *
+ * Returns the guest absolute address that corresponds to the passed guest real
+ * address @gra of a virtual guest cpu by applying its prefix.
+ */
+static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
+						 unsigned long gra)
+{
+	return _kvm_s390_real_to_abs(kvm_s390_get_prefix(vcpu), gra);
+}
+
 /**
  * _kvm_s390_logical_to_effective - convert guest logical to effective address
  * @psw: psw of the guest
Signature · 1 line
2.26.2
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] s390/kvm: split kvm_s390_real_to_abs

Quoted 11 lines · Claudio Imbrenda

A new function _kvm_s390_real_to_abs will apply prefixing to a real address with a given prefix value.

The old kvm_s390_real_to_abs becomes now a wrapper around the new function.

This is needed to avoid code duplication in vSIE.

Quoted 51 lines
---
  arch/s390/kvm/gaccess.h | 23 +++++++++++++++++------
  1 file changed, 17 insertions(+), 6 deletions(-)
arch/s390/kvm/gaccess.h +17 -6
index daba10f76936..7c72a5e3449f 100644
@@ -18,17 +18,14 @@
 
  /**
   * kvm_s390_real_to_abs - convert guest real address to guest absolute address
- * @vcpu - guest virtual cpu
+ * @prefix - guest prefix
   * @gra - guest real address
   *
   * Returns the guest absolute address that corresponds to the passed guest real
- * address @gra of a virtual guest cpu by applying its prefix.
+ * address @gra of by applying the given prefix.
   */
-static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
-						 unsigned long gra)
+static inline unsigned long _kvm_s390_real_to_abs(u32 prefix, unsigned long gra)
  {
-	unsigned long prefix  = kvm_s390_get_prefix(vcpu);
-
  	if (gra < 2 * PAGE_SIZE)
  		gra += prefix;
  	else if (gra >= prefix && gra < prefix + 2 * PAGE_SIZE)
@@ -36,6 +33,20 @@ static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
  	return gra;
  }
 
+/**
+ * kvm_s390_real_to_abs - convert guest real address to guest absolute address
+ * @vcpu - guest virtual cpu
+ * @gra - guest real address
+ *
+ * Returns the guest absolute address that corresponds to the passed guest real
+ * address @gra of a virtual guest cpu by applying its prefix.
+ */
+static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
+						 unsigned long gra)
+{
+	return _kvm_s390_real_to_abs(kvm_s390_get_prefix(vcpu), gra);
+}
+
  /**
   * _kvm_s390_logical_to_effective - convert guest logical to effective address
   * @psw: psw of the guest
author maintainer
#3 lore raw

PATCH v2 2/2 s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

In reply to Claudio Imbrenda

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")
---
 arch/s390/kvm/vsie.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +5 -1
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, 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 = scb_s->mso & ~(1UL << 20);
+	prefix = scb_s->prefix << GUEST_PREFIX_SHIFT;
 
 	dest = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 16) & mask;
+	dest = _kvm_s390_real_to_abs(prefix, dest) + mso;
 	src = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 20) & mask;
+	src = _kvm_s390_real_to_abs(prefix, src) + 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);
Signature · 1 line
2.26.2
Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

Quoted 32 lines · Claudio Imbrenda

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")
---
  arch/s390/kvm/vsie.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, 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);

arch/s390/kvm/vsie.c static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · line 1022

Quoted 10 lines
arch/s390/kvm/vsie.c +4 -0
+	mso = scb_s->mso & ~(1UL << 20);
+	prefix = scb_s->prefix << GUEST_PREFIX_SHIFT;
 
  	dest = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 16) & mask;
+	dest = _kvm_s390_real_to_abs(prefix, dest) + mso;
  	src = vsie_get_register(vcpu, vsie_page, scb_s->ipb >> 20) & mask;
+	src = _kvm_s390_real_to_abs(prefix, src) + 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);

mso is always confusing, but I think this should be correct.

Signature · 3 lines
Thanks,

David / dhildenb
#5 lore raw

Re: [PATCH v2 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

In reply to Claudio Imbrenda
Quoted 28 lines · Claudio Imbrenda

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")
---
  arch/s390/kvm/vsie.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, mask, mso, prefix;
  	u64 *pei_block = &vsie_page->scb_o->mcic;
  	int edat, rc_dest, rc_src;
  	union ctlreg0 cr0;

arch/s390/kvm/vsie.c static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · line 1013

Quoted 4 lines
arch/s390/kvm/vsie.c +1 -0
@@ -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 = scb_s->mso & ~(1UL << 20);
			shouldnt that be ~((1UL << 20 ) -1)
#6 lore raw

Re: [PATCH v2 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

Quoted 28 lines · Christian Borntraeger
Quoted 25 lines · Claudio Imbrenda

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")
---
   arch/s390/kvm/vsie.c | 6 +++++-
   1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, mask, mso, prefix;
   	u64 *pei_block = &vsie_page->scb_o->mcic;
Quoted 9 lines

arch/s390/kvm/vsie.c static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · line 1013

Quoted 7 lines
arch/s390/kvm/vsie.c +1 -0
   	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 = scb_s->mso & ~(1UL << 20);
			shouldnt that be ~((1UL << 20 ) -1)

Looking at shadow_scb(), we can simply take scb_s->mso unmodified.

Signature · 3 lines
Thanks,

David / dhildenb
#7 lore raw

Re: [PATCH v2 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

Quoted 39 lines · David Hildenbrand
Quoted 28 lines · Christian Borntraeger
Quoted 25 lines · Claudio Imbrenda

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

---
   arch/s390/kvm/vsie.c | 6 +++++-

   1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, mask, mso, prefix;
        u64 *pei_block = &vsie_page->scb_o->mcic;
Quoted 9 lines

arch/s390/kvm/vsie.c static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · line 1013

Quoted 7 lines
arch/s390/kvm/vsie.c +1 -0
        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 = scb_s->mso & ~(1UL << 20);

            shouldnt that be ~((1UL << 20 ) -1)

Quoted 1 line

Looking at shadow_scb(), we can simply take scb_s->mso unmodified.

Right, I think I can fix this up (and get rid of the local mso variable) when queueing. Or shall Claudio send a new version of the patch?

#8 lore raw

Re: [PATCH v2 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

Quoted 42 lines · Christian Borntraeger
Quoted 39 lines · David Hildenbrand
Quoted 37 lines · Christian Borntraeger
Quoted 28 lines · Claudio Imbrenda

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")
---
    arch/s390/kvm/vsie.c | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, mask, mso, prefix;
        u64 *pei_block = &vsie_page->scb_o->mcic;
        int edat, rc_dest, rc_src;
        union ctlreg0 cr0;

arch/s390/kvm/vsie.c static int vsie_handle_mvpg(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · line 1013

Quoted 4 lines
arch/s390/kvm/vsie.c +1 -0
@@ -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 = scb_s->mso & ~(1UL << 20);

            shouldnt that be ~((1UL << 20 ) -1)

Quoted 5 lines
Quoted 1 line

Looking at shadow_scb(), we can simply take scb_s->mso unmodified.

Right, I think I can fix this up (and get rid of the local mso variable) when queueing. Or shall Claudio send a new version of the patch?

IMHO, you can just fix it up.

Signature · 3 lines
Thanks,

David / dhildenb
author maintainer
#9 lore raw

Re: [PATCH v2 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

In reply to Christian Borntraeger
Quoted 32 lines · On Tue, 23 Mar 2021 16:16:18 +0100 Christian Borntraeger…
Quoted 31 lines · David Hildenbrand
Quoted 30 lines · Christian Borntraeger
Quoted 27 lines · Claudio Imbrenda

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: [email protected]

---
   arch/s390/kvm/vsie.c | 6 +++++-

   1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +0 -0
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, mask, mso, prefix; u64 *pei_block = &vsie_page->scb_o->mcic; int edat, rc_dest, rc_src;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

       union ctlreg0 cr0;

arch/s390/kvm/vsie.c +0 -0
@@ -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 = scb_s->mso & ~(1UL << 20);

            shouldnt that be ~((1UL << 20 ) -1)

oops

Quoted 4 lines
Quoted 2 lines

Looking at shadow_scb(), we can simply take scb_s->mso unmodified.

Right, I think I can fix this up (and get rid of the local mso

I think that's easier/simpler

Quoted 2 lines

variable) when queueing. Or shall Claudio send a new version of the patch?

#10 lore raw

Re: [PATCH v2 2/2] s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

Quoted 44 lines · Claudio Imbrenda
Quoted 32 lines · On Tue, 23 Mar 2021 16:16:18 +0100 Christian Borntraeger…
Quoted 31 lines · David Hildenbrand
Quoted 30 lines · Christian Borntraeger
Quoted 27 lines · Claudio Imbrenda

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: [email protected]

---
    arch/s390/kvm/vsie.c | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)
arch/s390/kvm/vsie.c +0 -0
index 48aab6290a77..ac86f11e46dc 100644
@@ -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, dest, src, mask, mso, prefix; u64 *pei_block = &vsie_page->scb_o->mcic;
       int edat, rc_dest, rc_src;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

       union ctlreg0 cr0;

arch/s390/kvm/vsie.c +0 -0
@@ -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 = scb_s->mso & ~(1UL << 20);

            shouldnt that be ~((1UL << 20 ) -1)

Quoted 12 lines

oops

Quoted 4 lines
Quoted 2 lines

Looking at shadow_scb(), we can simply take scb_s->mso unmodified.

Right, I think I can fix this up (and get rid of the local mso

I think that's easier/simpler

Quoted 2 lines

variable) when queueing. Or shall Claudio send a new version of the patch?

queued (with fixup). Please note: can you use "KVM: s390:" instead of "s390/kvm" for the future patches.

#11 lore raw
In reply to Claudio Imbrenda
Quoted 10 lines · Claudio Imbrenda

The guest real address needs to pass through prefixing in order to yield the absolute address.

The absolute address needs to be offset by the MSO in order to get the host virtual address.

v1->v2
* use the MSO from the shadow SIE page instead of the original one
* reuse src and dest variabled to improve readability

Quoted 8 lines

Claudio Imbrenda (2):
s390/kvm: split kvm_s390_real_to_abs
s390/kvm: VSIE: fix MVPG handling for prefixing and MSO

  arch/s390/kvm/gaccess.h | 23 +++++++++++++++++------
  arch/s390/kvm/vsie.c    |  6 +++++-
  2 files changed, 22 insertions(+), 7 deletions(-)

I picked both for internal CI and staging.
RBs or acks can still be send.