Re: [PATCH v4 09/17] KVM: arm64: Add selftests for the pKVM heap allocator
flat view
From: Fuad Tabba <fuad.tabba@linux.dev>
Date: 2026-08-24 18:15:45
Also in:
linux-arm-kernel
On Mon, 24 Aug 2026 at 17:23, Vincent Donnefort [off-list ref] 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