Skip to contentSkip to conversation

Use TLB macro instead of MMU operations

PATCH In review Zhang Wei 1 participant 1 message Jan 25, 2008

Subsystems (2)
lore
Share & tools
lore

Zhang Wei

author
#0 lore raw

PATCH 3/5 Use TLB macro instead of MMU operations

The 44x dependence MMU operations can be replaced by TLB marco, which modifications are prepared for adding e500 MMU macro to booke_interrupts.S

---
 arch/powerpc/kvm/44x_int_asm.h      |   41 +++++++++++++++++++++
 arch/powerpc/kvm/booke_interrupts.S |   67 ++++++++++-------------------------
 include/asm-powerpc/kvm_asm.h       |    4 ++
 3 files changed, 64 insertions(+), 48 deletions(-)
 create mode 100644 arch/powerpc/kvm/44x_int_asm.h
arch/powerpc/kvm/44x_int_asm.h new file +41 -0
new file mode 100644
index 0000000..73fe2d8
@@ -0,0 +1,41 @@
+#ifndef __ARCH_POWERPC_KVM_44X_INT_ASM_H__
+#define __ARCH_POWERPC_KVM_44X_INT_ASM_H__
+
+/* Load TLB size to rd register */
+.macro LOAD_TLB_SIZE rd
+	li	\rd, PPC44x_TLB_SIZE
+.endm
+
+/* TLB entry will be loaded from rd + 4 address to r_entry_idx entry */
+.macro TLB_ENTRY_LOAD r_entry_idx, rd, ra
+	lwzu	\rd, 4(\ra)
+	mtspr	SPRN_MMUCR, \rd
+	lwzu	\rd, 4(\ra)
+	tlbwe	\rd, \r_entry_idx, PPC44x_TLB_PAGEID
+	lwzu	\rd, 4(\ra)
+	tlbwe	\rd, \r_entry_idx, PPC44x_TLB_XLAT
+	lwzu	\rd, 4(\ra)
+	tlbwe	\rd, \r_entry_idx, PPC44x_TLB_ATTRIB
+.endm
+
+/* TLB entry will be saved to rd + 4 address */
+.macro TLB_ENTRY_SAVE r_entry_idx, rd, ra
+	mfspr	\rd, SPRN_MMUCR
+	stwu	\rd, 4(\ra)
+	tlbre	\rd, \r_entry_idx, PPC44x_TLB_PAGEID
+	stwu	\rd, 4(\ra)
+	tlbre	\rd, \r_entry_idx, PPC44x_TLB_XLAT
+	stwu	\rd, 4(\ra)
+	tlbre	\rd, \r_entry_idx, PPC44x_TLB_ATTRIB
+	stwu	\rd, 4(\ra)
+.endm
+
+.macro SAVE_MMUCR rd
+	mfspr	\rd, SPRN_MMUCR
+.endm
+
+.macro LOAD_MMUCR rd
+	mtspr	SPRN_MMUCR, \rd
+.endm
+
+#endif /* __ARCH_POWERPC_KVM_44X_INT_ASM_H__ */
arch/powerpc/kvm/booke_interrupts.S +19 -48

118 lines not on this page · raw message

include/asm-powerpc/kvm_asm.h +4 -0
index 8ed6b0b..3c5da1d 100644
@@ -57,4 +57,8 @@
 #define KVM_PPC_IOCTL_GETTLB 5
 #define KVM_PPC_IOCTL_SETTLB 6
 
+#if defined(CONFIG_KVM_POWERPC_440)
+#define KVMPPC_HOST_TLB_SIZE PPC44x_TLB_SIZE
+#endif
+
 #endif /* __POWERPC_KVM_ASM_H__ */
Signature · 11 lines
1.5.2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel