[PATCH 4/6] KVM: arm64: Move hyp state to hyp_vmemmap
Vincent Donnefort
vdonnefort at google.com
Mon Mar 3 01:47:48 PST 2025
[...]
> diff --git a/arch/arm64/kvm/hyp/nvhe/setup.c b/arch/arm64/kvm/hyp/nvhe/setup.c
> index 1a414288fe8c..955c431af5d0 100644
> --- a/arch/arm64/kvm/hyp/nvhe/setup.c
> +++ b/arch/arm64/kvm/hyp/nvhe/setup.c
> @@ -194,16 +194,20 @@ static int fix_host_ownership_walker(const struct kvm_pgtable_visit_ctx *ctx,
>
> /*
> * Adjust the host stage-2 mappings to match the ownership attributes
> - * configured in the hypervisor stage-1.
> + * configured in the hypervisor stage-1, and make sure to propagate them
> + * to the hyp_vmemmap state.
> */
> state = pkvm_getstate(kvm_pgtable_hyp_pte_prot(ctx->old));
> switch (state) {
> case PKVM_PAGE_OWNED:
> + set_hyp_state(phys, PKVM_PAGE_OWNED);
> return host_stage2_set_owner_locked(phys, PAGE_SIZE, PKVM_ID_HYP);
> case PKVM_PAGE_SHARED_OWNED:
> + set_hyp_state(phys, PKVM_PAGE_SHARED_OWNED);
> set_host_state(phys, PKVM_PAGE_SHARED_BORROWED);
> break;
> case PKVM_PAGE_SHARED_BORROWED:
> + set_hyp_state(phys, PKVM_PAGE_SHARED_BORROWED);
> set_host_state(phys, PKVM_PAGE_SHARED_OWNED);
> break;
> default:
Are the SHARED_OWNED/SHARED_BORROWED still relevant since the introduction of
"KVM: arm64: Don't map 'kvm_vgic_global_state' at EL2 with pKVM"? It doesn't
seem we have any !OWNED pages in the hyp anymore at setup, do we?
> --
> 2.48.1.658.g4767266eb4-goog
>
More information about the linux-arm-kernel
mailing list