kvm.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * QEMU KVM support
  3. *
  4. * Copyright IBM, Corp. 2008
  5. *
  6. * Authors:
  7. * Anthony Liguori <aliguori@us.ibm.com>
  8. *
  9. * This work is licensed under the terms of the GNU GPL, version 2 or later.
  10. * See the COPYING file in the top-level directory.
  11. *
  12. */
  13. #ifndef QEMU_KVM_H
  14. #define QEMU_KVM_H
  15. #include "config.h"
  16. #ifdef CONFIG_KVM
  17. extern int kvm_allowed;
  18. #define kvm_enabled() (kvm_allowed)
  19. #else
  20. #define kvm_enabled() (0)
  21. #endif
  22. struct kvm_run;
  23. /* external API */
  24. int kvm_init(int smp_cpus);
  25. int kvm_init_vcpu(CPUState *env);
  26. int kvm_sync_vcpus(void);
  27. int kvm_cpu_exec(CPUState *env);
  28. void kvm_set_phys_mem(target_phys_addr_t start_addr,
  29. ram_addr_t size,
  30. ram_addr_t phys_offset);
  31. void kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, target_phys_addr_t end_addr);
  32. int kvm_log_start(target_phys_addr_t phys_addr, target_phys_addr_t len);
  33. int kvm_log_stop(target_phys_addr_t phys_addr, target_phys_addr_t len);
  34. int kvm_has_sync_mmu(void);
  35. void kvm_setup_guest_memory(void *start, size_t size);
  36. int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
  37. int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size);
  38. /* internal API */
  39. struct KVMState;
  40. typedef struct KVMState KVMState;
  41. int kvm_ioctl(KVMState *s, int type, ...);
  42. int kvm_vm_ioctl(KVMState *s, int type, ...);
  43. int kvm_vcpu_ioctl(CPUState *env, int type, ...);
  44. /* Arch specific hooks */
  45. int kvm_arch_post_run(CPUState *env, struct kvm_run *run);
  46. int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run);
  47. int kvm_arch_pre_run(CPUState *env, struct kvm_run *run);
  48. int kvm_arch_get_registers(CPUState *env);
  49. int kvm_arch_put_registers(CPUState *env);
  50. int kvm_arch_init(KVMState *s, int smp_cpus);
  51. int kvm_arch_init_vcpu(CPUState *env);
  52. int kvm_check_extension(KVMState *s, unsigned int extension);
  53. uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
  54. int reg);
  55. #endif