Skip to contentSkip to conversation

arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr

PATCH Applied Andrew Scull 3 participants 3 messages Jun 18, 2020 – Jul 5, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr

get_vcpu_ptr is an assembly accessor for the percpu value kvm_host_data->host_ctxt.__hyp_running_vcpu. kern_hyp_va only applies to nVHE however __hyp_running_vcpu is always assigned a pointer that has already had kern_hyp_va applied in __kvm_vcpu_run_nvhe.

kern_hyp_va is currently idempotent as it just masks and inserts the tag, but this could change in future and the second application is unnecessary.

---
Built with ARM64_HARDEN_EL2_VECTORS=y and tested on qemu A72 with kvm-unit-tests and booting a VM with kvmtool.

---
 arch/arm64/include/asm/kvm_asm.h | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/include/asm/kvm_asm.h +0 -1
index 352aaebf4198..ac71d0939f2e 100644
@@ -143,7 +143,6 @@ extern char __smccc_workaround_1_smc[__SMCCC_WORKAROUND_1_SMC_SZ];
 .macro get_vcpu_ptr vcpu, ctxt
 	get_host_ctxt \ctxt, \vcpu
 	ldr	\vcpu, [\ctxt, #HOST_CONTEXT_VCPU]
-	kern_hyp_va	\vcpu
 .endm
 
 #endif
Signature · 6 lines
2.27.0.290.gba653c62da-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Reviewed-by on v1 1/1
#1 lore raw

Hi Andrew,

Quoted 4 lines · Andrew Scull

get_vcpu_ptr is an assembly accessor for the percpu value kvm_host_data->host_ctxt.__hyp_running_vcpu. kern_hyp_va only applies to nVHE however __hyp_running_vcpu is always assigned a pointer that has already had kern_hyp_va applied in __kvm_vcpu_run_nvhe.

So it is!

Quoted 3 lines

kern_hyp_va is currently idempotent as it just masks and inserts the tag, but this could change in future and the second application is unnecessary.

Thanks,

James
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

maintainer Applied
#2 lore raw
In reply to Andrew Scull
Quoted 8 lines · Andrew Scull

get_vcpu_ptr is an assembly accessor for the percpu value kvm_host_data->host_ctxt.__hyp_running_vcpu. kern_hyp_va only applies to nVHE however __hyp_running_vcpu is always assigned a pointer that has already had kern_hyp_va applied in __kvm_vcpu_run_nvhe.

kern_hyp_va is currently idempotent as it just masks and inserts the tag, but this could change in future and the second application is unnecessary.

Applied, thanks!

[1/1] arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr

      commit: 2da3ffa6e840b9f8fc65a71326c43b716992861d

Best regards,

Signature · 6 lines
Without deviation from the norm, progress is not possible.

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm