4 * Copyright (C) 2006-2008 Qumranet Technologies
6 * Licensed under the terms of the GNU GPL version 2 or higher.
9 #include "config-host.h"
19 #include "qemu-common.h"
26 #include <sys/utsname.h>
27 #include <sys/syscall.h>
33 extern void perror(const char *s
);
35 kvm_context_t kvm_context
;
39 pthread_mutex_t qemu_mutex
= PTHREAD_MUTEX_INITIALIZER
;
40 pthread_cond_t qemu_aio_cond
= PTHREAD_COND_INITIALIZER
;
41 pthread_cond_t qemu_vcpu_cond
= PTHREAD_COND_INITIALIZER
;
42 pthread_cond_t qemu_system_cond
= PTHREAD_COND_INITIALIZER
;
43 pthread_cond_t qemu_pause_cond
= PTHREAD_COND_INITIALIZER
;
44 pthread_cond_t qemu_work_cond
= PTHREAD_COND_INITIALIZER
;
45 __thread
struct vcpu_info
*vcpu
;
47 static int qemu_system_ready
;
49 #define SIG_IPI (SIGRTMIN+4)
51 struct qemu_kvm_work_item
{
52 struct qemu_kvm_work_item
*next
;
53 void (*func
)(void *data
);
67 struct qemu_kvm_work_item
*queued_work_first
, *queued_work_last
;
71 static int io_thread_fd
= -1;
72 static int io_thread_sigfd
= -1;
74 static int kvm_debug_stop_requested
;
76 static inline unsigned long kvm_get_thread_id(void)
78 return syscall(SYS_gettid
);
81 static void qemu_cond_wait(pthread_cond_t
*cond
)
83 CPUState
*env
= cpu_single_env
;
85 pthread_cond_wait(cond
, &qemu_mutex
);
89 CPUState
*qemu_kvm_cpu_env(int index
)
91 return vcpu_info
[index
].env
;
94 static void sig_ipi_handler(int n
)
98 static void on_vcpu(CPUState
*env
, void (*func
)(void *data
), void *data
)
100 struct vcpu_info
*vi
= &vcpu_info
[env
->cpu_index
];
101 struct qemu_kvm_work_item wi
;
110 if (!vi
->queued_work_first
)
111 vi
->queued_work_first
= &wi
;
113 vi
->queued_work_last
->next
= &wi
;
114 vi
->queued_work_last
= &wi
;
118 pthread_kill(vi
->thread
, SIG_IPI
);
120 qemu_cond_wait(&qemu_work_cond
);
123 void kvm_update_interrupt_request(CPUState
*env
)
130 if (vcpu
&& env
!= vcpu
->env
&& !vcpu_info
[env
->cpu_index
].signalled
)
134 vcpu_info
[env
->cpu_index
].signalled
= 1;
135 if (vcpu_info
[env
->cpu_index
].thread
)
136 pthread_kill(vcpu_info
[env
->cpu_index
].thread
, SIG_IPI
);
141 void kvm_update_after_sipi(CPUState
*env
)
143 vcpu_info
[env
->cpu_index
].sipi_needed
= 1;
144 kvm_update_interrupt_request(env
);
147 void kvm_apic_init(CPUState
*env
)
149 if (env
->cpu_index
!= 0)
150 vcpu_info
[env
->cpu_index
].init
= 1;
151 kvm_update_interrupt_request(env
);
156 static int try_push_interrupts(void *opaque
)
158 return kvm_arch_try_push_interrupts(opaque
);
161 static void post_kvm_run(void *opaque
, int vcpu
)
164 pthread_mutex_lock(&qemu_mutex
);
165 kvm_arch_post_kvm_run(opaque
, vcpu
);
168 static int pre_kvm_run(void *opaque
, int vcpu
)
170 CPUState
*env
= qemu_kvm_cpu_env(vcpu
);
172 kvm_arch_pre_kvm_run(opaque
, vcpu
);
174 if (env
->interrupt_request
& CPU_INTERRUPT_EXIT
)
176 pthread_mutex_unlock(&qemu_mutex
);
180 static void kvm_do_load_registers(void *_env
)
182 CPUState
*env
= _env
;
184 kvm_arch_load_regs(env
);
187 void kvm_load_registers(CPUState
*env
)
190 on_vcpu(env
, kvm_do_load_registers
, env
);
193 static void kvm_do_save_registers(void *_env
)
195 CPUState
*env
= _env
;
197 kvm_arch_save_regs(env
);
200 void kvm_save_registers(CPUState
*env
)
203 on_vcpu(env
, kvm_do_save_registers
, env
);
206 int kvm_cpu_exec(CPUState
*env
)
210 r
= kvm_run(kvm_context
, env
->cpu_index
);
212 printf("kvm_run returned %d\n", r
);
219 extern int vm_running
;
221 static int has_work(CPUState
*env
)
223 if (!vm_running
|| (env
&& vcpu_info
[env
->cpu_index
].stopped
))
225 if (!(env
->hflags
& HF_HALTED_MASK
))
227 return kvm_arch_has_work(env
);
230 static void flush_queued_work(CPUState
*env
)
232 struct vcpu_info
*vi
= &vcpu_info
[env
->cpu_index
];
233 struct qemu_kvm_work_item
*wi
;
235 if (!vi
->queued_work_first
)
238 while ((wi
= vi
->queued_work_first
)) {
239 vi
->queued_work_first
= wi
->next
;
243 vi
->queued_work_last
= NULL
;
244 pthread_cond_broadcast(&qemu_work_cond
);
247 static void kvm_main_loop_wait(CPUState
*env
, int timeout
)
254 pthread_mutex_unlock(&qemu_mutex
);
256 ts
.tv_sec
= timeout
/ 1000;
257 ts
.tv_nsec
= (timeout
% 1000) * 1000000;
258 sigemptyset(&waitset
);
259 sigaddset(&waitset
, SIG_IPI
);
261 r
= sigtimedwait(&waitset
, &siginfo
, &ts
);
264 pthread_mutex_lock(&qemu_mutex
);
266 if (r
== -1 && !(e
== EAGAIN
|| e
== EINTR
)) {
267 printf("sigtimedwait: %s\n", strerror(e
));
271 cpu_single_env
= env
;
272 flush_queued_work(env
);
274 if (vcpu_info
[env
->cpu_index
].stop
) {
275 vcpu_info
[env
->cpu_index
].stop
= 0;
276 vcpu_info
[env
->cpu_index
].stopped
= 1;
277 pthread_cond_signal(&qemu_pause_cond
);
280 vcpu_info
[env
->cpu_index
].signalled
= 0;
283 static int all_threads_paused(void)
287 for (i
= 0; i
< smp_cpus
; ++i
)
288 if (vcpu_info
[i
].stop
)
293 static void pause_all_threads(void)
297 assert(!cpu_single_env
);
299 for (i
= 0; i
< smp_cpus
; ++i
) {
300 vcpu_info
[i
].stop
= 1;
301 pthread_kill(vcpu_info
[i
].thread
, SIG_IPI
);
303 while (!all_threads_paused())
304 qemu_cond_wait(&qemu_pause_cond
);
307 static void resume_all_threads(void)
311 assert(!cpu_single_env
);
313 for (i
= 0; i
< smp_cpus
; ++i
) {
314 vcpu_info
[i
].stop
= 0;
315 vcpu_info
[i
].stopped
= 0;
316 pthread_kill(vcpu_info
[i
].thread
, SIG_IPI
);
320 static void kvm_vm_state_change_handler(void *context
, int running
)
323 resume_all_threads();
328 static void update_regs_for_sipi(CPUState
*env
)
330 kvm_arch_update_regs_for_sipi(env
);
331 vcpu_info
[env
->cpu_index
].sipi_needed
= 0;
332 vcpu_info
[env
->cpu_index
].init
= 0;
335 static void update_regs_for_init(CPUState
*env
)
338 kvm_arch_load_regs(env
);
341 static void setup_kernel_sigmask(CPUState
*env
)
346 sigaddset(&set
, SIGUSR2
);
347 sigaddset(&set
, SIGIO
);
348 sigaddset(&set
, SIGALRM
);
349 sigprocmask(SIG_BLOCK
, &set
, NULL
);
351 sigprocmask(SIG_BLOCK
, NULL
, &set
);
352 sigdelset(&set
, SIG_IPI
);
354 kvm_set_signal_mask(kvm_context
, env
->cpu_index
, &set
);
357 void qemu_kvm_system_reset(void)
365 for (i
= 0; i
< smp_cpus
; ++i
)
366 kvm_arch_cpu_reset(vcpu_info
[i
].env
);
368 resume_all_threads();
371 static int kvm_main_loop_cpu(CPUState
*env
)
373 struct vcpu_info
*info
= &vcpu_info
[env
->cpu_index
];
375 setup_kernel_sigmask(env
);
377 pthread_mutex_lock(&qemu_mutex
);
378 if (kvm_irqchip_in_kernel(kvm_context
))
379 env
->hflags
&= ~HF_HALTED_MASK
;
381 kvm_qemu_init_env(env
);
382 env
->ready_for_interrupt_injection
= 1;
384 kvm_tpr_vcpu_start(env
);
387 cpu_single_env
= env
;
389 while (!has_work(env
))
390 kvm_main_loop_wait(env
, 1000);
391 if (env
->interrupt_request
& CPU_INTERRUPT_HARD
)
392 env
->hflags
&= ~HF_HALTED_MASK
;
393 if (!kvm_irqchip_in_kernel(kvm_context
) && info
->sipi_needed
)
394 update_regs_for_sipi(env
);
395 if (!kvm_irqchip_in_kernel(kvm_context
) && info
->init
)
396 update_regs_for_init(env
);
397 if (!(env
->hflags
& HF_HALTED_MASK
) && !info
->init
)
399 env
->interrupt_request
&= ~CPU_INTERRUPT_EXIT
;
400 kvm_main_loop_wait(env
, 0);
402 pthread_mutex_unlock(&qemu_mutex
);
406 static void *ap_main_loop(void *_env
)
408 CPUState
*env
= _env
;
411 vcpu
= &vcpu_info
[env
->cpu_index
];
413 vcpu
->env
->thread_id
= kvm_get_thread_id();
414 sigfillset(&signals
);
415 sigprocmask(SIG_BLOCK
, &signals
, NULL
);
416 kvm_create_vcpu(kvm_context
, env
->cpu_index
);
417 kvm_qemu_init_env(env
);
419 /* signal VCPU creation */
420 pthread_mutex_lock(&qemu_mutex
);
422 pthread_cond_signal(&qemu_vcpu_cond
);
424 /* and wait for machine initialization */
425 while (!qemu_system_ready
)
426 qemu_cond_wait(&qemu_system_cond
);
427 pthread_mutex_unlock(&qemu_mutex
);
429 kvm_main_loop_cpu(env
);
433 void kvm_init_new_ap(int cpu
, CPUState
*env
)
435 pthread_create(&vcpu_info
[cpu
].thread
, NULL
, ap_main_loop
, env
);
437 while (vcpu_info
[cpu
].created
== 0)
438 qemu_cond_wait(&qemu_vcpu_cond
);
441 int kvm_init_ap(void)
446 qemu_add_vm_change_state_handler(kvm_vm_state_change_handler
, NULL
);
448 signal(SIG_IPI
, sig_ipi_handler
);
452 void qemu_kvm_notify_work(void)
458 if (io_thread_fd
== -1)
461 memcpy(buffer
, &value
, sizeof(value
));
466 len
= write(io_thread_fd
, buffer
+ offset
, 8 - offset
);
467 if (len
== -1 && errno
== EINTR
)
477 fprintf(stderr
, "failed to notify io thread\n");
480 /* If we have signalfd, we mask out the signals we want to handle and then
481 * use signalfd to listen for them. We rely on whatever the current signal
482 * handler is to dispatch the signals when we receive them.
485 static void sigfd_handler(void *opaque
)
487 int fd
= (unsigned long)opaque
;
488 struct signalfd_siginfo info
;
489 struct sigaction action
;
494 len
= read(fd
, &info
, sizeof(info
));
495 } while (len
== -1 && errno
== EINTR
);
497 if (len
== -1 && errno
== EAGAIN
)
500 if (len
!= sizeof(info
)) {
501 printf("read from sigfd returned %ld: %m\n", len
);
505 sigaction(info
.ssi_signo
, NULL
, &action
);
506 if (action
.sa_handler
)
507 action
.sa_handler(info
.ssi_signo
);
509 if (info
.ssi_signo
== SIGUSR2
) {
510 pthread_cond_signal(&qemu_aio_cond
);
515 /* Used to break IO thread out of select */
516 static void io_thread_wakeup(void *opaque
)
518 int fd
= (unsigned long)opaque
;
525 len
= read(fd
, buffer
+ offset
, 8 - offset
);
526 if (len
== -1 && errno
== EINTR
)
536 int kvm_main_loop(void)
542 io_thread
= pthread_self();
543 qemu_system_ready
= 1;
545 if (kvm_eventfd(fds
) == -1) {
546 fprintf(stderr
, "failed to create eventfd\n");
550 qemu_set_fd_handler2(fds
[0], NULL
, io_thread_wakeup
, NULL
,
551 (void *)(unsigned long)fds
[0]);
553 io_thread_fd
= fds
[1];
556 sigaddset(&mask
, SIGIO
);
557 sigaddset(&mask
, SIGALRM
);
558 sigaddset(&mask
, SIGUSR2
);
559 sigprocmask(SIG_BLOCK
, &mask
, NULL
);
561 sigfd
= kvm_signalfd(&mask
);
563 fprintf(stderr
, "failed to create signalfd\n");
567 fcntl(sigfd
, F_SETFL
, O_NONBLOCK
);
569 qemu_set_fd_handler2(sigfd
, NULL
, sigfd_handler
, NULL
,
570 (void *)(unsigned long)sigfd
);
572 pthread_cond_broadcast(&qemu_system_cond
);
574 io_thread_sigfd
= sigfd
;
575 cpu_single_env
= NULL
;
578 main_loop_wait(1000);
579 if (qemu_shutdown_requested())
581 else if (qemu_powerdown_requested())
582 qemu_system_powerdown();
583 else if (qemu_reset_requested())
584 qemu_kvm_system_reset();
585 else if (kvm_debug_stop_requested
) {
587 kvm_debug_stop_requested
= 0;
592 pthread_mutex_unlock(&qemu_mutex
);
597 static int kvm_debug(void *opaque
, int vcpu
)
599 CPUState
*env
= cpu_single_env
;
601 kvm_debug_stop_requested
= 1;
602 vcpu_info
[vcpu
].stopped
= 1;
606 static int kvm_inb(void *opaque
, uint16_t addr
, uint8_t *data
)
608 *data
= cpu_inb(0, addr
);
612 static int kvm_inw(void *opaque
, uint16_t addr
, uint16_t *data
)
614 *data
= cpu_inw(0, addr
);
618 static int kvm_inl(void *opaque
, uint16_t addr
, uint32_t *data
)
620 *data
= cpu_inl(0, addr
);
624 #define PM_IO_BASE 0xb000
626 static int kvm_outb(void *opaque
, uint16_t addr
, uint8_t data
)
631 cpu_outb(0, 0xb3, 0);
638 x
= cpu_inw(0, PM_IO_BASE
+ 4);
640 cpu_outw(0, PM_IO_BASE
+ 4, x
);
647 x
= cpu_inw(0, PM_IO_BASE
+ 4);
649 cpu_outw(0, PM_IO_BASE
+ 4, x
);
657 cpu_outb(0, addr
, data
);
661 static int kvm_outw(void *opaque
, uint16_t addr
, uint16_t data
)
663 cpu_outw(0, addr
, data
);
667 static int kvm_outl(void *opaque
, uint16_t addr
, uint32_t data
)
669 cpu_outl(0, addr
, data
);
673 static int kvm_mmio_read(void *opaque
, uint64_t addr
, uint8_t *data
, int len
)
675 cpu_physical_memory_rw(addr
, data
, len
, 0);
679 static int kvm_mmio_write(void *opaque
, uint64_t addr
, uint8_t *data
, int len
)
681 cpu_physical_memory_rw(addr
, data
, len
, 1);
685 static int kvm_io_window(void *opaque
)
691 static int kvm_halt(void *opaque
, int vcpu
)
693 return kvm_arch_halt(opaque
, vcpu
);
696 static int kvm_shutdown(void *opaque
, int vcpu
)
698 /* stop the current vcpu from going back to guest mode */
699 vcpu_info
[cpu_single_env
->cpu_index
].stopped
= 1;
701 qemu_system_reset_request();
705 static struct kvm_callbacks qemu_kvm_ops
= {
713 .mmio_read
= kvm_mmio_read
,
714 .mmio_write
= kvm_mmio_write
,
716 .shutdown
= kvm_shutdown
,
717 .io_window
= kvm_io_window
,
718 .try_push_interrupts
= try_push_interrupts
,
719 .post_kvm_run
= post_kvm_run
,
720 .pre_kvm_run
= pre_kvm_run
,
722 .tpr_access
= handle_tpr_access
,
725 .powerpc_dcr_read
= handle_powerpc_dcr_read
,
726 .powerpc_dcr_write
= handle_powerpc_dcr_write
,
732 /* Try to initialize kvm */
733 kvm_context
= kvm_init(&qemu_kvm_ops
, cpu_single_env
);
737 pthread_mutex_lock(&qemu_mutex
);
742 int kvm_qemu_create_context(void)
746 kvm_disable_irqchip_creation(kvm_context
);
749 kvm_disable_pit_creation(kvm_context
);
751 if (kvm_create(kvm_context
, phys_ram_size
, (void**)&phys_ram_base
) < 0) {
755 r
= kvm_arch_qemu_create_context();
761 void kvm_qemu_destroy(void)
763 kvm_finalize(kvm_context
);
766 void kvm_cpu_register_physical_memory(target_phys_addr_t start_addr
,
768 unsigned long phys_offset
)
770 #ifdef KVM_CAP_USER_MEMORY
773 r
= kvm_check_extension(kvm_context
, KVM_CAP_USER_MEMORY
);
775 if (!(phys_offset
& ~TARGET_PAGE_MASK
)) {
776 r
= kvm_is_allocated_mem(kvm_context
, start_addr
, size
);
779 r
= kvm_is_intersecting_mem(kvm_context
, start_addr
);
781 kvm_create_mem_hole(kvm_context
, start_addr
, size
);
782 r
= kvm_register_userspace_phys_mem(kvm_context
, start_addr
,
783 phys_ram_base
+ phys_offset
,
786 if (phys_offset
& IO_MEM_ROM
) {
787 phys_offset
&= ~IO_MEM_ROM
;
788 r
= kvm_is_intersecting_mem(kvm_context
, start_addr
);
790 kvm_create_mem_hole(kvm_context
, start_addr
, size
);
791 r
= kvm_register_userspace_phys_mem(kvm_context
, start_addr
,
792 phys_ram_base
+ phys_offset
,
796 printf("kvm_cpu_register_physical_memory: failed\n");
802 if (phys_offset
& IO_MEM_ROM
) {
803 phys_offset
&= ~IO_MEM_ROM
;
804 memcpy(phys_ram_base
+ start_addr
, phys_ram_base
+ phys_offset
, size
);
808 int kvm_qemu_check_extension(int ext
)
810 return kvm_check_extension(kvm_context
, ext
);
813 int kvm_qemu_init_env(CPUState
*cenv
)
815 return kvm_arch_qemu_init_env(cenv
);
818 struct kvm_guest_debug_data
{
819 struct kvm_debug_guest dbg
;
823 void kvm_invoke_guest_debug(void *data
)
825 struct kvm_guest_debug_data
*dbg_data
= data
;
827 dbg_data
->err
= kvm_guest_debug(kvm_context
, cpu_single_env
->cpu_index
,
831 int kvm_update_debugger(CPUState
*env
)
833 struct kvm_guest_debug_data data
;
836 memset(data
.dbg
.breakpoints
, 0, sizeof(data
.dbg
.breakpoints
));
838 data
.dbg
.enabled
= 0;
839 if (env
->nb_breakpoints
|| env
->singlestep_enabled
) {
840 data
.dbg
.enabled
= 1;
841 for (i
= 0; i
< 4 && i
< env
->nb_breakpoints
; ++i
) {
842 data
.dbg
.breakpoints
[i
].enabled
= 1;
843 data
.dbg
.breakpoints
[i
].address
= env
->breakpoints
[i
];
845 data
.dbg
.singlestep
= env
->singlestep_enabled
;
847 on_vcpu(env
, kvm_invoke_guest_debug
, &data
);
853 * dirty pages logging
855 /* FIXME: use unsigned long pointer instead of unsigned char */
856 unsigned char *kvm_dirty_bitmap
= NULL
;
857 int kvm_physical_memory_set_dirty_tracking(int enable
)
865 if (!kvm_dirty_bitmap
) {
866 unsigned bitmap_size
= BITMAP_SIZE(phys_ram_size
);
867 kvm_dirty_bitmap
= qemu_malloc(bitmap_size
);
868 if (kvm_dirty_bitmap
== NULL
) {
869 perror("Failed to allocate dirty pages bitmap");
873 r
= kvm_dirty_pages_log_enable_all(kvm_context
);
878 if (kvm_dirty_bitmap
) {
879 r
= kvm_dirty_pages_log_reset(kvm_context
);
880 qemu_free(kvm_dirty_bitmap
);
881 kvm_dirty_bitmap
= NULL
;
887 /* get kvm's dirty pages bitmap and update qemu's */
888 int kvm_get_dirty_pages_log_range(unsigned long start_addr
,
889 unsigned char *bitmap
,
891 unsigned long mem_size
)
893 unsigned int i
, j
, n
=0;
895 unsigned page_number
, addr
, addr1
;
896 unsigned int len
= ((mem_size
/TARGET_PAGE_SIZE
) + 7) / 8;
899 * bitmap-traveling is faster than memory-traveling (for addr...)
900 * especially when most of the memory is not dirty.
902 for (i
=0; i
<len
; i
++) {
907 page_number
= i
* 8 + j
;
908 addr1
= page_number
* TARGET_PAGE_SIZE
;
909 addr
= offset
+ addr1
;
910 cpu_physical_memory_set_dirty(addr
);
916 int kvm_get_dirty_bitmap_cb(unsigned long start
, unsigned long len
,
917 void *bitmap
, void *opaque
)
919 return kvm_get_dirty_pages_log_range(start
, bitmap
, start
, len
);
923 * get kvm's dirty pages bitmap and update qemu's
924 * we only care about physical ram, which resides in slots 0 and 3
926 int kvm_update_dirty_pages_log(void)
931 r
= kvm_get_dirty_pages_range(kvm_context
, 0, phys_ram_size
,
932 kvm_dirty_bitmap
, NULL
,
933 kvm_get_dirty_bitmap_cb
);
937 int kvm_get_phys_ram_page_bitmap(unsigned char *bitmap
)
939 unsigned int bsize
= BITMAP_SIZE(phys_ram_size
);
940 unsigned int brsize
= BITMAP_SIZE(ram_size
);
941 unsigned int extra_pages
= (phys_ram_size
- ram_size
) / TARGET_PAGE_SIZE
;
942 unsigned int extra_bytes
= (extra_pages
+7)/8;
943 unsigned int hole_start
= BITMAP_SIZE(0xa0000);
944 unsigned int hole_end
= BITMAP_SIZE(0xc0000);
946 memset(bitmap
, 0xFF, brsize
+ extra_bytes
);
947 memset(bitmap
+ hole_start
, 0, hole_end
- hole_start
);
948 memset(bitmap
+ brsize
+ extra_bytes
, 0, bsize
- brsize
- extra_bytes
);
953 #ifdef KVM_CAP_IRQCHIP
955 int kvm_set_irq(int irq
, int level
)
957 return kvm_set_irq_level(kvm_context
, irq
, level
);
962 void qemu_kvm_aio_wait_start(void)
966 void qemu_kvm_aio_wait(void)
968 if (!cpu_single_env
) {
969 if (io_thread_sigfd
!= -1) {
974 FD_SET(io_thread_sigfd
, &rfds
);
976 /* this is a rare case where we do want to hold qemu_mutex
977 * while sleeping. We cannot allow anything else to run
979 ret
= select(io_thread_sigfd
+ 1, &rfds
, NULL
, NULL
, NULL
);
980 if (ret
> 0 && FD_ISSET(io_thread_sigfd
, &rfds
))
981 sigfd_handler((void *)(unsigned long)io_thread_sigfd
);
985 qemu_cond_wait(&qemu_aio_cond
);
988 void qemu_kvm_aio_wait_end(void)
992 int qemu_kvm_get_dirty_pages(unsigned long phys_addr
, void *buf
)
994 return kvm_get_dirty_pages(kvm_context
, phys_addr
, buf
);
997 void *kvm_cpu_create_phys_mem(target_phys_addr_t start_addr
,
998 unsigned long size
, int log
, int writable
)
1000 return kvm_create_phys_mem(kvm_context
, start_addr
, size
, log
, writable
);
1003 void kvm_cpu_destroy_phys_mem(target_phys_addr_t start_addr
,
1006 kvm_destroy_phys_mem(kvm_context
, start_addr
, size
);
1009 void kvm_mutex_unlock(void)
1011 assert(!cpu_single_env
);
1012 pthread_mutex_unlock(&qemu_mutex
);
1015 void kvm_mutex_lock(void)
1017 pthread_mutex_lock(&qemu_mutex
);
1018 cpu_single_env
= NULL
;
1021 int qemu_kvm_register_coalesced_mmio(target_phys_addr_t addr
, unsigned int size
)
1023 return kvm_register_coalesced_mmio(kvm_context
, addr
, size
);
1026 int qemu_kvm_unregister_coalesced_mmio(target_phys_addr_t addr
,
1029 return kvm_unregister_coalesced_mmio(kvm_context
, addr
, size
);