Skip to contentSkip to conversation

A cumulative MIPS patchset

PATCH In review Thiemo Seufer 2 participants 2 messages Nov 21, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 A cumulative MIPS patchset

Hello All,

the attached patch is an update of Daniel's MIPS TLB improvements

Thiemo

Date: Sun, 12 Nov 2006 12:49:44 -0500
From: Daniel Jacobowitz <[email protected]>
To: [email protected]
Subject: Re: [Qemu-devel] [PATCH] Huge TLB performance improvement

 target-mips/cpu.h       |    3 ++-
 target-mips/exec.h      |    1 +
 target-mips/helper.c    |    2 +-
 target-mips/mips-defs.h |    1 +
 target-mips/op_helper.c |   43 +++++++++++++++++++++++++++++++++++++------
 target-mips/translate.c |    1 +
 6 files changed, 43 insertions(+), 8 deletions(-)
target-mips/cpu.h +2 -1
Index: qemu-work/target-mips/cpu.h
===================================================================
@@ -94,7 +94,8 @@
 		
 #endif
 #if defined(MIPS_USES_R4K_TLB)
-    tlb_t tlb[MIPS_TLB_NB];
+    tlb_t tlb[MIPS_TLB_MAX];
+    uint32_t tlb_in_use;
 #endif
     uint32_t CP0_index;
     uint32_t CP0_random;
target-mips/exec.h +1 -0
Index: qemu-work/target-mips/exec.h
===================================================================
@@ -115,5 +115,6 @@
 void cpu_mips_store_count (CPUState *env, uint32_t value);
 void cpu_mips_store_compare (CPUState *env, uint32_t value);
 void cpu_mips_clock_init (CPUState *env);
+void cpu_mips_tlb_flush (CPUState *env, int flush_global);
 
 #endif /* !defined(__QEMU_MIPS_EXEC_H__) */
target-mips/helper.c +1 -1
Index: qemu-work/target-mips/helper.c
===================================================================
@@ -46,7 +46,7 @@
     tlb_t *tlb;
     int i, n;
 
-    for (i = 0; i < MIPS_TLB_NB; i++) {
+    for (i = 0; i < env->tlb_in_use; i++) {
         tlb = &env->tlb[i];
         /* Check ASID, virtual page number & size */
         if ((tlb->G == 1 || tlb->ASID == ASID) &&
target-mips/mips-defs.h +1 -0
Index: qemu-work/target-mips/mips-defs.h
===================================================================
@@ -22,6 +22,7 @@
 /* Uses MIPS R4Kc TLB model */
 #define MIPS_USES_R4K_TLB
 #define MIPS_TLB_NB 16
+#define MIPS_TLB_MAX 128
 /* basic FPU register support */
 #define MIPS_USES_FPU 1
 /* Define a implementation number of 1.
target-mips/op_helper.c +37 -6

93 lines not on this page · raw message

target-mips/translate.c +1 -0
Index: qemu-work/target-mips/translate.c
===================================================================
@@ -2430,6 +2430,7 @@
     env->PC = 0xBFC00000;
 #if defined (MIPS_USES_R4K_TLB)
     env->CP0_random = MIPS_TLB_NB - 1;
+    env->tlb_in_use = MIPS_TLB_NB;
 #endif
     env->CP0_Wired = 0;
     env->CP0_Config0 = MIPS_CONFIG0;
#1 lore raw
Quoted 3 lines · Thiemo Seufer

Hello All,

the attached patch is an update of Daniel's MIPS TLB improvements

FYI, I actually have a better version of this patch now. Attached.

Signature · 2 lines
Daniel Jacobowitz
CodeSourcery
---
 target-mips/cpu.h       |    3 +-
 target-mips/exec.h      |    1 
 target-mips/helper.c    |    2 -
 target-mips/mips-defs.h |    1 
 target-mips/op_helper.c |   54 ++++++++++++++++++++++++++++++++++++++++++------
 target-mips/translate.c |    1 
 6 files changed, 54 insertions(+), 8 deletions(-)
target-mips/cpu.h +2 -1
Index: qemu/target-mips/cpu.h
===================================================================
@@ -94,7 +94,8 @@ struct CPUMIPSState {
 		
 #endif
 #if defined(MIPS_USES_R4K_TLB)
-    tlb_t tlb[MIPS_TLB_NB];
+    tlb_t tlb[MIPS_TLB_MAX];
+    uint32_t tlb_in_use;
 #endif
     uint32_t CP0_index;
     uint32_t CP0_random;
target-mips/exec.h +1 -0
Index: qemu/target-mips/exec.h
===================================================================
@@ -115,5 +115,6 @@ uint32_t cpu_mips_get_count (CPUState *e
 void cpu_mips_store_count (CPUState *env, uint32_t value);
 void cpu_mips_store_compare (CPUState *env, uint32_t value);
 void cpu_mips_clock_init (CPUState *env);
+void cpu_mips_tlb_flush (CPUState *env, int flush_global);
 
 #endif /* !defined(__QEMU_MIPS_EXEC_H__) */
target-mips/helper.c +1 -1
Index: qemu/target-mips/helper.c
===================================================================
@@ -46,7 +46,7 @@ static int map_address (CPUState *env, t
     tlb_t *tlb;
     int i, n;
 
-    for (i = 0; i < MIPS_TLB_NB; i++) {
+    for (i = 0; i < env->tlb_in_use; i++) {
         tlb = &env->tlb[i];
         /* Check ASID, virtual page number & size */
         if ((tlb->G == 1 || tlb->ASID == ASID) &&
target-mips/mips-defs.h +1 -0
Index: qemu/target-mips/mips-defs.h
===================================================================
@@ -22,6 +22,7 @@
 /* Uses MIPS R4Kc TLB model */
 #define MIPS_USES_R4K_TLB
 #define MIPS_TLB_NB 16
+#define MIPS_TLB_MAX 128
 /* basic FPU register support */
 #define MIPS_USES_FPU 1
 /* Define a implementation number of 1.
target-mips/op_helper.c +48 -6

104 lines not on this page · raw message

target-mips/translate.c +1 -0
Index: qemu/target-mips/translate.c
===================================================================
@@ -2450,6 +2450,7 @@ void cpu_reset (CPUMIPSState *env)
     env->PC = 0xBFC00000;
 #if defined (MIPS_USES_R4K_TLB)
     env->CP0_random = MIPS_TLB_NB - 1;
+    env->tlb_in_use = MIPS_TLB_NB;
 #endif
     env->CP0_Wired = 0;
     env->CP0_Config0 = MIPS_CONFIG0;