]> git.itanic.dy.fi Git - linux-stable/commitdiff
KVM: x86: hyper-v: Expose support for extended gva ranges for flush hypercalls
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 1 Nov 2022 14:53:50 +0000 (15:53 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 18 Nov 2022 17:59:06 +0000 (12:59 -0500)
Extended GVA ranges support bit seems to indicate whether lower 12
bits of GVA can be used to specify up to 4095 additional consequent
GVAs to flush. This is somewhat described in TLFS.

Previously, KVM was handling HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST{,EX}
requests by flushing the whole VPID so technically, extended GVA
ranges were already supported. As such requests are handled more
gently now, advertizing support for extended ranges starts making
sense to reduce the size of TLB flush requests.

Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20221101145426.251680-13-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/hyperv-tlfs.h
arch/x86/kvm/hyperv.c

index c5e0e5a06c0dcc639c8e5826450c741576b56f9d..6639979302ab70258403501fc6320e585dc10751 100644 (file)
@@ -61,6 +61,8 @@
 #define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE           BIT(10)
 /* Support for debug MSRs available */
 #define HV_FEATURE_DEBUG_MSRS_AVAILABLE                        BIT(11)
+/* Support for extended gva ranges for flush hypercalls available */
+#define HV_FEATURE_EXT_GVA_RANGES_FLUSH                        BIT(14)
 /*
  * Support for returning hypercall output block via XMM
  * registers is available
index 6868c478617c0d3ce3cad532109a8f7c060f0509..fca9c51891f5f6e6b4e55a42a9d21a701bd8bbe6 100644 (file)
@@ -2641,6 +2641,7 @@ int kvm_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid,
                        ent->ebx |= HV_DEBUGGING;
                        ent->edx |= HV_X64_GUEST_DEBUGGING_AVAILABLE;
                        ent->edx |= HV_FEATURE_DEBUG_MSRS_AVAILABLE;
+                       ent->edx |= HV_FEATURE_EXT_GVA_RANGES_FLUSH;
 
                        /*
                         * Direct Synthetic timers only make sense with in-kernel