]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blame - arch/s390/kvm/interrupt.c
KVM: s390: Fix memory slot versus run - v3
[mirror_ubuntu-kernels.git] / arch / s390 / kvm / interrupt.c
CommitLineData
ba5c1e9b
CO
1/*
2 * interrupt.c - handling kvm guest interrupts
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 */
12
13#include <asm/lowcore.h>
14#include <asm/uaccess.h>
15#include <linux/kvm_host.h>
3cd61299 16#include <linux/signal.h>
ba5c1e9b
CO
17#include "kvm-s390.h"
18#include "gaccess.h"
19
20static int psw_extint_disabled(struct kvm_vcpu *vcpu)
21{
22 return !(vcpu->arch.sie_block->gpsw.mask & PSW_MASK_EXT);
23}
24
25static int psw_interrupts_disabled(struct kvm_vcpu *vcpu)
26{
27 if ((vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PER) ||
28 (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_IO) ||
29 (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_EXT))
30 return 0;
31 return 1;
32}
33
34static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu,
180c12fb 35 struct kvm_s390_interrupt_info *inti)
ba5c1e9b
CO
36{
37 switch (inti->type) {
38 case KVM_S390_INT_EMERGENCY:
39 if (psw_extint_disabled(vcpu))
40 return 0;
41 if (vcpu->arch.sie_block->gcr[0] & 0x4000ul)
42 return 1;
43 return 0;
44 case KVM_S390_INT_SERVICE:
45 if (psw_extint_disabled(vcpu))
46 return 0;
47 if (vcpu->arch.sie_block->gcr[0] & 0x200ul)
48 return 1;
49 return 0;
50 case KVM_S390_INT_VIRTIO:
51 if (psw_extint_disabled(vcpu))
52 return 0;
53 if (vcpu->arch.sie_block->gcr[0] & 0x200ul)
54 return 1;
55 return 0;
56 case KVM_S390_PROGRAM_INT:
57 case KVM_S390_SIGP_STOP:
58 case KVM_S390_SIGP_SET_PREFIX:
59 case KVM_S390_RESTART:
60 return 1;
61 default:
62 BUG();
63 }
64 return 0;
65}
66
67static void __set_cpu_idle(struct kvm_vcpu *vcpu)
68{
69 BUG_ON(vcpu->vcpu_id > KVM_MAX_VCPUS - 1);
70 atomic_set_mask(CPUSTAT_WAIT, &vcpu->arch.sie_block->cpuflags);
71 set_bit(vcpu->vcpu_id, vcpu->arch.local_int.float_int->idle_mask);
72}
73
74static void __unset_cpu_idle(struct kvm_vcpu *vcpu)
75{
76 BUG_ON(vcpu->vcpu_id > KVM_MAX_VCPUS - 1);
77 atomic_clear_mask(CPUSTAT_WAIT, &vcpu->arch.sie_block->cpuflags);
78 clear_bit(vcpu->vcpu_id, vcpu->arch.local_int.float_int->idle_mask);
79}
80
81static void __reset_intercept_indicators(struct kvm_vcpu *vcpu)
82{
83 atomic_clear_mask(CPUSTAT_ECALL_PEND |
84 CPUSTAT_IO_INT | CPUSTAT_EXT_INT | CPUSTAT_STOP_INT,
85 &vcpu->arch.sie_block->cpuflags);
86 vcpu->arch.sie_block->lctl = 0x0000;
87}
88
89static void __set_cpuflag(struct kvm_vcpu *vcpu, u32 flag)
90{
91 atomic_set_mask(flag, &vcpu->arch.sie_block->cpuflags);
92}
93
94static void __set_intercept_indicator(struct kvm_vcpu *vcpu,
180c12fb 95 struct kvm_s390_interrupt_info *inti)
ba5c1e9b
CO
96{
97 switch (inti->type) {
98 case KVM_S390_INT_EMERGENCY:
99 case KVM_S390_INT_SERVICE:
100 case KVM_S390_INT_VIRTIO:
101 if (psw_extint_disabled(vcpu))
102 __set_cpuflag(vcpu, CPUSTAT_EXT_INT);
103 else
104 vcpu->arch.sie_block->lctl |= LCTL_CR0;
105 break;
106 case KVM_S390_SIGP_STOP:
107 __set_cpuflag(vcpu, CPUSTAT_STOP_INT);
108 break;
109 default:
110 BUG();
111 }
112}
113
114static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
180c12fb 115 struct kvm_s390_interrupt_info *inti)
ba5c1e9b
CO
116{
117 const unsigned short table[] = { 2, 4, 4, 6 };
118 int rc, exception = 0;
119
120 switch (inti->type) {
121 case KVM_S390_INT_EMERGENCY:
122 VCPU_EVENT(vcpu, 4, "%s", "interrupt: sigp emerg");
123 vcpu->stat.deliver_emergency_signal++;
124 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1201);
125 if (rc == -EFAULT)
126 exception = 1;
127
128 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
129 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
130 if (rc == -EFAULT)
131 exception = 1;
132
133 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
134 __LC_EXT_NEW_PSW, sizeof(psw_t));
135 if (rc == -EFAULT)
136 exception = 1;
137 break;
138
139 case KVM_S390_INT_SERVICE:
140 VCPU_EVENT(vcpu, 4, "interrupt: sclp parm:%x",
141 inti->ext.ext_params);
142 vcpu->stat.deliver_service_signal++;
143 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2401);
144 if (rc == -EFAULT)
145 exception = 1;
146
147 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
148 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
149 if (rc == -EFAULT)
150 exception = 1;
151
152 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
153 __LC_EXT_NEW_PSW, sizeof(psw_t));
154 if (rc == -EFAULT)
155 exception = 1;
156
157 rc = put_guest_u32(vcpu, __LC_EXT_PARAMS, inti->ext.ext_params);
158 if (rc == -EFAULT)
159 exception = 1;
160 break;
161
162 case KVM_S390_INT_VIRTIO:
33e19115 163 VCPU_EVENT(vcpu, 4, "interrupt: virtio parm:%x,parm64:%llx",
ba5c1e9b
CO
164 inti->ext.ext_params, inti->ext.ext_params2);
165 vcpu->stat.deliver_virtio_interrupt++;
166 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2603);
167 if (rc == -EFAULT)
168 exception = 1;
169
170 rc = put_guest_u16(vcpu, __LC_CPU_ADDRESS, 0x0d00);
171 if (rc == -EFAULT)
172 exception = 1;
173
174 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
175 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
176 if (rc == -EFAULT)
177 exception = 1;
178
179 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
180 __LC_EXT_NEW_PSW, sizeof(psw_t));
181 if (rc == -EFAULT)
182 exception = 1;
183
184 rc = put_guest_u32(vcpu, __LC_EXT_PARAMS, inti->ext.ext_params);
185 if (rc == -EFAULT)
186 exception = 1;
187
188 rc = put_guest_u64(vcpu, __LC_PFAULT_INTPARM,
189 inti->ext.ext_params2);
190 if (rc == -EFAULT)
191 exception = 1;
192 break;
193
194 case KVM_S390_SIGP_STOP:
195 VCPU_EVENT(vcpu, 4, "%s", "interrupt: cpu stop");
196 vcpu->stat.deliver_stop_signal++;
197 __set_intercept_indicator(vcpu, inti);
198 break;
199
200 case KVM_S390_SIGP_SET_PREFIX:
201 VCPU_EVENT(vcpu, 4, "interrupt: set prefix to %x",
202 inti->prefix.address);
203 vcpu->stat.deliver_prefix_signal++;
204 vcpu->arch.sie_block->prefix = inti->prefix.address;
205 vcpu->arch.sie_block->ihcpu = 0xffff;
206 break;
207
208 case KVM_S390_RESTART:
209 VCPU_EVENT(vcpu, 4, "%s", "interrupt: cpu restart");
210 vcpu->stat.deliver_restart_signal++;
211 rc = copy_to_guest(vcpu, offsetof(struct _lowcore,
212 restart_old_psw), &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
213 if (rc == -EFAULT)
214 exception = 1;
215
216 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
217 offsetof(struct _lowcore, restart_psw), sizeof(psw_t));
218 if (rc == -EFAULT)
219 exception = 1;
220 break;
221
222 case KVM_S390_PROGRAM_INT:
223 VCPU_EVENT(vcpu, 4, "interrupt: pgm check code:%x, ilc:%x",
224 inti->pgm.code,
225 table[vcpu->arch.sie_block->ipa >> 14]);
226 vcpu->stat.deliver_program_int++;
227 rc = put_guest_u16(vcpu, __LC_PGM_INT_CODE, inti->pgm.code);
228 if (rc == -EFAULT)
229 exception = 1;
230
231 rc = put_guest_u16(vcpu, __LC_PGM_ILC,
232 table[vcpu->arch.sie_block->ipa >> 14]);
233 if (rc == -EFAULT)
234 exception = 1;
235
236 rc = copy_to_guest(vcpu, __LC_PGM_OLD_PSW,
237 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
238 if (rc == -EFAULT)
239 exception = 1;
240
241 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
242 __LC_PGM_NEW_PSW, sizeof(psw_t));
243 if (rc == -EFAULT)
244 exception = 1;
245 break;
246
247 default:
248 BUG();
249 }
ba5c1e9b 250 if (exception) {
3cd61299
CB
251 printk("kvm: The guest lowcore is not mapped during interrupt "
252 "delivery, killing userspace\n");
253 do_exit(SIGKILL);
ba5c1e9b
CO
254 }
255}
256
257static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu)
258{
259 int rc, exception = 0;
260
261 if (psw_extint_disabled(vcpu))
262 return 0;
263 if (!(vcpu->arch.sie_block->gcr[0] & 0x800ul))
264 return 0;
265 rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1004);
266 if (rc == -EFAULT)
267 exception = 1;
268 rc = copy_to_guest(vcpu, __LC_EXT_OLD_PSW,
269 &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
270 if (rc == -EFAULT)
271 exception = 1;
272 rc = copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
273 __LC_EXT_NEW_PSW, sizeof(psw_t));
274 if (rc == -EFAULT)
275 exception = 1;
ba5c1e9b 276 if (exception) {
3cd61299
CB
277 printk("kvm: The guest lowcore is not mapped during interrupt "
278 "delivery, killing userspace\n");
279 do_exit(SIGKILL);
ba5c1e9b 280 }
ba5c1e9b
CO
281 return 1;
282}
283
284int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
285{
180c12fb
CB
286 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
287 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
288 struct kvm_s390_interrupt_info *inti;
ba5c1e9b
CO
289 int rc = 0;
290
291 if (atomic_read(&li->active)) {
292 spin_lock_bh(&li->lock);
293 list_for_each_entry(inti, &li->list, list)
294 if (__interrupt_is_deliverable(vcpu, inti)) {
295 rc = 1;
296 break;
297 }
298 spin_unlock_bh(&li->lock);
299 }
300
301 if ((!rc) && atomic_read(&fi->active)) {
302 spin_lock_bh(&fi->lock);
303 list_for_each_entry(inti, &fi->list, list)
304 if (__interrupt_is_deliverable(vcpu, inti)) {
305 rc = 1;
306 break;
307 }
308 spin_unlock_bh(&fi->lock);
309 }
310
311 if ((!rc) && (vcpu->arch.sie_block->ckc <
312 get_clock() + vcpu->arch.sie_block->epoch)) {
313 if ((!psw_extint_disabled(vcpu)) &&
314 (vcpu->arch.sie_block->gcr[0] & 0x800ul))
315 rc = 1;
316 }
317
318 return rc;
319}
320
78646121
GN
321int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu)
322{
323 /* do real check here */
324 return 1;
325}
326
3d80840d
MT
327int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
328{
329 return 0;
330}
331
ba5c1e9b
CO
332int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
333{
334 u64 now, sltime;
335 DECLARE_WAITQUEUE(wait, current);
336
337 vcpu->stat.exit_wait_state++;
338 if (kvm_cpu_has_interrupt(vcpu))
339 return 0;
340
e52b2af5
CO
341 __set_cpu_idle(vcpu);
342 spin_lock_bh(&vcpu->arch.local_int.lock);
343 vcpu->arch.local_int.timer_due = 0;
344 spin_unlock_bh(&vcpu->arch.local_int.lock);
345
ba5c1e9b
CO
346 if (psw_interrupts_disabled(vcpu)) {
347 VCPU_EVENT(vcpu, 3, "%s", "disabled wait");
348 __unset_cpu_idle(vcpu);
349 return -ENOTSUPP; /* disabled wait */
350 }
351
352 if (psw_extint_disabled(vcpu) ||
353 (!(vcpu->arch.sie_block->gcr[0] & 0x800ul))) {
354 VCPU_EVENT(vcpu, 3, "%s", "enabled wait w/o timer");
355 goto no_timer;
356 }
357
358 now = get_clock() + vcpu->arch.sie_block->epoch;
359 if (vcpu->arch.sie_block->ckc < now) {
360 __unset_cpu_idle(vcpu);
361 return 0;
362 }
363
364 sltime = (vcpu->arch.sie_block->ckc - now) / (0xf4240000ul / HZ) + 1;
365
366 vcpu->arch.ckc_timer.expires = jiffies + sltime;
367
368 add_timer(&vcpu->arch.ckc_timer);
33e19115 369 VCPU_EVENT(vcpu, 5, "enabled wait timer:%llx jiffies", sltime);
ba5c1e9b
CO
370no_timer:
371 spin_lock_bh(&vcpu->arch.local_int.float_int->lock);
372 spin_lock_bh(&vcpu->arch.local_int.lock);
ba5c1e9b
CO
373 add_wait_queue(&vcpu->arch.local_int.wq, &wait);
374 while (list_empty(&vcpu->arch.local_int.list) &&
375 list_empty(&vcpu->arch.local_int.float_int->list) &&
376 (!vcpu->arch.local_int.timer_due) &&
377 !signal_pending(current)) {
378 set_current_state(TASK_INTERRUPTIBLE);
379 spin_unlock_bh(&vcpu->arch.local_int.lock);
380 spin_unlock_bh(&vcpu->arch.local_int.float_int->lock);
381 vcpu_put(vcpu);
382 schedule();
383 vcpu_load(vcpu);
384 spin_lock_bh(&vcpu->arch.local_int.float_int->lock);
385 spin_lock_bh(&vcpu->arch.local_int.lock);
386 }
387 __unset_cpu_idle(vcpu);
388 __set_current_state(TASK_RUNNING);
389 remove_wait_queue(&vcpu->wq, &wait);
390 spin_unlock_bh(&vcpu->arch.local_int.lock);
391 spin_unlock_bh(&vcpu->arch.local_int.float_int->lock);
392 del_timer(&vcpu->arch.ckc_timer);
393 return 0;
394}
395
396void kvm_s390_idle_wakeup(unsigned long data)
397{
398 struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
399
400 spin_lock_bh(&vcpu->arch.local_int.lock);
401 vcpu->arch.local_int.timer_due = 1;
402 if (waitqueue_active(&vcpu->arch.local_int.wq))
403 wake_up_interruptible(&vcpu->arch.local_int.wq);
404 spin_unlock_bh(&vcpu->arch.local_int.lock);
405}
406
407
408void kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu)
409{
180c12fb
CB
410 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
411 struct kvm_s390_float_interrupt *fi = vcpu->arch.local_int.float_int;
412 struct kvm_s390_interrupt_info *n, *inti = NULL;
ba5c1e9b
CO
413 int deliver;
414
415 __reset_intercept_indicators(vcpu);
416 if (atomic_read(&li->active)) {
417 do {
418 deliver = 0;
419 spin_lock_bh(&li->lock);
420 list_for_each_entry_safe(inti, n, &li->list, list) {
421 if (__interrupt_is_deliverable(vcpu, inti)) {
422 list_del(&inti->list);
423 deliver = 1;
424 break;
425 }
426 __set_intercept_indicator(vcpu, inti);
427 }
428 if (list_empty(&li->list))
429 atomic_set(&li->active, 0);
430 spin_unlock_bh(&li->lock);
431 if (deliver) {
432 __do_deliver_interrupt(vcpu, inti);
433 kfree(inti);
434 }
435 } while (deliver);
436 }
437
438 if ((vcpu->arch.sie_block->ckc <
439 get_clock() + vcpu->arch.sie_block->epoch))
440 __try_deliver_ckc_interrupt(vcpu);
441
442 if (atomic_read(&fi->active)) {
443 do {
444 deliver = 0;
445 spin_lock_bh(&fi->lock);
446 list_for_each_entry_safe(inti, n, &fi->list, list) {
447 if (__interrupt_is_deliverable(vcpu, inti)) {
448 list_del(&inti->list);
449 deliver = 1;
450 break;
451 }
452 __set_intercept_indicator(vcpu, inti);
453 }
454 if (list_empty(&fi->list))
455 atomic_set(&fi->active, 0);
456 spin_unlock_bh(&fi->lock);
457 if (deliver) {
458 __do_deliver_interrupt(vcpu, inti);
459 kfree(inti);
460 }
461 } while (deliver);
462 }
463}
464
465int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code)
466{
180c12fb
CB
467 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
468 struct kvm_s390_interrupt_info *inti;
ba5c1e9b
CO
469
470 inti = kzalloc(sizeof(*inti), GFP_KERNEL);
471 if (!inti)
472 return -ENOMEM;
473
474 inti->type = KVM_S390_PROGRAM_INT;;
475 inti->pgm.code = code;
476
477 VCPU_EVENT(vcpu, 3, "inject: program check %d (from kernel)", code);
478 spin_lock_bh(&li->lock);
479 list_add(&inti->list, &li->list);
480 atomic_set(&li->active, 1);
481 BUG_ON(waitqueue_active(&li->wq));
482 spin_unlock_bh(&li->lock);
483 return 0;
484}
485
486int kvm_s390_inject_vm(struct kvm *kvm,
487 struct kvm_s390_interrupt *s390int)
488{
180c12fb
CB
489 struct kvm_s390_local_interrupt *li;
490 struct kvm_s390_float_interrupt *fi;
491 struct kvm_s390_interrupt_info *inti;
ba5c1e9b
CO
492 int sigcpu;
493
494 inti = kzalloc(sizeof(*inti), GFP_KERNEL);
495 if (!inti)
496 return -ENOMEM;
497
498 switch (s390int->type) {
499 case KVM_S390_INT_VIRTIO:
33e19115 500 VM_EVENT(kvm, 5, "inject: virtio parm:%x,parm64:%llx",
ba5c1e9b
CO
501 s390int->parm, s390int->parm64);
502 inti->type = s390int->type;
503 inti->ext.ext_params = s390int->parm;
504 inti->ext.ext_params2 = s390int->parm64;
505 break;
506 case KVM_S390_INT_SERVICE:
507 VM_EVENT(kvm, 5, "inject: sclp parm:%x", s390int->parm);
508 inti->type = s390int->type;
509 inti->ext.ext_params = s390int->parm;
510 break;
511 case KVM_S390_PROGRAM_INT:
512 case KVM_S390_SIGP_STOP:
513 case KVM_S390_INT_EMERGENCY:
514 default:
515 kfree(inti);
516 return -EINVAL;
517 }
518
519 mutex_lock(&kvm->lock);
520 fi = &kvm->arch.float_int;
521 spin_lock_bh(&fi->lock);
522 list_add_tail(&inti->list, &fi->list);
523 atomic_set(&fi->active, 1);
524 sigcpu = find_first_bit(fi->idle_mask, KVM_MAX_VCPUS);
525 if (sigcpu == KVM_MAX_VCPUS) {
526 do {
527 sigcpu = fi->next_rr_cpu++;
528 if (sigcpu == KVM_MAX_VCPUS)
529 sigcpu = fi->next_rr_cpu = 0;
530 } while (fi->local_int[sigcpu] == NULL);
531 }
532 li = fi->local_int[sigcpu];
533 spin_lock_bh(&li->lock);
534 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
535 if (waitqueue_active(&li->wq))
536 wake_up_interruptible(&li->wq);
537 spin_unlock_bh(&li->lock);
538 spin_unlock_bh(&fi->lock);
539 mutex_unlock(&kvm->lock);
540 return 0;
541}
542
543int kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
544 struct kvm_s390_interrupt *s390int)
545{
180c12fb
CB
546 struct kvm_s390_local_interrupt *li;
547 struct kvm_s390_interrupt_info *inti;
ba5c1e9b
CO
548
549 inti = kzalloc(sizeof(*inti), GFP_KERNEL);
550 if (!inti)
551 return -ENOMEM;
552
553 switch (s390int->type) {
554 case KVM_S390_PROGRAM_INT:
555 if (s390int->parm & 0xffff0000) {
556 kfree(inti);
557 return -EINVAL;
558 }
559 inti->type = s390int->type;
560 inti->pgm.code = s390int->parm;
561 VCPU_EVENT(vcpu, 3, "inject: program check %d (from user)",
562 s390int->parm);
563 break;
b7e6e4d3
CB
564 case KVM_S390_SIGP_SET_PREFIX:
565 inti->prefix.address = s390int->parm;
566 inti->type = s390int->type;
567 VCPU_EVENT(vcpu, 3, "inject: set prefix to %x (from user)",
568 s390int->parm);
569 break;
ba5c1e9b
CO
570 case KVM_S390_SIGP_STOP:
571 case KVM_S390_RESTART:
ba5c1e9b
CO
572 case KVM_S390_INT_EMERGENCY:
573 VCPU_EVENT(vcpu, 3, "inject: type %x", s390int->type);
574 inti->type = s390int->type;
575 break;
576 case KVM_S390_INT_VIRTIO:
577 case KVM_S390_INT_SERVICE:
578 default:
579 kfree(inti);
580 return -EINVAL;
581 }
582
583 mutex_lock(&vcpu->kvm->lock);
584 li = &vcpu->arch.local_int;
585 spin_lock_bh(&li->lock);
586 if (inti->type == KVM_S390_PROGRAM_INT)
587 list_add(&inti->list, &li->list);
588 else
589 list_add_tail(&inti->list, &li->list);
590 atomic_set(&li->active, 1);
591 if (inti->type == KVM_S390_SIGP_STOP)
592 li->action_bits |= ACTION_STOP_ON_STOP;
593 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
594 if (waitqueue_active(&li->wq))
595 wake_up_interruptible(&vcpu->arch.local_int.wq);
596 spin_unlock_bh(&li->lock);
597 mutex_unlock(&vcpu->kvm->lock);
598 return 0;
599}