powerpc.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  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/hrtimer.h>
  26. #include <linux/fs.h>
  27. #include <linux/slab.h>
  28. #include <asm/cputable.h>
  29. #include <asm/uaccess.h>
  30. #include <asm/kvm_ppc.h>
  31. #include <asm/tlbflush.h>
  32. #include "timing.h"
  33. #include "../mm/mmu_decl.h"
  34. #define CREATE_TRACE_POINTS
  35. #include "trace.h"
  36. int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
  37. {
  38. return !(v->arch.shared->msr & MSR_WE) ||
  39. !!(v->arch.pending_exceptions);
  40. }
  41. int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
  42. {
  43. int nr = kvmppc_get_gpr(vcpu, 11);
  44. int r;
  45. unsigned long __maybe_unused param1 = kvmppc_get_gpr(vcpu, 3);
  46. unsigned long __maybe_unused param2 = kvmppc_get_gpr(vcpu, 4);
  47. unsigned long __maybe_unused param3 = kvmppc_get_gpr(vcpu, 5);
  48. unsigned long __maybe_unused param4 = kvmppc_get_gpr(vcpu, 6);
  49. unsigned long r2 = 0;
  50. if (!(vcpu->arch.shared->msr & MSR_SF)) {
  51. /* 32 bit mode */
  52. param1 &= 0xffffffff;
  53. param2 &= 0xffffffff;
  54. param3 &= 0xffffffff;
  55. param4 &= 0xffffffff;
  56. }
  57. switch (nr) {
  58. case HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE:
  59. {
  60. vcpu->arch.magic_page_pa = param1;
  61. vcpu->arch.magic_page_ea = param2;
  62. r2 = KVM_MAGIC_FEAT_SR;
  63. r = HC_EV_SUCCESS;
  64. break;
  65. }
  66. case HC_VENDOR_KVM | KVM_HC_FEATURES:
  67. r = HC_EV_SUCCESS;
  68. #if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500)
  69. /* XXX Missing magic page on 44x */
  70. r2 |= (1 << KVM_FEATURE_MAGIC_PAGE);
  71. #endif
  72. /* Second return value is in r4 */
  73. break;
  74. default:
  75. r = HC_EV_UNIMPLEMENTED;
  76. break;
  77. }
  78. kvmppc_set_gpr(vcpu, 4, r2);
  79. return r;
  80. }
  81. int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
  82. {
  83. enum emulation_result er;
  84. int r;
  85. er = kvmppc_emulate_instruction(run, vcpu);
  86. switch (er) {
  87. case EMULATE_DONE:
  88. /* Future optimization: only reload non-volatiles if they were
  89. * actually modified. */
  90. r = RESUME_GUEST_NV;
  91. break;
  92. case EMULATE_DO_MMIO:
  93. run->exit_reason = KVM_EXIT_MMIO;
  94. /* We must reload nonvolatiles because "update" load/store
  95. * instructions modify register state. */
  96. /* Future optimization: only reload non-volatiles if they were
  97. * actually modified. */
  98. r = RESUME_HOST_NV;
  99. break;
  100. case EMULATE_FAIL:
  101. /* XXX Deliver Program interrupt to guest. */
  102. printk(KERN_EMERG "%s: emulation failed (%08x)\n", __func__,
  103. kvmppc_get_last_inst(vcpu));
  104. r = RESUME_HOST;
  105. break;
  106. default:
  107. BUG();
  108. }
  109. return r;
  110. }
  111. int kvm_arch_hardware_enable(void *garbage)
  112. {
  113. return 0;
  114. }
  115. void kvm_arch_hardware_disable(void *garbage)
  116. {
  117. }
  118. int kvm_arch_hardware_setup(void)
  119. {
  120. return 0;
  121. }
  122. void kvm_arch_hardware_unsetup(void)
  123. {
  124. }
  125. void kvm_arch_check_processor_compat(void *rtn)
  126. {
  127. *(int *)rtn = kvmppc_core_check_processor_compat();
  128. }
  129. int kvm_arch_init_vm(struct kvm *kvm)
  130. {
  131. return kvmppc_core_init_vm(kvm);
  132. }
  133. void kvm_arch_destroy_vm(struct kvm *kvm)
  134. {
  135. unsigned int i;
  136. struct kvm_vcpu *vcpu;
  137. kvm_for_each_vcpu(i, vcpu, kvm)
  138. kvm_arch_vcpu_free(vcpu);
  139. mutex_lock(&kvm->lock);
  140. for (i = 0; i < atomic_read(&kvm->online_vcpus); i++)
  141. kvm->vcpus[i] = NULL;
  142. atomic_set(&kvm->online_vcpus, 0);
  143. kvmppc_core_destroy_vm(kvm);
  144. mutex_unlock(&kvm->lock);
  145. }
  146. void kvm_arch_sync_events(struct kvm *kvm)
  147. {
  148. }
  149. int kvm_dev_ioctl_check_extension(long ext)
  150. {
  151. int r;
  152. switch (ext) {
  153. #ifdef CONFIG_BOOKE
  154. case KVM_CAP_PPC_BOOKE_SREGS:
  155. #else
  156. case KVM_CAP_PPC_SEGSTATE:
  157. #endif
  158. case KVM_CAP_PPC_PAIRED_SINGLES:
  159. case KVM_CAP_PPC_UNSET_IRQ:
  160. case KVM_CAP_PPC_IRQ_LEVEL:
  161. case KVM_CAP_ENABLE_CAP:
  162. case KVM_CAP_PPC_OSI:
  163. case KVM_CAP_PPC_GET_PVINFO:
  164. r = 1;
  165. break;
  166. case KVM_CAP_COALESCED_MMIO:
  167. r = KVM_COALESCED_MMIO_PAGE_OFFSET;
  168. break;
  169. default:
  170. r = 0;
  171. break;
  172. }
  173. return r;
  174. }
  175. long kvm_arch_dev_ioctl(struct file *filp,
  176. unsigned int ioctl, unsigned long arg)
  177. {
  178. return -EINVAL;
  179. }
  180. int kvm_arch_prepare_memory_region(struct kvm *kvm,
  181. struct kvm_memory_slot *memslot,
  182. struct kvm_memory_slot old,
  183. struct kvm_userspace_memory_region *mem,
  184. int user_alloc)
  185. {
  186. return kvmppc_core_prepare_memory_region(kvm, mem);
  187. }
  188. void kvm_arch_commit_memory_region(struct kvm *kvm,
  189. struct kvm_userspace_memory_region *mem,
  190. struct kvm_memory_slot old,
  191. int user_alloc)
  192. {
  193. kvmppc_core_commit_memory_region(kvm, mem);
  194. }
  195. void kvm_arch_flush_shadow(struct kvm *kvm)
  196. {
  197. }
  198. struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
  199. {
  200. struct kvm_vcpu *vcpu;
  201. vcpu = kvmppc_core_vcpu_create(kvm, id);
  202. if (!IS_ERR(vcpu))
  203. kvmppc_create_vcpu_debugfs(vcpu, id);
  204. return vcpu;
  205. }
  206. void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
  207. {
  208. /* Make sure we're not using the vcpu anymore */
  209. hrtimer_cancel(&vcpu->arch.dec_timer);
  210. tasklet_kill(&vcpu->arch.tasklet);
  211. kvmppc_remove_vcpu_debugfs(vcpu);
  212. kvmppc_core_vcpu_free(vcpu);
  213. }
  214. void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
  215. {
  216. kvm_arch_vcpu_free(vcpu);
  217. }
  218. int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
  219. {
  220. return kvmppc_core_pending_dec(vcpu);
  221. }
  222. static void kvmppc_decrementer_func(unsigned long data)
  223. {
  224. struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data;
  225. kvmppc_core_queue_dec(vcpu);
  226. if (waitqueue_active(&vcpu->wq)) {
  227. wake_up_interruptible(&vcpu->wq);
  228. vcpu->stat.halt_wakeup++;
  229. }
  230. }
  231. /*
  232. * low level hrtimer wake routine. Because this runs in hardirq context
  233. * we schedule a tasklet to do the real work.
  234. */
  235. enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer)
  236. {
  237. struct kvm_vcpu *vcpu;
  238. vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer);
  239. tasklet_schedule(&vcpu->arch.tasklet);
  240. return HRTIMER_NORESTART;
  241. }
  242. int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
  243. {
  244. hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
  245. tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
  246. vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
  247. #ifdef CONFIG_KVM_EXIT_TIMING
  248. mutex_init(&vcpu->arch.exit_timing_lock);
  249. #endif
  250. return 0;
  251. }
  252. void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
  253. {
  254. kvmppc_mmu_destroy(vcpu);
  255. }
  256. void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
  257. {
  258. #ifdef CONFIG_BOOKE
  259. /*
  260. * vrsave (formerly usprg0) isn't used by Linux, but may
  261. * be used by the guest.
  262. *
  263. * On non-booke this is associated with Altivec and
  264. * is handled by code in book3s.c.
  265. */
  266. mtspr(SPRN_VRSAVE, vcpu->arch.vrsave);
  267. #endif
  268. kvmppc_core_vcpu_load(vcpu, cpu);
  269. }
  270. void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
  271. {
  272. kvmppc_core_vcpu_put(vcpu);
  273. #ifdef CONFIG_BOOKE
  274. vcpu->arch.vrsave = mfspr(SPRN_VRSAVE);
  275. #endif
  276. }
  277. int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
  278. struct kvm_guest_debug *dbg)
  279. {
  280. return -EINVAL;
  281. }
  282. static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu,
  283. struct kvm_run *run)
  284. {
  285. kvmppc_set_gpr(vcpu, vcpu->arch.io_gpr, run->dcr.data);
  286. }
  287. static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
  288. struct kvm_run *run)
  289. {
  290. u64 uninitialized_var(gpr);
  291. if (run->mmio.len > sizeof(gpr)) {
  292. printk(KERN_ERR "bad MMIO length: %d\n", run->mmio.len);
  293. return;
  294. }
  295. if (vcpu->arch.mmio_is_bigendian) {
  296. switch (run->mmio.len) {
  297. case 8: gpr = *(u64 *)run->mmio.data; break;
  298. case 4: gpr = *(u32 *)run->mmio.data; break;
  299. case 2: gpr = *(u16 *)run->mmio.data; break;
  300. case 1: gpr = *(u8 *)run->mmio.data; break;
  301. }
  302. } else {
  303. /* Convert BE data from userland back to LE. */
  304. switch (run->mmio.len) {
  305. case 4: gpr = ld_le32((u32 *)run->mmio.data); break;
  306. case 2: gpr = ld_le16((u16 *)run->mmio.data); break;
  307. case 1: gpr = *(u8 *)run->mmio.data; break;
  308. }
  309. }
  310. if (vcpu->arch.mmio_sign_extend) {
  311. switch (run->mmio.len) {
  312. #ifdef CONFIG_PPC64
  313. case 4:
  314. gpr = (s64)(s32)gpr;
  315. break;
  316. #endif
  317. case 2:
  318. gpr = (s64)(s16)gpr;
  319. break;
  320. case 1:
  321. gpr = (s64)(s8)gpr;
  322. break;
  323. }
  324. }
  325. kvmppc_set_gpr(vcpu, vcpu->arch.io_gpr, gpr);
  326. switch (vcpu->arch.io_gpr & KVM_REG_EXT_MASK) {
  327. case KVM_REG_GPR:
  328. kvmppc_set_gpr(vcpu, vcpu->arch.io_gpr, gpr);
  329. break;
  330. case KVM_REG_FPR:
  331. vcpu->arch.fpr[vcpu->arch.io_gpr & KVM_REG_MASK] = gpr;
  332. break;
  333. #ifdef CONFIG_PPC_BOOK3S
  334. case KVM_REG_QPR:
  335. vcpu->arch.qpr[vcpu->arch.io_gpr & KVM_REG_MASK] = gpr;
  336. break;
  337. case KVM_REG_FQPR:
  338. vcpu->arch.fpr[vcpu->arch.io_gpr & KVM_REG_MASK] = gpr;
  339. vcpu->arch.qpr[vcpu->arch.io_gpr & KVM_REG_MASK] = gpr;
  340. break;
  341. #endif
  342. default:
  343. BUG();
  344. }
  345. }
  346. int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
  347. unsigned int rt, unsigned int bytes, int is_bigendian)
  348. {
  349. if (bytes > sizeof(run->mmio.data)) {
  350. printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__,
  351. run->mmio.len);
  352. }
  353. run->mmio.phys_addr = vcpu->arch.paddr_accessed;
  354. run->mmio.len = bytes;
  355. run->mmio.is_write = 0;
  356. vcpu->arch.io_gpr = rt;
  357. vcpu->arch.mmio_is_bigendian = is_bigendian;
  358. vcpu->mmio_needed = 1;
  359. vcpu->mmio_is_write = 0;
  360. vcpu->arch.mmio_sign_extend = 0;
  361. return EMULATE_DO_MMIO;
  362. }
  363. /* Same as above, but sign extends */
  364. int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
  365. unsigned int rt, unsigned int bytes, int is_bigendian)
  366. {
  367. int r;
  368. r = kvmppc_handle_load(run, vcpu, rt, bytes, is_bigendian);
  369. vcpu->arch.mmio_sign_extend = 1;
  370. return r;
  371. }
  372. int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
  373. u64 val, unsigned int bytes, int is_bigendian)
  374. {
  375. void *data = run->mmio.data;
  376. if (bytes > sizeof(run->mmio.data)) {
  377. printk(KERN_ERR "%s: bad MMIO length: %d\n", __func__,
  378. run->mmio.len);
  379. }
  380. run->mmio.phys_addr = vcpu->arch.paddr_accessed;
  381. run->mmio.len = bytes;
  382. run->mmio.is_write = 1;
  383. vcpu->mmio_needed = 1;
  384. vcpu->mmio_is_write = 1;
  385. /* Store the value at the lowest bytes in 'data'. */
  386. if (is_bigendian) {
  387. switch (bytes) {
  388. case 8: *(u64 *)data = val; break;
  389. case 4: *(u32 *)data = val; break;
  390. case 2: *(u16 *)data = val; break;
  391. case 1: *(u8 *)data = val; break;
  392. }
  393. } else {
  394. /* Store LE value into 'data'. */
  395. switch (bytes) {
  396. case 4: st_le32(data, val); break;
  397. case 2: st_le16(data, val); break;
  398. case 1: *(u8 *)data = val; break;
  399. }
  400. }
  401. return EMULATE_DO_MMIO;
  402. }
  403. int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
  404. {
  405. int r;
  406. sigset_t sigsaved;
  407. if (vcpu->sigset_active)
  408. sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
  409. if (vcpu->mmio_needed) {
  410. if (!vcpu->mmio_is_write)
  411. kvmppc_complete_mmio_load(vcpu, run);
  412. vcpu->mmio_needed = 0;
  413. } else if (vcpu->arch.dcr_needed) {
  414. if (!vcpu->arch.dcr_is_write)
  415. kvmppc_complete_dcr_load(vcpu, run);
  416. vcpu->arch.dcr_needed = 0;
  417. } else if (vcpu->arch.osi_needed) {
  418. u64 *gprs = run->osi.gprs;
  419. int i;
  420. for (i = 0; i < 32; i++)
  421. kvmppc_set_gpr(vcpu, i, gprs[i]);
  422. vcpu->arch.osi_needed = 0;
  423. }
  424. kvmppc_core_deliver_interrupts(vcpu);
  425. local_irq_disable();
  426. kvm_guest_enter();
  427. r = __kvmppc_vcpu_run(run, vcpu);
  428. kvm_guest_exit();
  429. local_irq_enable();
  430. if (vcpu->sigset_active)
  431. sigprocmask(SIG_SETMASK, &sigsaved, NULL);
  432. return r;
  433. }
  434. int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
  435. {
  436. if (irq->irq == KVM_INTERRUPT_UNSET)
  437. kvmppc_core_dequeue_external(vcpu, irq);
  438. else
  439. kvmppc_core_queue_external(vcpu, irq);
  440. if (waitqueue_active(&vcpu->wq)) {
  441. wake_up_interruptible(&vcpu->wq);
  442. vcpu->stat.halt_wakeup++;
  443. }
  444. return 0;
  445. }
  446. static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu,
  447. struct kvm_enable_cap *cap)
  448. {
  449. int r;
  450. if (cap->flags)
  451. return -EINVAL;
  452. switch (cap->cap) {
  453. case KVM_CAP_PPC_OSI:
  454. r = 0;
  455. vcpu->arch.osi_enabled = true;
  456. break;
  457. default:
  458. r = -EINVAL;
  459. break;
  460. }
  461. return r;
  462. }
  463. int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
  464. struct kvm_mp_state *mp_state)
  465. {
  466. return -EINVAL;
  467. }
  468. int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
  469. struct kvm_mp_state *mp_state)
  470. {
  471. return -EINVAL;
  472. }
  473. long kvm_arch_vcpu_ioctl(struct file *filp,
  474. unsigned int ioctl, unsigned long arg)
  475. {
  476. struct kvm_vcpu *vcpu = filp->private_data;
  477. void __user *argp = (void __user *)arg;
  478. long r;
  479. switch (ioctl) {
  480. case KVM_INTERRUPT: {
  481. struct kvm_interrupt irq;
  482. r = -EFAULT;
  483. if (copy_from_user(&irq, argp, sizeof(irq)))
  484. goto out;
  485. r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
  486. goto out;
  487. }
  488. case KVM_ENABLE_CAP:
  489. {
  490. struct kvm_enable_cap cap;
  491. r = -EFAULT;
  492. if (copy_from_user(&cap, argp, sizeof(cap)))
  493. goto out;
  494. r = kvm_vcpu_ioctl_enable_cap(vcpu, &cap);
  495. break;
  496. }
  497. default:
  498. r = -EINVAL;
  499. }
  500. out:
  501. return r;
  502. }
  503. static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
  504. {
  505. u32 inst_lis = 0x3c000000;
  506. u32 inst_ori = 0x60000000;
  507. u32 inst_nop = 0x60000000;
  508. u32 inst_sc = 0x44000002;
  509. u32 inst_imm_mask = 0xffff;
  510. /*
  511. * The hypercall to get into KVM from within guest context is as
  512. * follows:
  513. *
  514. * lis r0, r0, KVM_SC_MAGIC_R0@h
  515. * ori r0, KVM_SC_MAGIC_R0@l
  516. * sc
  517. * nop
  518. */
  519. pvinfo->hcall[0] = inst_lis | ((KVM_SC_MAGIC_R0 >> 16) & inst_imm_mask);
  520. pvinfo->hcall[1] = inst_ori | (KVM_SC_MAGIC_R0 & inst_imm_mask);
  521. pvinfo->hcall[2] = inst_sc;
  522. pvinfo->hcall[3] = inst_nop;
  523. return 0;
  524. }
  525. long kvm_arch_vm_ioctl(struct file *filp,
  526. unsigned int ioctl, unsigned long arg)
  527. {
  528. void __user *argp = (void __user *)arg;
  529. long r;
  530. switch (ioctl) {
  531. case KVM_PPC_GET_PVINFO: {
  532. struct kvm_ppc_pvinfo pvinfo;
  533. memset(&pvinfo, 0, sizeof(pvinfo));
  534. r = kvm_vm_ioctl_get_pvinfo(&pvinfo);
  535. if (copy_to_user(argp, &pvinfo, sizeof(pvinfo))) {
  536. r = -EFAULT;
  537. goto out;
  538. }
  539. break;
  540. }
  541. default:
  542. r = -ENOTTY;
  543. }
  544. out:
  545. return r;
  546. }
  547. int kvm_arch_init(void *opaque)
  548. {
  549. return 0;
  550. }
  551. void kvm_arch_exit(void)
  552. {
  553. }