KVM: arm64: Transfer the hyp stack pages out of the host stage-2
PATCH 1/1 KVM: arm64: Transfer the hyp stack pages out of the host stage-2
From: Fuad Tabba <[email protected]>
[ Upstream commit 3a8c562892b96f35bba1e00d5e455a15963bbb92 ]
fix_host_ownership() walks only the linear-map alias of each memblock region, and the per-CPU hyp stack, mapped in the private VA range for its guard page, has none.
Walk each stack's VA range with the same walker.
[ 38f9e4b905a0 ("arm64: kvm: Introduce nvhe stack size constants") is
not backported because it converts nvhe stack code in eight files to NVHE_STACK_SIZE, and the hyp stack here is one page, so PAGE_SIZE replaces it. ]
--- arch/arm64/kvm/hyp/nvhe/setup.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/kvm/hyp/nvhe/setup.c +10 -0
@@ -264,6 +264,16 @@ static int fix_host_ownership(void)return ret; } +/* The stacks sit in the private VA range, not the linear map. */ +for (i =0 ; i < hyp_nr_cpus; i++) { +struct kvm_nvhe_init_params *params =per_cpu_ptr (&kvm_init_params, i); +u64 start = params->stack_hyp_va -PAGE_SIZE ; + + ret =kvm_pgtable_walk (&pkvm_pgtable, start,PAGE_SIZE , &walker); +if (ret) +return ret; + } +return 0 ; }
base-commit: 85d82e0d7c2dfd3e75d34f35b7ebbf41f45c9c4e
Signature · 1 line
2.50.1
PATCH v2 1/1 KVM: arm64: Transfer the hyp stack pages out of the host stage-2
From: Fuad Tabba <[email protected]>
[ Upstream commit 3a8c562892b96f35bba1e00d5e455a15963bbb92 ]
fix_host_ownership() walks only the linear-map alias of each memblock region, and the per-CPU hyp stack, mapped in the private VA range for its guard page, has none.
Walk each stack's VA range with the same walker.
[ 38f9e4b905a0 ("arm64: kvm: Introduce nvhe stack size constants") is
not backported because it converts nvhe stack code in eight files to NVHE_STACK_SIZE, and the hyp stack here is one page, so PAGE_SIZE replaces it. ]
---
v2: add my missing Signed-off-by
v1: https://lore.kernel.org/stable/[email protected]/
arch/arm64/kvm/hyp/nvhe/setup.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/kvm/hyp/nvhe/setup.c +10 -0
@@ -264,6 +264,16 @@ static int fix_host_ownership(void)return ret; } +/* The stacks sit in the private VA range, not the linear map. */ +for (i =0 ; i < hyp_nr_cpus; i++) { +struct kvm_nvhe_init_params *params =per_cpu_ptr (&kvm_init_params, i); +u64 start = params->stack_hyp_va -PAGE_SIZE ; + + ret =kvm_pgtable_walk (&pkvm_pgtable, start,PAGE_SIZE , &walker); +if (ret) +return ret; + } +return 0 ; }
base-commit: 85d82e0d7c2dfd3e75d34f35b7ebbf41f45c9c4e
Signature · 1 line
2.50.1
Quoted 4 lines
[
38f9e4b905a0("arm64: kvm: Introduce nvhe stack size constants") is
not backported because it converts nvhe stack code in eight files toNVHE_STACK_SIZE, and the hyp stack here is one page, soPAGE_SIZEreplaces it. ]
Queued for 6.12, thanks.
Signature · 2 lines
Thanks, Sasha