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 <[email protected]>
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 
hv_set_msr(unsigned int reg,u64 value)33 static inline void hv_set_msr(unsigned int reg, u64 value)
34 {
35 	hv_set_vpreg(reg, value);
36 }
37 
hv_get_msr(unsigned int reg)38 static inline u64 hv_get_msr(unsigned int reg)
39 {
40 	return hv_get_vpreg(reg);
41 }
42 
43 /* SMCCC hypercall parameters */
44 #define HV_SMCCC_FUNC_NUMBER	1
45 #define HV_FUNC_ID	ARM_SMCCC_CALL_VAL(			\
46 				ARM_SMCCC_STD_CALL,		\
47 				ARM_SMCCC_SMC_64,		\
48 				ARM_SMCCC_OWNER_VENDOR_HYP,	\
49 				HV_SMCCC_FUNC_NUMBER)
50 
51 #include <asm-generic/mshyperv.h>
52 
53 #endif
54