kvm: powerpc: book3s: Allow the HV and PR selection per virtual machine
[deliverable/linux.git] / arch / powerpc / kvm / book3s_hv.c
index 3d7079a08d2a1ad7d49a5b409482971c73b06216..8743048881b797b451335086dc2e23579f6228de 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/vmalloc.h>
 #include <linux/highmem.h>
 #include <linux/hugetlb.h>
+#include <linux/module.h>
 
 #include "book3s.h"
 
@@ -2158,7 +2159,8 @@ static long kvm_arch_vm_ioctl_hv(struct file *filp,
        return r;
 }
 
-static struct kvmppc_ops kvmppc_hv_ops = {
+static struct kvmppc_ops kvm_ops_hv = {
+       .is_hv_enabled = true,
        .get_sregs = kvm_arch_vcpu_ioctl_get_sregs_hv,
        .set_sregs = kvm_arch_vcpu_ioctl_set_sregs_hv,
        .get_one_reg = kvmppc_get_one_reg_hv,
@@ -2184,7 +2186,6 @@ static struct kvmppc_ops kvmppc_hv_ops = {
        .create_memslot = kvmppc_core_create_memslot_hv,
        .init_vm =  kvmppc_core_init_vm_hv,
        .destroy_vm = kvmppc_core_destroy_vm_hv,
-       .check_processor_compat = kvmppc_core_check_processor_compat_hv,
        .get_smmu_info = kvm_vm_ioctl_get_smmu_info_hv,
        .emulate_op = kvmppc_core_emulate_op_hv,
        .emulate_mtspr = kvmppc_core_emulate_mtspr_hv,
@@ -2196,21 +2197,25 @@ static struct kvmppc_ops kvmppc_hv_ops = {
 static int kvmppc_book3s_init_hv(void)
 {
        int r;
-
-       r = kvm_init(&kvmppc_hv_ops, sizeof(struct kvm_vcpu), 0, THIS_MODULE);
-
-       if (r)
+       /*
+        * FIXME!! Do we need to check on all cpus ?
+        */
+       r = kvmppc_core_check_processor_compat_hv();
+       if (r < 0)
                return r;
 
-       r = kvmppc_mmu_hv_init();
+       kvm_ops_hv.owner = THIS_MODULE;
+       kvmppc_hv_ops = &kvm_ops_hv;
 
+       r = kvmppc_mmu_hv_init();
        return r;
 }
 
 static void kvmppc_book3s_exit_hv(void)
 {
-       kvm_exit();
+       kvmppc_hv_ops = NULL;
 }
 
 module_init(kvmppc_book3s_init_hv);
 module_exit(kvmppc_book3s_exit_hv);
+MODULE_LICENSE("GPL");
This page took 0.025691 seconds and 5 git commands to generate.