kvm_host.h 14 KB

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