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

Commit 690edec5 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'kvmarm-fixes-for-5.1' of...

Merge tag 'kvmarm-fixes-for-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master

KVM/ARM fixes for 5.1

- Fix THP handling in the presence of pre-existing PTEs
- Honor request for PTE mappings even when THPs are available
- GICv4 performance improvement
- Take the srcu lock when writing to guest-controlled ITS data structures
- Reset the virtual PMU in preemptible context
- Various cleanups
parents e2788c4a 8324c3d5
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -381,6 +381,17 @@ static inline int kvm_read_guest_lock(struct kvm *kvm,
	return ret;
}

static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa,
				       const void *data, unsigned long len)
{
	int srcu_idx = srcu_read_lock(&kvm->srcu);
	int ret = kvm_write_guest(kvm, gpa, data, len);

	srcu_read_unlock(&kvm->srcu, srcu_idx);

	return ret;
}

static inline void *kvm_get_hyp_vector(void)
{
	switch(read_cpuid_part()) {
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ static inline bool kvm_stage2_has_pud(struct kvm *kvm)

#define S2_PMD_MASK				PMD_MASK
#define S2_PMD_SIZE				PMD_SIZE
#define S2_PUD_MASK				PUD_MASK
#define S2_PUD_SIZE				PUD_SIZE

static inline bool kvm_stage2_has_pmd(struct kvm *kvm)
{
+11 −0
Original line number Diff line number Diff line
@@ -445,6 +445,17 @@ static inline int kvm_read_guest_lock(struct kvm *kvm,
	return ret;
}

static inline int kvm_write_guest_lock(struct kvm *kvm, gpa_t gpa,
				       const void *data, unsigned long len)
{
	int srcu_idx = srcu_read_lock(&kvm->srcu);
	int ret = kvm_write_guest(kvm, gpa, data, len);

	srcu_read_unlock(&kvm->srcu, srcu_idx);

	return ret;
}

#ifdef CONFIG_KVM_INDIRECT_VECTORS
/*
 * EL2 vectors can be mapped and rerouted in a number of ways,
+3 −3
Original line number Diff line number Diff line
@@ -123,6 +123,9 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
	int ret = -EINVAL;
	bool loaded;

	/* Reset PMU outside of the non-preemptible section */
	kvm_pmu_vcpu_reset(vcpu);

	preempt_disable();
	loaded = (vcpu->cpu != -1);
	if (loaded)
@@ -170,9 +173,6 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
		vcpu->arch.reset_state.reset = false;
	}

	/* Reset PMU */
	kvm_pmu_vcpu_reset(vcpu);

	/* Default workaround setup is enabled (if supported) */
	if (kvm_arm_have_ssbd() == KVM_SSBD_KERNEL)
		vcpu->arch.workaround_flags |= VCPU_WORKAROUND_2_FLAG;
+2 −2
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ void __hyp_text __vgic_v3_save_state(struct kvm_vcpu *vcpu)
		}
	}

	if (used_lrs) {
	if (used_lrs || cpu_if->its_vpe.its_vm) {
		int i;
		u32 elrsr;

@@ -247,7 +247,7 @@ void __hyp_text __vgic_v3_restore_state(struct kvm_vcpu *vcpu)
	u64 used_lrs = vcpu->arch.vgic_cpu.used_lrs;
	int i;

	if (used_lrs) {
	if (used_lrs || cpu_if->its_vpe.its_vm) {
		write_gicreg(cpu_if->vgic_hcr, ICH_HCR_EL2);

		for (i = 0; i < used_lrs; i++)
Loading