new scsi-generic abstraction, use SG_IO (Christoph Hellwig)
[qemu-kvm/fedora.git] / kvm-all.c
blob3cfc7b5d8b878ea5259b588cc6872c3be18ccc52
1 /*
2 * QEMU KVM support
4 * Copyright IBM, Corp. 2008
5 * Red Hat, Inc. 2008
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
9 * Glauber Costa <gcosta@redhat.com>
11 * This work is licensed under the terms of the GNU GPL, version 2 or later.
12 * See the COPYING file in the top-level directory.
16 #include <sys/types.h>
17 #include <sys/ioctl.h>
18 #include <sys/mman.h>
19 #include <stdarg.h>
21 #include <linux/kvm.h>
23 #include "qemu-common.h"
24 #include "sysemu.h"
25 #include "gdbstub.h"
26 #include "kvm.h"
28 /* KVM uses PAGE_SIZE in it's definition of COALESCED_MMIO_MAX */
29 #define PAGE_SIZE TARGET_PAGE_SIZE
31 //#define DEBUG_KVM
33 #ifdef DEBUG_KVM
34 #define dprintf(fmt, ...) \
35 do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
36 #else
37 #define dprintf(fmt, ...) \
38 do { } while (0)
39 #endif
41 typedef struct KVMSlot
43 target_phys_addr_t start_addr;
44 ram_addr_t memory_size;
45 ram_addr_t phys_offset;
46 int slot;
47 int flags;
48 } KVMSlot;
50 typedef struct kvm_dirty_log KVMDirtyLog;
52 int kvm_allowed = 0;
54 struct KVMState
56 KVMSlot slots[32];
57 int fd;
58 int vmfd;
59 int coalesced_mmio;
60 #ifdef KVM_CAP_SET_GUEST_DEBUG
61 struct kvm_sw_breakpoint_head kvm_sw_breakpoints;
62 #endif
65 static KVMState *kvm_state;
67 static KVMSlot *kvm_alloc_slot(KVMState *s)
69 int i;
71 for (i = 0; i < ARRAY_SIZE(s->slots); i++) {
72 /* KVM private memory slots */
73 if (i >= 8 && i < 12)
74 continue;
75 if (s->slots[i].memory_size == 0)
76 return &s->slots[i];
79 return NULL;
82 static KVMSlot *kvm_lookup_slot(KVMState *s, target_phys_addr_t start_addr)
84 int i;
86 for (i = 0; i < ARRAY_SIZE(s->slots); i++) {
87 KVMSlot *mem = &s->slots[i];
89 if (start_addr >= mem->start_addr &&
90 start_addr < (mem->start_addr + mem->memory_size))
91 return mem;
94 return NULL;
97 static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
99 struct kvm_userspace_memory_region mem;
101 mem.slot = slot->slot;
102 mem.guest_phys_addr = slot->start_addr;
103 mem.memory_size = slot->memory_size;
104 mem.userspace_addr = (unsigned long)phys_ram_base + slot->phys_offset;
105 mem.flags = slot->flags;
107 return kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem);
111 int kvm_init_vcpu(CPUState *env)
113 KVMState *s = kvm_state;
114 long mmap_size;
115 int ret;
117 dprintf("kvm_init_vcpu\n");
119 ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index);
120 if (ret < 0) {
121 dprintf("kvm_create_vcpu failed\n");
122 goto err;
125 env->kvm_fd = ret;
126 env->kvm_state = s;
128 mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0);
129 if (mmap_size < 0) {
130 dprintf("KVM_GET_VCPU_MMAP_SIZE failed\n");
131 goto err;
134 env->kvm_run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED,
135 env->kvm_fd, 0);
136 if (env->kvm_run == MAP_FAILED) {
137 ret = -errno;
138 dprintf("mmap'ing vcpu state failed\n");
139 goto err;
142 ret = kvm_arch_init_vcpu(env);
144 err:
145 return ret;
148 int kvm_sync_vcpus(void)
150 CPUState *env;
152 for (env = first_cpu; env != NULL; env = env->next_cpu) {
153 int ret;
155 ret = kvm_arch_put_registers(env);
156 if (ret)
157 return ret;
160 return 0;
164 * dirty pages logging control
166 static int kvm_dirty_pages_log_change(target_phys_addr_t phys_addr, target_phys_addr_t end_addr,
167 unsigned flags,
168 unsigned mask)
170 KVMState *s = kvm_state;
171 KVMSlot *mem = kvm_lookup_slot(s, phys_addr);
172 if (mem == NULL) {
173 dprintf("invalid parameters %llx-%llx\n", phys_addr, end_addr);
174 return -EINVAL;
177 flags = (mem->flags & ~mask) | flags;
178 /* Nothing changed, no need to issue ioctl */
179 if (flags == mem->flags)
180 return 0;
182 mem->flags = flags;
184 return kvm_set_user_memory_region(s, mem);
187 int kvm_log_start(target_phys_addr_t phys_addr, target_phys_addr_t end_addr)
189 return kvm_dirty_pages_log_change(phys_addr, end_addr,
190 KVM_MEM_LOG_DIRTY_PAGES,
191 KVM_MEM_LOG_DIRTY_PAGES);
194 int kvm_log_stop(target_phys_addr_t phys_addr, target_phys_addr_t end_addr)
196 return kvm_dirty_pages_log_change(phys_addr, end_addr,
198 KVM_MEM_LOG_DIRTY_PAGES);
202 * kvm_physical_sync_dirty_bitmap - Grab dirty bitmap from kernel space
203 * This function updates qemu's dirty bitmap using cpu_physical_memory_set_dirty().
204 * This means all bits are set to dirty.
206 * @start_add: start of logged region. This is what we use to search the memslot
207 * @end_addr: end of logged region.
209 void kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr, target_phys_addr_t end_addr)
211 KVMState *s = kvm_state;
212 KVMDirtyLog d;
213 KVMSlot *mem = kvm_lookup_slot(s, start_addr);
214 unsigned long alloc_size;
215 ram_addr_t addr;
216 target_phys_addr_t phys_addr = start_addr;
218 dprintf("sync addr: %llx into %lx\n", start_addr, mem->phys_offset);
219 if (mem == NULL) {
220 fprintf(stderr, "BUG: %s: invalid parameters\n", __func__);
221 return;
224 alloc_size = mem->memory_size >> TARGET_PAGE_BITS / sizeof(d.dirty_bitmap);
225 d.dirty_bitmap = qemu_mallocz(alloc_size);
227 d.slot = mem->slot;
228 dprintf("slot %d, phys_addr %llx, uaddr: %llx\n",
229 d.slot, mem->start_addr, mem->phys_offset);
231 if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
232 dprintf("ioctl failed %d\n", errno);
233 goto out;
236 phys_addr = start_addr;
237 for (addr = mem->phys_offset; phys_addr < end_addr; phys_addr+= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
238 unsigned long *bitmap = (unsigned long *)d.dirty_bitmap;
239 unsigned nr = (phys_addr - start_addr) >> TARGET_PAGE_BITS;
240 unsigned word = nr / (sizeof(*bitmap) * 8);
241 unsigned bit = nr % (sizeof(*bitmap) * 8);
242 if ((bitmap[word] >> bit) & 1)
243 cpu_physical_memory_set_dirty(addr);
245 out:
246 qemu_free(d.dirty_bitmap);
249 int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size)
251 int ret = -ENOSYS;
252 #ifdef KVM_CAP_COALESCED_MMIO
253 KVMState *s = kvm_state;
255 if (s->coalesced_mmio) {
256 struct kvm_coalesced_mmio_zone zone;
258 zone.addr = start;
259 zone.size = size;
261 ret = kvm_vm_ioctl(s, KVM_REGISTER_COALESCED_MMIO, &zone);
263 #endif
265 return ret;
268 int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size)
270 int ret = -ENOSYS;
271 #ifdef KVM_CAP_COALESCED_MMIO
272 KVMState *s = kvm_state;
274 if (s->coalesced_mmio) {
275 struct kvm_coalesced_mmio_zone zone;
277 zone.addr = start;
278 zone.size = size;
280 ret = kvm_vm_ioctl(s, KVM_UNREGISTER_COALESCED_MMIO, &zone);
282 #endif
284 return ret;
287 int kvm_init(int smp_cpus)
289 KVMState *s;
290 int ret;
291 int i;
293 if (smp_cpus > 1)
294 return -EINVAL;
296 s = qemu_mallocz(sizeof(KVMState));
298 #ifdef KVM_CAP_SET_GUEST_DEBUG
299 TAILQ_INIT(&s->kvm_sw_breakpoints);
300 #endif
301 for (i = 0; i < ARRAY_SIZE(s->slots); i++)
302 s->slots[i].slot = i;
304 s->vmfd = -1;
305 s->fd = open("/dev/kvm", O_RDWR);
306 if (s->fd == -1) {
307 fprintf(stderr, "Could not access KVM kernel module: %m\n");
308 ret = -errno;
309 goto err;
312 ret = kvm_ioctl(s, KVM_GET_API_VERSION, 0);
313 if (ret < KVM_API_VERSION) {
314 if (ret > 0)
315 ret = -EINVAL;
316 fprintf(stderr, "kvm version too old\n");
317 goto err;
320 if (ret > KVM_API_VERSION) {
321 ret = -EINVAL;
322 fprintf(stderr, "kvm version not supported\n");
323 goto err;
326 s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);
327 if (s->vmfd < 0)
328 goto err;
330 /* initially, KVM allocated its own memory and we had to jump through
331 * hooks to make phys_ram_base point to this. Modern versions of KVM
332 * just use a user allocated buffer so we can use phys_ram_base
333 * unmodified. Make sure we have a sufficiently modern version of KVM.
335 ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_USER_MEMORY);
336 if (ret <= 0) {
337 if (ret == 0)
338 ret = -EINVAL;
339 fprintf(stderr, "kvm does not support KVM_CAP_USER_MEMORY\n");
340 goto err;
343 /* There was a nasty bug in < kvm-80 that prevents memory slots from being
344 * destroyed properly. Since we rely on this capability, refuse to work
345 * with any kernel without this capability. */
346 ret = kvm_ioctl(s, KVM_CHECK_EXTENSION,
347 KVM_CAP_DESTROY_MEMORY_REGION_WORKS);
348 if (ret <= 0) {
349 if (ret == 0)
350 ret = -EINVAL;
352 fprintf(stderr,
353 "KVM kernel module broken (DESTROY_MEMORY_REGION)\n"
354 "Please upgrade to at least kvm-81.\n");
355 goto err;
358 s->coalesced_mmio = 0;
359 #ifdef KVM_CAP_COALESCED_MMIO
360 ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_COALESCED_MMIO);
361 if (ret > 0)
362 s->coalesced_mmio = ret;
363 #endif
365 ret = kvm_arch_init(s, smp_cpus);
366 if (ret < 0)
367 goto err;
369 kvm_state = s;
371 return 0;
373 err:
374 if (s) {
375 if (s->vmfd != -1)
376 close(s->vmfd);
377 if (s->fd != -1)
378 close(s->fd);
380 qemu_free(s);
382 return ret;
385 static int kvm_handle_io(CPUState *env, uint16_t port, void *data,
386 int direction, int size, uint32_t count)
388 int i;
389 uint8_t *ptr = data;
391 for (i = 0; i < count; i++) {
392 if (direction == KVM_EXIT_IO_IN) {
393 switch (size) {
394 case 1:
395 stb_p(ptr, cpu_inb(env, port));
396 break;
397 case 2:
398 stw_p(ptr, cpu_inw(env, port));
399 break;
400 case 4:
401 stl_p(ptr, cpu_inl(env, port));
402 break;
404 } else {
405 switch (size) {
406 case 1:
407 cpu_outb(env, port, ldub_p(ptr));
408 break;
409 case 2:
410 cpu_outw(env, port, lduw_p(ptr));
411 break;
412 case 4:
413 cpu_outl(env, port, ldl_p(ptr));
414 break;
418 ptr += size;
421 return 1;
424 static void kvm_run_coalesced_mmio(CPUState *env, struct kvm_run *run)
426 #ifdef KVM_CAP_COALESCED_MMIO
427 KVMState *s = kvm_state;
428 if (s->coalesced_mmio) {
429 struct kvm_coalesced_mmio_ring *ring;
431 ring = (void *)run + (s->coalesced_mmio * TARGET_PAGE_SIZE);
432 while (ring->first != ring->last) {
433 struct kvm_coalesced_mmio *ent;
435 ent = &ring->coalesced_mmio[ring->first];
437 cpu_physical_memory_write(ent->phys_addr, ent->data, ent->len);
438 /* FIXME smp_wmb() */
439 ring->first = (ring->first + 1) % KVM_COALESCED_MMIO_MAX;
442 #endif
445 int kvm_cpu_exec(CPUState *env)
447 struct kvm_run *run = env->kvm_run;
448 int ret;
450 dprintf("kvm_cpu_exec()\n");
452 do {
453 kvm_arch_pre_run(env, run);
455 if (env->exit_request) {
456 dprintf("interrupt exit requested\n");
457 ret = 0;
458 break;
461 ret = kvm_vcpu_ioctl(env, KVM_RUN, 0);
462 kvm_arch_post_run(env, run);
464 if (ret == -EINTR || ret == -EAGAIN) {
465 dprintf("io window exit\n");
466 ret = 0;
467 break;
470 if (ret < 0) {
471 dprintf("kvm run failed %s\n", strerror(-ret));
472 abort();
475 kvm_run_coalesced_mmio(env, run);
477 ret = 0; /* exit loop */
478 switch (run->exit_reason) {
479 case KVM_EXIT_IO:
480 dprintf("handle_io\n");
481 ret = kvm_handle_io(env, run->io.port,
482 (uint8_t *)run + run->io.data_offset,
483 run->io.direction,
484 run->io.size,
485 run->io.count);
486 break;
487 case KVM_EXIT_MMIO:
488 dprintf("handle_mmio\n");
489 cpu_physical_memory_rw(run->mmio.phys_addr,
490 run->mmio.data,
491 run->mmio.len,
492 run->mmio.is_write);
493 ret = 1;
494 break;
495 case KVM_EXIT_IRQ_WINDOW_OPEN:
496 dprintf("irq_window_open\n");
497 break;
498 case KVM_EXIT_SHUTDOWN:
499 dprintf("shutdown\n");
500 qemu_system_reset_request();
501 ret = 1;
502 break;
503 case KVM_EXIT_UNKNOWN:
504 dprintf("kvm_exit_unknown\n");
505 break;
506 case KVM_EXIT_FAIL_ENTRY:
507 dprintf("kvm_exit_fail_entry\n");
508 break;
509 case KVM_EXIT_EXCEPTION:
510 dprintf("kvm_exit_exception\n");
511 break;
512 case KVM_EXIT_DEBUG:
513 dprintf("kvm_exit_debug\n");
514 #ifdef KVM_CAP_SET_GUEST_DEBUG
515 if (kvm_arch_debug(&run->debug.arch)) {
516 gdb_set_stop_cpu(env);
517 vm_stop(EXCP_DEBUG);
518 env->exception_index = EXCP_DEBUG;
519 return 0;
521 /* re-enter, this exception was guest-internal */
522 ret = 1;
523 #endif /* KVM_CAP_SET_GUEST_DEBUG */
524 break;
525 default:
526 dprintf("kvm_arch_handle_exit\n");
527 ret = kvm_arch_handle_exit(env, run);
528 break;
530 } while (ret > 0);
532 if (env->exit_request) {
533 env->exit_request = 0;
534 env->exception_index = EXCP_INTERRUPT;
537 return ret;
540 void kvm_set_phys_mem(target_phys_addr_t start_addr,
541 ram_addr_t size,
542 ram_addr_t phys_offset)
544 KVMState *s = kvm_state;
545 ram_addr_t flags = phys_offset & ~TARGET_PAGE_MASK;
546 KVMSlot *mem;
548 /* KVM does not support read-only slots */
549 phys_offset &= ~IO_MEM_ROM;
551 mem = kvm_lookup_slot(s, start_addr);
552 if (mem) {
553 if ((flags == IO_MEM_UNASSIGNED) || (flags >= TLB_MMIO)) {
554 mem->memory_size = 0;
555 mem->start_addr = start_addr;
556 mem->phys_offset = 0;
557 mem->flags = 0;
559 kvm_set_user_memory_region(s, mem);
560 } else if (start_addr >= mem->start_addr &&
561 (start_addr + size) <= (mem->start_addr +
562 mem->memory_size)) {
563 KVMSlot slot;
564 target_phys_addr_t mem_start;
565 ram_addr_t mem_size, mem_offset;
567 /* Not splitting */
568 if ((phys_offset - (start_addr - mem->start_addr)) ==
569 mem->phys_offset)
570 return;
572 /* unregister whole slot */
573 memcpy(&slot, mem, sizeof(slot));
574 mem->memory_size = 0;
575 kvm_set_user_memory_region(s, mem);
577 /* register prefix slot */
578 mem_start = slot.start_addr;
579 mem_size = start_addr - slot.start_addr;
580 mem_offset = slot.phys_offset;
581 if (mem_size)
582 kvm_set_phys_mem(mem_start, mem_size, mem_offset);
584 /* register new slot */
585 kvm_set_phys_mem(start_addr, size, phys_offset);
587 /* register suffix slot */
588 mem_start = start_addr + size;
589 mem_offset += mem_size + size;
590 mem_size = slot.memory_size - mem_size - size;
591 if (mem_size)
592 kvm_set_phys_mem(mem_start, mem_size, mem_offset);
594 return;
595 } else {
596 printf("Registering overlapping slot\n");
597 abort();
600 /* KVM does not need to know about this memory */
601 if (flags >= IO_MEM_UNASSIGNED)
602 return;
604 mem = kvm_alloc_slot(s);
605 mem->memory_size = size;
606 mem->start_addr = start_addr;
607 mem->phys_offset = phys_offset;
608 mem->flags = 0;
610 kvm_set_user_memory_region(s, mem);
611 /* FIXME deal with errors */
614 int kvm_ioctl(KVMState *s, int type, ...)
616 int ret;
617 void *arg;
618 va_list ap;
620 va_start(ap, type);
621 arg = va_arg(ap, void *);
622 va_end(ap);
624 ret = ioctl(s->fd, type, arg);
625 if (ret == -1)
626 ret = -errno;
628 return ret;
631 int kvm_vm_ioctl(KVMState *s, int type, ...)
633 int ret;
634 void *arg;
635 va_list ap;
637 va_start(ap, type);
638 arg = va_arg(ap, void *);
639 va_end(ap);
641 ret = ioctl(s->vmfd, type, arg);
642 if (ret == -1)
643 ret = -errno;
645 return ret;
648 int kvm_vcpu_ioctl(CPUState *env, int type, ...)
650 int ret;
651 void *arg;
652 va_list ap;
654 va_start(ap, type);
655 arg = va_arg(ap, void *);
656 va_end(ap);
658 ret = ioctl(env->kvm_fd, type, arg);
659 if (ret == -1)
660 ret = -errno;
662 return ret;
665 int kvm_has_sync_mmu(void)
667 #ifdef KVM_CAP_SYNC_MMU
668 KVMState *s = kvm_state;
670 if (kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_SYNC_MMU) > 0)
671 return 1;
672 #endif
674 return 0;
677 #ifdef KVM_CAP_SET_GUEST_DEBUG
678 struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *env,
679 target_ulong pc)
681 struct kvm_sw_breakpoint *bp;
683 TAILQ_FOREACH(bp, &env->kvm_state->kvm_sw_breakpoints, entry) {
684 if (bp->pc == pc)
685 return bp;
687 return NULL;
690 int kvm_sw_breakpoints_active(CPUState *env)
692 return !TAILQ_EMPTY(&env->kvm_state->kvm_sw_breakpoints);
695 int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap)
697 struct kvm_guest_debug dbg;
699 dbg.control = 0;
700 if (env->singlestep_enabled)
701 dbg.control = KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
703 kvm_arch_update_guest_debug(env, &dbg);
704 dbg.control |= reinject_trap;
706 return kvm_vcpu_ioctl(env, KVM_SET_GUEST_DEBUG, &dbg);
709 int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
710 target_ulong len, int type)
712 struct kvm_sw_breakpoint *bp;
713 CPUState *env;
714 int err;
716 if (type == GDB_BREAKPOINT_SW) {
717 bp = kvm_find_sw_breakpoint(current_env, addr);
718 if (bp) {
719 bp->use_count++;
720 return 0;
723 bp = qemu_malloc(sizeof(struct kvm_sw_breakpoint));
724 if (!bp)
725 return -ENOMEM;
727 bp->pc = addr;
728 bp->use_count = 1;
729 err = kvm_arch_insert_sw_breakpoint(current_env, bp);
730 if (err) {
731 free(bp);
732 return err;
735 TAILQ_INSERT_HEAD(&current_env->kvm_state->kvm_sw_breakpoints,
736 bp, entry);
737 } else {
738 err = kvm_arch_insert_hw_breakpoint(addr, len, type);
739 if (err)
740 return err;
743 for (env = first_cpu; env != NULL; env = env->next_cpu) {
744 err = kvm_update_guest_debug(env, 0);
745 if (err)
746 return err;
748 return 0;
751 int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr,
752 target_ulong len, int type)
754 struct kvm_sw_breakpoint *bp;
755 CPUState *env;
756 int err;
758 if (type == GDB_BREAKPOINT_SW) {
759 bp = kvm_find_sw_breakpoint(current_env, addr);
760 if (!bp)
761 return -ENOENT;
763 if (bp->use_count > 1) {
764 bp->use_count--;
765 return 0;
768 err = kvm_arch_remove_sw_breakpoint(current_env, bp);
769 if (err)
770 return err;
772 TAILQ_REMOVE(&current_env->kvm_state->kvm_sw_breakpoints, bp, entry);
773 qemu_free(bp);
774 } else {
775 err = kvm_arch_remove_hw_breakpoint(addr, len, type);
776 if (err)
777 return err;
780 for (env = first_cpu; env != NULL; env = env->next_cpu) {
781 err = kvm_update_guest_debug(env, 0);
782 if (err)
783 return err;
785 return 0;
788 void kvm_remove_all_breakpoints(CPUState *current_env)
790 struct kvm_sw_breakpoint *bp, *next;
791 KVMState *s = current_env->kvm_state;
792 CPUState *env;
794 TAILQ_FOREACH_SAFE(bp, &s->kvm_sw_breakpoints, entry, next) {
795 if (kvm_arch_remove_sw_breakpoint(current_env, bp) != 0) {
796 /* Try harder to find a CPU that currently sees the breakpoint. */
797 for (env = first_cpu; env != NULL; env = env->next_cpu) {
798 if (kvm_arch_remove_sw_breakpoint(env, bp) == 0)
799 break;
803 kvm_arch_remove_all_hw_breakpoints();
805 for (env = first_cpu; env != NULL; env = env->next_cpu)
806 kvm_update_guest_debug(env, 0);
809 #else /* !KVM_CAP_SET_GUEST_DEBUG */
811 int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap)
813 return -EINVAL;
816 int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
817 target_ulong len, int type)
819 return -EINVAL;
822 int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr,
823 target_ulong len, int type)
825 return -EINVAL;
828 void kvm_remove_all_breakpoints(CPUState *current_env)
831 #endif /* !KVM_CAP_SET_GUEST_DEBUG */