aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/include
diff options
context:
space:
mode:
authorHollis Blanchard <hollisb@us.ibm.com>2008-11-05 10:36:14 -0500
committerAvi Kivity <avi@redhat.com>2008-12-31 09:52:21 -0500
commit9dd921cfea734409a931ccc6eafd7f09850311e9 (patch)
tree84bd4c0fe65cb866dd78882c90e54df5f7d17313 /arch/powerpc/include
parentd9fbd03d240380826c0ec16f927242be24ff6265 (diff)
KVM: ppc: Refactor powerpc.c to relocate 440-specific code
This introduces a set of core-provided hooks. For 440, some of these are implemented by booke.c, with the rest in (the new) 44x.c. Note that these hooks are link-time, not run-time. Since it is not possible to build a single kernel for both e500 and 440 (for example), using function pointers would only add overhead. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r--arch/powerpc/include/asm/kvm_host.h3
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h34
2 files changed, 20 insertions, 17 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index df733511d671..f5850d7d57a5 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -74,6 +74,9 @@ struct kvmppc_44x_tlbe {
74struct kvm_arch { 74struct kvm_arch {
75}; 75};
76 76
77/* XXX Can't include mmu-44x.h because it redefines struct mm_context. */
78#define PPC44x_TLB_SIZE 64
79
77struct kvm_vcpu_arch { 80struct kvm_vcpu_arch {
78 /* Unmodified copy of the guest's TLB. */ 81 /* Unmodified copy of the guest's TLB. */
79 struct kvmppc_44x_tlbe guest_tlb[PPC44x_TLB_SIZE]; 82 struct kvmppc_44x_tlbe guest_tlb[PPC44x_TLB_SIZE];
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 39daeaa82b53..96d5de90ac5a 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -61,23 +61,6 @@ extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn,
61extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode); 61extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode);
62extern void kvmppc_mmu_switch_pid(struct kvm_vcpu *vcpu, u32 pid); 62extern void kvmppc_mmu_switch_pid(struct kvm_vcpu *vcpu, u32 pid);
63 63
64/* XXX Book E specific */
65extern void kvmppc_tlbe_set_modified(struct kvm_vcpu *vcpu, unsigned int i);
66
67extern void kvmppc_check_and_deliver_interrupts(struct kvm_vcpu *vcpu);
68
69static inline void kvmppc_queue_exception(struct kvm_vcpu *vcpu, int exception)
70{
71 unsigned int priority = exception_priority[exception];
72 set_bit(priority, &vcpu->arch.pending_exceptions);
73}
74
75static inline void kvmppc_clear_exception(struct kvm_vcpu *vcpu, int exception)
76{
77 unsigned int priority = exception_priority[exception];
78 clear_bit(priority, &vcpu->arch.pending_exceptions);
79}
80
81/* Helper function for "full" MSR writes. No need to call this if only EE is 64/* Helper function for "full" MSR writes. No need to call this if only EE is
82 * changing. */ 65 * changing. */
83static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) 66static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
@@ -99,6 +82,23 @@ static inline void kvmppc_set_pid(struct kvm_vcpu *vcpu, u32 new_pid)
99 } 82 }
100} 83}
101 84
85/* Core-specific hooks */
86
87extern int kvmppc_core_check_processor_compat(void);
88
89extern void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
90extern void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu);
91
92extern void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu);
93extern void kvmppc_core_load_host_debugstate(struct kvm_vcpu *vcpu);
94
95extern void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu);
96extern int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu);
97extern void kvmppc_core_queue_program(struct kvm_vcpu *vcpu);
98extern void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu);
99extern void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
100 struct kvm_interrupt *irq);
101
102extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu); 102extern void kvmppc_core_destroy_mmu(struct kvm_vcpu *vcpu);
103 103
104#endif /* __POWERPC_KVM_PPC_H__ */ 104#endif /* __POWERPC_KVM_PPC_H__ */