aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 19:14:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 19:14:20 -0400
commit32087d4eeca14b82660dab288b1d659963b954bd (patch)
tree8c131ca9bf08f88d3b02e1937b795a42f8951d79 /arch/s390/kvm
parentb1c907f3b2675ecb01e340948fc62d6535ff5ac3 (diff)
parent07ea815b22b9f70ec8de6ddf8db63a1dd1585caf (diff)
Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6: (54 commits) [S390] Remove error checking from copy_oldmem_page() [S390] qdio: prevent dsci access without adapter interrupts [S390] irqstats: split IPI interrupt accounting [S390] add missing __tlb_flush_global() for !CONFIG_SMP [S390] sparse: fix sparse symbol shadow warning [S390] sparse: fix sparse NULL pointer warnings [S390] sparse: fix sparse warnings with __user pointers [S390] sparse: fix sparse warnings in math-emu [S390] sparse: fix sparse warnings about missing prototypes [S390] sparse: fix sparse ANSI-C warnings [S390] sparse: fix sparse static warnings [S390] sparse: fix access past end of array warnings [S390] dasd: prevent path verification before resume [S390] qdio: remove multicast polling [S390] qdio: reset outbound SBAL error states [S390] qdio: EQBS retry after CCQ 96 [S390] qdio: add timestamp for last queue scan time [S390] Introduce get_clock_fast() [S390] kvm: Handle diagnose 0x10 (release pages) [S390] take mmap_sem when walking guest page table ...
Diffstat (limited to 'arch/s390/kvm')
-rw-r--r--arch/s390/kvm/diag.c32
-rw-r--r--arch/s390/kvm/kvm-s390.c1
2 files changed, 32 insertions, 1 deletions
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 9e4c84187cf5..87cedd61be04 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * diag.c - handling diagnose instructions 2 * diag.c - handling diagnose instructions
3 * 3 *
4 * Copyright IBM Corp. 2008 4 * Copyright IBM Corp. 2008,2011
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only) 7 * it under the terms of the GNU General Public License (version 2 only)
@@ -15,6 +15,34 @@
15#include <linux/kvm_host.h> 15#include <linux/kvm_host.h>
16#include "kvm-s390.h" 16#include "kvm-s390.h"
17 17
18static int diag_release_pages(struct kvm_vcpu *vcpu)
19{
20 unsigned long start, end;
21 unsigned long prefix = vcpu->arch.sie_block->prefix;
22
23 start = vcpu->arch.guest_gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4];
24 end = vcpu->arch.guest_gprs[vcpu->arch.sie_block->ipa & 0xf] + 4096;
25
26 if (start & ~PAGE_MASK || end & ~PAGE_MASK || start > end
27 || start < 2 * PAGE_SIZE)
28 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
29
30 VCPU_EVENT(vcpu, 5, "diag release pages %lX %lX", start, end);
31 vcpu->stat.diagnose_10++;
32
33 /* we checked for start > end above */
34 if (end < prefix || start >= prefix + 2 * PAGE_SIZE) {
35 gmap_discard(start, end, vcpu->arch.gmap);
36 } else {
37 if (start < prefix)
38 gmap_discard(start, prefix, vcpu->arch.gmap);
39 if (end >= prefix)
40 gmap_discard(prefix + 2 * PAGE_SIZE,
41 end, vcpu->arch.gmap);
42 }
43 return 0;
44}
45
18static int __diag_time_slice_end(struct kvm_vcpu *vcpu) 46static int __diag_time_slice_end(struct kvm_vcpu *vcpu)
19{ 47{
20 VCPU_EVENT(vcpu, 5, "%s", "diag time slice end"); 48 VCPU_EVENT(vcpu, 5, "%s", "diag time slice end");
@@ -57,6 +85,8 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
57 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; 85 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16;
58 86
59 switch (code) { 87 switch (code) {
88 case 0x10:
89 return diag_release_pages(vcpu);
60 case 0x44: 90 case 0x44:
61 return __diag_time_slice_end(vcpu); 91 return __diag_time_slice_end(vcpu);
62 case 0x308: 92 case 0x308:
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 9610ba41b974..0bd3bea1e4cd 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -71,6 +71,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
71 { "instruction_sigp_set_arch", VCPU_STAT(instruction_sigp_arch) }, 71 { "instruction_sigp_set_arch", VCPU_STAT(instruction_sigp_arch) },
72 { "instruction_sigp_set_prefix", VCPU_STAT(instruction_sigp_prefix) }, 72 { "instruction_sigp_set_prefix", VCPU_STAT(instruction_sigp_prefix) },
73 { "instruction_sigp_restart", VCPU_STAT(instruction_sigp_restart) }, 73 { "instruction_sigp_restart", VCPU_STAT(instruction_sigp_restart) },
74 { "diagnose_10", VCPU_STAT(diagnose_10) },
74 { "diagnose_44", VCPU_STAT(diagnose_44) }, 75 { "diagnose_44", VCPU_STAT(diagnose_44) },
75 { NULL } 76 { NULL }
76}; 77};