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

Fuad Tabba <[email protected]>
Newsgroups dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel
Message-ID <CA+EHjTwp=80sZar7XXd1ojZKpTooDeCK-td8q2L7qgVzayFjmw@mail.gmail.com>
On Mon, 24 Aug 2026 at 17:23, Vincent Donnefort <[email protected]> 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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.