Commit da773ea3 authored by Tao Cui's avatar Tao Cui Committed by Huacai Chen
Browse files

LoongArch: KVM: Use CSR_CRMD_PLV in kvm_arch_vcpu_in_kernel()



The function reads LOONGARCH_CSR_CRMD but uses CSR_PRMD_PPLV to
extract the privilege level. While both masks have the same value
(0x3), CSR_CRMD_PLV is the semantically correct constant for CRMD.

Cc: stable@vger.kernel.org
Reviewed-by: default avatarBibo Mao <maobibo@loongson.cn>
Signed-off-by: default avatarTao Cui <cuitao@kylinos.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 591cd656
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -402,7 +402,7 @@ bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu)
	val = gcsr_read(LOONGARCH_CSR_CRMD);
	preempt_enable();

	return (val & CSR_PRMD_PPLV) == PLV_KERN;
	return (val & CSR_CRMD_PLV) == PLV_KERN;
}

#ifdef CONFIG_GUEST_PERF_EVENTS