Commit 029e24ef authored by Yanan Wang's avatar Yanan Wang Committed by lishusen
Browse files

KVM: arm64: Only probe Hisi ncsnp feature on Hisi CPUs

virt inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8TN8N


CVE: NA

----------------------------------------------------

The "ncsnp" is an implementation specific CPU virtualization
feature on Hisi 1620 series CPUs. This feature works just
like ARM standard S2FWB to reduce some cache management
operations in virtualization.
Given that it's Hisi specific feature, let's restrict the
detection only to Hisi CPUs. To realize this:
1) Add a sub-directory `hisilicon/` within arch/arm64/kvm to
hold code for Hisi specific virtualization features.
2) Add a new kconfig option `CONFIG_KVM_HISI_VIRT` for users
to select the whole Hisi specific virtualization features.
3) Add a generic global KVM variable `kvm_ncsnp_support`
which is `false` by default. Only re-initialize it when
we have `CONFIG_KVM_HISI_VIRT` enabled.

Signed-off-by: default avatarYanan Wang <wangyanan55@huawei.com>
Signed-off-by: default avatarlishusen <lishusen2@huawei.com>
parent 625086f8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -725,6 +725,7 @@ CONFIG_KVM_VFIO=y
CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT=y
CONFIG_HAVE_KVM_IRQ_BYPASS=y
CONFIG_HAVE_KVM_VCPU_RUN_PID_CHANGE=y
CONFIG_KVM_HISI_VIRT=y
CONFIG_KVM_XFER_TO_GUEST_WORK=y
CONFIG_KVM_GENERIC_HARDWARE_ENABLING=y
CONFIG_VIRTUALIZATION=y
+2 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
#include <asm/fpsimd.h>
#include <asm/kvm.h>
#include <asm/kvm_asm.h>
#include <asm/hisi_cpu_model.h>

#define __KVM_HAVE_ARCH_INTC_INITIALIZED

@@ -1155,4 +1154,6 @@ static inline void kvm_hyp_reserve(void) { }
void kvm_arm_vcpu_power_off(struct kvm_vcpu *vcpu);
bool kvm_arm_vcpu_stopped(struct kvm_vcpu *vcpu);

extern bool kvm_ncsnp_support;

#endif /* __ARM64_KVM_HOST_H__ */
+5 −0
Original line number Diff line number Diff line
@@ -111,6 +111,11 @@ KVM_NVHE_ALIAS(__hyp_rodata_end);
/* pKVM static key */
KVM_NVHE_ALIAS(kvm_protected_mode_initialized);

#ifdef CONFIG_KVM_HISI_VIRT
/* Capability of non-cacheable snooping */
KVM_NVHE_ALIAS(kvm_ncsnp_support);
#endif

#endif /* CONFIG_KVM */

#ifdef CONFIG_EFI_ZBOOT
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@

source "virt/lib/Kconfig"
source "virt/kvm/Kconfig"
source "arch/arm64/kvm/hisilicon/Kconfig"

menuconfig VIRTUALIZATION
	bool "Virtualization"
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ kvm-y += arm.o mmu.o mmio.o psci.o hypercalls.o pvtime.o \
	 guest.o debug.o reset.o sys_regs.o stacktrace.o \
	 vgic-sys-reg-v3.o fpsimd.o pkvm.o \
	 arch_timer.o trng.o vmid.o emulate-nested.o nested.o \
	 hisi_cpu_model.o \
	 vgic/vgic.o vgic/vgic-init.o \
	 vgic/vgic-irqfd.o vgic/vgic-v2.o \
	 vgic/vgic-v3.o vgic/vgic-v4.o \
@@ -24,6 +23,7 @@ kvm-y += arm.o mmu.o mmio.o psci.o hypercalls.o pvtime.o \
	 vgic/vgic-its.o vgic/vgic-debug.o

kvm-$(CONFIG_HW_PERF_EVENTS)  += pmu-emul.o pmu.o
obj-$(CONFIG_KVM_HISI_VIRT) += hisilicon/

always-y := hyp_constants.h hyp-constants.s

Loading