diff options
author | Alexander Graf <agraf@suse.de> | 2010-04-15 18:11:44 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-05-17 05:18:32 -0400 |
commit | 0604675fe17f68741730cebe74422605bb79d972 (patch) | |
tree | 9eea58b6952f3d49be3bda9e957af104c191fe47 /arch/powerpc | |
parent | 56db45a5cd06e3a6a7823a8cd7541e6bafe8427b (diff) |
KVM: PPC: Use now shadowed vcpu fields
The shadow vcpu now contains some fields we don't use from the vcpu anymore.
Access to them happens using inline functions that happily use the shadow
vcpu fields.
So let's now ifdef them out to booke only and add asm-offsets.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 8 | ||||
-rw-r--r-- | arch/powerpc/include/asm/paca.h | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 91 |
3 files changed, 57 insertions, 48 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 22801f802312..5a83995105f8 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -191,11 +191,11 @@ struct kvm_vcpu_arch { | |||
191 | u32 qpr[32]; | 191 | u32 qpr[32]; |
192 | #endif | 192 | #endif |
193 | 193 | ||
194 | #ifdef CONFIG_BOOKE | ||
194 | ulong pc; | 195 | ulong pc; |
195 | ulong ctr; | 196 | ulong ctr; |
196 | ulong lr; | 197 | ulong lr; |
197 | 198 | ||
198 | #ifdef CONFIG_BOOKE | ||
199 | ulong xer; | 199 | ulong xer; |
200 | u32 cr; | 200 | u32 cr; |
201 | #endif | 201 | #endif |
@@ -203,7 +203,6 @@ struct kvm_vcpu_arch { | |||
203 | ulong msr; | 203 | ulong msr; |
204 | #ifdef CONFIG_PPC_BOOK3S | 204 | #ifdef CONFIG_PPC_BOOK3S |
205 | ulong shadow_msr; | 205 | ulong shadow_msr; |
206 | ulong shadow_srr1; | ||
207 | ulong hflags; | 206 | ulong hflags; |
208 | ulong guest_owned_ext; | 207 | ulong guest_owned_ext; |
209 | #endif | 208 | #endif |
@@ -258,14 +257,13 @@ struct kvm_vcpu_arch { | |||
258 | struct dentry *debugfs_exit_timing; | 257 | struct dentry *debugfs_exit_timing; |
259 | #endif | 258 | #endif |
260 | 259 | ||
260 | #ifdef CONFIG_BOOKE | ||
261 | u32 last_inst; | 261 | u32 last_inst; |
262 | #ifdef CONFIG_PPC64 | ||
263 | u32 fault_dsisr; | ||
264 | #endif | ||
265 | ulong fault_dear; | 262 | ulong fault_dear; |
266 | ulong fault_esr; | 263 | ulong fault_esr; |
267 | ulong queued_dear; | 264 | ulong queued_dear; |
268 | ulong queued_esr; | 265 | ulong queued_esr; |
266 | #endif | ||
269 | gpa_t paddr_accessed; | 267 | gpa_t paddr_accessed; |
270 | 268 | ||
271 | u8 io_gpr; /* GPR used as IO source/target */ | 269 | u8 io_gpr; /* GPR used as IO source/target */ |
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h index 33347ea4b47a..224eb371ca1d 100644 --- a/arch/powerpc/include/asm/paca.h +++ b/arch/powerpc/include/asm/paca.h | |||
@@ -137,14 +137,8 @@ struct paca_struct { | |||
137 | u64 startspurr; /* SPURR value snapshot */ | 137 | u64 startspurr; /* SPURR value snapshot */ |
138 | 138 | ||
139 | #ifdef CONFIG_KVM_BOOK3S_HANDLER | 139 | #ifdef CONFIG_KVM_BOOK3S_HANDLER |
140 | struct { | ||
141 | u64 esid; | ||
142 | u64 vsid; | ||
143 | } kvm_slb[64]; /* guest SLB */ | ||
144 | /* We use this to store guest state in */ | 140 | /* We use this to store guest state in */ |
145 | struct kvmppc_book3s_shadow_vcpu shadow_vcpu; | 141 | struct kvmppc_book3s_shadow_vcpu shadow_vcpu; |
146 | u8 kvm_slb_max; /* highest used guest slb entry */ | ||
147 | u8 kvm_in_guest; /* are we inside the guest? */ | ||
148 | #endif | 142 | #endif |
149 | }; | 143 | }; |
150 | 144 | ||
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index 57a8c49c8830..e8003ff81eef 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -50,6 +50,9 @@ | |||
50 | #endif | 50 | #endif |
51 | #ifdef CONFIG_KVM | 51 | #ifdef CONFIG_KVM |
52 | #include <linux/kvm_host.h> | 52 | #include <linux/kvm_host.h> |
53 | #ifndef CONFIG_BOOKE | ||
54 | #include <asm/kvm_book3s.h> | ||
55 | #endif | ||
53 | #endif | 56 | #endif |
54 | 57 | ||
55 | #ifdef CONFIG_PPC32 | 58 | #ifdef CONFIG_PPC32 |
@@ -191,33 +194,9 @@ int main(void) | |||
191 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); | 194 | DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); |
192 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); | 195 | DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); |
193 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER | 196 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER |
194 | DEFINE(PACA_KVM_IN_GUEST, offsetof(struct paca_struct, kvm_in_guest)); | 197 | DEFINE(PACA_KVM_SVCPU, offsetof(struct paca_struct, shadow_vcpu)); |
195 | DEFINE(PACA_KVM_SLB, offsetof(struct paca_struct, kvm_slb)); | 198 | DEFINE(SVCPU_SLB, offsetof(struct kvmppc_book3s_shadow_vcpu, slb)); |
196 | DEFINE(PACA_KVM_SLB_MAX, offsetof(struct paca_struct, kvm_slb_max)); | 199 | DEFINE(SVCPU_SLB_MAX, offsetof(struct kvmppc_book3s_shadow_vcpu, slb_max)); |
197 | DEFINE(PACA_KVM_CR, offsetof(struct paca_struct, shadow_vcpu.cr)); | ||
198 | DEFINE(PACA_KVM_XER, offsetof(struct paca_struct, shadow_vcpu.xer)); | ||
199 | DEFINE(PACA_KVM_R0, offsetof(struct paca_struct, shadow_vcpu.gpr[0])); | ||
200 | DEFINE(PACA_KVM_R1, offsetof(struct paca_struct, shadow_vcpu.gpr[1])); | ||
201 | DEFINE(PACA_KVM_R2, offsetof(struct paca_struct, shadow_vcpu.gpr[2])); | ||
202 | DEFINE(PACA_KVM_R3, offsetof(struct paca_struct, shadow_vcpu.gpr[3])); | ||
203 | DEFINE(PACA_KVM_R4, offsetof(struct paca_struct, shadow_vcpu.gpr[4])); | ||
204 | DEFINE(PACA_KVM_R5, offsetof(struct paca_struct, shadow_vcpu.gpr[5])); | ||
205 | DEFINE(PACA_KVM_R6, offsetof(struct paca_struct, shadow_vcpu.gpr[6])); | ||
206 | DEFINE(PACA_KVM_R7, offsetof(struct paca_struct, shadow_vcpu.gpr[7])); | ||
207 | DEFINE(PACA_KVM_R8, offsetof(struct paca_struct, shadow_vcpu.gpr[8])); | ||
208 | DEFINE(PACA_KVM_R9, offsetof(struct paca_struct, shadow_vcpu.gpr[9])); | ||
209 | DEFINE(PACA_KVM_R10, offsetof(struct paca_struct, shadow_vcpu.gpr[10])); | ||
210 | DEFINE(PACA_KVM_R11, offsetof(struct paca_struct, shadow_vcpu.gpr[11])); | ||
211 | DEFINE(PACA_KVM_R12, offsetof(struct paca_struct, shadow_vcpu.gpr[12])); | ||
212 | DEFINE(PACA_KVM_R13, offsetof(struct paca_struct, shadow_vcpu.gpr[13])); | ||
213 | DEFINE(PACA_KVM_HOST_R1, offsetof(struct paca_struct, shadow_vcpu.host_r1)); | ||
214 | DEFINE(PACA_KVM_HOST_R2, offsetof(struct paca_struct, shadow_vcpu.host_r2)); | ||
215 | DEFINE(PACA_KVM_VMHANDLER, offsetof(struct paca_struct, | ||
216 | shadow_vcpu.vmhandler)); | ||
217 | DEFINE(PACA_KVM_SCRATCH0, offsetof(struct paca_struct, | ||
218 | shadow_vcpu.scratch0)); | ||
219 | DEFINE(PACA_KVM_SCRATCH1, offsetof(struct paca_struct, | ||
220 | shadow_vcpu.scratch1)); | ||
221 | #endif | 200 | #endif |
222 | #endif /* CONFIG_PPC64 */ | 201 | #endif /* CONFIG_PPC64 */ |
223 | 202 | ||
@@ -412,9 +391,6 @@ int main(void) | |||
412 | DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, arch.host_stack)); | 391 | DEFINE(VCPU_HOST_STACK, offsetof(struct kvm_vcpu, arch.host_stack)); |
413 | DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, arch.host_pid)); | 392 | DEFINE(VCPU_HOST_PID, offsetof(struct kvm_vcpu, arch.host_pid)); |
414 | DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr)); | 393 | DEFINE(VCPU_GPRS, offsetof(struct kvm_vcpu, arch.gpr)); |
415 | DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr)); | ||
416 | DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr)); | ||
417 | DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc)); | ||
418 | DEFINE(VCPU_MSR, offsetof(struct kvm_vcpu, arch.msr)); | 394 | DEFINE(VCPU_MSR, offsetof(struct kvm_vcpu, arch.msr)); |
419 | DEFINE(VCPU_SPRG4, offsetof(struct kvm_vcpu, arch.sprg4)); | 395 | DEFINE(VCPU_SPRG4, offsetof(struct kvm_vcpu, arch.sprg4)); |
420 | DEFINE(VCPU_SPRG5, offsetof(struct kvm_vcpu, arch.sprg5)); | 396 | DEFINE(VCPU_SPRG5, offsetof(struct kvm_vcpu, arch.sprg5)); |
@@ -422,26 +398,67 @@ int main(void) | |||
422 | DEFINE(VCPU_SPRG7, offsetof(struct kvm_vcpu, arch.sprg7)); | 398 | DEFINE(VCPU_SPRG7, offsetof(struct kvm_vcpu, arch.sprg7)); |
423 | DEFINE(VCPU_SHADOW_PID, offsetof(struct kvm_vcpu, arch.shadow_pid)); | 399 | DEFINE(VCPU_SHADOW_PID, offsetof(struct kvm_vcpu, arch.shadow_pid)); |
424 | 400 | ||
425 | DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); | ||
426 | DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); | ||
427 | DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); | ||
428 | |||
429 | /* book3s */ | 401 | /* book3s */ |
430 | #ifdef CONFIG_PPC_BOOK3S | 402 | #ifdef CONFIG_PPC_BOOK3S |
431 | DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr)); | ||
432 | DEFINE(VCPU_HOST_RETIP, offsetof(struct kvm_vcpu, arch.host_retip)); | 403 | DEFINE(VCPU_HOST_RETIP, offsetof(struct kvm_vcpu, arch.host_retip)); |
433 | DEFINE(VCPU_HOST_R2, offsetof(struct kvm_vcpu, arch.host_r2)); | ||
434 | DEFINE(VCPU_HOST_MSR, offsetof(struct kvm_vcpu, arch.host_msr)); | 404 | DEFINE(VCPU_HOST_MSR, offsetof(struct kvm_vcpu, arch.host_msr)); |
435 | DEFINE(VCPU_SHADOW_MSR, offsetof(struct kvm_vcpu, arch.shadow_msr)); | 405 | DEFINE(VCPU_SHADOW_MSR, offsetof(struct kvm_vcpu, arch.shadow_msr)); |
436 | DEFINE(VCPU_SHADOW_SRR1, offsetof(struct kvm_vcpu, arch.shadow_srr1)); | ||
437 | DEFINE(VCPU_TRAMPOLINE_LOWMEM, offsetof(struct kvm_vcpu, arch.trampoline_lowmem)); | 406 | DEFINE(VCPU_TRAMPOLINE_LOWMEM, offsetof(struct kvm_vcpu, arch.trampoline_lowmem)); |
438 | DEFINE(VCPU_TRAMPOLINE_ENTER, offsetof(struct kvm_vcpu, arch.trampoline_enter)); | 407 | DEFINE(VCPU_TRAMPOLINE_ENTER, offsetof(struct kvm_vcpu, arch.trampoline_enter)); |
439 | DEFINE(VCPU_HIGHMEM_HANDLER, offsetof(struct kvm_vcpu, arch.highmem_handler)); | 408 | DEFINE(VCPU_HIGHMEM_HANDLER, offsetof(struct kvm_vcpu, arch.highmem_handler)); |
440 | DEFINE(VCPU_RMCALL, offsetof(struct kvm_vcpu, arch.rmcall)); | 409 | DEFINE(VCPU_RMCALL, offsetof(struct kvm_vcpu, arch.rmcall)); |
441 | DEFINE(VCPU_HFLAGS, offsetof(struct kvm_vcpu, arch.hflags)); | 410 | DEFINE(VCPU_HFLAGS, offsetof(struct kvm_vcpu, arch.hflags)); |
411 | DEFINE(VCPU_SVCPU, offsetof(struct kvmppc_vcpu_book3s, shadow_vcpu) - | ||
412 | offsetof(struct kvmppc_vcpu_book3s, vcpu)); | ||
413 | DEFINE(SVCPU_CR, offsetof(struct kvmppc_book3s_shadow_vcpu, cr)); | ||
414 | DEFINE(SVCPU_XER, offsetof(struct kvmppc_book3s_shadow_vcpu, xer)); | ||
415 | DEFINE(SVCPU_CTR, offsetof(struct kvmppc_book3s_shadow_vcpu, ctr)); | ||
416 | DEFINE(SVCPU_LR, offsetof(struct kvmppc_book3s_shadow_vcpu, lr)); | ||
417 | DEFINE(SVCPU_PC, offsetof(struct kvmppc_book3s_shadow_vcpu, pc)); | ||
418 | DEFINE(SVCPU_R0, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[0])); | ||
419 | DEFINE(SVCPU_R1, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[1])); | ||
420 | DEFINE(SVCPU_R2, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[2])); | ||
421 | DEFINE(SVCPU_R3, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[3])); | ||
422 | DEFINE(SVCPU_R4, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[4])); | ||
423 | DEFINE(SVCPU_R5, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[5])); | ||
424 | DEFINE(SVCPU_R6, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[6])); | ||
425 | DEFINE(SVCPU_R7, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[7])); | ||
426 | DEFINE(SVCPU_R8, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[8])); | ||
427 | DEFINE(SVCPU_R9, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[9])); | ||
428 | DEFINE(SVCPU_R10, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[10])); | ||
429 | DEFINE(SVCPU_R11, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[11])); | ||
430 | DEFINE(SVCPU_R12, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[12])); | ||
431 | DEFINE(SVCPU_R13, offsetof(struct kvmppc_book3s_shadow_vcpu, gpr[13])); | ||
432 | DEFINE(SVCPU_HOST_R1, offsetof(struct kvmppc_book3s_shadow_vcpu, host_r1)); | ||
433 | DEFINE(SVCPU_HOST_R2, offsetof(struct kvmppc_book3s_shadow_vcpu, host_r2)); | ||
434 | DEFINE(SVCPU_VMHANDLER, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
435 | vmhandler)); | ||
436 | DEFINE(SVCPU_SCRATCH0, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
437 | scratch0)); | ||
438 | DEFINE(SVCPU_SCRATCH1, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
439 | scratch1)); | ||
440 | DEFINE(SVCPU_IN_GUEST, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
441 | in_guest)); | ||
442 | DEFINE(SVCPU_FAULT_DSISR, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
443 | fault_dsisr)); | ||
444 | DEFINE(SVCPU_FAULT_DAR, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
445 | fault_dar)); | ||
446 | DEFINE(SVCPU_LAST_INST, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
447 | last_inst)); | ||
448 | DEFINE(SVCPU_SHADOW_SRR1, offsetof(struct kvmppc_book3s_shadow_vcpu, | ||
449 | shadow_srr1)); | ||
450 | #ifdef CONFIG_PPC_BOOK3S_32 | ||
451 | DEFINE(SVCPU_SR, offsetof(struct kvmppc_book3s_shadow_vcpu, sr)); | ||
452 | #endif | ||
442 | #else | 453 | #else |
443 | DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr)); | 454 | DEFINE(VCPU_CR, offsetof(struct kvm_vcpu, arch.cr)); |
444 | DEFINE(VCPU_XER, offsetof(struct kvm_vcpu, arch.xer)); | 455 | DEFINE(VCPU_XER, offsetof(struct kvm_vcpu, arch.xer)); |
456 | DEFINE(VCPU_LR, offsetof(struct kvm_vcpu, arch.lr)); | ||
457 | DEFINE(VCPU_CTR, offsetof(struct kvm_vcpu, arch.ctr)); | ||
458 | DEFINE(VCPU_PC, offsetof(struct kvm_vcpu, arch.pc)); | ||
459 | DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); | ||
460 | DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); | ||
461 | DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); | ||
445 | #endif /* CONFIG_PPC_BOOK3S */ | 462 | #endif /* CONFIG_PPC_BOOK3S */ |
446 | #endif | 463 | #endif |
447 | #ifdef CONFIG_44x | 464 | #ifdef CONFIG_44x |