aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kvm')
-rw-r--r--arch/s390/kvm/Kconfig7
-rw-r--r--arch/s390/kvm/Makefile2
-rw-r--r--arch/s390/kvm/kvm-s390.c30
-rw-r--r--arch/s390/kvm/priv.c6
-rw-r--r--arch/s390/kvm/sie64a.S6
5 files changed, 22 insertions, 29 deletions
diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig
index a7251580891c..f66a1bdbb61d 100644
--- a/arch/s390/kvm/Kconfig
+++ b/arch/s390/kvm/Kconfig
@@ -4,8 +4,8 @@
4source "virt/kvm/Kconfig" 4source "virt/kvm/Kconfig"
5 5
6menuconfig VIRTUALIZATION 6menuconfig VIRTUALIZATION
7 bool "Virtualization" 7 def_bool y
8 default y 8 prompt "Virtualization"
9 ---help--- 9 ---help---
10 Say Y here to get to see options for using your Linux host to run other 10 Say Y here to get to see options for using your Linux host to run other
11 operating systems inside virtual machines (guests). 11 operating systems inside virtual machines (guests).
@@ -16,7 +16,8 @@ menuconfig VIRTUALIZATION
16if VIRTUALIZATION 16if VIRTUALIZATION
17 17
18config KVM 18config KVM
19 tristate "Kernel-based Virtual Machine (KVM) support" 19 def_tristate y
20 prompt "Kernel-based Virtual Machine (KVM) support"
20 depends on HAVE_KVM && EXPERIMENTAL 21 depends on HAVE_KVM && EXPERIMENTAL
21 select PREEMPT_NOTIFIERS 22 select PREEMPT_NOTIFIERS
22 select ANON_INODES 23 select ANON_INODES
diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index e5221ec0b8e3..860d26514c08 100644
--- a/arch/s390/kvm/Makefile
+++ b/arch/s390/kvm/Makefile
@@ -8,7 +8,7 @@
8 8
9common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o) 9common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o)
10 10
11EXTRA_CFLAGS += -Ivirt/kvm -Iarch/s390/kvm 11ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
12 12
13kvm-objs := $(common-objs) kvm-s390.o sie64a.o intercept.o interrupt.o priv.o sigp.o diag.o 13kvm-objs := $(common-objs) kvm-s390.o sie64a.o intercept.o interrupt.o priv.o sigp.o diag.o
14obj-$(CONFIG_KVM) += kvm.o 14obj-$(CONFIG_KVM) += kvm.o
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 4fe68650535c..67345ae7ce8d 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -164,24 +164,18 @@ long kvm_arch_vm_ioctl(struct file *filp,
164 return r; 164 return r;
165} 165}
166 166
167struct kvm *kvm_arch_create_vm(void) 167int kvm_arch_init_vm(struct kvm *kvm)
168{ 168{
169 struct kvm *kvm;
170 int rc; 169 int rc;
171 char debug_name[16]; 170 char debug_name[16];
172 171
173 rc = s390_enable_sie(); 172 rc = s390_enable_sie();
174 if (rc) 173 if (rc)
175 goto out_nokvm; 174 goto out_err;
176
177 rc = -ENOMEM;
178 kvm = kzalloc(sizeof(struct kvm), GFP_KERNEL);
179 if (!kvm)
180 goto out_nokvm;
181 175
182 kvm->arch.sca = (struct sca_block *) get_zeroed_page(GFP_KERNEL); 176 kvm->arch.sca = (struct sca_block *) get_zeroed_page(GFP_KERNEL);
183 if (!kvm->arch.sca) 177 if (!kvm->arch.sca)
184 goto out_nosca; 178 goto out_err;
185 179
186 sprintf(debug_name, "kvm-%u", current->pid); 180 sprintf(debug_name, "kvm-%u", current->pid);
187 181
@@ -195,13 +189,11 @@ struct kvm *kvm_arch_create_vm(void)
195 debug_register_view(kvm->arch.dbf, &debug_sprintf_view); 189 debug_register_view(kvm->arch.dbf, &debug_sprintf_view);
196 VM_EVENT(kvm, 3, "%s", "vm created"); 190 VM_EVENT(kvm, 3, "%s", "vm created");
197 191
198 return kvm; 192 return 0;
199out_nodbf: 193out_nodbf:
200 free_page((unsigned long)(kvm->arch.sca)); 194 free_page((unsigned long)(kvm->arch.sca));
201out_nosca: 195out_err:
202 kfree(kvm); 196 return rc;
203out_nokvm:
204 return ERR_PTR(rc);
205} 197}
206 198
207void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) 199void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
@@ -240,11 +232,8 @@ void kvm_arch_sync_events(struct kvm *kvm)
240void kvm_arch_destroy_vm(struct kvm *kvm) 232void kvm_arch_destroy_vm(struct kvm *kvm)
241{ 233{
242 kvm_free_vcpus(kvm); 234 kvm_free_vcpus(kvm);
243 kvm_free_physmem(kvm);
244 free_page((unsigned long)(kvm->arch.sca)); 235 free_page((unsigned long)(kvm->arch.sca));
245 debug_unregister(kvm->arch.dbf); 236 debug_unregister(kvm->arch.dbf);
246 cleanup_srcu_struct(&kvm->srcu);
247 kfree(kvm);
248} 237}
249 238
250/* Section: vcpu related */ 239/* Section: vcpu related */
@@ -732,7 +721,7 @@ static int __init kvm_s390_init(void)
732 721
733 /* 722 /*
734 * guests can ask for up to 255+1 double words, we need a full page 723 * guests can ask for up to 255+1 double words, we need a full page
735 * to hold the maximum amount of facilites. On the other hand, we 724 * to hold the maximum amount of facilities. On the other hand, we
736 * only set facilities that are known to work in KVM. 725 * only set facilities that are known to work in KVM.
737 */ 726 */
738 facilities = (unsigned long long *) get_zeroed_page(GFP_KERNEL|GFP_DMA); 727 facilities = (unsigned long long *) get_zeroed_page(GFP_KERNEL|GFP_DMA);
@@ -740,8 +729,9 @@ static int __init kvm_s390_init(void)
740 kvm_exit(); 729 kvm_exit();
741 return -ENOMEM; 730 return -ENOMEM;
742 } 731 }
743 stfle(facilities, 1); 732 memcpy(facilities, S390_lowcore.stfle_fac_list, 16);
744 facilities[0] &= 0xff00fff3f0700000ULL; 733 facilities[0] &= 0xff00fff3f47c0000ULL;
734 facilities[1] &= 0x201c000000000000ULL;
745 return 0; 735 return 0;
746} 736}
747 737
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index 44205507717c..73c47bd95db3 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -154,12 +154,12 @@ static int handle_chsc(struct kvm_vcpu *vcpu)
154 154
155static int handle_stfl(struct kvm_vcpu *vcpu) 155static int handle_stfl(struct kvm_vcpu *vcpu)
156{ 156{
157 unsigned int facility_list = stfl(); 157 unsigned int facility_list;
158 int rc; 158 int rc;
159 159
160 vcpu->stat.instruction_stfl++; 160 vcpu->stat.instruction_stfl++;
161 /* only pass the facility bits, which we can handle */ 161 /* only pass the facility bits, which we can handle */
162 facility_list &= 0xff00fff3; 162 facility_list = S390_lowcore.stfl_fac_list & 0xff00fff3;
163 163
164 rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list), 164 rc = copy_to_guest(vcpu, offsetof(struct _lowcore, stfl_fac_list),
165 &facility_list, sizeof(facility_list)); 165 &facility_list, sizeof(facility_list));
@@ -311,7 +311,7 @@ int kvm_s390_handle_b2(struct kvm_vcpu *vcpu)
311 311
312 /* 312 /*
313 * a lot of B2 instructions are priviledged. We first check for 313 * a lot of B2 instructions are priviledged. We first check for
314 * the priviledges ones, that we can handle in the kernel. If the 314 * the privileged ones, that we can handle in the kernel. If the
315 * kernel can handle this instruction, we check for the problem 315 * kernel can handle this instruction, we check for the problem
316 * state bit and (a) handle the instruction or (b) send a code 2 316 * state bit and (a) handle the instruction or (b) send a code 2
317 * program check. 317 * program check.
diff --git a/arch/s390/kvm/sie64a.S b/arch/s390/kvm/sie64a.S
index 7e9d30d567b0..5faa1b1b23fa 100644
--- a/arch/s390/kvm/sie64a.S
+++ b/arch/s390/kvm/sie64a.S
@@ -48,10 +48,10 @@ sie_irq_handler:
48 tm __TI_flags+7(%r2),_TIF_EXIT_SIE 48 tm __TI_flags+7(%r2),_TIF_EXIT_SIE
49 jz 0f 49 jz 0f
50 larl %r2,sie_exit # work pending, leave sie 50 larl %r2,sie_exit # work pending, leave sie
51 stg %r2,__LC_RETURN_PSW+8 51 stg %r2,SPI_PSW+8(0,%r15)
52 br %r14 52 br %r14
530: larl %r2,sie_reenter # re-enter with guest id 530: larl %r2,sie_reenter # re-enter with guest id
54 stg %r2,__LC_RETURN_PSW+8 54 stg %r2,SPI_PSW+8(0,%r15)
551: br %r14 551: br %r14
56 56
57/* 57/*
@@ -93,4 +93,6 @@ sie_err:
93 93
94 .section __ex_table,"a" 94 .section __ex_table,"a"
95 .quad sie_inst,sie_err 95 .quad sie_inst,sie_err
96 .quad sie_exit,sie_err
97 .quad sie_reenter,sie_err
96 .previous 98 .previous