Handle HvTranslateVirtualAddress in user-space. The hypercall is
VTL-aware and only used in the context of VSM. Additionally, the TLFS
doesn't introduce an ad-hoc CPUID bit for it, so the hypercall
availability is tracked as part of the HV_ACCESS_VSM CPUID. This will be
documented with the main VSM commit.

Signed-off-by: Nicolas Saenz Julienne <nsa...@amazon.com>
---
 arch/x86/kvm/hyperv.c             | 3 +++
 include/asm-generic/hyperv-tlfs.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index d0edc2bec5a4f..cbe2aca52514b 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -2427,6 +2427,7 @@ static bool kvm_hv_is_xmm_output_hcall(u16 code)
 {
        switch (code) {
        case HVCALL_GET_VP_REGISTERS:
+       case HVCALL_TRANSLATE_VIRTUAL_ADDRESS:
                return true;
        }
 
@@ -2512,6 +2513,7 @@ static bool is_xmm_fast_hypercall(struct kvm_hv_hcall *hc)
        case HVCALL_SEND_IPI_EX:
        case HVCALL_GET_VP_REGISTERS:
        case HVCALL_SET_VP_REGISTERS:
+       case HVCALL_TRANSLATE_VIRTUAL_ADDRESS:
                return true;
        }
 
@@ -2740,6 +2742,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
                goto hypercall_userspace_exit;
        case HVCALL_GET_VP_REGISTERS:
        case HVCALL_SET_VP_REGISTERS:
+       case HVCALL_TRANSLATE_VIRTUAL_ADDRESS:
                goto hypercall_userspace_exit;
        default:
                ret = HV_STATUS_INVALID_HYPERCALL_CODE;
diff --git a/include/asm-generic/hyperv-tlfs.h 
b/include/asm-generic/hyperv-tlfs.h
index 9e909f0834598..57c791c555861 100644
--- a/include/asm-generic/hyperv-tlfs.h
+++ b/include/asm-generic/hyperv-tlfs.h
@@ -159,6 +159,7 @@ union hv_reference_tsc_msr {
 #define HVCALL_CREATE_VP                       0x004e
 #define HVCALL_GET_VP_REGISTERS                        0x0050
 #define HVCALL_SET_VP_REGISTERS                        0x0051
+#define HVCALL_TRANSLATE_VIRTUAL_ADDRESS       0x0052
 #define HVCALL_POST_MESSAGE                    0x005c
 #define HVCALL_SIGNAL_EVENT                    0x005d
 #define HVCALL_POST_DEBUG_DATA                 0x0069
-- 
2.40.1


Reply via email to