KVM: arm64: nVHE: Check hypercall handlers against the declared ABI

Each hypercall handler unmarshals its arguments from the host context
with hand-written DECLARE_REG() casts that nothing ties to what the
caller passed: a handler can disagree with its caller in argument type,
count or register index without a diagnostic.

Generate the unmarshalling instead. DEFINE_KVM_HOST_HCALL() expands to
the handle_<name>() glue, modelled on the syscall wrappers, and checks
the handler's parameter list against the signature declared in
kvm_hcall.h, so both ends of every hypercall are now compiled against
the same declaration. Handler bodies keep their logic and lose the
DECLARE_REG() and return-register boilerplate. The two
get_host_hyp_vcpus() macros existed only to wrap DECLARE_REG(), so one
is dropped and the other becomes a function. The compiled handlers are
instruction-for-instruction identical, apart from flush_hyp_vcpu() and
sync_hyp_vcpu() now being inlined into their only caller.

The return-register store is picked by the declared return type, so a
void handler needs no macro of its own. The type is pasted into the
store's name, which has to be a single word, so
__pkvm_create_private_mapping is declared ulong.

Assisted-by: Antigravity:gemini-3.1-pro
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Fuad Tabba <fuad.tabba@linux.dev>
2 files changed