Skip to contentSkip to conversation

refactor out 44x arch-dependent code

PATCH In review Liu Yu 1 participant 1 message Aug 15, 2008

Subsystems (2)
lore
Share & tools
lore

Liu Yu

author
#0 lore raw

PATCH 1/4 refactor out 44x arch-dependent code

mainly consist of tlb assciated code

---
 arch/powerpc/include/asm/kvm_ppc.h |    9 --
 arch/powerpc/kvm/44x_tlb.c         |  206 +++++++++++++++++++++++++++++++-----
 arch/powerpc/kvm/44x_tlb.h         |   50 ++++++++-
 arch/powerpc/kvm/booke_guest.c     |  122 ++++-----------------
 arch/powerpc/kvm/emulate.c         |  175 +------------------------------
 arch/powerpc/kvm/inst.h            |   60 +++++++++++
 arch/powerpc/kvm/powerpc.c         |   14 +--
 arch/powerpc/kvm/powerpc.h         |   10 ++
 8 files changed, 325 insertions(+), 321 deletions(-)
 create mode 100644 arch/powerpc/kvm/inst.h
 create mode 100644 arch/powerpc/kvm/powerpc.h
arch/powerpc/include/asm/kvm_ppc.h +0 -9
index 8931ba7..fa3e880 100644
@@ -29,11 +29,6 @@
 #include <linux/kvm_types.h>
 #include <linux/kvm_host.h>
 
-struct kvm_tlb {
-	struct tlbe guest_tlb[PPC44x_TLB_SIZE];
-	struct tlbe shadow_tlb[PPC44x_TLB_SIZE];
-};
-
 enum emulation_result {
 	EMULATE_DONE,         /* no further processing */
 	EMULATE_DO_MMIO,      /* kvm_run filled with MMIO request */
@@ -59,10 +54,6 @@ extern int kvmppc_emulate_instruction(struct kvm_run *run,
                                       struct kvm_vcpu *vcpu);
 extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
 
-extern void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gfn_t gfn,
-                           u64 asid, u32 flags);
-extern void kvmppc_mmu_invalidate(struct kvm_vcpu *vcpu, gva_t eaddr,
-                                  gva_t eend, u32 asid);
 extern void kvmppc_mmu_priv_switch(struct kvm_vcpu *vcpu, int usermode);
 extern void kvmppc_mmu_switch_pid(struct kvm_vcpu *vcpu, u32 pid);
 
arch/powerpc/kvm/44x_tlb.c +180 -26

230 lines not on this page · raw message

arch/powerpc/kvm/44x_tlb.h +47 -3

61 lines not on this page · raw message

arch/powerpc/kvm/booke_guest.c +22 -100

180 lines not on this page · raw message

arch/powerpc/kvm/emulate.c +4 -171

187 lines not on this page · raw message

arch/powerpc/kvm/inst.h new file +60 -0

60 lines not on this page · raw message

arch/powerpc/kvm/powerpc.c +2 -12
index 90a6fc4..d3bc29f 100644
@@ -308,16 +308,10 @@ static void kvmppc_load_guest_debug_registers(struct kvm_vcpu *vcpu)
 
 void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 {
-	int i;
-
 	if (vcpu->guest_debug.enabled)
 		kvmppc_load_guest_debug_registers(vcpu);
 
-	/* Mark every guest entry in the shadow TLB entry modified, so that they
-	 * will all be reloaded on the next vcpu run (instead of being
-	 * demand-faulted). */
-	for (i = 0; i <= tlb_44x_hwater; i++)
-		kvmppc_tlbe_set_modified(vcpu, i);
+	kvmppc_tlb_load(vcpu);
 }
 
 void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
@@ -325,11 +319,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
 	if (vcpu->guest_debug.enabled)
 		kvmppc_restore_host_debug_state(vcpu);
 
-	/* Don't leave guest TLB entries resident when being de-scheduled. */
-	/* XXX It would be nice to differentiate between heavyweight exit and
-	 * sched_out here, since we could avoid the TLB flush for heavyweight
-	 * exits. */
-	_tlbia();
+	kvmppc_tlb_put(vcpu);
 }
 
 int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
arch/powerpc/kvm/powerpc.h new file +10 -0
new file mode 100644
index 0000000..dd93461
@@ -0,0 +1,10 @@
+#ifndef __KVM_POWERPC_POWERPC_H__
+#define __KVM_POWERPC_POWERPC_H__
+
+#include <linux/kvm_host.h>
+
+#ifdef CONFIG_44x
+#include "44x_tlb.h"
+#endif
+
+#endif /* __KVM_POWERPC_POWERPC_H__ */
Signature · 1 line
1.5.4