KVM ARM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr
@ 2020-06-18  9:36 Andrew Scull
  2020-06-18 18:22 ` James Morse
  2020-07-05 17:17 ` Marc Zyngier
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Scull @ 2020-06-18  9:36 UTC (permalink / raw)
  To: kvmarm; +Cc: maz, kernel-team

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.

Signed-off-by: Andrew Scull <ascull@google.com>
---
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(-)

diff --git a/arch/arm64/include/asm/kvm_asm.h b/arch/arm64/include/asm/kvm_asm.h
index 352aaebf4198..ac71d0939f2e 100644
--- a/arch/arm64/include/asm/kvm_asm.h
+++ b/arch/arm64/include/asm/kvm_asm.h
@@ -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
-- 
2.27.0.290.gba653c62da-goog

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr
  2020-06-18  9:36 [PATCH] arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr Andrew Scull
@ 2020-06-18 18:22 ` James Morse
  2020-07-05 17:17 ` Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: James Morse @ 2020-06-18 18:22 UTC (permalink / raw)
  To: Andrew Scull; +Cc: maz, kernel-team, kvmarm

Hi Andrew,

On 18/06/2020 10:36, Andrew Scull wrote:
> 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!


> 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.


Reviewed-by: James Morse <james.morse@arm.com>


Thanks,

James
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr
  2020-06-18  9:36 [PATCH] arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr Andrew Scull
  2020-06-18 18:22 ` James Morse
@ 2020-07-05 17:17 ` Marc Zyngier
  1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2020-07-05 17:17 UTC (permalink / raw)
  To: Andrew Scull, kvmarm; +Cc: kernel-team

On Thu, 18 Jun 2020 10:36:16 +0100, Andrew Scull wrote:
> 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,
-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-18  9:36 [PATCH] arm64: kvm: Remove kern_hyp_va from get_vcpu_ptr Andrew Scull
2020-06-18 18:22 ` James Morse
2020-07-05 17:17 ` Marc Zyngier

KVM ARM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvmarm/0 kvmarm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvmarm kvmarm/ https://lore.kernel.org/kvmarm \
		kvmarm@lists.cs.columbia.edu
	public-inbox-index kvmarm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/edu.columbia.cs.lists.kvmarm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git