public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] KVM: s390: More patches for kvm-next.
@ 2013-03-25 16:22 Cornelia Huck
  2013-03-25 16:22 ` [PATCH 01/11] KVM: s390: Dont do a gmap update on minor memslot changes Cornelia Huck
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

Hi,

here are some kvm/s390 patches that have accumulated in our queue.

Changes include fixes in the lpsw(e) and stsi handlers, proper
handling of interrupt injection failures and a gmap optimization.

Also included are patches allowing support for standby memory on
kvm guests. Standby memory is used for providing hotpluggable
memory on s390.

Please consider applying.

Christian Borntraeger (1):
  KVM: s390: Dont do a gmap update on minor memslot changes

Heiko Carstens (7):
  KVM: s390: fix 24 bit psw handling in lpsw/lpswe handler
  KVM: s390: fix psw conversion in lpsw handler
  KVM: s390: fix return code handling in lpsw/lpswe handlers
  KVM: s390: make if statements in lpsw/lpswe handlers readable
  KVM: s390: fix and enforce return code handling for irq injections
  KVM: s390: fix stsi exception handling
  KVM: s390: fix compile with !CONFIG_COMPAT

Nick Wang (3):
  KVM: s390: Change the virtual memory mapping location for virtio
    devices
  KVM: s390: Remove the sanity checks for kvm memory slot
  KVM: s390: Enable KVM_CAP_NR_MEMSLOTS on s390

 arch/s390/kvm/intercept.c     |  12 +--
 arch/s390/kvm/kvm-s390.c      |  32 ++++---
 arch/s390/kvm/kvm-s390.h      |  12 +--
 arch/s390/kvm/priv.c          | 203 +++++++++++++++---------------------------
 drivers/s390/kvm/kvm_virtio.c |  11 +--
 5 files changed, 108 insertions(+), 162 deletions(-)

-- 
1.7.12.4

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

* [PATCH 01/11] KVM: s390: Dont do a gmap update on minor memslot changes
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 02/11] KVM: s390: fix 24 bit psw handling in lpsw/lpswe handler Cornelia Huck
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

From: Christian Borntraeger <borntraeger@de.ibm.com>

Some memslot updates dont affect the gmap implementation,
e.g. setting/unsetting dirty tracking. Since a gmap update
will cause tlb flushes and segment table invalidations we
want to avoid that.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 33161b4..f241e33 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1007,6 +1007,16 @@ void kvm_arch_commit_memory_region(struct kvm *kvm,
 {
 	int rc;
 
+	/* If the basics of the memslot do not change, we do not want
+	 * to update the gmap. Every update causes several unnecessary
+	 * segment translation exceptions. This is usually handled just
+	 * fine by the normal fault handler + gmap, but it will also
+	 * cause faults on the prefix page of running guest CPUs.
+	 */
+	if (old->userspace_addr == mem->userspace_addr &&
+	    old->base_gfn * PAGE_SIZE == mem->guest_phys_addr &&
+	    old->npages * PAGE_SIZE == mem->memory_size)
+		return;
 
 	rc = gmap_map_segment(kvm->arch.gmap, mem->userspace_addr,
 		mem->guest_phys_addr, mem->memory_size);
-- 
1.7.12.4

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

* [PATCH 02/11] KVM: s390: fix 24 bit psw handling in lpsw/lpswe handler
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
  2013-03-25 16:22 ` [PATCH 01/11] KVM: s390: Dont do a gmap update on minor memslot changes Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 03/11] KVM: s390: fix psw conversion in lpsw handler Cornelia Huck
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

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

When checking for validity the lpsw/lpswe handler check that only
the lower 20 bits instead of 24 bits have a non-zero value.
There handling valid psws as invalid ones.
Fix the 24 bit psw mask.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/priv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 7db2ad0..7b397b3 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -255,7 +255,7 @@ static void handle_new_psw(struct kvm_vcpu *vcpu)
 
 #define PSW_MASK_ADDR_MODE (PSW_MASK_EA | PSW_MASK_BA)
 #define PSW_MASK_UNASSIGNED 0xb80800fe7fffffffUL
-#define PSW_ADDR_24 0x00000000000fffffUL
+#define PSW_ADDR_24 0x0000000000ffffffUL
 #define PSW_ADDR_31 0x000000007fffffffUL
 
 int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
-- 
1.7.12.4

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

* [PATCH 03/11] KVM: s390: fix psw conversion in lpsw handler
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
  2013-03-25 16:22 ` [PATCH 01/11] KVM: s390: Dont do a gmap update on minor memslot changes Cornelia Huck
  2013-03-25 16:22 ` [PATCH 02/11] KVM: s390: fix 24 bit psw handling in lpsw/lpswe handler Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 04/11] KVM: s390: fix return code handling in lpsw/lpswe handlers Cornelia Huck
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

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

When converting a 64 bit psw to a 128 bit psw the addressing mode bit of
the "addr" part of the 64 bit psw must be moved to the basic addressing
mode bit of the "mask" part of the 128 bit psw.
In addition the addressing mode bit must be cleared when moved to the "addr"
part of the 128 bit psw.
Otherwise an invalid psw would be generated if the orginal psw was in the
31 bit addressing mode.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/priv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 7b397b3..844a2b9 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -286,7 +286,8 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
 
 	vcpu->arch.sie_block->gpsw.mask =
 		(new_psw.mask & ~PSW32_MASK_BASE) << 32;
-	vcpu->arch.sie_block->gpsw.addr = new_psw.addr;
+	vcpu->arch.sie_block->gpsw.mask |= new_psw.addr & PSW32_ADDR_AMODE;
+	vcpu->arch.sie_block->gpsw.addr = new_psw.addr & ~PSW32_ADDR_AMODE;
 
 	if ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_UNASSIGNED) ||
 	    (!(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) &&
-- 
1.7.12.4

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

* [PATCH 04/11] KVM: s390: fix return code handling in lpsw/lpswe handlers
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (2 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 03/11] KVM: s390: fix psw conversion in lpsw handler Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 05/11] KVM: s390: make if statements in lpsw/lpswe handlers readable Cornelia Huck
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

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

kvm_s390_inject_program_int() may return with a non-zero return value, in
case of an error (out of memory). Report that to the calling functions
instead of ignoring the error case.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/priv.c | 44 ++++++++++++++------------------------------
 1 file changed, 14 insertions(+), 30 deletions(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 844a2b9..9d32c56 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -269,20 +269,14 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
 
 	addr = kvm_s390_get_base_disp_s(vcpu);
 
-	if (addr & 7) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (addr & 7)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
-	if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out;
-	}
+	if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw)))
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
-	if (!(new_psw.mask & PSW32_MASK_BASE)) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (!(new_psw.mask & PSW32_MASK_BASE))
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
 	vcpu->arch.sie_block->gpsw.mask =
 		(new_psw.mask & ~PSW32_MASK_BASE) << 32;
@@ -293,13 +287,10 @@ int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
 	    (!(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) &&
 	     (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_24)) ||
 	    ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
-	     PSW_MASK_EA)) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	     PSW_MASK_EA))
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
 	handle_new_psw(vcpu);
-out:
 	return 0;
 }
 
@@ -310,15 +301,11 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
 
 	addr = kvm_s390_get_base_disp_s(vcpu);
 
-	if (addr & 7) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (addr & 7)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
-	if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out;
-	}
+	if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw)))
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
 	vcpu->arch.sie_block->gpsw.mask = new_psw.mask;
 	vcpu->arch.sie_block->gpsw.addr = new_psw.addr;
@@ -330,13 +317,10 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
 	    (!(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) &&
 	     (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_24)) ||
 	    ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
-	     PSW_MASK_EA)) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	     PSW_MASK_EA))
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
 	handle_new_psw(vcpu);
-out:
 	return 0;
 }
 
-- 
1.7.12.4

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

* [PATCH 05/11] KVM: s390: make if statements in lpsw/lpswe handlers readable
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (3 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 04/11] KVM: s390: fix return code handling in lpsw/lpswe handlers Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 06/11] KVM: s390: fix and enforce return code handling for irq injections Cornelia Huck
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

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

Being unable to parse the 5- and 8-line if statements I had to split them
to be able to make any sense of them and verify that they match the
architecture.
So change the code since I guess that other people will also have a hard
time parsing such long conditional statements with line breaks.

Introduce a common is_valid_psw() function which does all the checks needed.
In case of lpsw (64 bit psw -> 128 bit psw conversion) it will do some not
needed additional checks, since a couple of bits can't be set anyway, but
that doesn't hurt.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/priv.c | 58 ++++++++++++++++++++++------------------------------
 1 file changed, 24 insertions(+), 34 deletions(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 9d32c56..05d186c 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -258,68 +258,58 @@ static void handle_new_psw(struct kvm_vcpu *vcpu)
 #define PSW_ADDR_24 0x0000000000ffffffUL
 #define PSW_ADDR_31 0x000000007fffffffUL
 
+static int is_valid_psw(psw_t *psw) {
+	if (psw->mask & PSW_MASK_UNASSIGNED)
+		return 0;
+	if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_BA) {
+		if (psw->addr & ~PSW_ADDR_31)
+			return 0;
+	}
+	if (!(psw->mask & PSW_MASK_ADDR_MODE) && (psw->addr & ~PSW_ADDR_24))
+		return 0;
+	if ((psw->mask & PSW_MASK_ADDR_MODE) ==  PSW_MASK_EA)
+		return 0;
+	return 1;
+}
+
 int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu)
 {
-	u64 addr;
+	psw_t *gpsw = &vcpu->arch.sie_block->gpsw;
 	psw_compat_t new_psw;
+	u64 addr;
 
-	if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
+	if (gpsw->mask & PSW_MASK_PSTATE)
 		return kvm_s390_inject_program_int(vcpu,
 						   PGM_PRIVILEGED_OPERATION);
-
 	addr = kvm_s390_get_base_disp_s(vcpu);
-
 	if (addr & 7)
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-
 	if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw)))
 		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-
 	if (!(new_psw.mask & PSW32_MASK_BASE))
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-
-	vcpu->arch.sie_block->gpsw.mask =
-		(new_psw.mask & ~PSW32_MASK_BASE) << 32;
-	vcpu->arch.sie_block->gpsw.mask |= new_psw.addr & PSW32_ADDR_AMODE;
-	vcpu->arch.sie_block->gpsw.addr = new_psw.addr & ~PSW32_ADDR_AMODE;
-
-	if ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_UNASSIGNED) ||
-	    (!(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) &&
-	     (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_24)) ||
-	    ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
-	     PSW_MASK_EA))
+	gpsw->mask = (new_psw.mask & ~PSW32_MASK_BASE) << 32;
+	gpsw->mask |= new_psw.addr & PSW32_ADDR_AMODE;
+	gpsw->addr = new_psw.addr & ~PSW32_ADDR_AMODE;
+	if (!is_valid_psw(gpsw))
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-
 	handle_new_psw(vcpu);
 	return 0;
 }
 
 static int handle_lpswe(struct kvm_vcpu *vcpu)
 {
-	u64 addr;
 	psw_t new_psw;
+	u64 addr;
 
 	addr = kvm_s390_get_base_disp_s(vcpu);
-
 	if (addr & 7)
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-
 	if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw)))
 		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-
-	vcpu->arch.sie_block->gpsw.mask = new_psw.mask;
-	vcpu->arch.sie_block->gpsw.addr = new_psw.addr;
-
-	if ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_UNASSIGNED) ||
-	    (((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
-	      PSW_MASK_BA) &&
-	     (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_31)) ||
-	    (!(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) &&
-	     (vcpu->arch.sie_block->gpsw.addr & ~PSW_ADDR_24)) ||
-	    ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_ADDR_MODE) ==
-	     PSW_MASK_EA))
+	vcpu->arch.sie_block->gpsw = new_psw;
+	if (!is_valid_psw(&vcpu->arch.sie_block->gpsw))
 		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-
 	handle_new_psw(vcpu);
 	return 0;
 }
-- 
1.7.12.4

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

* [PATCH 06/11] KVM: s390: fix and enforce return code handling for irq injections
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (4 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 05/11] KVM: s390: make if statements in lpsw/lpswe handlers readable Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 07/11] KVM: s390: fix stsi exception handling Cornelia Huck
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

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

kvm_s390_inject_program_int() and friends may fail if no memory is available.
This must be reported to the calling functions, so that this gets passed
down to user space which should fix the situation.
Alternatively we end up with guest state corruption.

So fix this and enforce return value checking by adding a __must_check
annotation to all of these function prototypes.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/intercept.c | 12 +++----
 arch/s390/kvm/kvm-s390.c  |  3 +-
 arch/s390/kvm/kvm-s390.h  | 12 +++----
 arch/s390/kvm/priv.c      | 83 +++++++++++++++--------------------------------
 4 files changed, 37 insertions(+), 73 deletions(-)

diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index c6ba4df..b7d1b2e 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -45,10 +45,8 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)
 	do {
 		rc = get_guest(vcpu, vcpu->arch.sie_block->gcr[reg],
 			       (u64 __user *) useraddr);
-		if (rc) {
-			kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-			break;
-		}
+		if (rc)
+			return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 		useraddr += 8;
 		if (reg == reg3)
 			break;
@@ -79,10 +77,8 @@ static int handle_lctl(struct kvm_vcpu *vcpu)
 	reg = reg1;
 	do {
 		rc = get_guest(vcpu, val, (u32 __user *) useraddr);
-		if (rc) {
-			kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-			break;
-		}
+		if (rc)
+			return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 		vcpu->arch.sie_block->gcr[reg] &= 0xffffffff00000000ul;
 		vcpu->arch.sie_block->gcr[reg] |= val;
 		useraddr += 4;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index f241e33..d05a59c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -633,8 +633,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
 		} else {
 			VCPU_EVENT(vcpu, 3, "%s", "fault in sie instruction");
 			trace_kvm_s390_sie_fault(vcpu);
-			kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-			rc = 0;
+			rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 		}
 	}
 	VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 4d89d64..efc14f6 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -110,12 +110,12 @@ enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer);
 void kvm_s390_tasklet(unsigned long parm);
 void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu);
 void kvm_s390_deliver_pending_machine_checks(struct kvm_vcpu *vcpu);
-int kvm_s390_inject_vm(struct kvm *kvm,
-		struct kvm_s390_interrupt *s390int);
-int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
-		struct kvm_s390_interrupt *s390int);
-int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code);
-int kvm_s390_inject_sigp_stop(struct kvm_vcpu *vcpu, int action);
+int __must_check kvm_s390_inject_vm(struct kvm *kvm,
+				    struct kvm_s390_interrupt *s390int);
+int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
+				      struct kvm_s390_interrupt *s390int);
+int __must_check kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code);
+int __must_check kvm_s390_inject_sigp_stop(struct kvm_vcpu *vcpu, int action);
 struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
 						    u64 cr6, u64 schid);
 
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 05d186c..23a8370 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -36,31 +36,24 @@ static int handle_set_prefix(struct kvm_vcpu *vcpu)
 	operand2 = kvm_s390_get_base_disp_s(vcpu);
 
 	/* must be word boundary */
-	if (operand2 & 3) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (operand2 & 3)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
 	/* get the value */
-	if (get_guest(vcpu, address, (u32 __user *) operand2)) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out;
-	}
+	if (get_guest(vcpu, address, (u32 __user *) operand2))
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
 	address = address & 0x7fffe000u;
 
 	/* make sure that the new value is valid memory */
 	if (copy_from_guest_absolute(vcpu, &tmp, address, 1) ||
-	   (copy_from_guest_absolute(vcpu, &tmp, address + PAGE_SIZE, 1))) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out;
-	}
+	   (copy_from_guest_absolute(vcpu, &tmp, address + PAGE_SIZE, 1)))
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
 	kvm_s390_set_prefix(vcpu, address);
 
 	VCPU_EVENT(vcpu, 5, "setting prefix to %x", address);
 	trace_kvm_s390_handle_prefix(vcpu, 1, address);
-out:
 	return 0;
 }
 
@@ -74,49 +67,37 @@ static int handle_store_prefix(struct kvm_vcpu *vcpu)
 	operand2 = kvm_s390_get_base_disp_s(vcpu);
 
 	/* must be word boundary */
-	if (operand2 & 3) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (operand2 & 3)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
 	address = vcpu->arch.sie_block->prefix;
 	address = address & 0x7fffe000u;
 
 	/* get the value */
-	if (put_guest(vcpu, address, (u32 __user *)operand2)) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out;
-	}
+	if (put_guest(vcpu, address, (u32 __user *)operand2))
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
 	VCPU_EVENT(vcpu, 5, "storing prefix to %x", address);
 	trace_kvm_s390_handle_prefix(vcpu, 0, address);
-out:
 	return 0;
 }
 
 static int handle_store_cpu_address(struct kvm_vcpu *vcpu)
 {
 	u64 useraddr;
-	int rc;
 
 	vcpu->stat.instruction_stap++;
 
 	useraddr = kvm_s390_get_base_disp_s(vcpu);
 
-	if (useraddr & 1) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (useraddr & 1)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
-	rc = put_guest(vcpu, vcpu->vcpu_id, (u16 __user *)useraddr);
-	if (rc) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out;
-	}
+	if (put_guest(vcpu, vcpu->vcpu_id, (u16 __user *)useraddr))
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
 	VCPU_EVENT(vcpu, 5, "storing cpu address to %llx", useraddr);
 	trace_kvm_s390_handle_stap(vcpu, useraddr);
-out:
 	return 0;
 }
 
@@ -135,10 +116,8 @@ static int handle_tpi(struct kvm_vcpu *vcpu)
 	int cc;
 
 	addr = kvm_s390_get_base_disp_s(vcpu);
-	if (addr & 3) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (addr & 3)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 	cc = 0;
 	inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0);
 	if (!inti)
@@ -167,7 +146,6 @@ no_interrupt:
 	/* Set condition code and we're done. */
 	vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
 	vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44;
-out:
 	return 0;
 }
 
@@ -237,12 +215,9 @@ static int handle_stfl(struct kvm_vcpu *vcpu)
 	rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list),
 			   &facility_list, sizeof(facility_list));
 	if (rc)
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-	else {
-		VCPU_EVENT(vcpu, 5, "store facility list value %x",
-			   facility_list);
-		trace_kvm_s390_handle_stfl(vcpu, facility_list);
-	}
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
+	VCPU_EVENT(vcpu, 5, "store facility list value %x", facility_list);
+	trace_kvm_s390_handle_stfl(vcpu, facility_list);
 	return 0;
 }
 
@@ -317,25 +292,18 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
 static int handle_stidp(struct kvm_vcpu *vcpu)
 {
 	u64 operand2;
-	int rc;
 
 	vcpu->stat.instruction_stidp++;
 
 	operand2 = kvm_s390_get_base_disp_s(vcpu);
 
-	if (operand2 & 7) {
-		kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
-		goto out;
-	}
+	if (operand2 & 7)
+		return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
 
-	rc = put_guest(vcpu, vcpu->arch.stidp_data, (u64 __user *)operand2);
-	if (rc) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out;
-	}
+	if (put_guest(vcpu, vcpu->arch.stidp_data, (u64 __user *)operand2))
+		return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 
 	VCPU_EVENT(vcpu, 5, "%s", "store cpu id");
-out:
 	return 0;
 }
 
@@ -377,6 +345,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
 	int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff;
 	u64 operand2;
 	unsigned long mem;
+	int rc = 0;
 
 	vcpu->stat.instruction_stsi++;
 	VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2);
@@ -412,7 +381,7 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
 	}
 
 	if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) {
-		kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
+		rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
 		goto out_mem;
 	}
 	trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
@@ -425,7 +394,7 @@ out_mem:
 out_fail:
 	/* condition code 3 */
 	vcpu->arch.sie_block->gpsw.mask |= 3ul << 44;
-	return 0;
+	return rc;
 }
 
 static const intercept_handler_t b2_handlers[256] = {
-- 
1.7.12.4

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

* [PATCH 07/11] KVM: s390: fix stsi exception handling
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (5 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 06/11] KVM: s390: fix and enforce return code handling for irq injections Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 08/11] KVM: s390: fix compile with !CONFIG_COMPAT Cornelia Huck
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

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

In case of an exception the guest psw condition code should be left alone.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-By: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/priv.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 23a8370..de1b1b6 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -343,8 +343,8 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
 	int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28;
 	int sel1 = vcpu->run->s.regs.gprs[0] & 0xff;
 	int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff;
+	unsigned long mem = 0;
 	u64 operand2;
-	unsigned long mem;
 	int rc = 0;
 
 	vcpu->stat.instruction_stsi++;
@@ -364,36 +364,36 @@ static int handle_stsi(struct kvm_vcpu *vcpu)
 	case 2:
 		mem = get_zeroed_page(GFP_KERNEL);
 		if (!mem)
-			goto out_fail;
+			goto out_no_data;
 		if (stsi((void *) mem, fc, sel1, sel2))
-			goto out_mem;
+			goto out_no_data;
 		break;
 	case 3:
 		if (sel1 != 2 || sel2 != 2)
-			goto out_fail;
+			goto out_no_data;
 		mem = get_zeroed_page(GFP_KERNEL);
 		if (!mem)
-			goto out_fail;
+			goto out_no_data;
 		handle_stsi_3_2_2(vcpu, (void *) mem);
 		break;
 	default:
-		goto out_fail;
+		goto out_no_data;
 	}
 
 	if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) {
 		rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
-		goto out_mem;
+		goto out_exception;
 	}
 	trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2);
 	free_page(mem);
 	vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
 	vcpu->run->s.regs.gprs[0] = 0;
 	return 0;
-out_mem:
-	free_page(mem);
-out_fail:
+out_no_data:
 	/* condition code 3 */
 	vcpu->arch.sie_block->gpsw.mask |= 3ul << 44;
+out_exception:
+	free_page(mem);
 	return rc;
 }
 
-- 
1.7.12.4

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

* [PATCH 08/11] KVM: s390: fix compile with !CONFIG_COMPAT
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (6 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 07/11] KVM: s390: fix stsi exception handling Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 09/11] KVM: s390: Change the virtual memory mapping location for virtio devices Cornelia Huck
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390

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

arch/s390/kvm/priv.c should include both
linux/compat.h and asm/compat.h.
Fixes this one:

In file included from arch/s390/kvm/priv.c:23:0:
arch/s390/include/asm/compat.h: In function ‘arch_compat_alloc_user_space’:
arch/s390/include/asm/compat.h:258:2: error: implicit declaration of function ‘is_compat_task’

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/priv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index de1b1b6..6bbd7b5 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -14,6 +14,7 @@
 #include <linux/kvm.h>
 #include <linux/gfp.h>
 #include <linux/errno.h>
+#include <linux/compat.h>
 #include <asm/asm-offsets.h>
 #include <asm/current.h>
 #include <asm/debug.h>
-- 
1.7.12.4

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

* [PATCH 09/11] KVM: s390: Change the virtual memory mapping location for virtio devices
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (7 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 08/11] KVM: s390: fix compile with !CONFIG_COMPAT Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 10/11] KVM: s390: Remove the sanity checks for kvm memory slot Cornelia Huck
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390, Nick Wang

From: Nick Wang <jfwang@us.ibm.com>

The current location for mapping virtio devices does not take
into consideration the standby memory. This causes the failure
of mapping standby memory since the location for the mapping is
already taken by the virtio devices. To fix the problem, we move
the location to beyond the end of standby memory.

Signed-off-by: Nick Wang <jfwang@us.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 drivers/s390/kvm/kvm_virtio.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 6711e65..2ea6165 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -443,29 +443,30 @@ static int __init test_devices_support(unsigned long addr)
 }
 /*
  * Init function for virtio
- * devices are in a single page above top of "normal" mem
+ * devices are in a single page above top of "normal" + standby mem
  */
 static int __init kvm_devices_init(void)
 {
 	int rc;
+	unsigned long total_memory_size = sclp_get_rzm() * sclp_get_rnmax();
 
 	if (!MACHINE_IS_KVM)
 		return -ENODEV;
 
-	if (test_devices_support(real_memory_size) < 0)
+	if (test_devices_support(total_memory_size) < 0)
 		return -ENODEV;
 
-	rc = vmem_add_mapping(real_memory_size, PAGE_SIZE);
+	rc = vmem_add_mapping(total_memory_size, PAGE_SIZE);
 	if (rc)
 		return rc;
 
-	kvm_devices = (void *) real_memory_size;
+	kvm_devices = (void *) total_memory_size;
 
 	kvm_root = root_device_register("kvm_s390");
 	if (IS_ERR(kvm_root)) {
 		rc = PTR_ERR(kvm_root);
 		printk(KERN_ERR "Could not register kvm_s390 root device");
-		vmem_remove_mapping(real_memory_size, PAGE_SIZE);
+		vmem_remove_mapping(total_memory_size, PAGE_SIZE);
 		return rc;
 	}
 
-- 
1.7.12.4

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

* [PATCH 10/11] KVM: s390: Remove the sanity checks for kvm memory slot
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (8 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 09/11] KVM: s390: Change the virtual memory mapping location for virtio devices Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-03-25 16:22 ` [PATCH 11/11] KVM: s390: Enable KVM_CAP_NR_MEMSLOTS on s390 Cornelia Huck
  2013-04-02 13:15 ` [PATCH 00/11] KVM: s390: More patches for kvm-next Gleb Natapov
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390, Nick Wang

From: Nick Wang <jfwang@us.ibm.com>

To model the standby memory with memory_region_add_subregion
and friends, the guest would have one or more regions of ram.
Remove the check allowing only one memory slot and the check
requiring the real address of memory slot starts at zero.

Signed-off-by: Nick Wang <jfwang@us.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index d05a59c..b322ff1 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -977,18 +977,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
 				   struct kvm_userspace_memory_region *mem,
 				   enum kvm_mr_change change)
 {
-	/* A few sanity checks. We can have exactly one memory slot which has
-	   to start at guest virtual zero and which has to be located at a
-	   page boundary in userland and which has to end at a page boundary.
-	   The memory in userland is ok to be fragmented into various different
-	   vmas. It is okay to mmap() and munmap() stuff in this slot after
-	   doing this call at any time */
-
-	if (mem->slot)
-		return -EINVAL;
-
-	if (mem->guest_phys_addr)
-		return -EINVAL;
+	/* A few sanity checks. We can have memory slots which have to be
+	   located/ended at a segment boundary (1MB). The memory in userland is
+	   ok to be fragmented into various different vmas. It is okay to mmap()
+	   and munmap() stuff in this slot after doing this call at any time */
 
 	if (mem->userspace_addr & 0xffffful)
 		return -EINVAL;
-- 
1.7.12.4

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

* [PATCH 11/11] KVM: s390: Enable KVM_CAP_NR_MEMSLOTS on s390
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (9 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 10/11] KVM: s390: Remove the sanity checks for kvm memory slot Cornelia Huck
@ 2013-03-25 16:22 ` Cornelia Huck
  2013-04-02 13:15 ` [PATCH 00/11] KVM: s390: More patches for kvm-next Gleb Natapov
  11 siblings, 0 replies; 13+ messages in thread
From: Cornelia Huck @ 2013-03-25 16:22 UTC (permalink / raw)
  To: Marcelo Tosatti, Gleb Natapov
  Cc: Christian Borntraeger, Carsten Otte, Alexander Graf,
	Heiko Carstens, Martin Schwidefsky, KVM, linux-s390, Nick Wang

From: Nick Wang <jfwang@us.ibm.com>

Return KVM_USER_MEM_SLOTS in kvm_dev_ioctl_check_extension().

Signed-off-by: Nick Wang <jfwang@us.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index b322ff1..c1c7c68 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -149,6 +149,9 @@ int kvm_dev_ioctl_check_extension(long ext)
 	case KVM_CAP_MAX_VCPUS:
 		r = KVM_MAX_VCPUS;
 		break;
+	case KVM_CAP_NR_MEMSLOTS:
+		r = KVM_USER_MEM_SLOTS;
+		break;
 	case KVM_CAP_S390_COW:
 		r = MACHINE_HAS_ESOP;
 		break;
-- 
1.7.12.4

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

* Re: [PATCH 00/11] KVM: s390: More patches for kvm-next.
  2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
                   ` (10 preceding siblings ...)
  2013-03-25 16:22 ` [PATCH 11/11] KVM: s390: Enable KVM_CAP_NR_MEMSLOTS on s390 Cornelia Huck
@ 2013-04-02 13:15 ` Gleb Natapov
  11 siblings, 0 replies; 13+ messages in thread
From: Gleb Natapov @ 2013-04-02 13:15 UTC (permalink / raw)
  To: Cornelia Huck
  Cc: Marcelo Tosatti, Christian Borntraeger, Carsten Otte,
	Alexander Graf, Heiko Carstens, Martin Schwidefsky, KVM,
	linux-s390

On Mon, Mar 25, 2013 at 05:22:47PM +0100, Cornelia Huck wrote:
> Hi,
> 
> here are some kvm/s390 patches that have accumulated in our queue.
> 
> Changes include fixes in the lpsw(e) and stsi handlers, proper
> handling of interrupt injection failures and a gmap optimization.
> 
> Also included are patches allowing support for standby memory on
> kvm guests. Standby memory is used for providing hotpluggable
> memory on s390.
> 
> Please consider applying.
> 
Applied, thanks.

> Christian Borntraeger (1):
>   KVM: s390: Dont do a gmap update on minor memslot changes
> 
> Heiko Carstens (7):
>   KVM: s390: fix 24 bit psw handling in lpsw/lpswe handler
>   KVM: s390: fix psw conversion in lpsw handler
>   KVM: s390: fix return code handling in lpsw/lpswe handlers
>   KVM: s390: make if statements in lpsw/lpswe handlers readable
>   KVM: s390: fix and enforce return code handling for irq injections
>   KVM: s390: fix stsi exception handling
>   KVM: s390: fix compile with !CONFIG_COMPAT
> 
> Nick Wang (3):
>   KVM: s390: Change the virtual memory mapping location for virtio
>     devices
>   KVM: s390: Remove the sanity checks for kvm memory slot
>   KVM: s390: Enable KVM_CAP_NR_MEMSLOTS on s390
> 
>  arch/s390/kvm/intercept.c     |  12 +--
>  arch/s390/kvm/kvm-s390.c      |  32 ++++---
>  arch/s390/kvm/kvm-s390.h      |  12 +--
>  arch/s390/kvm/priv.c          | 203 +++++++++++++++---------------------------
>  drivers/s390/kvm/kvm_virtio.c |  11 +--
>  5 files changed, 108 insertions(+), 162 deletions(-)
> 
> -- 
> 1.7.12.4

--
			Gleb.

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

end of thread, other threads:[~2013-04-02 13:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-25 16:22 [PATCH 00/11] KVM: s390: More patches for kvm-next Cornelia Huck
2013-03-25 16:22 ` [PATCH 01/11] KVM: s390: Dont do a gmap update on minor memslot changes Cornelia Huck
2013-03-25 16:22 ` [PATCH 02/11] KVM: s390: fix 24 bit psw handling in lpsw/lpswe handler Cornelia Huck
2013-03-25 16:22 ` [PATCH 03/11] KVM: s390: fix psw conversion in lpsw handler Cornelia Huck
2013-03-25 16:22 ` [PATCH 04/11] KVM: s390: fix return code handling in lpsw/lpswe handlers Cornelia Huck
2013-03-25 16:22 ` [PATCH 05/11] KVM: s390: make if statements in lpsw/lpswe handlers readable Cornelia Huck
2013-03-25 16:22 ` [PATCH 06/11] KVM: s390: fix and enforce return code handling for irq injections Cornelia Huck
2013-03-25 16:22 ` [PATCH 07/11] KVM: s390: fix stsi exception handling Cornelia Huck
2013-03-25 16:22 ` [PATCH 08/11] KVM: s390: fix compile with !CONFIG_COMPAT Cornelia Huck
2013-03-25 16:22 ` [PATCH 09/11] KVM: s390: Change the virtual memory mapping location for virtio devices Cornelia Huck
2013-03-25 16:22 ` [PATCH 10/11] KVM: s390: Remove the sanity checks for kvm memory slot Cornelia Huck
2013-03-25 16:22 ` [PATCH 11/11] KVM: s390: Enable KVM_CAP_NR_MEMSLOTS on s390 Cornelia Huck
2013-04-02 13:15 ` [PATCH 00/11] KVM: s390: More patches for kvm-next Gleb Natapov

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