diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2013-02-28 06:33:21 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-03-05 17:12:17 -0500 |
commit | 10ccaa1e7057d8a9dc3e9ce833af40ec8187b25e (patch) | |
tree | edf8ec1c1ffb422c3c6974287f5655d6608ca75e /arch/s390 | |
parent | 2b83451b45d720ca38c03878ce42ff9139cad9e3 (diff) |
KVM: s390: Wire up ioeventfd.
Enable ioeventfd support on s390 and hook up diagnose 500 virtio-ccw
notifications.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kvm/Kconfig | 1 | ||||
-rw-r--r-- | arch/s390/kvm/Makefile | 2 | ||||
-rw-r--r-- | arch/s390/kvm/diag.c | 26 | ||||
-rw-r--r-- | arch/s390/kvm/kvm-s390.c | 1 |
4 files changed, 29 insertions, 1 deletions
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig index 60f9f8ae0fc8..70b46eacf8e1 100644 --- a/arch/s390/kvm/Kconfig +++ b/arch/s390/kvm/Kconfig | |||
@@ -22,6 +22,7 @@ config KVM | |||
22 | select PREEMPT_NOTIFIERS | 22 | select PREEMPT_NOTIFIERS |
23 | select ANON_INODES | 23 | select ANON_INODES |
24 | select HAVE_KVM_CPU_RELAX_INTERCEPT | 24 | select HAVE_KVM_CPU_RELAX_INTERCEPT |
25 | select HAVE_KVM_EVENTFD | ||
25 | ---help--- | 26 | ---help--- |
26 | Support hosting paravirtualized guest machines using the SIE | 27 | Support hosting paravirtualized guest machines using the SIE |
27 | virtualization capability on the mainframe. This should work | 28 | virtualization capability on the mainframe. This should work |
diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile index 3975722bb19d..8fe9d65a4585 100644 --- a/arch/s390/kvm/Makefile +++ b/arch/s390/kvm/Makefile | |||
@@ -6,7 +6,7 @@ | |||
6 | # it under the terms of the GNU General Public License (version 2 only) | 6 | # it under the terms of the GNU General Public License (version 2 only) |
7 | # as published by the Free Software Foundation. | 7 | # as published by the Free Software Foundation. |
8 | 8 | ||
9 | common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o) | 9 | common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o eventfd.o) |
10 | 10 | ||
11 | ccflags-y := -Ivirt/kvm -Iarch/s390/kvm | 11 | ccflags-y := -Ivirt/kvm -Iarch/s390/kvm |
12 | 12 | ||
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c index a390687feb13..1c01a9912989 100644 --- a/arch/s390/kvm/diag.c +++ b/arch/s390/kvm/diag.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/kvm.h> | 14 | #include <linux/kvm.h> |
15 | #include <linux/kvm_host.h> | 15 | #include <linux/kvm_host.h> |
16 | #include <asm/virtio-ccw.h> | ||
16 | #include "kvm-s390.h" | 17 | #include "kvm-s390.h" |
17 | #include "trace.h" | 18 | #include "trace.h" |
18 | #include "trace-s390.h" | 19 | #include "trace-s390.h" |
@@ -104,6 +105,29 @@ static int __diag_ipl_functions(struct kvm_vcpu *vcpu) | |||
104 | return -EREMOTE; | 105 | return -EREMOTE; |
105 | } | 106 | } |
106 | 107 | ||
108 | static int __diag_virtio_hypercall(struct kvm_vcpu *vcpu) | ||
109 | { | ||
110 | int ret, idx; | ||
111 | |||
112 | /* No virtio-ccw notification? Get out quickly. */ | ||
113 | if (!vcpu->kvm->arch.css_support || | ||
114 | (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY)) | ||
115 | return -EOPNOTSUPP; | ||
116 | |||
117 | idx = srcu_read_lock(&vcpu->kvm->srcu); | ||
118 | /* | ||
119 | * The layout is as follows: | ||
120 | * - gpr 2 contains the subchannel id (passed as addr) | ||
121 | * - gpr 3 contains the virtqueue index (passed as datamatch) | ||
122 | */ | ||
123 | ret = kvm_io_bus_write(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS, | ||
124 | vcpu->run->s.regs.gprs[2], | ||
125 | 8, &vcpu->run->s.regs.gprs[3]); | ||
126 | srcu_read_unlock(&vcpu->kvm->srcu, idx); | ||
127 | /* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */ | ||
128 | return ret < 0 ? ret : 0; | ||
129 | } | ||
130 | |||
107 | int kvm_s390_handle_diag(struct kvm_vcpu *vcpu) | 131 | int kvm_s390_handle_diag(struct kvm_vcpu *vcpu) |
108 | { | 132 | { |
109 | int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; | 133 | int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16; |
@@ -118,6 +142,8 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu) | |||
118 | return __diag_time_slice_end_directed(vcpu); | 142 | return __diag_time_slice_end_directed(vcpu); |
119 | case 0x308: | 143 | case 0x308: |
120 | return __diag_ipl_functions(vcpu); | 144 | return __diag_ipl_functions(vcpu); |
145 | case 0x500: | ||
146 | return __diag_virtio_hypercall(vcpu); | ||
121 | default: | 147 | default: |
122 | return -EOPNOTSUPP; | 148 | return -EOPNOTSUPP; |
123 | } | 149 | } |
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 6cae4ad647a9..33161b4a8280 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c | |||
@@ -142,6 +142,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
142 | case KVM_CAP_ONE_REG: | 142 | case KVM_CAP_ONE_REG: |
143 | case KVM_CAP_ENABLE_CAP: | 143 | case KVM_CAP_ENABLE_CAP: |
144 | case KVM_CAP_S390_CSS_SUPPORT: | 144 | case KVM_CAP_S390_CSS_SUPPORT: |
145 | case KVM_CAP_IOEVENTFD: | ||
145 | r = 1; | 146 | r = 1; |
146 | break; | 147 | break; |
147 | case KVM_CAP_NR_VCPUS: | 148 | case KVM_CAP_NR_VCPUS: |