1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 /* 4 * Linux-specific definitions for managing interactions with Microsoft's 5 * Hyper-V hypervisor. The definitions in this file are specific to 6 * the ARM64 architecture. See include/asm-generic/mshyperv.h for 7 * definitions are that architecture independent. 8 * 9 * Definitions that are derived from Hyper-V code or headers should not go in 10 * this file, but should instead go in the relevant files in include/hyperv. 11 * 12 * Copyright (C) 2021, Microsoft, Inc. 13 * 14 * Author : Michael Kelley <mikelley@microsoft.com> 15 */ 16 17 #ifndef _ASM_MSHYPERV_H 18 #define _ASM_MSHYPERV_H 19 20 #include <linux/types.h> 21 #include <linux/arm-smccc.h> 22 #include <hyperv/hvhdk.h> 23 24 /* 25 * Declare calls to get and set Hyper-V VP register values on ARM64, which 26 * requires a hypercall. 27 */ 28 29 void hv_set_vpreg(u32 reg, u64 value); 30 u64 hv_get_vpreg(u32 reg); 31 void hv_get_vpreg_128(u32 reg, struct hv_get_vp_registers_output *result); 32 33 static inline void hv_set_msr(unsigned int reg, u64 value) 34 { 35 hv_set_vpreg(reg, value); 36 } 37 38 static inline u64 hv_get_msr(unsigned int reg) 39 { 40 return hv_get_vpreg(reg); 41 } 42 43 /* 44 * Nested is not supported on arm64 45 */ 46 static inline void hv_set_non_nested_msr(unsigned int reg, u64 value) 47 { 48 hv_set_msr(reg, value); 49 } 50 51 static inline u64 hv_get_non_nested_msr(unsigned int reg) 52 { 53 return hv_get_msr(reg); 54 } 55 56 /* SMCCC hypercall parameters */ 57 #define HV_SMCCC_FUNC_NUMBER 1 58 #define HV_FUNC_ID ARM_SMCCC_CALL_VAL( \ 59 ARM_SMCCC_STD_CALL, \ 60 ARM_SMCCC_SMC_64, \ 61 ARM_SMCCC_OWNER_VENDOR_HYP, \ 62 HV_SMCCC_FUNC_NUMBER) 63 64 #include <asm-generic/mshyperv.h> 65 66 #endif 67