Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * QEMU S/390 Interrupt support |
| 3 | * |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 4 | * Copyright IBM Corp. 2012, 2014 |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 5 | * |
| 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 Bonzini | 9c17d61 | 2012-12-17 18:20:04 +0100 | [diff] [blame] | 11 | #include "sysemu/kvm.h" |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 12 | |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 13 | /* |
| 14 | * All of the following interrupts are floating, i.e. not per-vcpu. |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 15 | * We just need a dummy cpustate in order to be able to inject in the |
| 16 | * non-kvm case. |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 17 | */ |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 18 | #if !defined(CONFIG_USER_ONLY) |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 19 | void s390_sclp_extint(uint32_t parm) |
| 20 | { |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 21 | if (kvm_enabled()) { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 22 | kvm_s390_service_interrupt(parm); |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 23 | } else { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 24 | S390CPU *dummy_cpu = s390_cpu_addr2state(0); |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 25 | |
Andreas Färber | f946673 | 2013-01-30 12:48:24 +0000 | [diff] [blame] | 26 | cpu_inject_ext(dummy_cpu, EXT_SERVICE, parm, 0); |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 27 | } |
| 28 | } |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 29 | |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 30 | void s390_virtio_irq(int config_change, uint64_t token) |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 31 | { |
| 32 | if (kvm_enabled()) { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 33 | kvm_s390_virtio_irq(config_change, token); |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 34 | } else { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 35 | S390CPU *dummy_cpu = s390_cpu_addr2state(0); |
| 36 | |
| 37 | cpu_inject_ext(dummy_cpu, EXT_VIRTIO, config_change, token); |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 41 | void s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr, |
| 42 | uint32_t io_int_parm, uint32_t io_int_word) |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 43 | { |
| 44 | if (kvm_enabled()) { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 45 | kvm_s390_io_interrupt(subchannel_id, subchannel_nr, io_int_parm, |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 46 | io_int_word); |
| 47 | } else { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 48 | S390CPU *dummy_cpu = s390_cpu_addr2state(0); |
| 49 | |
| 50 | cpu_inject_io(dummy_cpu, subchannel_id, subchannel_nr, io_int_parm, |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 51 | io_int_word); |
| 52 | } |
| 53 | } |
| 54 | |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 55 | void s390_crw_mchk(void) |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 56 | { |
| 57 | if (kvm_enabled()) { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 58 | kvm_s390_crw_mchk(); |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 59 | } else { |
Cornelia Huck | de13d21 | 2014-03-11 13:19:43 +0100 | [diff] [blame] | 60 | S390CPU *dummy_cpu = s390_cpu_addr2state(0); |
| 61 | |
| 62 | cpu_inject_crw_mchk(dummy_cpu); |
Cornelia Huck | 79afc36 | 2014-03-11 13:52:06 +0100 | [diff] [blame] | 63 | } |
| 64 | } |
| 65 | |
Christian Borntraeger | 000a1a3 | 2012-07-23 21:37:05 +0000 | [diff] [blame] | 66 | #endif |