kvm_host.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. 2007
  16. *
  17. * Authors: Hollis Blanchard <hollisb@us.ibm.com>
  18. */
  19. #ifndef __POWERPC_KVM_HOST_H__
  20. #define __POWERPC_KVM_HOST_H__
  21. #include <linux/mutex.h>
  22. #include <linux/timer.h>
  23. #include <linux/types.h>
  24. #include <linux/kvm_types.h>
  25. #include <asm/kvm_asm.h>
  26. #define KVM_MAX_VCPUS 1
  27. #define KVM_MEMORY_SLOTS 32
  28. /* memory slots that does not exposed to userspace */
  29. #define KVM_PRIVATE_MEM_SLOTS 4
  30. /* We don't currently support large pages. */
  31. #define KVM_PAGES_PER_HPAGE (1<<31)
  32. struct kvm;
  33. struct kvm_run;
  34. struct kvm_vcpu;
  35. struct kvm_vm_stat {
  36. u32 remote_tlb_flush;
  37. };
  38. struct kvm_vcpu_stat {
  39. u32 sum_exits;
  40. u32 mmio_exits;
  41. u32 dcr_exits;
  42. u32 signal_exits;
  43. u32 light_exits;
  44. /* Account for special types of light exits: */
  45. u32 itlb_real_miss_exits;
  46. u32 itlb_virt_miss_exits;
  47. u32 dtlb_real_miss_exits;
  48. u32 dtlb_virt_miss_exits;
  49. u32 syscall_exits;
  50. u32 isi_exits;
  51. u32 dsi_exits;
  52. u32 emulated_inst_exits;
  53. u32 dec_exits;
  54. u32 ext_intr_exits;
  55. u32 halt_wakeup;
  56. };
  57. struct tlbe {
  58. u32 tid; /* Only the low 8 bits are used. */
  59. u32 word0;
  60. u32 word1;
  61. u32 word2;
  62. };
  63. struct kvm_arch {
  64. };
  65. struct kvm_vcpu_arch {
  66. /* Unmodified copy of the guest's TLB. */
  67. struct tlbe guest_tlb[PPC44x_TLB_SIZE];
  68. /* TLB that's actually used when the guest is running. */
  69. struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
  70. /* Pages which are referenced in the shadow TLB. */
  71. struct page *shadow_pages[PPC44x_TLB_SIZE];
  72. /* Copy of the host's TLB. */
  73. struct tlbe host_tlb[PPC44x_TLB_SIZE];
  74. u32 host_stack;
  75. u32 host_pid;
  76. u64 fpr[32];
  77. u32 gpr[32];
  78. u32 pc;
  79. u32 cr;
  80. u32 ctr;
  81. u32 lr;
  82. u32 xer;
  83. u32 msr;
  84. u32 mmucr;
  85. u32 sprg0;
  86. u32 sprg1;
  87. u32 sprg2;
  88. u32 sprg3;
  89. u32 sprg4;
  90. u32 sprg5;
  91. u32 sprg6;
  92. u32 sprg7;
  93. u32 srr0;
  94. u32 srr1;
  95. u32 csrr0;
  96. u32 csrr1;
  97. u32 dsrr0;
  98. u32 dsrr1;
  99. u32 dear;
  100. u32 esr;
  101. u32 dec;
  102. u32 decar;
  103. u32 tbl;
  104. u32 tbu;
  105. u32 tcr;
  106. u32 tsr;
  107. u32 ivor[16];
  108. u32 ivpr;
  109. u32 pir;
  110. u32 pid;
  111. u32 pvr;
  112. u32 ccr0;
  113. u32 ccr1;
  114. u32 dbcr0;
  115. u32 dbcr1;
  116. u32 last_inst;
  117. u32 fault_dear;
  118. u32 fault_esr;
  119. gpa_t paddr_accessed;
  120. u8 io_gpr; /* GPR used as IO source/target */
  121. u8 mmio_is_bigendian;
  122. u8 dcr_needed;
  123. u8 dcr_is_write;
  124. u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
  125. struct timer_list dec_timer;
  126. unsigned long pending_exceptions;
  127. };
  128. struct kvm_guest_debug {
  129. int enabled;
  130. unsigned long bp[4];
  131. int singlestep;
  132. };
  133. #endif /* __POWERPC_KVM_HOST_H__ */