Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 1 | /* |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 2 | * handling privileged instructions |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 3 | * |
| 4 | * Copyright IBM Corp. 2008 |
| 5 | * |
| 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) |
| 8 | * as published by the Free Software Foundation. |
| 9 | * |
| 10 | * Author(s): Carsten Otte <cotte@de.ibm.com> |
| 11 | * Christian Borntraeger <borntraeger@de.ibm.com> |
| 12 | */ |
| 13 | |
| 14 | #include <linux/kvm.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 15 | #include <linux/gfp.h> |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 16 | #include <linux/errno.h> |
Heiko Carstens | b13b5dc | 2013-03-25 17:22:55 +0100 | [diff] [blame] | 17 | #include <linux/compat.h> |
Heiko Carstens | 7c959e8 | 2013-03-05 13:14:46 +0100 | [diff] [blame] | 18 | #include <asm/asm-offsets.h> |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 19 | #include <asm/current.h> |
| 20 | #include <asm/debug.h> |
| 21 | #include <asm/ebcdic.h> |
| 22 | #include <asm/sysinfo.h> |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 23 | #include <asm/ptrace.h> |
| 24 | #include <asm/compat.h> |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 25 | #include "gaccess.h" |
| 26 | #include "kvm-s390.h" |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 27 | #include "trace.h" |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 28 | |
| 29 | static int handle_set_prefix(struct kvm_vcpu *vcpu) |
| 30 | { |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 31 | u64 operand2; |
| 32 | u32 address = 0; |
| 33 | u8 tmp; |
| 34 | |
| 35 | vcpu->stat.instruction_spx++; |
| 36 | |
Cornelia Huck | b1c571a | 2012-12-20 15:32:07 +0100 | [diff] [blame] | 37 | operand2 = kvm_s390_get_base_disp_s(vcpu); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 38 | |
| 39 | /* must be word boundary */ |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 40 | if (operand2 & 3) |
| 41 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 42 | |
| 43 | /* get the value */ |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 44 | if (get_guest(vcpu, address, (u32 __user *) operand2)) |
| 45 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 46 | |
| 47 | address = address & 0x7fffe000u; |
| 48 | |
| 49 | /* make sure that the new value is valid memory */ |
| 50 | if (copy_from_guest_absolute(vcpu, &tmp, address, 1) || |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 51 | (copy_from_guest_absolute(vcpu, &tmp, address + PAGE_SIZE, 1))) |
| 52 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 53 | |
Christian Borntraeger | 8d26cf7 | 2012-01-11 11:19:32 +0100 | [diff] [blame] | 54 | kvm_s390_set_prefix(vcpu, address); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 55 | |
| 56 | VCPU_EVENT(vcpu, 5, "setting prefix to %x", address); |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 57 | trace_kvm_s390_handle_prefix(vcpu, 1, address); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 58 | return 0; |
| 59 | } |
| 60 | |
| 61 | static int handle_store_prefix(struct kvm_vcpu *vcpu) |
| 62 | { |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 63 | u64 operand2; |
| 64 | u32 address; |
| 65 | |
| 66 | vcpu->stat.instruction_stpx++; |
Cornelia Huck | b1c571a | 2012-12-20 15:32:07 +0100 | [diff] [blame] | 67 | |
| 68 | operand2 = kvm_s390_get_base_disp_s(vcpu); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 69 | |
| 70 | /* must be word boundary */ |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 71 | if (operand2 & 3) |
| 72 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 73 | |
| 74 | address = vcpu->arch.sie_block->prefix; |
| 75 | address = address & 0x7fffe000u; |
| 76 | |
| 77 | /* get the value */ |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 78 | if (put_guest(vcpu, address, (u32 __user *)operand2)) |
| 79 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 80 | |
| 81 | VCPU_EVENT(vcpu, 5, "storing prefix to %x", address); |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 82 | trace_kvm_s390_handle_prefix(vcpu, 0, address); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | static int handle_store_cpu_address(struct kvm_vcpu *vcpu) |
| 87 | { |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 88 | u64 useraddr; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 89 | |
| 90 | vcpu->stat.instruction_stap++; |
Cornelia Huck | b1c571a | 2012-12-20 15:32:07 +0100 | [diff] [blame] | 91 | |
| 92 | useraddr = kvm_s390_get_base_disp_s(vcpu); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 93 | |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 94 | if (useraddr & 1) |
| 95 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 96 | |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 97 | if (put_guest(vcpu, vcpu->vcpu_id, (u16 __user *)useraddr)) |
| 98 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 99 | |
Heiko Carstens | 33e1911 | 2009-01-09 12:14:56 +0100 | [diff] [blame] | 100 | VCPU_EVENT(vcpu, 5, "storing cpu address to %llx", useraddr); |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 101 | trace_kvm_s390_handle_stap(vcpu, useraddr); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static int handle_skey(struct kvm_vcpu *vcpu) |
| 106 | { |
| 107 | vcpu->stat.instruction_storage_key++; |
Martin Schwidefsky | dfcf7dc | 2013-05-17 14:41:32 +0200 | [diff] [blame] | 108 | vcpu->arch.sie_block->gpsw.addr = |
| 109 | __rewind_psw(vcpu->arch.sie_block->gpsw, 4); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 110 | VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); |
| 111 | return 0; |
| 112 | } |
| 113 | |
Cornelia Huck | fa6b7fe | 2012-12-20 15:32:12 +0100 | [diff] [blame] | 114 | static int handle_tpi(struct kvm_vcpu *vcpu) |
| 115 | { |
Cornelia Huck | fa6b7fe | 2012-12-20 15:32:12 +0100 | [diff] [blame] | 116 | struct kvm_s390_interrupt_info *inti; |
Heiko Carstens | 7c959e8 | 2013-03-05 13:14:46 +0100 | [diff] [blame] | 117 | u64 addr; |
Cornelia Huck | fa6b7fe | 2012-12-20 15:32:12 +0100 | [diff] [blame] | 118 | int cc; |
| 119 | |
| 120 | addr = kvm_s390_get_base_disp_s(vcpu); |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 121 | if (addr & 3) |
| 122 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Heiko Carstens | 7c959e8 | 2013-03-05 13:14:46 +0100 | [diff] [blame] | 123 | cc = 0; |
Cornelia Huck | fa6b7fe | 2012-12-20 15:32:12 +0100 | [diff] [blame] | 124 | inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0); |
Heiko Carstens | 7c959e8 | 2013-03-05 13:14:46 +0100 | [diff] [blame] | 125 | if (!inti) |
| 126 | goto no_interrupt; |
| 127 | cc = 1; |
| 128 | if (addr) { |
| 129 | /* |
| 130 | * Store the two-word I/O interruption code into the |
| 131 | * provided area. |
| 132 | */ |
Heiko Carstens | 0a75ca2 | 2013-03-05 13:14:47 +0100 | [diff] [blame] | 133 | put_guest(vcpu, inti->io.subchannel_id, (u16 __user *) addr); |
| 134 | put_guest(vcpu, inti->io.subchannel_nr, (u16 __user *) (addr + 2)); |
| 135 | put_guest(vcpu, inti->io.io_int_parm, (u32 __user *) (addr + 4)); |
Heiko Carstens | 7c959e8 | 2013-03-05 13:14:46 +0100 | [diff] [blame] | 136 | } else { |
| 137 | /* |
| 138 | * Store the three-word I/O interruption code into |
| 139 | * the appropriate lowcore area. |
| 140 | */ |
Heiko Carstens | 0a75ca2 | 2013-03-05 13:14:47 +0100 | [diff] [blame] | 141 | put_guest(vcpu, inti->io.subchannel_id, (u16 __user *) __LC_SUBCHANNEL_ID); |
| 142 | put_guest(vcpu, inti->io.subchannel_nr, (u16 __user *) __LC_SUBCHANNEL_NR); |
| 143 | put_guest(vcpu, inti->io.io_int_parm, (u32 __user *) __LC_IO_INT_PARM); |
| 144 | put_guest(vcpu, inti->io.io_int_word, (u32 __user *) __LC_IO_INT_WORD); |
Heiko Carstens | 7c959e8 | 2013-03-05 13:14:46 +0100 | [diff] [blame] | 145 | } |
Cornelia Huck | fa6b7fe | 2012-12-20 15:32:12 +0100 | [diff] [blame] | 146 | kfree(inti); |
Heiko Carstens | 7c959e8 | 2013-03-05 13:14:46 +0100 | [diff] [blame] | 147 | no_interrupt: |
Cornelia Huck | fa6b7fe | 2012-12-20 15:32:12 +0100 | [diff] [blame] | 148 | /* Set condition code and we're done. */ |
| 149 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); |
| 150 | vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44; |
| 151 | return 0; |
| 152 | } |
| 153 | |
| 154 | static int handle_tsch(struct kvm_vcpu *vcpu) |
| 155 | { |
| 156 | struct kvm_s390_interrupt_info *inti; |
| 157 | |
| 158 | inti = kvm_s390_get_io_int(vcpu->kvm, 0, |
| 159 | vcpu->run->s.regs.gprs[1]); |
| 160 | |
| 161 | /* |
| 162 | * Prepare exit to userspace. |
| 163 | * We indicate whether we dequeued a pending I/O interrupt |
| 164 | * so that userspace can re-inject it if the instruction gets |
| 165 | * a program check. While this may re-order the pending I/O |
| 166 | * interrupts, this is no problem since the priority is kept |
| 167 | * intact. |
| 168 | */ |
| 169 | vcpu->run->exit_reason = KVM_EXIT_S390_TSCH; |
| 170 | vcpu->run->s390_tsch.dequeued = !!inti; |
| 171 | if (inti) { |
| 172 | vcpu->run->s390_tsch.subchannel_id = inti->io.subchannel_id; |
| 173 | vcpu->run->s390_tsch.subchannel_nr = inti->io.subchannel_nr; |
| 174 | vcpu->run->s390_tsch.io_int_parm = inti->io.io_int_parm; |
| 175 | vcpu->run->s390_tsch.io_int_word = inti->io.io_int_word; |
| 176 | } |
| 177 | vcpu->run->s390_tsch.ipb = vcpu->arch.sie_block->ipb; |
| 178 | kfree(inti); |
| 179 | return -EREMOTE; |
| 180 | } |
| 181 | |
Cornelia Huck | f379aae | 2012-12-20 15:32:10 +0100 | [diff] [blame] | 182 | static int handle_io_inst(struct kvm_vcpu *vcpu) |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 183 | { |
Cornelia Huck | f379aae | 2012-12-20 15:32:10 +0100 | [diff] [blame] | 184 | VCPU_EVENT(vcpu, 4, "%s", "I/O instruction"); |
Cornelia Huck | fa6b7fe | 2012-12-20 15:32:12 +0100 | [diff] [blame] | 185 | |
| 186 | if (vcpu->kvm->arch.css_support) { |
| 187 | /* |
| 188 | * Most I/O instructions will be handled by userspace. |
| 189 | * Exceptions are tpi and the interrupt portion of tsch. |
| 190 | */ |
| 191 | if (vcpu->arch.sie_block->ipa == 0xb236) |
| 192 | return handle_tpi(vcpu); |
| 193 | if (vcpu->arch.sie_block->ipa == 0xb235) |
| 194 | return handle_tsch(vcpu); |
| 195 | /* Handle in userspace. */ |
| 196 | return -EOPNOTSUPP; |
| 197 | } else { |
| 198 | /* |
| 199 | * Set condition code 3 to stop the guest from issueing channel |
| 200 | * I/O instructions. |
| 201 | */ |
| 202 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); |
| 203 | vcpu->arch.sie_block->gpsw.mask |= (3 & 3ul) << 44; |
| 204 | return 0; |
| 205 | } |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 206 | } |
| 207 | |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 208 | static int handle_stfl(struct kvm_vcpu *vcpu) |
| 209 | { |
Martin Schwidefsky | 14375bc | 2010-10-25 16:10:51 +0200 | [diff] [blame] | 210 | unsigned int facility_list; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 211 | int rc; |
| 212 | |
| 213 | vcpu->stat.instruction_stfl++; |
Christian Borntraeger | a0046b6 | 2008-08-29 13:29:45 +0200 | [diff] [blame] | 214 | /* only pass the facility bits, which we can handle */ |
Martin Schwidefsky | 14375bc | 2010-10-25 16:10:51 +0200 | [diff] [blame] | 215 | facility_list = S390_lowcore.stfl_fac_list & 0xff00fff3; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 216 | |
| 217 | rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list), |
| 218 | &facility_list, sizeof(facility_list)); |
Heiko Carstens | dc5008b | 2013-03-05 13:14:43 +0100 | [diff] [blame] | 219 | if (rc) |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 220 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
| 221 | VCPU_EVENT(vcpu, 5, "store facility list value %x", facility_list); |
| 222 | trace_kvm_s390_handle_stfl(vcpu, facility_list); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 223 | return 0; |
| 224 | } |
| 225 | |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 226 | static void handle_new_psw(struct kvm_vcpu *vcpu) |
| 227 | { |
| 228 | /* Check whether the new psw is enabled for machine checks. */ |
| 229 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_MCHECK) |
| 230 | kvm_s390_deliver_pending_machine_checks(vcpu); |
| 231 | } |
| 232 | |
| 233 | #define PSW_MASK_ADDR_MODE (PSW_MASK_EA | PSW_MASK_BA) |
| 234 | #define PSW_MASK_UNASSIGNED 0xb80800fe7fffffffUL |
Heiko Carstens | d21683e | 2013-03-25 17:22:49 +0100 | [diff] [blame] | 235 | #define PSW_ADDR_24 0x0000000000ffffffUL |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 236 | #define PSW_ADDR_31 0x000000007fffffffUL |
| 237 | |
Heiko Carstens | 3736b87 | 2013-03-25 17:22:52 +0100 | [diff] [blame] | 238 | static int is_valid_psw(psw_t *psw) { |
| 239 | if (psw->mask & PSW_MASK_UNASSIGNED) |
| 240 | return 0; |
| 241 | if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_BA) { |
| 242 | if (psw->addr & ~PSW_ADDR_31) |
| 243 | return 0; |
| 244 | } |
| 245 | if (!(psw->mask & PSW_MASK_ADDR_MODE) && (psw->addr & ~PSW_ADDR_24)) |
| 246 | return 0; |
| 247 | if ((psw->mask & PSW_MASK_ADDR_MODE) == PSW_MASK_EA) |
| 248 | return 0; |
| 249 | return 1; |
| 250 | } |
| 251 | |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 252 | int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu) |
| 253 | { |
Heiko Carstens | 3736b87 | 2013-03-25 17:22:52 +0100 | [diff] [blame] | 254 | psw_t *gpsw = &vcpu->arch.sie_block->gpsw; |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 255 | psw_compat_t new_psw; |
Heiko Carstens | 3736b87 | 2013-03-25 17:22:52 +0100 | [diff] [blame] | 256 | u64 addr; |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 257 | |
Heiko Carstens | 3736b87 | 2013-03-25 17:22:52 +0100 | [diff] [blame] | 258 | if (gpsw->mask & PSW_MASK_PSTATE) |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 259 | return kvm_s390_inject_program_int(vcpu, |
| 260 | PGM_PRIVILEGED_OPERATION); |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 261 | addr = kvm_s390_get_base_disp_s(vcpu); |
Heiko Carstens | 6fd0fcc | 2013-03-25 17:22:51 +0100 | [diff] [blame] | 262 | if (addr & 7) |
| 263 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Heiko Carstens | 6fd0fcc | 2013-03-25 17:22:51 +0100 | [diff] [blame] | 264 | if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) |
| 265 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Heiko Carstens | 6fd0fcc | 2013-03-25 17:22:51 +0100 | [diff] [blame] | 266 | if (!(new_psw.mask & PSW32_MASK_BASE)) |
| 267 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Heiko Carstens | 3736b87 | 2013-03-25 17:22:52 +0100 | [diff] [blame] | 268 | gpsw->mask = (new_psw.mask & ~PSW32_MASK_BASE) << 32; |
| 269 | gpsw->mask |= new_psw.addr & PSW32_ADDR_AMODE; |
| 270 | gpsw->addr = new_psw.addr & ~PSW32_ADDR_AMODE; |
| 271 | if (!is_valid_psw(gpsw)) |
Heiko Carstens | 6fd0fcc | 2013-03-25 17:22:51 +0100 | [diff] [blame] | 272 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 273 | handle_new_psw(vcpu); |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 274 | return 0; |
| 275 | } |
| 276 | |
| 277 | static int handle_lpswe(struct kvm_vcpu *vcpu) |
| 278 | { |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 279 | psw_t new_psw; |
Heiko Carstens | 3736b87 | 2013-03-25 17:22:52 +0100 | [diff] [blame] | 280 | u64 addr; |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 281 | |
| 282 | addr = kvm_s390_get_base_disp_s(vcpu); |
Heiko Carstens | 6fd0fcc | 2013-03-25 17:22:51 +0100 | [diff] [blame] | 283 | if (addr & 7) |
| 284 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Heiko Carstens | 6fd0fcc | 2013-03-25 17:22:51 +0100 | [diff] [blame] | 285 | if (copy_from_guest(vcpu, &new_psw, addr, sizeof(new_psw))) |
| 286 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Heiko Carstens | 3736b87 | 2013-03-25 17:22:52 +0100 | [diff] [blame] | 287 | vcpu->arch.sie_block->gpsw = new_psw; |
| 288 | if (!is_valid_psw(&vcpu->arch.sie_block->gpsw)) |
Heiko Carstens | 6fd0fcc | 2013-03-25 17:22:51 +0100 | [diff] [blame] | 289 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 290 | handle_new_psw(vcpu); |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 291 | return 0; |
| 292 | } |
| 293 | |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 294 | static int handle_stidp(struct kvm_vcpu *vcpu) |
| 295 | { |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 296 | u64 operand2; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 297 | |
| 298 | vcpu->stat.instruction_stidp++; |
Cornelia Huck | b1c571a | 2012-12-20 15:32:07 +0100 | [diff] [blame] | 299 | |
| 300 | operand2 = kvm_s390_get_base_disp_s(vcpu); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 301 | |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 302 | if (operand2 & 7) |
| 303 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 304 | |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 305 | if (put_guest(vcpu, vcpu->arch.stidp_data, (u64 __user *)operand2)) |
| 306 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 307 | |
| 308 | VCPU_EVENT(vcpu, 5, "%s", "store cpu id"); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 309 | return 0; |
| 310 | } |
| 311 | |
| 312 | static void handle_stsi_3_2_2(struct kvm_vcpu *vcpu, struct sysinfo_3_2_2 *mem) |
| 313 | { |
Christian Borntraeger | 180c12f | 2008-06-27 15:05:40 +0200 | [diff] [blame] | 314 | struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 315 | int cpus = 0; |
| 316 | int n; |
| 317 | |
Christian Borntraeger | b037a4f | 2009-05-12 17:21:50 +0200 | [diff] [blame] | 318 | spin_lock(&fi->lock); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 319 | for (n = 0; n < KVM_MAX_VCPUS; n++) |
| 320 | if (fi->local_int[n]) |
| 321 | cpus++; |
Christian Borntraeger | b037a4f | 2009-05-12 17:21:50 +0200 | [diff] [blame] | 322 | spin_unlock(&fi->lock); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 323 | |
| 324 | /* deal with other level 3 hypervisors */ |
Heiko Carstens | caf757c | 2012-09-06 14:42:13 +0200 | [diff] [blame] | 325 | if (stsi(mem, 3, 2, 2)) |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 326 | mem->count = 0; |
| 327 | if (mem->count < 8) |
| 328 | mem->count++; |
| 329 | for (n = mem->count - 1; n > 0 ; n--) |
| 330 | memcpy(&mem->vm[n], &mem->vm[n - 1], sizeof(mem->vm[0])); |
| 331 | |
| 332 | mem->vm[0].cpus_total = cpus; |
| 333 | mem->vm[0].cpus_configured = cpus; |
| 334 | mem->vm[0].cpus_standby = 0; |
| 335 | mem->vm[0].cpus_reserved = 0; |
| 336 | mem->vm[0].caf = 1000; |
| 337 | memcpy(mem->vm[0].name, "KVMguest", 8); |
| 338 | ASCEBC(mem->vm[0].name, 8); |
| 339 | memcpy(mem->vm[0].cpi, "KVM/Linux ", 16); |
| 340 | ASCEBC(mem->vm[0].cpi, 16); |
| 341 | } |
| 342 | |
| 343 | static int handle_stsi(struct kvm_vcpu *vcpu) |
| 344 | { |
Christian Borntraeger | 5a32c1a | 2012-01-11 11:20:32 +0100 | [diff] [blame] | 345 | int fc = (vcpu->run->s.regs.gprs[0] & 0xf0000000) >> 28; |
| 346 | int sel1 = vcpu->run->s.regs.gprs[0] & 0xff; |
| 347 | int sel2 = vcpu->run->s.regs.gprs[1] & 0xffff; |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 348 | unsigned long mem = 0; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 349 | u64 operand2; |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 350 | int rc = 0; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 351 | |
| 352 | vcpu->stat.instruction_stsi++; |
| 353 | VCPU_EVENT(vcpu, 4, "stsi: fc: %x sel1: %x sel2: %x", fc, sel1, sel2); |
| 354 | |
Cornelia Huck | b1c571a | 2012-12-20 15:32:07 +0100 | [diff] [blame] | 355 | operand2 = kvm_s390_get_base_disp_s(vcpu); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 356 | |
| 357 | if (operand2 & 0xfff && fc > 0) |
| 358 | return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); |
| 359 | |
| 360 | switch (fc) { |
| 361 | case 0: |
Christian Borntraeger | 5a32c1a | 2012-01-11 11:20:32 +0100 | [diff] [blame] | 362 | vcpu->run->s.regs.gprs[0] = 3 << 28; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 363 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); |
| 364 | return 0; |
| 365 | case 1: /* same handling for 1 and 2 */ |
| 366 | case 2: |
| 367 | mem = get_zeroed_page(GFP_KERNEL); |
| 368 | if (!mem) |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 369 | goto out_no_data; |
Heiko Carstens | caf757c | 2012-09-06 14:42:13 +0200 | [diff] [blame] | 370 | if (stsi((void *) mem, fc, sel1, sel2)) |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 371 | goto out_no_data; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 372 | break; |
| 373 | case 3: |
| 374 | if (sel1 != 2 || sel2 != 2) |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 375 | goto out_no_data; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 376 | mem = get_zeroed_page(GFP_KERNEL); |
| 377 | if (!mem) |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 378 | goto out_no_data; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 379 | handle_stsi_3_2_2(vcpu, (void *) mem); |
| 380 | break; |
| 381 | default: |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 382 | goto out_no_data; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | if (copy_to_guest_absolute(vcpu, operand2, (void *) mem, PAGE_SIZE)) { |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 386 | rc = kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 387 | goto out_exception; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 388 | } |
Cornelia Huck | 5786fff | 2012-07-23 17:20:29 +0200 | [diff] [blame] | 389 | trace_kvm_s390_handle_stsi(vcpu, fc, sel1, sel2, operand2); |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 390 | free_page(mem); |
| 391 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); |
Christian Borntraeger | 5a32c1a | 2012-01-11 11:20:32 +0100 | [diff] [blame] | 392 | vcpu->run->s.regs.gprs[0] = 0; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 393 | return 0; |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 394 | out_no_data: |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 395 | /* condition code 3 */ |
| 396 | vcpu->arch.sie_block->gpsw.mask |= 3ul << 44; |
Heiko Carstens | c51f068 | 2013-03-25 17:22:54 +0100 | [diff] [blame] | 397 | out_exception: |
| 398 | free_page(mem); |
Heiko Carstens | db4a29c | 2013-03-25 17:22:53 +0100 | [diff] [blame] | 399 | return rc; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 400 | } |
| 401 | |
Cornelia Huck | f379aae | 2012-12-20 15:32:10 +0100 | [diff] [blame] | 402 | static const intercept_handler_t b2_handlers[256] = { |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 403 | [0x02] = handle_stidp, |
| 404 | [0x10] = handle_set_prefix, |
| 405 | [0x11] = handle_store_prefix, |
| 406 | [0x12] = handle_store_cpu_address, |
| 407 | [0x29] = handle_skey, |
| 408 | [0x2a] = handle_skey, |
| 409 | [0x2b] = handle_skey, |
Cornelia Huck | f379aae | 2012-12-20 15:32:10 +0100 | [diff] [blame] | 410 | [0x30] = handle_io_inst, |
| 411 | [0x31] = handle_io_inst, |
| 412 | [0x32] = handle_io_inst, |
| 413 | [0x33] = handle_io_inst, |
| 414 | [0x34] = handle_io_inst, |
| 415 | [0x35] = handle_io_inst, |
| 416 | [0x36] = handle_io_inst, |
| 417 | [0x37] = handle_io_inst, |
| 418 | [0x38] = handle_io_inst, |
| 419 | [0x39] = handle_io_inst, |
| 420 | [0x3a] = handle_io_inst, |
| 421 | [0x3b] = handle_io_inst, |
| 422 | [0x3c] = handle_io_inst, |
| 423 | [0x5f] = handle_io_inst, |
| 424 | [0x74] = handle_io_inst, |
| 425 | [0x76] = handle_io_inst, |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 426 | [0x7d] = handle_stsi, |
| 427 | [0xb1] = handle_stfl, |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 428 | [0xb2] = handle_lpswe, |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 429 | }; |
| 430 | |
Christian Borntraeger | 70455a3 | 2009-01-22 10:28:29 +0100 | [diff] [blame] | 431 | int kvm_s390_handle_b2(struct kvm_vcpu *vcpu) |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 432 | { |
| 433 | intercept_handler_t handler; |
| 434 | |
Christian Borntraeger | 70455a3 | 2009-01-22 10:28:29 +0100 | [diff] [blame] | 435 | /* |
| 436 | * a lot of B2 instructions are priviledged. We first check for |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 437 | * the privileged ones, that we can handle in the kernel. If the |
Christian Borntraeger | 70455a3 | 2009-01-22 10:28:29 +0100 | [diff] [blame] | 438 | * kernel can handle this instruction, we check for the problem |
| 439 | * state bit and (a) handle the instruction or (b) send a code 2 |
| 440 | * program check. |
| 441 | * Anything else goes to userspace.*/ |
Cornelia Huck | f379aae | 2012-12-20 15:32:10 +0100 | [diff] [blame] | 442 | handler = b2_handlers[vcpu->arch.sie_block->ipa & 0x00ff]; |
Christian Borntraeger | 70455a3 | 2009-01-22 10:28:29 +0100 | [diff] [blame] | 443 | if (handler) { |
| 444 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
| 445 | return kvm_s390_inject_program_int(vcpu, |
| 446 | PGM_PRIVILEGED_OPERATION); |
| 447 | else |
| 448 | return handler(vcpu); |
| 449 | } |
Heiko Carstens | b8e660b | 2010-02-26 22:37:41 +0100 | [diff] [blame] | 450 | return -EOPNOTSUPP; |
Christian Borntraeger | 453423d | 2008-03-25 18:47:29 +0100 | [diff] [blame] | 451 | } |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 452 | |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 453 | static int handle_epsw(struct kvm_vcpu *vcpu) |
| 454 | { |
| 455 | int reg1, reg2; |
| 456 | |
| 457 | reg1 = (vcpu->arch.sie_block->ipb & 0x00f00000) >> 24; |
| 458 | reg2 = (vcpu->arch.sie_block->ipb & 0x000f0000) >> 16; |
| 459 | |
| 460 | /* This basically extracts the mask half of the psw. */ |
| 461 | vcpu->run->s.regs.gprs[reg1] &= 0xffffffff00000000; |
| 462 | vcpu->run->s.regs.gprs[reg1] |= vcpu->arch.sie_block->gpsw.mask >> 32; |
| 463 | if (reg2) { |
| 464 | vcpu->run->s.regs.gprs[reg2] &= 0xffffffff00000000; |
| 465 | vcpu->run->s.regs.gprs[reg2] |= |
| 466 | vcpu->arch.sie_block->gpsw.mask & 0x00000000ffffffff; |
| 467 | } |
| 468 | return 0; |
| 469 | } |
| 470 | |
| 471 | static const intercept_handler_t b9_handlers[256] = { |
| 472 | [0x8d] = handle_epsw, |
Cornelia Huck | f379aae | 2012-12-20 15:32:10 +0100 | [diff] [blame] | 473 | [0x9c] = handle_io_inst, |
Cornelia Huck | 48a3e95 | 2012-12-20 15:32:09 +0100 | [diff] [blame] | 474 | }; |
| 475 | |
| 476 | int kvm_s390_handle_b9(struct kvm_vcpu *vcpu) |
| 477 | { |
| 478 | intercept_handler_t handler; |
| 479 | |
| 480 | /* This is handled just as for the B2 instructions. */ |
| 481 | handler = b9_handlers[vcpu->arch.sie_block->ipa & 0x00ff]; |
| 482 | if (handler) { |
| 483 | if ((handler != handle_epsw) && |
| 484 | (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)) |
| 485 | return kvm_s390_inject_program_int(vcpu, |
| 486 | PGM_PRIVILEGED_OPERATION); |
| 487 | else |
| 488 | return handler(vcpu); |
| 489 | } |
| 490 | return -EOPNOTSUPP; |
| 491 | } |
| 492 | |
Cornelia Huck | f379aae | 2012-12-20 15:32:10 +0100 | [diff] [blame] | 493 | static const intercept_handler_t eb_handlers[256] = { |
| 494 | [0x8a] = handle_io_inst, |
| 495 | }; |
| 496 | |
| 497 | int kvm_s390_handle_priv_eb(struct kvm_vcpu *vcpu) |
| 498 | { |
| 499 | intercept_handler_t handler; |
| 500 | |
| 501 | /* All eb instructions that end up here are privileged. */ |
| 502 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
| 503 | return kvm_s390_inject_program_int(vcpu, |
| 504 | PGM_PRIVILEGED_OPERATION); |
| 505 | handler = eb_handlers[vcpu->arch.sie_block->ipb & 0xff]; |
| 506 | if (handler) |
| 507 | return handler(vcpu); |
| 508 | return -EOPNOTSUPP; |
| 509 | } |
| 510 | |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 511 | static int handle_tprot(struct kvm_vcpu *vcpu) |
| 512 | { |
Cornelia Huck | b1c571a | 2012-12-20 15:32:07 +0100 | [diff] [blame] | 513 | u64 address1, address2; |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 514 | struct vm_area_struct *vma; |
Christian Borntraeger | 1eddb85 | 2011-11-17 11:00:43 +0100 | [diff] [blame] | 515 | unsigned long user_address; |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 516 | |
| 517 | vcpu->stat.instruction_tprot++; |
| 518 | |
Cornelia Huck | b1c571a | 2012-12-20 15:32:07 +0100 | [diff] [blame] | 519 | kvm_s390_get_base_disp_sse(vcpu, &address1, &address2); |
| 520 | |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 521 | /* we only handle the Linux memory detection case: |
| 522 | * access key == 0 |
| 523 | * guest DAT == off |
| 524 | * everything else goes to userspace. */ |
| 525 | if (address2 & 0xf0) |
| 526 | return -EOPNOTSUPP; |
| 527 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_DAT) |
| 528 | return -EOPNOTSUPP; |
| 529 | |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 530 | down_read(¤t->mm->mmap_sem); |
Heiko Carstens | 59a1fa2 | 2013-03-05 13:14:42 +0100 | [diff] [blame] | 531 | user_address = __gmap_translate(address1, vcpu->arch.gmap); |
| 532 | if (IS_ERR_VALUE(user_address)) |
| 533 | goto out_inject; |
Christian Borntraeger | 1eddb85 | 2011-11-17 11:00:43 +0100 | [diff] [blame] | 534 | vma = find_vma(current->mm, user_address); |
Heiko Carstens | 59a1fa2 | 2013-03-05 13:14:42 +0100 | [diff] [blame] | 535 | if (!vma) |
| 536 | goto out_inject; |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 537 | vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); |
| 538 | if (!(vma->vm_flags & VM_WRITE) && (vma->vm_flags & VM_READ)) |
| 539 | vcpu->arch.sie_block->gpsw.mask |= (1ul << 44); |
| 540 | if (!(vma->vm_flags & VM_WRITE) && !(vma->vm_flags & VM_READ)) |
| 541 | vcpu->arch.sie_block->gpsw.mask |= (2ul << 44); |
| 542 | |
| 543 | up_read(¤t->mm->mmap_sem); |
| 544 | return 0; |
Heiko Carstens | 59a1fa2 | 2013-03-05 13:14:42 +0100 | [diff] [blame] | 545 | |
| 546 | out_inject: |
| 547 | up_read(¤t->mm->mmap_sem); |
| 548 | return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING); |
Christian Borntraeger | bb25b9b | 2011-07-24 10:48:17 +0200 | [diff] [blame] | 549 | } |
| 550 | |
| 551 | int kvm_s390_handle_e5(struct kvm_vcpu *vcpu) |
| 552 | { |
| 553 | /* For e5xx... instructions we only handle TPROT */ |
| 554 | if ((vcpu->arch.sie_block->ipa & 0x00ff) == 0x01) |
| 555 | return handle_tprot(vcpu); |
| 556 | return -EOPNOTSUPP; |
| 557 | } |
| 558 | |
Cornelia Huck | 8c3f61e | 2012-04-24 09:24:44 +0200 | [diff] [blame] | 559 | static int handle_sckpf(struct kvm_vcpu *vcpu) |
| 560 | { |
| 561 | u32 value; |
| 562 | |
| 563 | if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
| 564 | return kvm_s390_inject_program_int(vcpu, |
| 565 | PGM_PRIVILEGED_OPERATION); |
| 566 | |
| 567 | if (vcpu->run->s.regs.gprs[0] & 0x00000000ffff0000) |
| 568 | return kvm_s390_inject_program_int(vcpu, |
| 569 | PGM_SPECIFICATION); |
| 570 | |
| 571 | value = vcpu->run->s.regs.gprs[0] & 0x000000000000ffff; |
| 572 | vcpu->arch.sie_block->todpr = value; |
| 573 | |
| 574 | return 0; |
| 575 | } |
| 576 | |
Cornelia Huck | 7797535 | 2012-12-20 15:32:06 +0100 | [diff] [blame] | 577 | static const intercept_handler_t x01_handlers[256] = { |
Cornelia Huck | 8c3f61e | 2012-04-24 09:24:44 +0200 | [diff] [blame] | 578 | [0x07] = handle_sckpf, |
| 579 | }; |
| 580 | |
| 581 | int kvm_s390_handle_01(struct kvm_vcpu *vcpu) |
| 582 | { |
| 583 | intercept_handler_t handler; |
| 584 | |
| 585 | handler = x01_handlers[vcpu->arch.sie_block->ipa & 0x00ff]; |
| 586 | if (handler) |
| 587 | return handler(vcpu); |
| 588 | return -EOPNOTSUPP; |
| 589 | } |