Flush icache after dma operations for ia64
[qemu-kvm/fedora.git] / libkvm-common.h
blobdc5b667e27a11395c8309a98f2a075e05d4f8173
1 /*
2 * This header is for functions & variables that will ONLY be
3 * used inside libkvm.
5 * derived from libkvm.c
7 * Copyright (C) 2006 Qumranet, Inc.
9 * Authors:
10 * Avi Kivity <avi@qumranet.com>
11 * Yaniv Kamay <yaniv@qumranet.com>
13 * This work is licensed under the GNU LGPL license, version 2.
16 #ifndef KVM_COMMON_H
17 #define KVM_COMMON_H
19 /* FIXME: share this number with kvm */
20 /* FIXME: or dynamically alloc/realloc regions */
21 #ifdef __s390__
22 #define KVM_MAX_NUM_MEM_REGIONS 1u
23 #define MAX_VCPUS 64
24 #define LIBKVM_S390_ORIGIN (0UL)
25 #elif defined(__ia64__)
26 #define KVM_MAX_NUM_MEM_REGIONS 32u
27 #define MAX_VCPUS 256
28 #else
29 #define KVM_MAX_NUM_MEM_REGIONS 32u
30 #define MAX_VCPUS 16
31 #endif
34 /* kvm abi verison variable */
35 extern int kvm_abi;
37 /**
38 * \brief The KVM context
40 * The verbose KVM context
43 struct kvm_context {
44 /// Filedescriptor to /dev/kvm
45 int fd;
46 int vm_fd;
47 /// Callbacks that KVM uses to emulate various unvirtualizable functionality
48 struct kvm_callbacks *callbacks;
49 void *opaque;
50 /// is dirty pages logging enabled for all regions or not
51 int dirty_pages_log_all;
52 /// do not create in-kernel irqchip if set
53 int no_irqchip_creation;
54 /// in-kernel irqchip status
55 int irqchip_in_kernel;
56 /// ioctl to use to inject interrupts
57 int irqchip_inject_ioctl;
58 /// do not create in-kernel pit if set
59 int no_pit_creation;
60 /// in-kernel pit status
61 int pit_in_kernel;
62 /// in-kernel coalesced mmio
63 int coalesced_mmio;
64 #ifdef KVM_CAP_IRQ_ROUTING
65 struct kvm_irq_routing *irq_routes;
66 int nr_allocated_irq_routes;
67 #endif
68 void *used_gsi_bitmap;
69 int max_gsi;
72 struct kvm_vcpu_context
74 int fd;
75 struct kvm_run *run;
76 struct kvm_context *kvm;
77 uint32_t id;
80 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
81 void **vm_mem);
82 int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory,
83 void **vm_mem);
85 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
86 void **vm_mem);
87 int kvm_arch_run(kvm_vcpu_context_t vcpu);
90 void kvm_show_code(kvm_vcpu_context_t vcpu);
92 int handle_halt(kvm_vcpu_context_t vcpu);
93 int handle_shutdown(kvm_context_t kvm, void *env);
94 void post_kvm_run(kvm_context_t kvm, void *env);
95 int pre_kvm_run(kvm_context_t kvm, void *env);
96 int handle_io_window(kvm_context_t kvm);
97 int handle_debug(kvm_vcpu_context_t vcpu, void *env);
98 int try_push_interrupts(kvm_context_t kvm);
100 #endif