Re: [PATCH] KVM: X86: Use the common definition - 'GPA_INVALID' for X86

From: Sean Christopherson
Date: Tue Dec 13 2022 - 00:52:29 EST


On Fri, Dec 09, 2022, Yu Zhang wrote:
> KVM already has a 'GPA_INVALID' defined as (~(gpa_t)0) in
> kvm_types.h, and it is used by ARM and X86 xen code. We do
> not need a replicated 'INVALID_GPA' for X86 specifically.
> Just replace it with the common one.
>
> Tested by rebuilding KVM.
>
> No functional change intended.
>
> Signed-off-by: Yu Zhang <yu.c.zhang@xxxxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/kvm_host.h | 2 -
> arch/x86/kvm/hyperv.c | 2 +-
> arch/x86/kvm/mmu/paging_tmpl.h | 6 +--
> arch/x86/kvm/svm/nested.c | 4 +-
> arch/x86/kvm/svm/svm.c | 4 +-
> arch/x86/kvm/vmx/nested.c | 66 ++++++++++++++++-----------------
> arch/x86/kvm/vmx/sgx.c | 2 +-
> arch/x86/kvm/vmx/vmx.c | 6 +--
> arch/x86/kvm/x86.c | 18 ++++-----
> 9 files changed, 54 insertions(+), 56 deletions(-)

What if we rename GPA_INVALID to INVALID_GPA and modify _those_ users? I have
a slight preference for INVALID_GPA, and we also have INVALID_PAGE. It'll also
yield a smaller diff.

EVMPTR_INVALID is the counter argument, but that's more of an error code than a
semi-arbitrary value, e.g. there's also EVMPTR_MAP_PENDING.

$ git grep GPA_INVALID | wc -l
17
$ git grep INVALID_GPA | wc -l
55