diff options
Diffstat (limited to 'arch/s390/kvm/diag.c')
-rw-r--r-- | arch/s390/kvm/diag.c | 32 |
1 files changed, 31 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 | ||
18 | static 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 | |||
18 | static int __diag_time_slice_end(struct kvm_vcpu *vcpu) | 46 | static 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: |