Handle IRQ status injection in userspace
[qemu-kvm/fedora.git] / kvm / libkvm / kvm-common.h
blobde1ada2e5f78bb7345d4bf83f132c409978d00cf
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 __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 int vcpu_fd[MAX_VCPUS];
48 struct kvm_run *run[MAX_VCPUS];
49 /// Callbacks that KVM uses to emulate various unvirtualizable functionality
50 struct kvm_callbacks *callbacks;
51 void *opaque;
52 /// is dirty pages logging enabled for all regions or not
53 int dirty_pages_log_all;
54 /// do not create in-kernel irqchip if set
55 int no_irqchip_creation;
56 /// in-kernel irqchip status
57 int irqchip_in_kernel;
58 /// ioctl to use to inject interrupts
59 int irqchip_inject_ioctl;
60 /// do not create in-kernel pit if set
61 int no_pit_creation;
62 /// in-kernel pit status
63 int pit_in_kernel;
64 /// in-kernel coalesced mmio
65 int coalesced_mmio;
66 #ifdef KVM_CAP_IRQ_ROUTING
67 struct kvm_irq_routing *irq_routes;
68 int nr_allocated_irq_routes;
69 #endif
72 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
73 void **vm_mem);
74 int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory,
75 void **vm_mem);
77 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
78 void **vm_mem);
79 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu);
82 void kvm_show_code(kvm_context_t kvm, int vcpu);
84 int handle_halt(kvm_context_t kvm, int vcpu);
85 int handle_shutdown(kvm_context_t kvm, void *env);
86 void post_kvm_run(kvm_context_t kvm, void *env);
87 int pre_kvm_run(kvm_context_t kvm, void *env);
88 int handle_io_window(kvm_context_t kvm);
89 int handle_debug(kvm_context_t kvm, int vcpu, void *env);
90 int try_push_interrupts(kvm_context_t kvm);
92 #endif