Re: [PATCH v2 01/13] KVM: x86: Redefine 'longmode' as a flag for KVM_EXIT_HYPERCALL

Sean Christopherson
2023-03-30T17:32:23Z

On Thu, Mar 30, 2023, Oliver Upton wrote:
> The 'longmode' field is a bit annoying as it blows an entire __u32 to
> represent a boolean value. Since other architectures are looking to add
> support for KVM_EXIT_HYPERCALL, now is probably a good time to clean it
> up.
>
> Redefine the field (and the remaining padding) as a set of flags.
> Preserve the existing ABI by using bit 0 to indicate if the guest was in
> long mode and requiring that the remaining 31 bits must be zero.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Sean Christopherson <seanjc@google.com>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---

Acked-by: Sean Christopherson <seanjc@google.com>

> Documentation/virt/kvm/api.rst | 3 +--
> arch/x86/include/asm/kvm_host.h | 7 +++++++
> arch/x86/include/uapi/asm/kvm.h | 3 +++
> arch/x86/kvm/x86.c | 6 +++++-
> include/uapi/linux/kvm.h | 9 +++++++--
> 5 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
> index 62de0768d6aa..9b01e3d0e757 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -6218,8 +6218,7 @@ to the byte array.
> __u64 nr;
> __u64 args[6];
> __u64 ret;
> - __u32 longmode;
> - __u32 pad;
> + __u64 flags;
> } hypercall;
>
> Unused. This was once used for 'hypercall to userspace'. To implement

Note to self, this needs to be updated as "hypercall" is longer unused.