LoongArch/KVM: Use CSR_CRMD_PLV instead of CSR_PRMD_PPLV in kvm_arch_vcpu_in_kernel
Subsystems (2)
PATCH 1/1 LoongArch/KVM: Use CSR_CRMD_PLV instead of CSR_PRMD_PPLV 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.
--- arch/loongarch/kvm/vcpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kvm/vcpu.c +1 -1
@@ -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
Signature · 1 line
2.43.0
Quoted 15 lines · cuitao
The function reads
LOONGARCH_CSR_CRMDbut usesCSR_PRMD_PPLVto extract the privilege level. While both masks have the same value (0x3),CSR_CRMD_PLVis the semantically correct constant for CRMD.Signed-off-by cuitao <[email protected]>--- arch/loongarch/kvm/vcpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/loongarch/kvm/vcpu.c +0
-0
arch/loongarch/kvm/vcpu.c bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) · line 408
Quoted 8 lines
arch/loongarch/kvm/vcpu.c +1
-1@@ -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
Quoted 21 lines · Bibo Mao
Quoted 17 lines · cuitao
The function reads
LOONGARCH_CSR_CRMDbut usesCSR_PRMD_PPLVto extract the privilege level. While both masks have the same value (0x3),CSR_CRMD_PLVis the semantically correct constant for CRMD.Signed-off-by cuitao <[email protected]>--- arch/loongarch/kvm/vcpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/loongarch/kvm/vcpu.c +0
-0@@ -402,7 +402,7 @@ bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) val =gcsr_read (LOONGARCH_CSR_CRMD );preempt_enable ();
Quoted 7 lines
arch/loongarch/kvm/vcpu.c bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) · line 408
Quoted 6 lines
arch/loongarch/kvm/vcpu.c +1
-1-return (val &CSR_PRMD_PPLV ) ==PLV_KERN ; +return (val &CSR_CRMD_PLV ) ==PLV_KERN ; }#ifdef CONFIG_GUEST_PERF_EVENTS Reviewed-by Bibo Mao <[email protected]>
Applied, thanks.
Huacai