KVM: arm64: nested: Fix VA sign extension in VNCR/TLBI paths
PATCH 1/1 KVM: arm64: nested: Fix VA sign extension in VNCR/TLBI paths
From: gyutrange <[email protected]>
--- arch/arm64/kvm/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/nested.c +1 -1
@@ -1169,7 +1169,7 @@ int kvm_vcpu_allocate_vncr_tlb(struct kvm_vcpu *vcpu)static u64 read_vncr_el2 (struct kvm_vcpu *vcpu) { -return (u64 )sign_extend64 (__vcpu_sys_reg (vcpu,VNCR_EL2 ),48 ); +return (u64 )sign_extend64 (__vcpu_sys_reg (vcpu,VNCR_EL2 ),47 ); }static int kvm_translate_vncr (struct kvm_vcpu *vcpu)
Signature · 1 line
2.43.0
Marc Zyngier
maintainerQuoted 4 lines · Gyujeong Jin
From: gyutrange <[email protected]>
Signed-off-by gyutrange <[email protected]>
Where is the commit message?
Quoted 9 lines
--- arch/arm64/kvm/nested.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kvm/nested.c +0
-0
arch/arm64/kvm/nested.c int kvm_vcpu_allocate_vncr_tlb(struct kvm_vcpu *vcpu) · line 1174
Quoted 7 lines
arch/arm64/kvm/nested.c +1
-1@@ -1169,7 +1169,7 @@ int kvm_vcpu_allocate_vncr_tlb(struct kvm_vcpu *vcpu)static u64 read_vncr_el2 (struct kvm_vcpu *vcpu) { -return (u64 )sign_extend64 (__vcpu_sys_reg (vcpu,VNCR_EL2 ),48 ); +return (u64 )sign_extend64 (__vcpu_sys_reg (vcpu,VNCR_EL2 ),47 ); }
This code is not there for sign extension of the VA. It is there for the propagation of bit 48 (yes, bit 48, not a typo) in RESS and the top bits of BADDR. D24.2.206 has all the details for this.
Furthermore, we already check that the VA is canonical at the point of establishing the translation (see the references to R_YYVYV and I_THCZK in the S1 PTW code), and don't install a TLB in that case.
But maybe you have spotted something I didn't, so some explanations would be very welcome.
Thanks,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.