kvm_para.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License, version 2, as
  4. * published by the Free Software Foundation.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  14. *
  15. * Copyright IBM Corp. 2008
  16. *
  17. * Authors: Hollis Blanchard <hollisb@us.ibm.com>
  18. */
  19. #ifndef __POWERPC_KVM_PARA_H__
  20. #define __POWERPC_KVM_PARA_H__
  21. #include <uapi/asm/kvm_para.h>
  22. #ifdef CONFIG_KVM_GUEST
  23. #include <linux/of.h>
  24. static inline int kvm_para_available(void)
  25. {
  26. struct device_node *hyper_node;
  27. hyper_node = of_find_node_by_path("/hypervisor");
  28. if (!hyper_node)
  29. return 0;
  30. if (!of_device_is_compatible(hyper_node, "linux,kvm"))
  31. return 0;
  32. return 1;
  33. }
  34. #else
  35. static inline int kvm_para_available(void)
  36. {
  37. return 0;
  38. }
  39. #endif
  40. static inline unsigned int kvm_arch_para_features(void)
  41. {
  42. unsigned long r;
  43. if (!kvm_para_available())
  44. return 0;
  45. if(epapr_hypercall0_1(KVM_HCALL_TOKEN(KVM_HC_FEATURES), &r))
  46. return 0;
  47. return r;
  48. }
  49. static inline bool kvm_check_and_clear_guest_paused(void)
  50. {
  51. return false;
  52. }
  53. #endif /* __POWERPC_KVM_PARA_H__ */