booke.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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. * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
  19. */
  20. #include <linux/errno.h>
  21. #include <linux/err.h>
  22. #include <linux/kvm_host.h>
  23. #include <linux/module.h>
  24. #include <linux/vmalloc.h>
  25. #include <linux/fs.h>
  26. #include <asm/cputable.h>
  27. #include <asm/uaccess.h>
  28. #include <asm/kvm_ppc.h>
  29. #include <asm/cacheflush.h>
  30. #include "booke.h"
  31. #include "44x_tlb.h"
  32. unsigned long kvmppc_booke_handlers;
  33. #define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM
  34. #define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
  35. struct kvm_stats_debugfs_item debugfs_entries[] = {
  36. { "mmio", VCPU_STAT(mmio_exits) },
  37. { "dcr", VCPU_STAT(dcr_exits) },
  38. { "sig", VCPU_STAT(signal_exits) },
  39. { "itlb_r", VCPU_STAT(itlb_real_miss_exits) },
  40. { "itlb_v", VCPU_STAT(itlb_virt_miss_exits) },
  41. { "dtlb_r", VCPU_STAT(dtlb_real_miss_exits) },
  42. { "dtlb_v", VCPU_STAT(dtlb_virt_miss_exits) },
  43. { "sysc", VCPU_STAT(syscall_exits) },
  44. { "isi", VCPU_STAT(isi_exits) },
  45. { "dsi", VCPU_STAT(dsi_exits) },
  46. { "inst_emu", VCPU_STAT(emulated_inst_exits) },
  47. { "dec", VCPU_STAT(dec_exits) },
  48. { "ext_intr", VCPU_STAT(ext_intr_exits) },
  49. { "halt_wakeup", VCPU_STAT(halt_wakeup) },
  50. { NULL }
  51. };
  52. /* TODO: use vcpu_printf() */
  53. void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu)
  54. {
  55. int i;
  56. printk("pc: %08lx msr: %08lx\n", vcpu->arch.pc, vcpu->arch.msr);
  57. printk("lr: %08lx ctr: %08lx\n", vcpu->arch.lr, vcpu->arch.ctr);
  58. printk("srr0: %08lx srr1: %08lx\n", vcpu->arch.srr0, vcpu->arch.srr1);
  59. printk("exceptions: %08lx\n", vcpu->arch.pending_exceptions);
  60. for (i = 0; i < 32; i += 4) {
  61. printk("gpr%02d: %08lx %08lx %08lx %08lx\n", i,
  62. vcpu->arch.gpr[i],
  63. vcpu->arch.gpr[i+1],
  64. vcpu->arch.gpr[i+2],
  65. vcpu->arch.gpr[i+3]);
  66. }
  67. }
  68. static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu,
  69. unsigned int priority)
  70. {
  71. set_bit(priority, &vcpu->arch.pending_exceptions);
  72. }
  73. void kvmppc_core_queue_program(struct kvm_vcpu *vcpu)
  74. {
  75. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_PROGRAM);
  76. }
  77. void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu)
  78. {
  79. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DECREMENTER);
  80. }
  81. int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu)
  82. {
  83. return test_bit(BOOKE_IRQPRIO_DECREMENTER, &vcpu->arch.pending_exceptions);
  84. }
  85. void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
  86. struct kvm_interrupt *irq)
  87. {
  88. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_EXTERNAL);
  89. }
  90. /* Deliver the interrupt of the corresponding priority, if possible. */
  91. static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
  92. unsigned int priority)
  93. {
  94. int allowed = 0;
  95. ulong msr_mask;
  96. switch (priority) {
  97. case BOOKE_IRQPRIO_PROGRAM:
  98. case BOOKE_IRQPRIO_DTLB_MISS:
  99. case BOOKE_IRQPRIO_ITLB_MISS:
  100. case BOOKE_IRQPRIO_SYSCALL:
  101. case BOOKE_IRQPRIO_DATA_STORAGE:
  102. case BOOKE_IRQPRIO_INST_STORAGE:
  103. case BOOKE_IRQPRIO_FP_UNAVAIL:
  104. case BOOKE_IRQPRIO_AP_UNAVAIL:
  105. case BOOKE_IRQPRIO_ALIGNMENT:
  106. allowed = 1;
  107. msr_mask = MSR_CE|MSR_ME|MSR_DE;
  108. break;
  109. case BOOKE_IRQPRIO_CRITICAL:
  110. case BOOKE_IRQPRIO_WATCHDOG:
  111. allowed = vcpu->arch.msr & MSR_CE;
  112. msr_mask = MSR_ME;
  113. break;
  114. case BOOKE_IRQPRIO_MACHINE_CHECK:
  115. allowed = vcpu->arch.msr & MSR_ME;
  116. msr_mask = 0;
  117. break;
  118. case BOOKE_IRQPRIO_EXTERNAL:
  119. case BOOKE_IRQPRIO_DECREMENTER:
  120. case BOOKE_IRQPRIO_FIT:
  121. allowed = vcpu->arch.msr & MSR_EE;
  122. msr_mask = MSR_CE|MSR_ME|MSR_DE;
  123. break;
  124. case BOOKE_IRQPRIO_DEBUG:
  125. allowed = vcpu->arch.msr & MSR_DE;
  126. msr_mask = MSR_ME;
  127. break;
  128. }
  129. if (allowed) {
  130. vcpu->arch.srr0 = vcpu->arch.pc;
  131. vcpu->arch.srr1 = vcpu->arch.msr;
  132. vcpu->arch.pc = vcpu->arch.ivpr | vcpu->arch.ivor[priority];
  133. kvmppc_set_msr(vcpu, vcpu->arch.msr & msr_mask);
  134. clear_bit(priority, &vcpu->arch.pending_exceptions);
  135. }
  136. return allowed;
  137. }
  138. /* Check pending exceptions and deliver one, if possible. */
  139. void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
  140. {
  141. unsigned long *pending = &vcpu->arch.pending_exceptions;
  142. unsigned int priority;
  143. priority = __ffs(*pending);
  144. while (priority <= BOOKE_MAX_INTERRUPT) {
  145. if (kvmppc_booke_irqprio_deliver(vcpu, priority))
  146. break;
  147. priority = find_next_bit(pending,
  148. BITS_PER_BYTE * sizeof(*pending),
  149. priority + 1);
  150. }
  151. }
  152. /**
  153. * kvmppc_handle_exit
  154. *
  155. * Return value is in the form (errcode<<2 | RESUME_FLAG_HOST | RESUME_FLAG_NV)
  156. */
  157. int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
  158. unsigned int exit_nr)
  159. {
  160. enum emulation_result er;
  161. int r = RESUME_HOST;
  162. local_irq_enable();
  163. run->exit_reason = KVM_EXIT_UNKNOWN;
  164. run->ready_for_interrupt_injection = 1;
  165. switch (exit_nr) {
  166. case BOOKE_INTERRUPT_MACHINE_CHECK:
  167. printk("MACHINE CHECK: %lx\n", mfspr(SPRN_MCSR));
  168. kvmppc_dump_vcpu(vcpu);
  169. r = RESUME_HOST;
  170. break;
  171. case BOOKE_INTERRUPT_EXTERNAL:
  172. vcpu->stat.ext_intr_exits++;
  173. if (need_resched())
  174. cond_resched();
  175. r = RESUME_GUEST;
  176. break;
  177. case BOOKE_INTERRUPT_DECREMENTER:
  178. /* Since we switched IVPR back to the host's value, the host
  179. * handled this interrupt the moment we enabled interrupts.
  180. * Now we just offer it a chance to reschedule the guest. */
  181. /* XXX At this point the TLB still holds our shadow TLB, so if
  182. * we do reschedule the host will fault over it. Perhaps we
  183. * should politely restore the host's entries to minimize
  184. * misses before ceding control. */
  185. vcpu->stat.dec_exits++;
  186. if (need_resched())
  187. cond_resched();
  188. r = RESUME_GUEST;
  189. break;
  190. case BOOKE_INTERRUPT_PROGRAM:
  191. if (vcpu->arch.msr & MSR_PR) {
  192. /* Program traps generated by user-level software must be handled
  193. * by the guest kernel. */
  194. vcpu->arch.esr = vcpu->arch.fault_esr;
  195. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_PROGRAM);
  196. r = RESUME_GUEST;
  197. break;
  198. }
  199. er = kvmppc_emulate_instruction(run, vcpu);
  200. switch (er) {
  201. case EMULATE_DONE:
  202. /* Future optimization: only reload non-volatiles if
  203. * they were actually modified by emulation. */
  204. vcpu->stat.emulated_inst_exits++;
  205. r = RESUME_GUEST_NV;
  206. break;
  207. case EMULATE_DO_DCR:
  208. run->exit_reason = KVM_EXIT_DCR;
  209. vcpu->stat.dcr_exits++;
  210. r = RESUME_HOST;
  211. break;
  212. case EMULATE_FAIL:
  213. /* XXX Deliver Program interrupt to guest. */
  214. printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n",
  215. __func__, vcpu->arch.pc, vcpu->arch.last_inst);
  216. /* For debugging, encode the failing instruction and
  217. * report it to userspace. */
  218. run->hw.hardware_exit_reason = ~0ULL << 32;
  219. run->hw.hardware_exit_reason |= vcpu->arch.last_inst;
  220. r = RESUME_HOST;
  221. break;
  222. default:
  223. BUG();
  224. }
  225. break;
  226. case BOOKE_INTERRUPT_FP_UNAVAIL:
  227. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_FP_UNAVAIL);
  228. r = RESUME_GUEST;
  229. break;
  230. case BOOKE_INTERRUPT_DATA_STORAGE:
  231. vcpu->arch.dear = vcpu->arch.fault_dear;
  232. vcpu->arch.esr = vcpu->arch.fault_esr;
  233. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DATA_STORAGE);
  234. vcpu->stat.dsi_exits++;
  235. r = RESUME_GUEST;
  236. break;
  237. case BOOKE_INTERRUPT_INST_STORAGE:
  238. vcpu->arch.esr = vcpu->arch.fault_esr;
  239. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_INST_STORAGE);
  240. vcpu->stat.isi_exits++;
  241. r = RESUME_GUEST;
  242. break;
  243. case BOOKE_INTERRUPT_SYSCALL:
  244. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_SYSCALL);
  245. vcpu->stat.syscall_exits++;
  246. r = RESUME_GUEST;
  247. break;
  248. case BOOKE_INTERRUPT_DTLB_MISS: {
  249. struct kvmppc_44x_tlbe *gtlbe;
  250. unsigned long eaddr = vcpu->arch.fault_dear;
  251. gfn_t gfn;
  252. /* Check the guest TLB. */
  253. gtlbe = kvmppc_44x_dtlb_search(vcpu, eaddr);
  254. if (!gtlbe) {
  255. /* The guest didn't have a mapping for it. */
  256. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_DTLB_MISS);
  257. vcpu->arch.dear = vcpu->arch.fault_dear;
  258. vcpu->arch.esr = vcpu->arch.fault_esr;
  259. vcpu->stat.dtlb_real_miss_exits++;
  260. r = RESUME_GUEST;
  261. break;
  262. }
  263. vcpu->arch.paddr_accessed = tlb_xlate(gtlbe, eaddr);
  264. gfn = vcpu->arch.paddr_accessed >> PAGE_SHIFT;
  265. if (kvm_is_visible_gfn(vcpu->kvm, gfn)) {
  266. /* The guest TLB had a mapping, but the shadow TLB
  267. * didn't, and it is RAM. This could be because:
  268. * a) the entry is mapping the host kernel, or
  269. * b) the guest used a large mapping which we're faking
  270. * Either way, we need to satisfy the fault without
  271. * invoking the guest. */
  272. kvmppc_mmu_map(vcpu, eaddr, gfn, gtlbe->tid,
  273. gtlbe->word2);
  274. vcpu->stat.dtlb_virt_miss_exits++;
  275. r = RESUME_GUEST;
  276. } else {
  277. /* Guest has mapped and accessed a page which is not
  278. * actually RAM. */
  279. r = kvmppc_emulate_mmio(run, vcpu);
  280. vcpu->stat.mmio_exits++;
  281. }
  282. break;
  283. }
  284. case BOOKE_INTERRUPT_ITLB_MISS: {
  285. struct kvmppc_44x_tlbe *gtlbe;
  286. unsigned long eaddr = vcpu->arch.pc;
  287. gfn_t gfn;
  288. r = RESUME_GUEST;
  289. /* Check the guest TLB. */
  290. gtlbe = kvmppc_44x_itlb_search(vcpu, eaddr);
  291. if (!gtlbe) {
  292. /* The guest didn't have a mapping for it. */
  293. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ITLB_MISS);
  294. vcpu->stat.itlb_real_miss_exits++;
  295. break;
  296. }
  297. vcpu->stat.itlb_virt_miss_exits++;
  298. gfn = tlb_xlate(gtlbe, eaddr) >> PAGE_SHIFT;
  299. if (kvm_is_visible_gfn(vcpu->kvm, gfn)) {
  300. /* The guest TLB had a mapping, but the shadow TLB
  301. * didn't. This could be because:
  302. * a) the entry is mapping the host kernel, or
  303. * b) the guest used a large mapping which we're faking
  304. * Either way, we need to satisfy the fault without
  305. * invoking the guest. */
  306. kvmppc_mmu_map(vcpu, eaddr, gfn, gtlbe->tid,
  307. gtlbe->word2);
  308. } else {
  309. /* Guest mapped and leaped at non-RAM! */
  310. kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_MACHINE_CHECK);
  311. }
  312. break;
  313. }
  314. case BOOKE_INTERRUPT_DEBUG: {
  315. u32 dbsr;
  316. vcpu->arch.pc = mfspr(SPRN_CSRR0);
  317. /* clear IAC events in DBSR register */
  318. dbsr = mfspr(SPRN_DBSR);
  319. dbsr &= DBSR_IAC1 | DBSR_IAC2 | DBSR_IAC3 | DBSR_IAC4;
  320. mtspr(SPRN_DBSR, dbsr);
  321. run->exit_reason = KVM_EXIT_DEBUG;
  322. r = RESUME_HOST;
  323. break;
  324. }
  325. default:
  326. printk(KERN_EMERG "exit_nr %d\n", exit_nr);
  327. BUG();
  328. }
  329. local_irq_disable();
  330. kvmppc_core_deliver_interrupts(vcpu);
  331. if (!(r & RESUME_HOST)) {
  332. /* To avoid clobbering exit_reason, only check for signals if
  333. * we aren't already exiting to userspace for some other
  334. * reason. */
  335. if (signal_pending(current)) {
  336. run->exit_reason = KVM_EXIT_INTR;
  337. r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
  338. vcpu->stat.signal_exits++;
  339. }
  340. }
  341. return r;
  342. }
  343. /* Initial guest state: 16MB mapping 0 -> 0, PC = 0, MSR = 0, R1 = 16MB */
  344. int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
  345. {
  346. vcpu->arch.pc = 0;
  347. vcpu->arch.msr = 0;
  348. vcpu->arch.gpr[1] = (16<<20) - 8; /* -8 for the callee-save LR slot */
  349. vcpu->arch.shadow_pid = 1;
  350. /* Eye-catching number so we know if the guest takes an interrupt
  351. * before it's programmed its own IVPR. */
  352. vcpu->arch.ivpr = 0x55550000;
  353. return kvmppc_core_vcpu_setup(vcpu);
  354. }
  355. int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
  356. {
  357. int i;
  358. regs->pc = vcpu->arch.pc;
  359. regs->cr = vcpu->arch.cr;
  360. regs->ctr = vcpu->arch.ctr;
  361. regs->lr = vcpu->arch.lr;
  362. regs->xer = vcpu->arch.xer;
  363. regs->msr = vcpu->arch.msr;
  364. regs->srr0 = vcpu->arch.srr0;
  365. regs->srr1 = vcpu->arch.srr1;
  366. regs->pid = vcpu->arch.pid;
  367. regs->sprg0 = vcpu->arch.sprg0;
  368. regs->sprg1 = vcpu->arch.sprg1;
  369. regs->sprg2 = vcpu->arch.sprg2;
  370. regs->sprg3 = vcpu->arch.sprg3;
  371. regs->sprg5 = vcpu->arch.sprg4;
  372. regs->sprg6 = vcpu->arch.sprg5;
  373. regs->sprg7 = vcpu->arch.sprg6;
  374. for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
  375. regs->gpr[i] = vcpu->arch.gpr[i];
  376. return 0;
  377. }
  378. int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
  379. {
  380. int i;
  381. vcpu->arch.pc = regs->pc;
  382. vcpu->arch.cr = regs->cr;
  383. vcpu->arch.ctr = regs->ctr;
  384. vcpu->arch.lr = regs->lr;
  385. vcpu->arch.xer = regs->xer;
  386. kvmppc_set_msr(vcpu, regs->msr);
  387. vcpu->arch.srr0 = regs->srr0;
  388. vcpu->arch.srr1 = regs->srr1;
  389. vcpu->arch.sprg0 = regs->sprg0;
  390. vcpu->arch.sprg1 = regs->sprg1;
  391. vcpu->arch.sprg2 = regs->sprg2;
  392. vcpu->arch.sprg3 = regs->sprg3;
  393. vcpu->arch.sprg5 = regs->sprg4;
  394. vcpu->arch.sprg6 = regs->sprg5;
  395. vcpu->arch.sprg7 = regs->sprg6;
  396. for (i = 0; i < ARRAY_SIZE(vcpu->arch.gpr); i++)
  397. vcpu->arch.gpr[i] = regs->gpr[i];
  398. return 0;
  399. }
  400. int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
  401. struct kvm_sregs *sregs)
  402. {
  403. return -ENOTSUPP;
  404. }
  405. int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
  406. struct kvm_sregs *sregs)
  407. {
  408. return -ENOTSUPP;
  409. }
  410. int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
  411. {
  412. return -ENOTSUPP;
  413. }
  414. int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
  415. {
  416. return -ENOTSUPP;
  417. }
  418. int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
  419. struct kvm_translation *tr)
  420. {
  421. return kvmppc_core_vcpu_translate(vcpu, tr);
  422. }
  423. int kvmppc_booke_init(void)
  424. {
  425. unsigned long ivor[16];
  426. unsigned long max_ivor = 0;
  427. int i;
  428. /* We install our own exception handlers by hijacking IVPR. IVPR must
  429. * be 16-bit aligned, so we need a 64KB allocation. */
  430. kvmppc_booke_handlers = __get_free_pages(GFP_KERNEL | __GFP_ZERO,
  431. VCPU_SIZE_ORDER);
  432. if (!kvmppc_booke_handlers)
  433. return -ENOMEM;
  434. /* XXX make sure our handlers are smaller than Linux's */
  435. /* Copy our interrupt handlers to match host IVORs. That way we don't
  436. * have to swap the IVORs on every guest/host transition. */
  437. ivor[0] = mfspr(SPRN_IVOR0);
  438. ivor[1] = mfspr(SPRN_IVOR1);
  439. ivor[2] = mfspr(SPRN_IVOR2);
  440. ivor[3] = mfspr(SPRN_IVOR3);
  441. ivor[4] = mfspr(SPRN_IVOR4);
  442. ivor[5] = mfspr(SPRN_IVOR5);
  443. ivor[6] = mfspr(SPRN_IVOR6);
  444. ivor[7] = mfspr(SPRN_IVOR7);
  445. ivor[8] = mfspr(SPRN_IVOR8);
  446. ivor[9] = mfspr(SPRN_IVOR9);
  447. ivor[10] = mfspr(SPRN_IVOR10);
  448. ivor[11] = mfspr(SPRN_IVOR11);
  449. ivor[12] = mfspr(SPRN_IVOR12);
  450. ivor[13] = mfspr(SPRN_IVOR13);
  451. ivor[14] = mfspr(SPRN_IVOR14);
  452. ivor[15] = mfspr(SPRN_IVOR15);
  453. for (i = 0; i < 16; i++) {
  454. if (ivor[i] > max_ivor)
  455. max_ivor = ivor[i];
  456. memcpy((void *)kvmppc_booke_handlers + ivor[i],
  457. kvmppc_handlers_start + i * kvmppc_handler_len,
  458. kvmppc_handler_len);
  459. }
  460. flush_icache_range(kvmppc_booke_handlers,
  461. kvmppc_booke_handlers + max_ivor + kvmppc_handler_len);
  462. return 0;
  463. }
  464. void __exit kvmppc_booke_exit(void)
  465. {
  466. free_pages(kvmppc_booke_handlers, VCPU_SIZE_ORDER);
  467. kvm_exit();
  468. }