Re: [PATCH v4 06/17] KVM: arm64: Add pkvm_hyp_req infrastructure

Aneesh Kumar K.V <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,dev.linux.lists.kvmarm
Message-ID <[email protected]>
Vincent Donnefort <[email protected]> writes:

> On Tue, Aug 25, 2026 at 01:11:10PM +0530, Aneesh Kumar K.V wrote:
>> Vincent Donnefort <[email protected]> writes:
>> 
>> > Introduce a struct pkvm_hyp_req to enable the pKVM hypervisor to request
>> > resources from the host.
>> >
>> > Provide serialisation helpers to transport these requests via SMCCC
>> > registers (starting from a2):
>> >
>> >   pkvm_hyp_req_to_smccc() to encode into the SMCCC args.
>> >   smccc_to_pkvm_hyp_req() to decode them.
>> >
>> > When the hypervisor raises a request, the host must handle it and retry
>> > the HVC. To automate this sequence, introduce the pkvm_call_hyp_req()
>> > macro. This intercepts pending requests, invokes the handler and retries
>> > the HVC.
>> >
>> > Additionally, introduce a trace event to track the handling of these
>> > requests.
>> >
>> > Reviewed-by: Fuad Tabba <[email protected]>
>> > Tested-by: Fuad Tabba <[email protected]>
>> > Signed-off-by: Vincent Donnefort <[email protected]>
>> 
>> 
>> This is very similar to the memory-transferring SRO operations described
>> in section B4.3, RMI operations, of https://support.arm.com/documentation/den0137/2-0bet3/
>> 
>> The SRO model covers more details than the pkvm_hyp_req infrastructure.
>> Should we look at making the two more similar?
>> 
>> -aneesh
>
> Hum, this is really just a few lines of code. Also, pKVM doesn't need a stable
> ABI with the kernel. Implementing a portion of a spec here sounds way too
> complicated for that simple usage IMO. I struggle to see in what way this would
> make pKVM better.
>

My goal was mainly to see whether we could keep a similar design pattern
for the hypervisor requesting additional memory from the host. I wasn't
suggesting that CCA and pKVM should use the same helpers or code paths.

I was thinking this might be relatively easy to do on the pKVM side,
given that there is no strict ABI between the host and hypervisor. The
benefit would mostly be in keeping the design patterns similar: how an
incomplete hypercall is indicated, which registers are used for that,
and how additional memory is requested.

If aligning those patterns requires more work than the benefit it
provides, we can ignore this.

-aneesh
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.