/arch/powerpc/include/asm/kvm_para.h

http://github.com/mirrors/linux · C Header · 63 lines · 39 code · 17 blank · 7 comment · 4 complexity · 051985a7efbc9ad7ad26f2e765081589 MD5 · raw file

  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. *
  4. * Copyright IBM Corp. 2008
  5. *
  6. * Authors: Hollis Blanchard <hollisb@us.ibm.com>
  7. */
  8. #ifndef __POWERPC_KVM_PARA_H__
  9. #define __POWERPC_KVM_PARA_H__
  10. #include <uapi/asm/kvm_para.h>
  11. #ifdef CONFIG_KVM_GUEST
  12. #include <linux/of.h>
  13. static inline int kvm_para_available(void)
  14. {
  15. struct device_node *hyper_node;
  16. hyper_node = of_find_node_by_path("/hypervisor");
  17. if (!hyper_node)
  18. return 0;
  19. if (!of_device_is_compatible(hyper_node, "linux,kvm"))
  20. return 0;
  21. return 1;
  22. }
  23. #else
  24. static inline int kvm_para_available(void)
  25. {
  26. return 0;
  27. }
  28. #endif
  29. static inline unsigned int kvm_arch_para_features(void)
  30. {
  31. unsigned long r;
  32. if (!kvm_para_available())
  33. return 0;
  34. if(epapr_hypercall0_1(KVM_HCALL_TOKEN(KVM_HC_FEATURES), &r))
  35. return 0;
  36. return r;
  37. }
  38. static inline unsigned int kvm_arch_para_hints(void)
  39. {
  40. return 0;
  41. }
  42. static inline bool kvm_check_and_clear_guest_paused(void)
  43. {
  44. return false;
  45. }
  46. #endif /* __POWERPC_KVM_PARA_H__ */