Commit b7bcdd9e authored by yangjinqian's avatar yangjinqian Committed by Jinqian Yang
Browse files

kvm: hisi_virt: fix kernel panic when enable DVMBM in nVHE

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



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

When the kernel is in nvhe mode and is in EL1, the original judgment
logic causes the hardware_disable_dvmbm function to read the EL2
register in EL1, causing a panic during kernel startup.

Signed-off-by: default avatarJinqian Yang <yangjinqian1@huawei.com>
parent b28aab59
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -160,12 +160,17 @@ bool hisi_dvmbm_supported(void)
	if (cpu_type != HI_IP10 && cpu_type != HI_IP10C)
		return false;

	if (!is_kernel_in_hyp_mode()) {
		kvm_info("Hisi dvmbm not supported by KVM nVHE mode\n");
		return false;
	}

	/* Determine whether DVMBM is supported by the hardware */
	if (!(read_sysreg(aidr_el1) & AIDR_EL1_DVMBM_MASK))
		return false;

	/* User provided kernel command-line parameter */
	if (!dvmbm_enabled || !is_kernel_in_hyp_mode()) {
	if (!dvmbm_enabled) {
		on_each_cpu(hardware_disable_dvmbm, NULL, 1);
		return false;
	}