]> Git Repo - linux.git/commitdiff
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
authorLinus Torvalds <[email protected]>
Thu, 4 Mar 2021 19:26:17 +0000 (11:26 -0800)
committerLinus Torvalds <[email protected]>
Thu, 4 Mar 2021 19:26:17 +0000 (11:26 -0800)
Pull KVM fixes from Paolo Bonzini:

 - Doc fixes

 - selftests fixes

 - Add runstate information to the new Xen support

 - Allow compiling out the Xen interface

 - 32-bit PAE without EPT bugfix

 - NULL pointer dereference bugfix

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: SVM: Clear the CR4 register on reset
  KVM: x86/xen: Add support for vCPU runstate information
  KVM: x86/xen: Fix return code when clearing vcpu_info and vcpu_time_info
  selftests: kvm: Mmap the entire vcpu mmap area
  KVM: Documentation: Fix index for KVM_CAP_PPC_DAWR1
  KVM: x86: allow compiling out the Xen hypercall interface
  KVM: xen: flush deferred static key before checking it
  KVM: x86/mmu: Set SPTE_AD_WRPROT_ONLY_MASK if and only if PML is enabled
  KVM: x86: hyper-v: Fix Hyper-V context null-ptr-deref
  KVM: x86: remove misplaced comment on active_mmu_pages
  KVM: Documentation: rectify rst markup in kvm_run->flags
  Documentation: kvm: fix messy conversion from .txt to .rst

1  2 
arch/x86/kvm/x86.c

diff --combined arch/x86/kvm/x86.c
index 3712bb5245eb9a206b872bb69e476d172ef343ed,868213ca4f98444a0d940836448d305a1f78835a..2a20ce60152ea98e9521ed928c0cae06139317ab
@@@ -1785,7 -1785,6 +1785,7 @@@ EXPORT_SYMBOL_GPL(kvm_emulate_wrmsr)
  
  static inline bool kvm_vcpu_exit_request(struct kvm_vcpu *vcpu)
  {
 +      xfer_to_guest_mode_prepare();
        return vcpu->mode == EXITING_GUEST_MODE || kvm_request_pending(vcpu) ||
                xfer_to_guest_mode_work_pending();
  }
@@@ -2957,6 -2956,11 +2957,11 @@@ static void record_steal_time(struct kv
        struct kvm_host_map map;
        struct kvm_steal_time *st;
  
+       if (kvm_xen_msr_enabled(vcpu->kvm)) {
+               kvm_xen_runstate_set_running(vcpu);
+               return;
+       }
        if (!(vcpu->arch.st.msr_val & KVM_MSR_ENABLED))
                return;
  
@@@ -3756,11 -3760,15 +3761,15 @@@ int kvm_vm_ioctl_check_extension(struc
        case KVM_CAP_ENFORCE_PV_FEATURE_CPUID:
                r = 1;
                break;
+ #ifdef CONFIG_KVM_XEN
        case KVM_CAP_XEN_HVM:
                r = KVM_XEN_HVM_CONFIG_HYPERCALL_MSR |
                    KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL |
                    KVM_XEN_HVM_CONFIG_SHARED_INFO;
+               if (sched_info_on())
+                       r |= KVM_XEN_HVM_CONFIG_RUNSTATE;
                break;
+ #endif
        case KVM_CAP_SYNC_REGS:
                r = KVM_SYNC_X86_VALID_FIELDS;
                break;
@@@ -4038,7 -4046,11 +4047,11 @@@ void kvm_arch_vcpu_put(struct kvm_vcpu 
        if (vcpu->preempted && !vcpu->arch.guest_state_protected)
                vcpu->arch.preempted_in_kernel = !static_call(kvm_x86_get_cpl)(vcpu);
  
-       kvm_steal_time_set_preempted(vcpu);
+       if (kvm_xen_msr_enabled(vcpu->kvm))
+               kvm_xen_runstate_set_preempted(vcpu);
+       else
+               kvm_steal_time_set_preempted(vcpu);
        static_call(kvm_x86_vcpu_put)(vcpu);
        vcpu->arch.last_host_tsc = rdtsc();
        /*
@@@ -5013,6 -5025,7 +5026,7 @@@ long kvm_arch_vcpu_ioctl(struct file *f
        case KVM_GET_SUPPORTED_HV_CPUID:
                r = kvm_ioctl_get_supported_hv_cpuid(vcpu, argp);
                break;
+ #ifdef CONFIG_KVM_XEN
        case KVM_XEN_VCPU_GET_ATTR: {
                struct kvm_xen_vcpu_attr xva;
  
                r = kvm_xen_vcpu_set_attr(vcpu, &xva);
                break;
        }
+ #endif
        default:
                r = -EINVAL;
        }
@@@ -5654,6 -5668,7 +5669,7 @@@ set_pit2_out
                        kvm->arch.bsp_vcpu_id = arg;
                mutex_unlock(&kvm->lock);
                break;
+ #ifdef CONFIG_KVM_XEN
        case KVM_XEN_HVM_CONFIG: {
                struct kvm_xen_hvm_config xhc;
                r = -EFAULT;
                r = kvm_xen_hvm_set_attr(kvm, &xha);
                break;
        }
+ #endif
        case KVM_SET_CLOCK: {
                struct kvm_clock_data user_ns;
                u64 now_ns;
@@@ -8040,7 -8056,10 +8057,10 @@@ void kvm_arch_exit(void
        kvm_mmu_module_exit();
        free_percpu(user_return_msrs);
        kmem_cache_destroy(x86_fpu_cache);
+ #ifdef CONFIG_KVM_XEN
+       static_key_deferred_flush(&kvm_xen_enabled);
        WARN_ON(static_branch_unlikely(&kvm_xen_enabled.key));
+ #endif
  }
  
  static int __kvm_vcpu_halt(struct kvm_vcpu *vcpu, int state, int reason)
This page took 0.150176 seconds and 4 git commands to generate.