Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58ddfe6c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull kvm fixes from Paolo Bonzini:

 - ARM/ARM64 locking fixes

 - x86 fixes: PCID, UMIP, locking

 - improved support for recent Windows version that have a 2048 Hz APIC
   timer

 - rename KVM_HINTS_DEDICATED CPUID bit to KVM_HINTS_REALTIME

 - better behaved selftests

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  kvm: rename KVM_HINTS_DEDICATED to KVM_HINTS_REALTIME
  KVM: arm/arm64: VGIC/ITS save/restore: protect kvm_read_guest() calls
  KVM: arm/arm64: VGIC/ITS: protect kvm_read_guest() calls with SRCU lock
  KVM: arm/arm64: VGIC/ITS: Promote irq_lock() in update_affinity
  KVM: arm/arm64: Properly protect VGIC locks from IRQs
  KVM: X86: Lower the default timer frequency limit to 200us
  KVM: vmx: update sec exec controls for UMIP iff emulating UMIP
  kvm: x86: Suppress CR3_PCID_INVD bit only when PCIDs are enabled
  KVM: selftests: exit with 0 status code when tests cannot be run
  KVM: hyperv: idr_find needs RCU protection
  x86: Delay skip of emulated hypercall instruction
  KVM: Extend MAX_IRQ_ROUTES to 4096 for all archs
parents 7c9a0fc7 633711e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -72,8 +72,8 @@ KVM_FEATURE_CLOCKSOURCE_STABLE_BIT || 24 || host will warn if no guest-side


flag                               || value || meaning
flag                               || value || meaning
==================================================================================
==================================================================================
KVM_HINTS_DEDICATED                ||     0 || guest checks this feature bit to
KVM_HINTS_REALTIME                 ||     0 || guest checks this feature bit to
                                   ||       || determine if there is vCPU pinning
                                   ||       || determine that vCPUs are never
                                   ||       || and there is no vCPU over-commitment,
                                   ||       || preempted for an unlimited time,
                                   ||       || allowing optimizations
                                   ||       || allowing optimizations
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
+16 −0
Original line number Original line Diff line number Diff line
@@ -309,6 +309,22 @@ static inline unsigned int kvm_get_vmid_bits(void)
	return 8;
	return 8;
}
}


/*
 * We are not in the kvm->srcu critical section most of the time, so we take
 * the SRCU read lock here. Since we copy the data from the user page, we
 * can immediately drop the lock again.
 */
static inline int kvm_read_guest_lock(struct kvm *kvm,
				      gpa_t gpa, void *data, unsigned long len)
{
	int srcu_idx = srcu_read_lock(&kvm->srcu);
	int ret = kvm_read_guest(kvm, gpa, data, len);

	srcu_read_unlock(&kvm->srcu, srcu_idx);

	return ret;
}

static inline void *kvm_get_hyp_vector(void)
static inline void *kvm_get_hyp_vector(void)
{
{
	return kvm_ksym_ref(__kvm_hyp_vector);
	return kvm_ksym_ref(__kvm_hyp_vector);
+16 −0
Original line number Original line Diff line number Diff line
@@ -360,6 +360,22 @@ static inline unsigned int kvm_get_vmid_bits(void)
	return (cpuid_feature_extract_unsigned_field(reg, ID_AA64MMFR1_VMIDBITS_SHIFT) == 2) ? 16 : 8;
	return (cpuid_feature_extract_unsigned_field(reg, ID_AA64MMFR1_VMIDBITS_SHIFT) == 2) ? 16 : 8;
}
}


/*
 * We are not in the kvm->srcu critical section most of the time, so we take
 * the SRCU read lock here. Since we copy the data from the user page, we
 * can immediately drop the lock again.
 */
static inline int kvm_read_guest_lock(struct kvm *kvm,
				      gpa_t gpa, void *data, unsigned long len)
{
	int srcu_idx = srcu_read_lock(&kvm->srcu);
	int ret = kvm_read_guest(kvm, gpa, data, len);

	srcu_read_unlock(&kvm->srcu, srcu_idx);

	return ret;
}

#ifdef CONFIG_KVM_INDIRECT_VECTORS
#ifdef CONFIG_KVM_INDIRECT_VECTORS
/*
/*
 * EL2 vectors can be mapped and rerouted in a number of ways,
 * EL2 vectors can be mapped and rerouted in a number of ways,
+1 −1
Original line number Original line Diff line number Diff line
@@ -29,7 +29,7 @@
#define KVM_FEATURE_PV_TLB_FLUSH	9
#define KVM_FEATURE_PV_TLB_FLUSH	9
#define KVM_FEATURE_ASYNC_PF_VMEXIT	10
#define KVM_FEATURE_ASYNC_PF_VMEXIT	10


#define KVM_HINTS_DEDICATED      0
#define KVM_HINTS_REALTIME      0


/* The last 8 bits are used to indicate how to interpret the flags field
/* The last 8 bits are used to indicate how to interpret the flags field
 * in pvclock structure. If no bits are set, all flags are ignored.
 * in pvclock structure. If no bits are set, all flags are ignored.
+4 −4
Original line number Original line Diff line number Diff line
@@ -457,7 +457,7 @@ static void __init sev_map_percpu_data(void)
static void __init kvm_smp_prepare_cpus(unsigned int max_cpus)
static void __init kvm_smp_prepare_cpus(unsigned int max_cpus)
{
{
	native_smp_prepare_cpus(max_cpus);
	native_smp_prepare_cpus(max_cpus);
	if (kvm_para_has_hint(KVM_HINTS_DEDICATED))
	if (kvm_para_has_hint(KVM_HINTS_REALTIME))
		static_branch_disable(&virt_spin_lock_key);
		static_branch_disable(&virt_spin_lock_key);
}
}


@@ -553,7 +553,7 @@ static void __init kvm_guest_init(void)
	}
	}


	if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
	if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
	    !kvm_para_has_hint(KVM_HINTS_DEDICATED) &&
	    !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
	    kvm_para_has_feature(KVM_FEATURE_STEAL_TIME))
	    kvm_para_has_feature(KVM_FEATURE_STEAL_TIME))
		pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others;
		pv_mmu_ops.flush_tlb_others = kvm_flush_tlb_others;


@@ -649,7 +649,7 @@ static __init int kvm_setup_pv_tlb_flush(void)
	int cpu;
	int cpu;


	if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
	if (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
	    !kvm_para_has_hint(KVM_HINTS_DEDICATED) &&
	    !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
	    kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {
	    kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) {
		for_each_possible_cpu(cpu) {
		for_each_possible_cpu(cpu) {
			zalloc_cpumask_var_node(per_cpu_ptr(&__pv_tlb_mask, cpu),
			zalloc_cpumask_var_node(per_cpu_ptr(&__pv_tlb_mask, cpu),
@@ -745,7 +745,7 @@ void __init kvm_spinlock_init(void)
	if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
	if (!kvm_para_has_feature(KVM_FEATURE_PV_UNHALT))
		return;
		return;


	if (kvm_para_has_hint(KVM_HINTS_DEDICATED))
	if (kvm_para_has_hint(KVM_HINTS_REALTIME))
		return;
		return;


	__pv_init_lock_hash();
	__pv_init_lock_hash();
Loading