Commit 7c419937 authored by Marc Zyngier's avatar Marc Zyngier
Browse files

KVM: arm64: Drop the CPU_FTR_REG_HYP_COPY infrastructure



Now that the read_ctr macro has been specialised for nVHE,
the whole CPU_FTR_REG_HYP_COPY infrastrcture looks completely
overengineered.

Simplify it by populating the two u64 quantities (MMFR0 and 1)
that the hypervisor need.

Reviewed-by: default avatarQuentin Perret <qperret@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 755db234
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -607,7 +607,6 @@ void check_local_cpu_capabilities(void);

u64 read_sanitised_ftr_reg(u32 id);
u64 __read_sysreg_by_encoding(u32 sys_id);
int copy_ftr_reg(u32 id, struct arm64_ftr_reg *dst);

static inline bool cpu_supports_mixed_endian_el0(void)
{
+0 −26
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (C) 2020 - Google LLC
 * Author: Quentin Perret <qperret@google.com>
 */

#ifndef __ARM64_KVM_CPUFEATURE_H__
#define __ARM64_KVM_CPUFEATURE_H__

#include <asm/cpufeature.h>

#include <linux/build_bug.h>

#if defined(__KVM_NVHE_HYPERVISOR__)
#define DECLARE_KVM_HYP_CPU_FTR_REG(name) extern struct arm64_ftr_reg name
#define DEFINE_KVM_HYP_CPU_FTR_REG(name) struct arm64_ftr_reg name
#else
#define DECLARE_KVM_HYP_CPU_FTR_REG(name) extern struct arm64_ftr_reg kvm_nvhe_sym(name)
#define DEFINE_KVM_HYP_CPU_FTR_REG(name) BUILD_BUG()
#endif

DECLARE_KVM_HYP_CPU_FTR_REG(arm64_ftr_reg_ctrel0);
DECLARE_KVM_HYP_CPU_FTR_REG(arm64_ftr_reg_id_aa64mmfr0_el1);
DECLARE_KVM_HYP_CPU_FTR_REG(arm64_ftr_reg_id_aa64mmfr1_el1);

#endif
+0 −4
Original line number Diff line number Diff line
@@ -740,13 +740,9 @@ void kvm_clr_pmu_events(u32 clr);

void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu);
void kvm_vcpu_pmu_restore_host(struct kvm_vcpu *vcpu);

void setup_kvm_el2_caps(void);
#else
static inline void kvm_set_pmu_events(u32 set, struct perf_event_attr *attr) {}
static inline void kvm_clr_pmu_events(u32 clr) {}

static inline void setup_kvm_el2_caps(void) {}
#endif

void kvm_vcpu_load_sysregs_vhe(struct kvm_vcpu *vcpu);
+3 −0
Original line number Diff line number Diff line
@@ -116,4 +116,7 @@ int __pkvm_init(phys_addr_t phys, unsigned long size, unsigned long nr_cpus,
void __noreturn __host_enter(struct kvm_cpu_context *host_ctxt);
#endif

extern u64 kvm_nvhe_sym(id_aa64mmfr0_el1_sys_val);
extern u64 kvm_nvhe_sym(id_aa64mmfr1_el1_sys_val);

#endif /* __ARM64_KVM_HYP_H__ */
+0 −13
Original line number Diff line number Diff line
@@ -1154,18 +1154,6 @@ u64 read_sanitised_ftr_reg(u32 id)
}
EXPORT_SYMBOL_GPL(read_sanitised_ftr_reg);

int copy_ftr_reg(u32 id, struct arm64_ftr_reg *dst)
{
	struct arm64_ftr_reg *regp = get_arm64_ftr_reg(id);

	if (!regp)
		return -EINVAL;

	*dst = *regp;

	return 0;
}

#define read_sysreg_case(r)	\
	case r:		val = read_sysreg_s(r); break;

@@ -2785,7 +2773,6 @@ void __init setup_cpu_features(void)

	setup_system_capabilities();
	setup_elf_hwcaps(arm64_elf_hwcaps);
	setup_kvm_el2_caps();

	if (system_supports_32bit_el0())
		setup_elf_hwcaps(compat_elf_hwcaps);
Loading