aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/intercept.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-24 16:07:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-24 16:07:18 -0500
commit89f883372fa60f604d136924baf3e89ff1870e9e (patch)
treecb69b0a14957945ba00d3d392bf9ccbbef56f3b8 /arch/s390/kvm/intercept.c
parent9e2d59ad580d590134285f361a0e80f0e98c0207 (diff)
parent6b73a96065e89dc9fa75ba4f78b1aa3a3bbd0470 (diff)
Merge tag 'kvm-3.9-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM updates from Marcelo Tosatti: "KVM updates for the 3.9 merge window, including x86 real mode emulation fixes, stronger memory slot interface restrictions, mmu_lock spinlock hold time reduction, improved handling of large page faults on shadow, initial APICv HW acceleration support, s390 channel IO based virtio, amongst others" * tag 'kvm-3.9-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (143 commits) Revert "KVM: MMU: lazily drop large spte" x86: pvclock kvm: align allocation size to page size KVM: nVMX: Remove redundant get_vmcs12 from nested_vmx_exit_handled_msr x86 emulator: fix parity calculation for AAD instruction KVM: PPC: BookE: Handle alignment interrupts booke: Added DBCR4 SPR number KVM: PPC: booke: Allow multiple exception types KVM: PPC: booke: use vcpu reference from thread_struct KVM: Remove user_alloc from struct kvm_memory_slot KVM: VMX: disable apicv by default KVM: s390: Fix handling of iscs. KVM: MMU: cleanup __direct_map KVM: MMU: remove pt_access in mmu_set_spte KVM: MMU: cleanup mapping-level KVM: MMU: lazily drop large spte KVM: VMX: cleanup vmx_set_cr0(). KVM: VMX: add missing exit names to VMX_EXIT_REASONS array KVM: VMX: disable SMEP feature when guest is in non-paging mode KVM: Remove duplicate text in api.txt Revert "KVM: MMU: split kvm_mmu_free_page" ...
Diffstat (limited to 'arch/s390/kvm/intercept.c')
-rw-r--r--arch/s390/kvm/intercept.c45
1 files changed, 26 insertions, 19 deletions
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 22798ec33fd1..f26ff1e31bdb 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -26,27 +26,20 @@ static int handle_lctlg(struct kvm_vcpu *vcpu)
26{ 26{
27 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; 27 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
28 int reg3 = vcpu->arch.sie_block->ipa & 0x000f; 28 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
29 int base2 = vcpu->arch.sie_block->ipb >> 28;
30 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) +
31 ((vcpu->arch.sie_block->ipb & 0xff00) << 4);
32 u64 useraddr; 29 u64 useraddr;
33 int reg, rc; 30 int reg, rc;
34 31
35 vcpu->stat.instruction_lctlg++; 32 vcpu->stat.instruction_lctlg++;
36 if ((vcpu->arch.sie_block->ipb & 0xff) != 0x2f)
37 return -EOPNOTSUPP;
38 33
39 useraddr = disp2; 34 useraddr = kvm_s390_get_base_disp_rsy(vcpu);
40 if (base2)
41 useraddr += vcpu->run->s.regs.gprs[base2];
42 35
43 if (useraddr & 7) 36 if (useraddr & 7)
44 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 37 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
45 38
46 reg = reg1; 39 reg = reg1;
47 40
48 VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, 41 VCPU_EVENT(vcpu, 5, "lctlg r1:%x, r3:%x, addr:%llx", reg1, reg3,
49 disp2); 42 useraddr);
50 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, useraddr); 43 trace_kvm_s390_handle_lctl(vcpu, 1, reg1, reg3, useraddr);
51 44
52 do { 45 do {
@@ -68,23 +61,19 @@ static int handle_lctl(struct kvm_vcpu *vcpu)
68{ 61{
69 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4; 62 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
70 int reg3 = vcpu->arch.sie_block->ipa & 0x000f; 63 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
71 int base2 = vcpu->arch.sie_block->ipb >> 28;
72 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
73 u64 useraddr; 64 u64 useraddr;
74 u32 val = 0; 65 u32 val = 0;
75 int reg, rc; 66 int reg, rc;
76 67
77 vcpu->stat.instruction_lctl++; 68 vcpu->stat.instruction_lctl++;
78 69
79 useraddr = disp2; 70 useraddr = kvm_s390_get_base_disp_rs(vcpu);
80 if (base2)
81 useraddr += vcpu->run->s.regs.gprs[base2];
82 71
83 if (useraddr & 3) 72 if (useraddr & 3)
84 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 73 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
85 74
86 VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x,b2:%x,d2:%x", reg1, reg3, base2, 75 VCPU_EVENT(vcpu, 5, "lctl r1:%x, r3:%x, addr:%llx", reg1, reg3,
87 disp2); 76 useraddr);
88 trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, useraddr); 77 trace_kvm_s390_handle_lctl(vcpu, 0, reg1, reg3, useraddr);
89 78
90 reg = reg1; 79 reg = reg1;
@@ -104,14 +93,31 @@ static int handle_lctl(struct kvm_vcpu *vcpu)
104 return 0; 93 return 0;
105} 94}
106 95
107static intercept_handler_t instruction_handlers[256] = { 96static const intercept_handler_t eb_handlers[256] = {
97 [0x2f] = handle_lctlg,
98 [0x8a] = kvm_s390_handle_priv_eb,
99};
100
101static int handle_eb(struct kvm_vcpu *vcpu)
102{
103 intercept_handler_t handler;
104
105 handler = eb_handlers[vcpu->arch.sie_block->ipb & 0xff];
106 if (handler)
107 return handler(vcpu);
108 return -EOPNOTSUPP;
109}
110
111static const intercept_handler_t instruction_handlers[256] = {
108 [0x01] = kvm_s390_handle_01, 112 [0x01] = kvm_s390_handle_01,
113 [0x82] = kvm_s390_handle_lpsw,
109 [0x83] = kvm_s390_handle_diag, 114 [0x83] = kvm_s390_handle_diag,
110 [0xae] = kvm_s390_handle_sigp, 115 [0xae] = kvm_s390_handle_sigp,
111 [0xb2] = kvm_s390_handle_b2, 116 [0xb2] = kvm_s390_handle_b2,
112 [0xb7] = handle_lctl, 117 [0xb7] = handle_lctl,
118 [0xb9] = kvm_s390_handle_b9,
113 [0xe5] = kvm_s390_handle_e5, 119 [0xe5] = kvm_s390_handle_e5,
114 [0xeb] = handle_lctlg, 120 [0xeb] = handle_eb,
115}; 121};
116 122
117static int handle_noop(struct kvm_vcpu *vcpu) 123static int handle_noop(struct kvm_vcpu *vcpu)
@@ -258,6 +264,7 @@ static const intercept_handler_t intercept_funcs[] = {
258 [0x0C >> 2] = handle_instruction_and_prog, 264 [0x0C >> 2] = handle_instruction_and_prog,
259 [0x10 >> 2] = handle_noop, 265 [0x10 >> 2] = handle_noop,
260 [0x14 >> 2] = handle_noop, 266 [0x14 >> 2] = handle_noop,
267 [0x18 >> 2] = handle_noop,
261 [0x1C >> 2] = kvm_s390_handle_wait, 268 [0x1C >> 2] = kvm_s390_handle_wait,
262 [0x20 >> 2] = handle_validity, 269 [0x20 >> 2] = handle_validity,
263 [0x28 >> 2] = handle_stop, 270 [0x28 >> 2] = handle_stop,