kvm_host.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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/hrtimer.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/types.h>
  25. #include <linux/kvm_types.h>
  26. #include <linux/threads.h>
  27. #include <linux/spinlock.h>
  28. #include <linux/kvm_para.h>
  29. #include <linux/list.h>
  30. #include <linux/atomic.h>
  31. #include <asm/kvm_asm.h>
  32. #include <asm/processor.h>
  33. #include <asm/page.h>
  34. #include <asm/cacheflush.h>
  35. #define KVM_MAX_VCPUS NR_CPUS
  36. #define KVM_MAX_VCORES NR_CPUS
  37. #define KVM_USER_MEM_SLOTS 32
  38. #define KVM_MEM_SLOTS_NUM KVM_USER_MEM_SLOTS
  39. #ifdef CONFIG_KVM_MMIO
  40. #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
  41. #endif
  42. /* These values are internal and can be increased later */
  43. #define KVM_NR_IRQCHIPS 1
  44. #define KVM_IRQCHIP_NUM_PINS 256
  45. #if !defined(CONFIG_KVM_440)
  46. #include <linux/mmu_notifier.h>
  47. #define KVM_ARCH_WANT_MMU_NOTIFIER
  48. struct kvm;
  49. extern int kvm_unmap_hva(struct kvm *kvm, unsigned long hva);
  50. extern int kvm_unmap_hva_range(struct kvm *kvm,
  51. unsigned long start, unsigned long end);
  52. extern int kvm_age_hva(struct kvm *kvm, unsigned long hva);
  53. extern int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
  54. extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);
  55. #endif
  56. /* We don't currently support large pages. */
  57. #define KVM_HPAGE_GFN_SHIFT(x) 0
  58. #define KVM_NR_PAGE_SIZES 1
  59. #define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
  60. #define HPTEG_CACHE_NUM (1 << 15)
  61. #define HPTEG_HASH_BITS_PTE 13
  62. #define HPTEG_HASH_BITS_PTE_LONG 12
  63. #define HPTEG_HASH_BITS_VPTE 13
  64. #define HPTEG_HASH_BITS_VPTE_LONG 5
  65. #define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE)
  66. #define HPTEG_HASH_NUM_PTE_LONG (1 << HPTEG_HASH_BITS_PTE_LONG)
  67. #define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE)
  68. #define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG)
  69. /* Physical Address Mask - allowed range of real mode RAM access */
  70. #define KVM_PAM 0x0fffffffffffffffULL
  71. struct kvm;
  72. struct kvm_run;
  73. struct kvm_vcpu;
  74. struct lppaca;
  75. struct slb_shadow;
  76. struct dtl_entry;
  77. struct kvm_vm_stat {
  78. u32 remote_tlb_flush;
  79. };
  80. struct kvm_vcpu_stat {
  81. u32 sum_exits;
  82. u32 mmio_exits;
  83. u32 dcr_exits;
  84. u32 signal_exits;
  85. u32 light_exits;
  86. /* Account for special types of light exits: */
  87. u32 itlb_real_miss_exits;
  88. u32 itlb_virt_miss_exits;
  89. u32 dtlb_real_miss_exits;
  90. u32 dtlb_virt_miss_exits;
  91. u32 syscall_exits;
  92. u32 isi_exits;
  93. u32 dsi_exits;
  94. u32 emulated_inst_exits;
  95. u32 dec_exits;
  96. u32 ext_intr_exits;
  97. u32 halt_wakeup;
  98. u32 dbell_exits;
  99. u32 gdbell_exits;
  100. #ifdef CONFIG_PPC_BOOK3S
  101. u32 pf_storage;
  102. u32 pf_instruc;
  103. u32 sp_storage;
  104. u32 sp_instruc;
  105. u32 queue_intr;
  106. u32 ld;
  107. u32 ld_slow;
  108. u32 st;
  109. u32 st_slow;
  110. #endif
  111. };
  112. enum kvm_exit_types {
  113. MMIO_EXITS,
  114. DCR_EXITS,
  115. SIGNAL_EXITS,
  116. ITLB_REAL_MISS_EXITS,
  117. ITLB_VIRT_MISS_EXITS,
  118. DTLB_REAL_MISS_EXITS,
  119. DTLB_VIRT_MISS_EXITS,
  120. SYSCALL_EXITS,
  121. ISI_EXITS,
  122. DSI_EXITS,
  123. EMULATED_INST_EXITS,
  124. EMULATED_MTMSRWE_EXITS,
  125. EMULATED_WRTEE_EXITS,
  126. EMULATED_MTSPR_EXITS,
  127. EMULATED_MFSPR_EXITS,
  128. EMULATED_MTMSR_EXITS,
  129. EMULATED_MFMSR_EXITS,
  130. EMULATED_TLBSX_EXITS,
  131. EMULATED_TLBWE_EXITS,
  132. EMULATED_RFI_EXITS,
  133. EMULATED_RFCI_EXITS,
  134. DEC_EXITS,
  135. EXT_INTR_EXITS,
  136. HALT_WAKEUP,
  137. USR_PR_INST,
  138. FP_UNAVAIL,
  139. DEBUG_EXITS,
  140. TIMEINGUEST,
  141. DBELL_EXITS,
  142. GDBELL_EXITS,
  143. __NUMBER_OF_KVM_EXIT_TYPES
  144. };
  145. /* allow access to big endian 32bit upper/lower parts and 64bit var */
  146. struct kvmppc_exit_timing {
  147. union {
  148. u64 tv64;
  149. struct {
  150. u32 tbu, tbl;
  151. } tv32;
  152. };
  153. };
  154. struct kvmppc_pginfo {
  155. unsigned long pfn;
  156. atomic_t refcnt;
  157. };
  158. struct kvmppc_spapr_tce_table {
  159. struct list_head list;
  160. struct kvm *kvm;
  161. u64 liobn;
  162. u32 window_size;
  163. struct page *pages[0];
  164. };
  165. struct kvmppc_linear_info {
  166. void *base_virt;
  167. unsigned long base_pfn;
  168. unsigned long npages;
  169. struct list_head list;
  170. atomic_t use_count;
  171. int type;
  172. };
  173. /* XICS components, defined in book3s_xics.c */
  174. struct kvmppc_xics;
  175. struct kvmppc_icp;
  176. /*
  177. * The reverse mapping array has one entry for each HPTE,
  178. * which stores the guest's view of the second word of the HPTE
  179. * (including the guest physical address of the mapping),
  180. * plus forward and backward pointers in a doubly-linked ring
  181. * of HPTEs that map the same host page. The pointers in this
  182. * ring are 32-bit HPTE indexes, to save space.
  183. */
  184. struct revmap_entry {
  185. unsigned long guest_rpte;
  186. unsigned int forw, back;
  187. };
  188. /*
  189. * We use the top bit of each memslot->arch.rmap entry as a lock bit,
  190. * and bit 32 as a present flag. The bottom 32 bits are the
  191. * index in the guest HPT of a HPTE that points to the page.
  192. */
  193. #define KVMPPC_RMAP_LOCK_BIT 63
  194. #define KVMPPC_RMAP_RC_SHIFT 32
  195. #define KVMPPC_RMAP_REFERENCED (HPTE_R_R << KVMPPC_RMAP_RC_SHIFT)
  196. #define KVMPPC_RMAP_CHANGED (HPTE_R_C << KVMPPC_RMAP_RC_SHIFT)
  197. #define KVMPPC_RMAP_PRESENT 0x100000000ul
  198. #define KVMPPC_RMAP_INDEX 0xfffffffful
  199. /* Low-order bits in memslot->arch.slot_phys[] */
  200. #define KVMPPC_PAGE_ORDER_MASK 0x1f
  201. #define KVMPPC_PAGE_NO_CACHE HPTE_R_I /* 0x20 */
  202. #define KVMPPC_PAGE_WRITETHRU HPTE_R_W /* 0x40 */
  203. #define KVMPPC_GOT_PAGE 0x80
  204. struct kvm_arch_memory_slot {
  205. #ifdef CONFIG_KVM_BOOK3S_64_HV
  206. unsigned long *rmap;
  207. unsigned long *slot_phys;
  208. #endif /* CONFIG_KVM_BOOK3S_64_HV */
  209. };
  210. struct kvm_arch {
  211. unsigned int lpid;
  212. #ifdef CONFIG_KVM_BOOK3S_64_HV
  213. unsigned long hpt_virt;
  214. struct revmap_entry *revmap;
  215. unsigned int host_lpid;
  216. unsigned long host_lpcr;
  217. unsigned long sdr1;
  218. unsigned long host_sdr1;
  219. int tlbie_lock;
  220. unsigned long lpcr;
  221. unsigned long rmor;
  222. struct kvmppc_linear_info *rma;
  223. unsigned long vrma_slb_v;
  224. int rma_setup_done;
  225. int using_mmu_notifiers;
  226. u32 hpt_order;
  227. atomic_t vcpus_running;
  228. u32 online_vcores;
  229. unsigned long hpt_npte;
  230. unsigned long hpt_mask;
  231. atomic_t hpte_mod_interest;
  232. spinlock_t slot_phys_lock;
  233. cpumask_t need_tlb_flush;
  234. struct kvmppc_vcore *vcores[KVM_MAX_VCORES];
  235. struct kvmppc_linear_info *hpt_li;
  236. #endif /* CONFIG_KVM_BOOK3S_64_HV */
  237. #ifdef CONFIG_PPC_BOOK3S_64
  238. struct list_head spapr_tce_tables;
  239. struct list_head rtas_tokens;
  240. #endif
  241. #ifdef CONFIG_KVM_MPIC
  242. struct openpic *mpic;
  243. #endif
  244. #ifdef CONFIG_KVM_XICS
  245. struct kvmppc_xics *xics;
  246. #endif
  247. };
  248. /*
  249. * Struct for a virtual core.
  250. * Note: entry_exit_count combines an entry count in the bottom 8 bits
  251. * and an exit count in the next 8 bits. This is so that we can
  252. * atomically increment the entry count iff the exit count is 0
  253. * without taking the lock.
  254. */
  255. struct kvmppc_vcore {
  256. int n_runnable;
  257. int n_busy;
  258. int num_threads;
  259. int entry_exit_count;
  260. int n_woken;
  261. int nap_count;
  262. int napping_threads;
  263. u16 pcpu;
  264. u16 last_cpu;
  265. u8 vcore_state;
  266. u8 in_guest;
  267. struct list_head runnable_threads;
  268. spinlock_t lock;
  269. wait_queue_head_t wq;
  270. u64 stolen_tb;
  271. u64 preempt_tb;
  272. struct kvm_vcpu *runner;
  273. };
  274. #define VCORE_ENTRY_COUNT(vc) ((vc)->entry_exit_count & 0xff)
  275. #define VCORE_EXIT_COUNT(vc) ((vc)->entry_exit_count >> 8)
  276. /* Values for vcore_state */
  277. #define VCORE_INACTIVE 0
  278. #define VCORE_SLEEPING 1
  279. #define VCORE_STARTING 2
  280. #define VCORE_RUNNING 3
  281. #define VCORE_EXITING 4
  282. /*
  283. * Struct used to manage memory for a virtual processor area
  284. * registered by a PAPR guest. There are three types of area
  285. * that a guest can register.
  286. */
  287. struct kvmppc_vpa {
  288. unsigned long gpa; /* Current guest phys addr */
  289. void *pinned_addr; /* Address in kernel linear mapping */
  290. void *pinned_end; /* End of region */
  291. unsigned long next_gpa; /* Guest phys addr for update */
  292. unsigned long len; /* Number of bytes required */
  293. u8 update_pending; /* 1 => update pinned_addr from next_gpa */
  294. bool dirty; /* true => area has been modified by kernel */
  295. };
  296. struct kvmppc_pte {
  297. ulong eaddr;
  298. u64 vpage;
  299. ulong raddr;
  300. bool may_read : 1;
  301. bool may_write : 1;
  302. bool may_execute : 1;
  303. };
  304. struct kvmppc_mmu {
  305. /* book3s_64 only */
  306. void (*slbmte)(struct kvm_vcpu *vcpu, u64 rb, u64 rs);
  307. u64 (*slbmfee)(struct kvm_vcpu *vcpu, u64 slb_nr);
  308. u64 (*slbmfev)(struct kvm_vcpu *vcpu, u64 slb_nr);
  309. void (*slbie)(struct kvm_vcpu *vcpu, u64 slb_nr);
  310. void (*slbia)(struct kvm_vcpu *vcpu);
  311. /* book3s */
  312. void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value);
  313. u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum);
  314. int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data);
  315. void (*reset_msr)(struct kvm_vcpu *vcpu);
  316. void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large);
  317. int (*esid_to_vsid)(struct kvm_vcpu *vcpu, ulong esid, u64 *vsid);
  318. u64 (*ea_to_vp)(struct kvm_vcpu *vcpu, gva_t eaddr, bool data);
  319. bool (*is_dcbz32)(struct kvm_vcpu *vcpu);
  320. };
  321. struct kvmppc_slb {
  322. u64 esid;
  323. u64 vsid;
  324. u64 orige;
  325. u64 origv;
  326. bool valid : 1;
  327. bool Ks : 1;
  328. bool Kp : 1;
  329. bool nx : 1;
  330. bool large : 1; /* PTEs are 16MB */
  331. bool tb : 1; /* 1TB segment */
  332. bool class : 1;
  333. };
  334. # ifdef CONFIG_PPC_FSL_BOOK3E
  335. #define KVMPPC_BOOKE_IAC_NUM 2
  336. #define KVMPPC_BOOKE_DAC_NUM 2
  337. # else
  338. #define KVMPPC_BOOKE_IAC_NUM 4
  339. #define KVMPPC_BOOKE_DAC_NUM 2
  340. # endif
  341. #define KVMPPC_BOOKE_MAX_IAC 4
  342. #define KVMPPC_BOOKE_MAX_DAC 2
  343. /* KVMPPC_EPR_USER takes precedence over KVMPPC_EPR_KERNEL */
  344. #define KVMPPC_EPR_NONE 0 /* EPR not supported */
  345. #define KVMPPC_EPR_USER 1 /* exit to userspace to fill EPR */
  346. #define KVMPPC_EPR_KERNEL 2 /* in-kernel irqchip */
  347. struct kvmppc_booke_debug_reg {
  348. u32 dbcr0;
  349. u32 dbcr1;
  350. u32 dbcr2;
  351. #ifdef CONFIG_KVM_E500MC
  352. u32 dbcr4;
  353. #endif
  354. u64 iac[KVMPPC_BOOKE_MAX_IAC];
  355. u64 dac[KVMPPC_BOOKE_MAX_DAC];
  356. };
  357. #define KVMPPC_IRQ_DEFAULT 0
  358. #define KVMPPC_IRQ_MPIC 1
  359. #define KVMPPC_IRQ_XICS 2
  360. struct openpic;
  361. struct kvm_vcpu_arch {
  362. ulong host_stack;
  363. u32 host_pid;
  364. #ifdef CONFIG_PPC_BOOK3S
  365. struct kvmppc_slb slb[64];
  366. int slb_max; /* 1 + index of last valid entry in slb[] */
  367. int slb_nr; /* total number of entries in SLB */
  368. struct kvmppc_mmu mmu;
  369. #endif
  370. ulong gpr[32];
  371. u64 fpr[32];
  372. u64 fpscr;
  373. #ifdef CONFIG_SPE
  374. ulong evr[32];
  375. ulong spefscr;
  376. ulong host_spefscr;
  377. u64 acc;
  378. #endif
  379. #ifdef CONFIG_ALTIVEC
  380. vector128 vr[32];
  381. vector128 vscr;
  382. #endif
  383. #ifdef CONFIG_VSX
  384. u64 vsr[64];
  385. #endif
  386. #ifdef CONFIG_KVM_BOOKE_HV
  387. u32 host_mas4;
  388. u32 host_mas6;
  389. u32 shadow_epcr;
  390. u32 shadow_msrp;
  391. u32 eplc;
  392. u32 epsc;
  393. u32 oldpir;
  394. #endif
  395. #if defined(CONFIG_BOOKE)
  396. #if defined(CONFIG_KVM_BOOKE_HV) || defined(CONFIG_64BIT)
  397. u32 epcr;
  398. #endif
  399. #endif
  400. #ifdef CONFIG_PPC_BOOK3S
  401. /* For Gekko paired singles */
  402. u32 qpr[32];
  403. #endif
  404. ulong pc;
  405. ulong ctr;
  406. ulong lr;
  407. ulong xer;
  408. u32 cr;
  409. #ifdef CONFIG_PPC_BOOK3S
  410. ulong hflags;
  411. ulong guest_owned_ext;
  412. ulong purr;
  413. ulong spurr;
  414. ulong dscr;
  415. ulong amr;
  416. ulong uamor;
  417. u32 ctrl;
  418. ulong dabr;
  419. ulong cfar;
  420. #endif
  421. u32 vrsave; /* also USPRG0 */
  422. u32 mmucr;
  423. /* shadow_msr is unused for BookE HV */
  424. ulong shadow_msr;
  425. ulong csrr0;
  426. ulong csrr1;
  427. ulong dsrr0;
  428. ulong dsrr1;
  429. ulong mcsrr0;
  430. ulong mcsrr1;
  431. ulong mcsr;
  432. u32 dec;
  433. #ifdef CONFIG_BOOKE
  434. u32 decar;
  435. #endif
  436. u32 tbl;
  437. u32 tbu;
  438. u32 tcr;
  439. ulong tsr; /* we need to perform set/clr_bits() which requires ulong */
  440. u32 ivor[64];
  441. ulong ivpr;
  442. u32 pvr;
  443. u32 shadow_pid;
  444. u32 shadow_pid1;
  445. u32 pid;
  446. u32 swap_pid;
  447. u32 ccr0;
  448. u32 ccr1;
  449. u32 dbsr;
  450. u64 mmcr[3];
  451. u32 pmc[8];
  452. #ifdef CONFIG_KVM_EXIT_TIMING
  453. struct mutex exit_timing_lock;
  454. struct kvmppc_exit_timing timing_exit;
  455. struct kvmppc_exit_timing timing_last_enter;
  456. u32 last_exit_type;
  457. u32 timing_count_type[__NUMBER_OF_KVM_EXIT_TYPES];
  458. u64 timing_sum_duration[__NUMBER_OF_KVM_EXIT_TYPES];
  459. u64 timing_sum_quad_duration[__NUMBER_OF_KVM_EXIT_TYPES];
  460. u64 timing_min_duration[__NUMBER_OF_KVM_EXIT_TYPES];
  461. u64 timing_max_duration[__NUMBER_OF_KVM_EXIT_TYPES];
  462. u64 timing_last_exit;
  463. struct dentry *debugfs_exit_timing;
  464. #endif
  465. #ifdef CONFIG_PPC_BOOK3S
  466. ulong fault_dar;
  467. u32 fault_dsisr;
  468. #endif
  469. #ifdef CONFIG_BOOKE
  470. ulong fault_dear;
  471. ulong fault_esr;
  472. ulong queued_dear;
  473. ulong queued_esr;
  474. spinlock_t wdt_lock;
  475. struct timer_list wdt_timer;
  476. u32 tlbcfg[4];
  477. u32 tlbps[4];
  478. u32 mmucfg;
  479. u32 eptcfg;
  480. u32 epr;
  481. u32 crit_save;
  482. struct kvmppc_booke_debug_reg dbg_reg;
  483. #endif
  484. gpa_t paddr_accessed;
  485. gva_t vaddr_accessed;
  486. u8 io_gpr; /* GPR used as IO source/target */
  487. u8 mmio_is_bigendian;
  488. u8 mmio_sign_extend;
  489. u8 dcr_needed;
  490. u8 dcr_is_write;
  491. u8 osi_needed;
  492. u8 osi_enabled;
  493. u8 papr_enabled;
  494. u8 watchdog_enabled;
  495. u8 sane;
  496. u8 cpu_type;
  497. u8 hcall_needed;
  498. u8 epr_flags; /* KVMPPC_EPR_xxx */
  499. u8 epr_needed;
  500. u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
  501. struct hrtimer dec_timer;
  502. struct tasklet_struct tasklet;
  503. u64 dec_jiffies;
  504. u64 dec_expires;
  505. unsigned long pending_exceptions;
  506. u8 ceded;
  507. u8 prodded;
  508. u32 last_inst;
  509. wait_queue_head_t *wqp;
  510. struct kvmppc_vcore *vcore;
  511. int ret;
  512. int trap;
  513. int state;
  514. int ptid;
  515. bool timer_running;
  516. wait_queue_head_t cpu_run;
  517. struct kvm_vcpu_arch_shared *shared;
  518. unsigned long magic_page_pa; /* phys addr to map the magic page to */
  519. unsigned long magic_page_ea; /* effect. addr to map the magic page to */
  520. int irq_type; /* one of KVM_IRQ_* */
  521. int irq_cpu_id;
  522. struct openpic *mpic; /* KVM_IRQ_MPIC */
  523. #ifdef CONFIG_KVM_XICS
  524. struct kvmppc_icp *icp; /* XICS presentation controller */
  525. #endif
  526. #ifdef CONFIG_KVM_BOOK3S_64_HV
  527. struct kvm_vcpu_arch_shared shregs;
  528. unsigned long pgfault_addr;
  529. long pgfault_index;
  530. unsigned long pgfault_hpte[2];
  531. struct list_head run_list;
  532. struct task_struct *run_task;
  533. struct kvm_run *kvm_run;
  534. pgd_t *pgdir;
  535. spinlock_t vpa_update_lock;
  536. struct kvmppc_vpa vpa;
  537. struct kvmppc_vpa dtl;
  538. struct dtl_entry *dtl_ptr;
  539. unsigned long dtl_index;
  540. u64 stolen_logged;
  541. struct kvmppc_vpa slb_shadow;
  542. spinlock_t tbacct_lock;
  543. u64 busy_stolen;
  544. u64 busy_preempt;
  545. #endif
  546. };
  547. /* Values for vcpu->arch.state */
  548. #define KVMPPC_VCPU_NOTREADY 0
  549. #define KVMPPC_VCPU_RUNNABLE 1
  550. #define KVMPPC_VCPU_BUSY_IN_HOST 2
  551. /* Values for vcpu->arch.io_gpr */
  552. #define KVM_MMIO_REG_MASK 0x001f
  553. #define KVM_MMIO_REG_EXT_MASK 0xffe0
  554. #define KVM_MMIO_REG_GPR 0x0000
  555. #define KVM_MMIO_REG_FPR 0x0020
  556. #define KVM_MMIO_REG_QPR 0x0040
  557. #define KVM_MMIO_REG_FQPR 0x0060
  558. #define __KVM_HAVE_ARCH_WQP
  559. #define __KVM_HAVE_CREATE_DEVICE
  560. #endif /* __POWERPC_KVM_HOST_H__ */