Merge tag 'kvm-4.9-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm
[cascardo/linux.git] / arch / x86 / kvm / svm.c
index 8023d53..f8157a3 100644 (file)
@@ -1412,7 +1412,7 @@ static void avic_vm_destroy(struct kvm *kvm)
 static int avic_vm_init(struct kvm *kvm)
 {
        unsigned long flags;
-       int err = -ENOMEM;
+       int vm_id, err = -ENOMEM;
        struct kvm_arch *vm_data = &kvm->arch;
        struct page *p_page;
        struct page *l_page;
@@ -1420,9 +1420,10 @@ static int avic_vm_init(struct kvm *kvm)
        if (!avic)
                return 0;
 
-       vm_data->avic_vm_id = avic_get_next_vm_id();
-       if (vm_data->avic_vm_id < 0)
-               return vm_data->avic_vm_id;
+       vm_id = avic_get_next_vm_id();
+       if (vm_id < 0)
+               return vm_id;
+       vm_data->avic_vm_id = (u32)vm_id;
 
        /* Allocating physical APIC ID table (4KB) */
        p_page = alloc_page(GFP_KERNEL);
@@ -5317,7 +5318,7 @@ static inline void avic_post_state_restore(struct kvm_vcpu *vcpu)
        avic_handle_ldr_update(vcpu);
 }
 
-static struct kvm_x86_ops svm_x86_ops = {
+static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
        .cpu_has_kvm_support = has_svm,
        .disabled_by_bios = is_disabled,
        .hardware_setup = svm_hardware_setup,