blob: 1404d0afdd75f535b8eaf5495ac5ce9f722c03f2 [file] [log] [blame]
Christian Borntraeger000a1a32012-07-23 21:37:05 +00001/*
2 * QEMU S/390 Interrupt support
3 *
Cornelia Huck79afc362014-03-11 13:52:06 +01004 * Copyright IBM Corp. 2012, 2014
Christian Borntraeger000a1a32012-07-23 21:37:05 +00005 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or (at your
7 * option) any later version. See the COPYING file in the top-level directory.
8 */
9
10#include "cpu.h"
Paolo Bonzini9c17d612012-12-17 18:20:04 +010011#include "sysemu/kvm.h"
Christian Borntraeger000a1a32012-07-23 21:37:05 +000012
Cornelia Huck79afc362014-03-11 13:52:06 +010013/*
14 * All of the following interrupts are floating, i.e. not per-vcpu.
Cornelia Huckde13d212014-03-11 13:19:43 +010015 * We just need a dummy cpustate in order to be able to inject in the
16 * non-kvm case.
Cornelia Huck79afc362014-03-11 13:52:06 +010017 */
Christian Borntraeger000a1a32012-07-23 21:37:05 +000018#if !defined(CONFIG_USER_ONLY)
Christian Borntraeger000a1a32012-07-23 21:37:05 +000019void s390_sclp_extint(uint32_t parm)
20{
Christian Borntraeger000a1a32012-07-23 21:37:05 +000021 if (kvm_enabled()) {
Cornelia Huckde13d212014-03-11 13:19:43 +010022 kvm_s390_service_interrupt(parm);
Christian Borntraeger000a1a32012-07-23 21:37:05 +000023 } else {
Cornelia Huckde13d212014-03-11 13:19:43 +010024 S390CPU *dummy_cpu = s390_cpu_addr2state(0);
Cornelia Huckde13d212014-03-11 13:19:43 +010025
Andreas Färberf9466732013-01-30 12:48:24 +000026 cpu_inject_ext(dummy_cpu, EXT_SERVICE, parm, 0);
Christian Borntraeger000a1a32012-07-23 21:37:05 +000027 }
28}
Cornelia Huck79afc362014-03-11 13:52:06 +010029
Cornelia Huckde13d212014-03-11 13:19:43 +010030void s390_virtio_irq(int config_change, uint64_t token)
Cornelia Huck79afc362014-03-11 13:52:06 +010031{
32 if (kvm_enabled()) {
Cornelia Huckde13d212014-03-11 13:19:43 +010033 kvm_s390_virtio_irq(config_change, token);
Cornelia Huck79afc362014-03-11 13:52:06 +010034 } else {
Cornelia Huckde13d212014-03-11 13:19:43 +010035 S390CPU *dummy_cpu = s390_cpu_addr2state(0);
36
37 cpu_inject_ext(dummy_cpu, EXT_VIRTIO, config_change, token);
Cornelia Huck79afc362014-03-11 13:52:06 +010038 }
39}
40
Cornelia Huckde13d212014-03-11 13:19:43 +010041void s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr,
42 uint32_t io_int_parm, uint32_t io_int_word)
Cornelia Huck79afc362014-03-11 13:52:06 +010043{
44 if (kvm_enabled()) {
Cornelia Huckde13d212014-03-11 13:19:43 +010045 kvm_s390_io_interrupt(subchannel_id, subchannel_nr, io_int_parm,
Cornelia Huck79afc362014-03-11 13:52:06 +010046 io_int_word);
47 } else {
Cornelia Huckde13d212014-03-11 13:19:43 +010048 S390CPU *dummy_cpu = s390_cpu_addr2state(0);
49
50 cpu_inject_io(dummy_cpu, subchannel_id, subchannel_nr, io_int_parm,
Cornelia Huck79afc362014-03-11 13:52:06 +010051 io_int_word);
52 }
53}
54
Cornelia Huckde13d212014-03-11 13:19:43 +010055void s390_crw_mchk(void)
Cornelia Huck79afc362014-03-11 13:52:06 +010056{
57 if (kvm_enabled()) {
Cornelia Huckde13d212014-03-11 13:19:43 +010058 kvm_s390_crw_mchk();
Cornelia Huck79afc362014-03-11 13:52:06 +010059 } else {
Cornelia Huckde13d212014-03-11 13:19:43 +010060 S390CPU *dummy_cpu = s390_cpu_addr2state(0);
61
62 cpu_inject_crw_mchk(dummy_cpu);
Cornelia Huck79afc362014-03-11 13:52:06 +010063 }
64}
65
Christian Borntraeger000a1a32012-07-23 21:37:05 +000066#endif