diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-02 14:41:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-02 14:41:11 -0500 |
commit | 597b0d21626da4e6f09f132442caf0cc2b0eb47c (patch) | |
tree | 13c0074bb20f7b05a471e78d4ff52c665a10266a /arch/ia64/include | |
parent | 2640c9a90fa596871e142f42052608864335f102 (diff) | |
parent | 87917239204d67a316cb89751750f86c9ed3640b (diff) |
Merge branch 'kvm-updates/2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm
* 'kvm-updates/2.6.29' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm: (140 commits)
KVM: MMU: handle large host sptes on invlpg/resync
KVM: Add locking to virtual i8259 interrupt controller
KVM: MMU: Don't treat a global pte as such if cr4.pge is cleared
MAINTAINERS: Maintainership changes for kvm/ia64
KVM: ia64: Fix kvm_arch_vcpu_ioctl_[gs]et_regs()
KVM: x86: Rework user space NMI injection as KVM_CAP_USER_NMI
KVM: VMX: Fix pending NMI-vs.-IRQ race for user space irqchip
KVM: fix handling of ACK from shared guest IRQ
KVM: MMU: check for present pdptr shadow page in walk_shadow
KVM: Consolidate userspace memory capability reporting into common code
KVM: Advertise the bug in memory region destruction as fixed
KVM: use cpumask_var_t for cpus_hardware_enabled
KVM: use modern cpumask primitives, no cpumask_t on stack
KVM: Extract core of kvm_flush_remote_tlbs/kvm_reload_remote_mmus
KVM: set owner of cpu and vm file operations
anon_inodes: use fops->owner for module refcount
x86: KVM guest: kvm_get_tsc_khz: return khz, not lpj
KVM: MMU: prepopulate the shadow on invlpg
KVM: MMU: skip global pgtables on sync due to cr3 switch
KVM: MMU: collapse remote TLB flushes on root sync
...
Diffstat (limited to 'arch/ia64/include')
-rw-r--r-- | arch/ia64/include/asm/kvm.h | 6 | ||||
-rw-r--r-- | arch/ia64/include/asm/kvm_host.h | 196 |
2 files changed, 128 insertions, 74 deletions
diff --git a/arch/ia64/include/asm/kvm.h b/arch/ia64/include/asm/kvm.h index f38472ac2267..68aa6da807c1 100644 --- a/arch/ia64/include/asm/kvm.h +++ b/arch/ia64/include/asm/kvm.h | |||
@@ -166,8 +166,6 @@ struct saved_vpd { | |||
166 | }; | 166 | }; |
167 | 167 | ||
168 | struct kvm_regs { | 168 | struct kvm_regs { |
169 | char *saved_guest; | ||
170 | char *saved_stack; | ||
171 | struct saved_vpd vpd; | 169 | struct saved_vpd vpd; |
172 | /*Arch-regs*/ | 170 | /*Arch-regs*/ |
173 | int mp_state; | 171 | int mp_state; |
@@ -200,6 +198,10 @@ struct kvm_regs { | |||
200 | unsigned long fp_psr; /*used for lazy float register */ | 198 | unsigned long fp_psr; /*used for lazy float register */ |
201 | unsigned long saved_gp; | 199 | unsigned long saved_gp; |
202 | /*for phycial emulation */ | 200 | /*for phycial emulation */ |
201 | |||
202 | union context saved_guest; | ||
203 | |||
204 | unsigned long reserved[64]; /* for future use */ | ||
203 | }; | 205 | }; |
204 | 206 | ||
205 | struct kvm_sregs { | 207 | struct kvm_sregs { |
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h index c60d324da540..0560f3fae538 100644 --- a/arch/ia64/include/asm/kvm_host.h +++ b/arch/ia64/include/asm/kvm_host.h | |||
@@ -23,17 +23,6 @@ | |||
23 | #ifndef __ASM_KVM_HOST_H | 23 | #ifndef __ASM_KVM_HOST_H |
24 | #define __ASM_KVM_HOST_H | 24 | #define __ASM_KVM_HOST_H |
25 | 25 | ||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/mm.h> | ||
29 | #include <linux/kvm.h> | ||
30 | #include <linux/kvm_para.h> | ||
31 | #include <linux/kvm_types.h> | ||
32 | |||
33 | #include <asm/pal.h> | ||
34 | #include <asm/sal.h> | ||
35 | |||
36 | #define KVM_MAX_VCPUS 4 | ||
37 | #define KVM_MEMORY_SLOTS 32 | 26 | #define KVM_MEMORY_SLOTS 32 |
38 | /* memory slots that does not exposed to userspace */ | 27 | /* memory slots that does not exposed to userspace */ |
39 | #define KVM_PRIVATE_MEM_SLOTS 4 | 28 | #define KVM_PRIVATE_MEM_SLOTS 4 |
@@ -50,70 +39,132 @@ | |||
50 | #define EXIT_REASON_EXTERNAL_INTERRUPT 6 | 39 | #define EXIT_REASON_EXTERNAL_INTERRUPT 6 |
51 | #define EXIT_REASON_IPI 7 | 40 | #define EXIT_REASON_IPI 7 |
52 | #define EXIT_REASON_PTC_G 8 | 41 | #define EXIT_REASON_PTC_G 8 |
42 | #define EXIT_REASON_DEBUG 20 | ||
53 | 43 | ||
54 | /*Define vmm address space and vm data space.*/ | 44 | /*Define vmm address space and vm data space.*/ |
55 | #define KVM_VMM_SIZE (16UL<<20) | 45 | #define KVM_VMM_SIZE (__IA64_UL_CONST(16)<<20) |
56 | #define KVM_VMM_SHIFT 24 | 46 | #define KVM_VMM_SHIFT 24 |
57 | #define KVM_VMM_BASE 0xD000000000000000UL | 47 | #define KVM_VMM_BASE 0xD000000000000000 |
58 | #define VMM_SIZE (8UL<<20) | 48 | #define VMM_SIZE (__IA64_UL_CONST(8)<<20) |
59 | 49 | ||
60 | /* | 50 | /* |
61 | * Define vm_buffer, used by PAL Services, base address. | 51 | * Define vm_buffer, used by PAL Services, base address. |
62 | * Note: vmbuffer is in the VMM-BLOCK, the size must be < 8M | 52 | * Note: vm_buffer is in the VMM-BLOCK, the size must be < 8M |
63 | */ | 53 | */ |
64 | #define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE) | 54 | #define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE) |
65 | #define KVM_VM_BUFFER_SIZE (8UL<<20) | 55 | #define KVM_VM_BUFFER_SIZE (__IA64_UL_CONST(8)<<20) |
66 | 56 | ||
67 | /*Define Virtual machine data layout.*/ | 57 | /* |
68 | #define KVM_VM_DATA_SHIFT 24 | 58 | * kvm guest's data area looks as follow: |
69 | #define KVM_VM_DATA_SIZE (1UL << KVM_VM_DATA_SHIFT) | 59 | * |
70 | #define KVM_VM_DATA_BASE (KVM_VMM_BASE + KVM_VMM_SIZE) | 60 | * +----------------------+ ------- KVM_VM_DATA_SIZE |
71 | 61 | * | vcpu[n]'s data | | ___________________KVM_STK_OFFSET | |
72 | 62 | * | | | / | | |
73 | #define KVM_P2M_BASE KVM_VM_DATA_BASE | 63 | * | .......... | | /vcpu's struct&stack | |
74 | #define KVM_P2M_OFS 0 | 64 | * | .......... | | /---------------------|---- 0 |
75 | #define KVM_P2M_SIZE (8UL << 20) | 65 | * | vcpu[5]'s data | | / vpd | |
76 | 66 | * | vcpu[4]'s data | |/-----------------------| | |
77 | #define KVM_VHPT_BASE (KVM_P2M_BASE + KVM_P2M_SIZE) | 67 | * | vcpu[3]'s data | / vtlb | |
78 | #define KVM_VHPT_OFS KVM_P2M_SIZE | 68 | * | vcpu[2]'s data | /|------------------------| |
79 | #define KVM_VHPT_BLOCK_SIZE (2UL << 20) | 69 | * | vcpu[1]'s data |/ | vhpt | |
80 | #define VHPT_SHIFT 18 | 70 | * | vcpu[0]'s data |____________________________| |
81 | #define VHPT_SIZE (1UL << VHPT_SHIFT) | 71 | * +----------------------+ | |
82 | #define VHPT_NUM_ENTRIES (1<<(VHPT_SHIFT-5)) | 72 | * | memory dirty log | | |
83 | 73 | * +----------------------+ | | |
84 | #define KVM_VTLB_BASE (KVM_VHPT_BASE+KVM_VHPT_BLOCK_SIZE) | 74 | * | vm's data struct | | |
85 | #define KVM_VTLB_OFS (KVM_VHPT_OFS+KVM_VHPT_BLOCK_SIZE) | 75 | * +----------------------+ | |
86 | #define KVM_VTLB_BLOCK_SIZE (1UL<<20) | 76 | * | | | |
87 | #define VTLB_SHIFT 17 | 77 | * | | | |
88 | #define VTLB_SIZE (1UL<<VTLB_SHIFT) | 78 | * | | | |
89 | #define VTLB_NUM_ENTRIES (1<<(VTLB_SHIFT-5)) | 79 | * | | | |
90 | 80 | * | | | | |
91 | #define KVM_VPD_BASE (KVM_VTLB_BASE+KVM_VTLB_BLOCK_SIZE) | 81 | * | | | |
92 | #define KVM_VPD_OFS (KVM_VTLB_OFS+KVM_VTLB_BLOCK_SIZE) | 82 | * | | | |
93 | #define KVM_VPD_BLOCK_SIZE (2UL<<20) | 83 | * | vm's p2m table | | |
94 | #define VPD_SHIFT 16 | 84 | * | | | |
95 | #define VPD_SIZE (1UL<<VPD_SHIFT) | 85 | * | | | |
96 | 86 | * | | | | | |
97 | #define KVM_VCPU_BASE (KVM_VPD_BASE+KVM_VPD_BLOCK_SIZE) | 87 | * vm's data->| | | | |
98 | #define KVM_VCPU_OFS (KVM_VPD_OFS+KVM_VPD_BLOCK_SIZE) | 88 | * +----------------------+ ------- 0 |
99 | #define KVM_VCPU_BLOCK_SIZE (2UL<<20) | 89 | * To support large memory, needs to increase the size of p2m. |
100 | #define VCPU_SHIFT 18 | 90 | * To support more vcpus, needs to ensure it has enough space to |
101 | #define VCPU_SIZE (1UL<<VCPU_SHIFT) | 91 | * hold vcpus' data. |
102 | #define MAX_VCPU_NUM KVM_VCPU_BLOCK_SIZE/VCPU_SIZE | 92 | */ |
103 | 93 | ||
104 | #define KVM_VM_BASE (KVM_VCPU_BASE+KVM_VCPU_BLOCK_SIZE) | 94 | #define KVM_VM_DATA_SHIFT 26 |
105 | #define KVM_VM_OFS (KVM_VCPU_OFS+KVM_VCPU_BLOCK_SIZE) | 95 | #define KVM_VM_DATA_SIZE (__IA64_UL_CONST(1) << KVM_VM_DATA_SHIFT) |
106 | #define KVM_VM_BLOCK_SIZE (1UL<<19) | 96 | #define KVM_VM_DATA_BASE (KVM_VMM_BASE + KVM_VM_DATA_SIZE) |
107 | 97 | ||
108 | #define KVM_MEM_DIRTY_LOG_BASE (KVM_VM_BASE+KVM_VM_BLOCK_SIZE) | 98 | #define KVM_P2M_BASE KVM_VM_DATA_BASE |
109 | #define KVM_MEM_DIRTY_LOG_OFS (KVM_VM_OFS+KVM_VM_BLOCK_SIZE) | 99 | #define KVM_P2M_SIZE (__IA64_UL_CONST(24) << 20) |
110 | #define KVM_MEM_DIRTY_LOG_SIZE (1UL<<19) | 100 | |
111 | 101 | #define VHPT_SHIFT 16 | |
112 | /* Get vpd, vhpt, tlb, vcpu, base*/ | 102 | #define VHPT_SIZE (__IA64_UL_CONST(1) << VHPT_SHIFT) |
113 | #define VPD_ADDR(n) (KVM_VPD_BASE+n*VPD_SIZE) | 103 | #define VHPT_NUM_ENTRIES (__IA64_UL_CONST(1) << (VHPT_SHIFT-5)) |
114 | #define VHPT_ADDR(n) (KVM_VHPT_BASE+n*VHPT_SIZE) | 104 | |
115 | #define VTLB_ADDR(n) (KVM_VTLB_BASE+n*VTLB_SIZE) | 105 | #define VTLB_SHIFT 16 |
116 | #define VCPU_ADDR(n) (KVM_VCPU_BASE+n*VCPU_SIZE) | 106 | #define VTLB_SIZE (__IA64_UL_CONST(1) << VTLB_SHIFT) |
107 | #define VTLB_NUM_ENTRIES (1UL << (VHPT_SHIFT-5)) | ||
108 | |||
109 | #define VPD_SHIFT 16 | ||
110 | #define VPD_SIZE (__IA64_UL_CONST(1) << VPD_SHIFT) | ||
111 | |||
112 | #define VCPU_STRUCT_SHIFT 16 | ||
113 | #define VCPU_STRUCT_SIZE (__IA64_UL_CONST(1) << VCPU_STRUCT_SHIFT) | ||
114 | |||
115 | #define KVM_STK_OFFSET VCPU_STRUCT_SIZE | ||
116 | |||
117 | #define KVM_VM_STRUCT_SHIFT 19 | ||
118 | #define KVM_VM_STRUCT_SIZE (__IA64_UL_CONST(1) << KVM_VM_STRUCT_SHIFT) | ||
119 | |||
120 | #define KVM_MEM_DIRY_LOG_SHIFT 19 | ||
121 | #define KVM_MEM_DIRTY_LOG_SIZE (__IA64_UL_CONST(1) << KVM_MEM_DIRY_LOG_SHIFT) | ||
122 | |||
123 | #ifndef __ASSEMBLY__ | ||
124 | |||
125 | /*Define the max vcpus and memory for Guests.*/ | ||
126 | #define KVM_MAX_VCPUS (KVM_VM_DATA_SIZE - KVM_P2M_SIZE - KVM_VM_STRUCT_SIZE -\ | ||
127 | KVM_MEM_DIRTY_LOG_SIZE) / sizeof(struct kvm_vcpu_data) | ||
128 | #define KVM_MAX_MEM_SIZE (KVM_P2M_SIZE >> 3 << PAGE_SHIFT) | ||
129 | |||
130 | #define VMM_LOG_LEN 256 | ||
131 | |||
132 | #include <linux/types.h> | ||
133 | #include <linux/mm.h> | ||
134 | #include <linux/kvm.h> | ||
135 | #include <linux/kvm_para.h> | ||
136 | #include <linux/kvm_types.h> | ||
137 | |||
138 | #include <asm/pal.h> | ||
139 | #include <asm/sal.h> | ||
140 | #include <asm/page.h> | ||
141 | |||
142 | struct kvm_vcpu_data { | ||
143 | char vcpu_vhpt[VHPT_SIZE]; | ||
144 | char vcpu_vtlb[VTLB_SIZE]; | ||
145 | char vcpu_vpd[VPD_SIZE]; | ||
146 | char vcpu_struct[VCPU_STRUCT_SIZE]; | ||
147 | }; | ||
148 | |||
149 | struct kvm_vm_data { | ||
150 | char kvm_p2m[KVM_P2M_SIZE]; | ||
151 | char kvm_vm_struct[KVM_VM_STRUCT_SIZE]; | ||
152 | char kvm_mem_dirty_log[KVM_MEM_DIRTY_LOG_SIZE]; | ||
153 | struct kvm_vcpu_data vcpu_data[KVM_MAX_VCPUS]; | ||
154 | }; | ||
155 | |||
156 | #define VCPU_BASE(n) KVM_VM_DATA_BASE + \ | ||
157 | offsetof(struct kvm_vm_data, vcpu_data[n]) | ||
158 | #define VM_BASE KVM_VM_DATA_BASE + \ | ||
159 | offsetof(struct kvm_vm_data, kvm_vm_struct) | ||
160 | #define KVM_MEM_DIRTY_LOG_BASE KVM_VM_DATA_BASE + \ | ||
161 | offsetof(struct kvm_vm_data, kvm_mem_dirty_log) | ||
162 | |||
163 | #define VHPT_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vhpt)) | ||
164 | #define VTLB_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vtlb)) | ||
165 | #define VPD_BASE(n) (VCPU_BASE(n) + offsetof(struct kvm_vcpu_data, vcpu_vpd)) | ||
166 | #define VCPU_STRUCT_BASE(n) (VCPU_BASE(n) + \ | ||
167 | offsetof(struct kvm_vcpu_data, vcpu_struct)) | ||
117 | 168 | ||
118 | /*IO section definitions*/ | 169 | /*IO section definitions*/ |
119 | #define IOREQ_READ 1 | 170 | #define IOREQ_READ 1 |
@@ -389,6 +440,7 @@ struct kvm_vcpu_arch { | |||
389 | 440 | ||
390 | unsigned long opcode; | 441 | unsigned long opcode; |
391 | unsigned long cause; | 442 | unsigned long cause; |
443 | char log_buf[VMM_LOG_LEN]; | ||
392 | union context host; | 444 | union context host; |
393 | union context guest; | 445 | union context guest; |
394 | }; | 446 | }; |
@@ -403,14 +455,13 @@ struct kvm_sal_data { | |||
403 | }; | 455 | }; |
404 | 456 | ||
405 | struct kvm_arch { | 457 | struct kvm_arch { |
458 | spinlock_t dirty_log_lock; | ||
459 | |||
406 | unsigned long vm_base; | 460 | unsigned long vm_base; |
407 | unsigned long metaphysical_rr0; | 461 | unsigned long metaphysical_rr0; |
408 | unsigned long metaphysical_rr4; | 462 | unsigned long metaphysical_rr4; |
409 | unsigned long vmm_init_rr; | 463 | unsigned long vmm_init_rr; |
410 | unsigned long vhpt_base; | 464 | |
411 | unsigned long vtlb_base; | ||
412 | unsigned long vpd_base; | ||
413 | spinlock_t dirty_log_lock; | ||
414 | struct kvm_ioapic *vioapic; | 465 | struct kvm_ioapic *vioapic; |
415 | struct kvm_vm_stat stat; | 466 | struct kvm_vm_stat stat; |
416 | struct kvm_sal_data rdv_sal_data; | 467 | struct kvm_sal_data rdv_sal_data; |
@@ -512,7 +563,7 @@ struct kvm_pt_regs { | |||
512 | 563 | ||
513 | static inline struct kvm_pt_regs *vcpu_regs(struct kvm_vcpu *v) | 564 | static inline struct kvm_pt_regs *vcpu_regs(struct kvm_vcpu *v) |
514 | { | 565 | { |
515 | return (struct kvm_pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; | 566 | return (struct kvm_pt_regs *) ((unsigned long) v + KVM_STK_OFFSET) - 1; |
516 | } | 567 | } |
517 | 568 | ||
518 | typedef int kvm_vmm_entry(void); | 569 | typedef int kvm_vmm_entry(void); |
@@ -531,5 +582,6 @@ int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); | |||
531 | void kvm_sal_emul(struct kvm_vcpu *vcpu); | 582 | void kvm_sal_emul(struct kvm_vcpu *vcpu); |
532 | 583 | ||
533 | static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {} | 584 | static inline void kvm_inject_nmi(struct kvm_vcpu *vcpu) {} |
585 | #endif /* __ASSEMBLY__*/ | ||
534 | 586 | ||
535 | #endif | 587 | #endif |