Thread (97 messages) 97 messages, 6 authors, 2021-02-22

Re: [RFC PATCH v2 04/26] KVM: arm64: Initialize kvm_nvhe_init_params early

From: Will Deacon <will@kernel.org>
Date: 2021-02-01 17:43:55
Also in: kvmarm, linux-arm-kernel, lkml

On Fri, Jan 08, 2021 at 12:15:02PM +0000, Quentin Perret wrote:
quoted hunk ↗ jump to hunk
Move the initialization of kvm_nvhe_init_params in a dedicated function
that is run early, and only once during KVM init, rather than every time
the KVM vectors are set and reset.

This also opens the opportunity for the hypervisor to change the init
structs during boot, hence simplifying the replacement of host-provided
page-tables and stacks by the ones the hypervisor will create for
itself.

Signed-off-by: Quentin Perret <redacted>
---
 arch/arm64/kvm/arm.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 04c44853b103..3ac0f3425833 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
[...]
quoted hunk ↗ jump to hunk
@@ -1807,6 +1813,12 @@ static int init_hyp_mode(void)
 			goto out_err;
 	}
 
+	/*
+	 * Prepare the CPU initialization parameters
+	 */
+	for_each_possible_cpu(cpu)
+		cpu_prepare_hyp_mode(cpu);
+
This is the fifth for_each_possible_cpu() loop in this function; can any of
them be merged together?

Will
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help