[PATCH v4 09/17] KVM: arm64: Add selftests for the pKVM heap allocator

Fuad Tabba fuad.tabba at linux.dev
Mon Aug 24 11:15:05 PDT 2026


On Mon, 24 Aug 2026 at 17:23, Vincent Donnefort <vdonnefort at google.com> wrote:
...
> Clearly not something that would happen but I can put the #ifdef inside
> handle___pkvm_hyp_alloc_selftest() so it looks cleaner:
>
>   static void handle___pkvm_hyp_alloc_selftest(struct kvm_cpu_context *host_ctxt)
>   {
>           struct pkvm_hyp_req req = { .type = PKVM_HYP_NO_REQ };
>           int ret = -EPERM;
>
>   #ifdef CONFIG_NVHE_EL2_DEBUG
>           ret = hyp_allocator_selftest();
>           if (ret == -ENOMEM) {
>                   req.type = PKVM_HYP_REQ_HYP_ALLOC_SELFTEST;
>                   req.mem.nr_pages = hyp_alloc_selftest_topup_needed();
>           }
>   #endif
>           cpu_reg(host_ctxt, 1) = ret;
>           pkvm_hyp_req_to_smccc(host_ctxt, &req);
>   }
>
> Regarding pkvm_call_hyp_req(), how about a proper kerneldoc?
>
>  /**
>   * pkvm_call_hyp_req() - Issue an HVC that can return hypervisor requests
>   * @f: Hypervisor function symbol to call.
>   * @...: Arguments to pass to the hypercall.
>   *
>   * Re-issue an HVC and process any pending hypervisor request until completion
>   * or error.
>   *
>   * Only use this helper for HVCs whose hypervisor handlers format their return
>   * registers with pkvm_hyp_req_to_smccc().
>   *
>   * Return: Result of the hypercall or a negative error if the hyp request
>   * handling failed.
>   */

Both look good. The merged handler writes x2 through the no-req path,
which is what I was after, and the kerneldoc states the rule.

Thanks,
/fuad

>
> --
> Vincent
>



More information about the linux-arm-kernel mailing list