kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master)
@ 2017-06-22 13:34 Christian Borntraeger
  2017-06-22 13:34 ` [GIT PULL 1/1] KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows Christian Borntraeger
  2017-06-22 14:18 ` [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master) Radim Krčmář
  0 siblings, 2 replies; 4+ messages in thread
From: Christian Borntraeger @ 2017-06-22 13:34 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář, Martin Schwidefsky
  Cc: KVM, Christian Borntraeger, Cornelia Huck, linux-s390,
	Heiko Carstens, David Hildenbrand

Paolo, Radim,

a late bugfix for 4.12.

The following changes since commit 1ba15b24f07c44f68067959522639226c963e212:

  KVM: s390: fix ais handling vs cpu model (2017-05-31 19:54:49 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-4.12-2

for you to fetch changes up to addb63c18a0d52a9ce2611d039f981f7b6148d2b:

  KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows (2017-06-22 12:53:34 +0200)

----------------------------------------------------------------
KVM: s390: fix shadow table handling for nested guests

Some odd-ball cases (real-space designation ASCEs) are handled wrong
for the shadow page tables. Fix it.

----------------------------------------------------------------
Heiko Carstens (1):
      KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows

 arch/s390/kvm/gaccess.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

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

* [GIT PULL 1/1] KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows
  2017-06-22 13:34 [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master) Christian Borntraeger
@ 2017-06-22 13:34 ` Christian Borntraeger
  2017-06-22 13:48   ` David Hildenbrand
  2017-06-22 14:18 ` [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master) Radim Krčmář
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2017-06-22 13:34 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář, Martin Schwidefsky
  Cc: KVM, Christian Borntraeger, Cornelia Huck, linux-s390,
	Heiko Carstens, David Hildenbrand

From: Heiko Carstens <heiko.carstens@de.ibm.com>

For real-space designation asces the asce origin part is only a token.
The asce token origin must not be used to generate an effective
address for storage references. This however is erroneously done
within kvm_s390_shadow_tables().

Furthermore within the same function the wrong parts of virtual
addresses are used to generate a corresponding real address
(e.g. the region second index is used as region first index).

Both of the above can result in incorrect address translations. Only
for real space designations with a token origin of zero and addresses
below one megabyte the translation was correct.

Furthermore replace a "!asce.r" statement with a "!*fake" statement to
make it more obvious that a specific condition has nothing to do with
the architecture, but with the fake handling of real space designations.

Fixes: 3218f7094b6b ("s390/mm: support real-space for gmap shadows")
Cc: David Hildenbrand <david@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/gaccess.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/s390/kvm/gaccess.c b/arch/s390/kvm/gaccess.c
index 9da243d..3b297fa 100644
--- a/arch/s390/kvm/gaccess.c
+++ b/arch/s390/kvm/gaccess.c
@@ -977,11 +977,12 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
 	ptr = asce.origin * 4096;
 	if (asce.r) {
 		*fake = 1;
+		ptr = 0;
 		asce.dt = ASCE_TYPE_REGION1;
 	}
 	switch (asce.dt) {
 	case ASCE_TYPE_REGION1:
-		if (vaddr.rfx01 > asce.tl && !asce.r)
+		if (vaddr.rfx01 > asce.tl && !*fake)
 			return PGM_REGION_FIRST_TRANS;
 		break;
 	case ASCE_TYPE_REGION2:
@@ -1009,8 +1010,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
 		union region1_table_entry rfte;
 
 		if (*fake) {
-			/* offset in 16EB guest memory block */
-			ptr = ptr + ((unsigned long) vaddr.rsx << 53UL);
+			ptr += (unsigned long) vaddr.rfx << 53;
 			rfte.val = ptr;
 			goto shadow_r2t;
 		}
@@ -1036,8 +1036,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
 		union region2_table_entry rste;
 
 		if (*fake) {
-			/* offset in 8PB guest memory block */
-			ptr = ptr + ((unsigned long) vaddr.rtx << 42UL);
+			ptr += (unsigned long) vaddr.rsx << 42;
 			rste.val = ptr;
 			goto shadow_r3t;
 		}
@@ -1064,8 +1063,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
 		union region3_table_entry rtte;
 
 		if (*fake) {
-			/* offset in 4TB guest memory block */
-			ptr = ptr + ((unsigned long) vaddr.sx << 31UL);
+			ptr += (unsigned long) vaddr.rtx << 31;
 			rtte.val = ptr;
 			goto shadow_sgt;
 		}
@@ -1101,8 +1099,7 @@ static int kvm_s390_shadow_tables(struct gmap *sg, unsigned long saddr,
 		union segment_table_entry ste;
 
 		if (*fake) {
-			/* offset in 2G guest memory block */
-			ptr = ptr + ((unsigned long) vaddr.sx << 20UL);
+			ptr += (unsigned long) vaddr.sx << 20;
 			ste.val = ptr;
 			goto shadow_pgt;
 		}
-- 
2.7.4

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

* Re: [GIT PULL 1/1] KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows
  2017-06-22 13:34 ` [GIT PULL 1/1] KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows Christian Borntraeger
@ 2017-06-22 13:48   ` David Hildenbrand
  0 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2017-06-22 13:48 UTC (permalink / raw)
  To: Christian Borntraeger, Paolo Bonzini, Radim Krčmář,
	Martin Schwidefsky
  Cc: KVM, Cornelia Huck, linux-s390, Heiko Carstens

On 22.06.2017 15:34, Christian Borntraeger wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> 
> For real-space designation asces the asce origin part is only a token.
> The asce token origin must not be used to generate an effective
> address for storage references. This however is erroneously done
> within kvm_s390_shadow_tables().
> 
> Furthermore within the same function the wrong parts of virtual
> addresses are used to generate a corresponding real address
> (e.g. the region second index is used as region first index).
> 
> Both of the above can result in incorrect address translations. Only
> for real space designations with a token origin of zero and addresses
> below one megabyte the translation was correct.
> 
> Furthermore replace a "!asce.r" statement with a "!*fake" statement to
> make it more obvious that a specific condition has nothing to do with
> the architecture, but with the fake handling of real space designations.
> 
> Fixes: 3218f7094b6b ("s390/mm: support real-space for gmap shadows")
> Cc: David Hildenbrand <david@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

Reviewed-by: David Hildenbrand <david@redhat.com>


-- 

Thanks,

David

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

* Re: [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master)
  2017-06-22 13:34 [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master) Christian Borntraeger
  2017-06-22 13:34 ` [GIT PULL 1/1] KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows Christian Borntraeger
@ 2017-06-22 14:18 ` Radim Krčmář
  1 sibling, 0 replies; 4+ messages in thread
From: Radim Krčmář @ 2017-06-22 14:18 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Paolo Bonzini, Martin Schwidefsky, KVM, Cornelia Huck, linux-s390,
	Heiko Carstens, David Hildenbrand

2017-06-22 15:34+0200, Christian Borntraeger:
> Paolo, Radim,
> 
> a late bugfix for 4.12.
> 
> The following changes since commit 1ba15b24f07c44f68067959522639226c963e212:
> 
>   KVM: s390: fix ais handling vs cpu model (2017-05-31 19:54:49 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-4.12-2

Pulled, thanks.

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

end of thread, other threads:[~2017-06-22 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-22 13:34 [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master) Christian Borntraeger
2017-06-22 13:34 ` [GIT PULL 1/1] KVM: s390: gaccess: fix real-space designation asce handling for gmap shadows Christian Borntraeger
2017-06-22 13:48   ` David Hildenbrand
2017-06-22 14:18 ` [GIT PULL 0/1] KVM: s390: fix for 4.12 (via kvm/master) Radim Krčmář

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