mshyperv.h 1.6 KB

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