kvm: libkvm: raise max vcpus to 256 for ia64
[qemu-kvm/fedora.git] / kvm / libkvm / kvm-common.h
blobda56e22e681bc694dcb9fc1140d318f60812625b
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 /// 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;
66 void init_slots(void);
67 int get_free_slot(kvm_context_t kvm);
68 void register_slot(int slot, unsigned long phys_addr, unsigned long len,
69 unsigned long userspace_addr, unsigned flags);
71 void free_slot(int slot);
72 int get_slot(unsigned long phys_addr);
74 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
75 void **vm_mem);
76 int kvm_alloc_userspace_memory(kvm_context_t kvm, unsigned long memory,
77 void **vm_mem);
79 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
80 void **vm_mem);
81 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu);
84 void kvm_show_code(kvm_context_t kvm, int vcpu);
86 int handle_halt(kvm_context_t kvm, int vcpu);
87 int handle_shutdown(kvm_context_t kvm, int vcpu);
88 void post_kvm_run(kvm_context_t kvm, int vcpu);
89 int pre_kvm_run(kvm_context_t kvm, int vcpu);
90 int handle_io_window(kvm_context_t kvm);
91 int handle_debug(kvm_context_t kvm, int vcpu);
92 int try_push_interrupts(kvm_context_t kvm);
94 #endif