[RFC PATCH v2 5/6] KVM: arm64: Add support for KVM_EXIT_HYPERCALL
Oliver Upton
oliver.upton at linux.dev
Mon Feb 13 11:24:03 PST 2023
On Mon, Feb 13, 2023 at 04:01:29PM +0000, Sean Christopherson wrote:
> On Sat, Feb 11, 2023, Oliver Upton wrote:
> > Finally, we need a flag to let userspace know what conduit instruction
> > was used (i.e. SMC vs. HVC). Redefine the remaining padding in
> > kvm_run::hypercall to accomplish this. Let's all take a moment
> > to admire the flowers and see how 'longmode' tied up a full u32 in the
> > UAPI. Weep.
>
> I don't think it has to, at least not for other architectures.
And surrender the opportunity to write a smartass commit message? I
think not.
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index 55155e262646..7d3ad820d55c 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -341,8 +341,14 @@ struct kvm_run {
> __u64 nr;
> __u64 args[6];
> __u64 ret;
> - __u32 longmode;
> - __u32 pad;
> + union {
> + /*
> + * Long Mode, a.k.a. 64-bit mode, takes up the
> + * first 32 flags on x86 (historical sludge).
> + */
> + __u32 longmode;
> + __u64 flags;
> + };
You could pull further shenanigans with the x86 residue by guarding
longmode with #ifndef __KERNEL__ and using a macro to raise the
'longmode' flag.
Then we can all pretend it never existed :)
--
Thanks,
Oliver
More information about the linux-arm-kernel
mailing list