kvm_para.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 _UAPI__POWERPC_KVM_PARA_H__
  20. #define _UAPI__POWERPC_KVM_PARA_H__
  21. #include <linux/types.h>
  22. /*
  23. * Additions to this struct must only occur at the end, and should be
  24. * accompanied by a KVM_MAGIC_FEAT flag to advertise that they are present
  25. * (albeit not necessarily relevant to the current target hardware platform).
  26. *
  27. * Struct fields are always 32 or 64 bit aligned, depending on them being 32
  28. * or 64 bit wide respectively.
  29. *
  30. * See Documentation/virtual/kvm/ppc-pv.txt
  31. */
  32. struct kvm_vcpu_arch_shared {
  33. __u64 scratch1;
  34. __u64 scratch2;
  35. __u64 scratch3;
  36. __u64 critical; /* Guest may not get interrupts if == r1 */
  37. __u64 sprg0;
  38. __u64 sprg1;
  39. __u64 sprg2;
  40. __u64 sprg3;
  41. __u64 srr0;
  42. __u64 srr1;
  43. __u64 dar; /* dear on BookE */
  44. __u64 msr;
  45. __u32 dsisr;
  46. __u32 int_pending; /* Tells the guest if we have an interrupt */
  47. __u32 sr[16];
  48. __u32 mas0;
  49. __u32 mas1;
  50. __u64 mas7_3;
  51. __u64 mas2;
  52. __u32 mas4;
  53. __u32 mas6;
  54. __u32 esr;
  55. __u32 pir;
  56. /*
  57. * SPRG4-7 are user-readable, so we can only keep these consistent
  58. * between the shared area and the real registers when there's an
  59. * intervening exit to KVM. This also applies to SPRG3 on some
  60. * chips.
  61. *
  62. * This suffices for access by guest userspace, since in PR-mode
  63. * KVM, an exit must occur when changing the guest's MSR[PR].
  64. * If the guest kernel writes to SPRG3-7 via the shared area, it
  65. * must also use the shared area for reading while in kernel space.
  66. */
  67. __u64 sprg4;
  68. __u64 sprg5;
  69. __u64 sprg6;
  70. __u64 sprg7;
  71. };
  72. #define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
  73. #define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
  74. #include <asm/epapr_hcalls.h>
  75. #define KVM_FEATURE_MAGIC_PAGE 1
  76. /* Magic page flags from host to guest */
  77. #define KVM_MAGIC_FEAT_SR (1 << 0)
  78. /* MASn, ESR, PIR, and high SPRGs */
  79. #define KVM_MAGIC_FEAT_MAS0_TO_SPRG7 (1 << 1)
  80. /* Magic page flags from guest to host */
  81. #define MAGIC_PAGE_FLAG_NOT_MAPPED_NX (1 << 0)
  82. #endif /* _UAPI__POWERPC_KVM_PARA_H__ */