Skip to contentSkip to conversation

target/mips: CP0 housekeeping patches for Nov 2020

PATCH Applied Philippe Mathieu-Daudé 3 participants 6 messages Nov 9, 2020 – Nov 22, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover target/mips: CP0 housekeeping patches for Nov 2020

Based-on: <[email protected]>

Philippe Mathieu-Daudé (2):
target/mips: Replace magic values by CP0PM_MASK or
TARGET_PAGE_BITS_MIN
target/mips: Do not include CP0 helpers in user-mode emulation

 target/mips/cp0_helper.c | 9 +++------
 target/mips/helper.c     | 4 ++--
 target/mips/meson.build  | 2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/2 target/mips: Replace magic values by CP0PM_MASK or TARGET_PAGE_BITS_MIN

Replace magic values related to page size:

12 -> TARGET_PAGE_BITS_MIN
13 -> CP0PM_MASK

---
 target/mips/cp0_helper.c | 5 +++--
 target/mips/helper.c     | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
target/mips/cp0_helper.c +3 -2
index a1b5140ccaf..e8b9343ec9c 100644
@@ -904,7 +904,7 @@ void update_pagemask(CPUMIPSState *env, target_ulong arg1, int32_t *pagemask)
         goto invalid;
     }
     /* We don't support VTLB entry smaller than target page */
-    if ((maskbits + 12) < TARGET_PAGE_BITS) {
+    if ((maskbits + TARGET_PAGE_BITS_MIN) < TARGET_PAGE_BITS) {
         goto invalid;
     }
     env->CP0_PageMask = mask << CP0PM_MASK;
@@ -913,7 +913,8 @@ void update_pagemask(CPUMIPSState *env, target_ulong arg1, int32_t *pagemask)
 
 invalid:
     /* When invalid, set to default target page size. */
-    env->CP0_PageMask = (~TARGET_PAGE_MASK >> 12) << CP0PM_MASK;
+    mask = (~TARGET_PAGE_MASK >> TARGET_PAGE_BITS_MIN);
+    env->CP0_PageMask = mask << CP0PM_MASK;
 }
 
 void helper_mtc0_pagemask(CPUMIPSState *env, target_ulong arg1)
target/mips/helper.c +2 -2
index 063b65c0528..041432489d6 100644
@@ -858,8 +858,8 @@ refill:
             break;
         }
     }
-    pw_pagemask = m >> 12;
-    update_pagemask(env, pw_pagemask << 13, &pw_pagemask);
+    pw_pagemask = m >> TARGET_PAGE_BITS_MIN;
+    update_pagemask(env, pw_pagemask << CP0PM_MASK, &pw_pagemask);
     pw_entryhi = (address & ~0x1fff) | (env->CP0_EntryHi & 0xFF);
     {
         target_ulong tmp_entryhi = env->CP0_EntryHi;
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/2 target/mips: Do not include CP0 helpers in user-mode emulation

In reply to Philippe Mathieu-Daudé

CP0 helpers are restricted to system-mode emulation. Do not intent do build cp0_helper.c in user-mode (this allows to simplify some #ifdef'ry).

---
 target/mips/cp0_helper.c | 4 ----
 target/mips/meson.build  | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)
target/mips/cp0_helper.c +0 -4
index e8b9343ec9c..caaaefcc8ad 100644
@@ -32,7 +32,6 @@
 #include "sysemu/kvm.h"
 
 
-#ifndef CONFIG_USER_ONLY
 /* SMP helpers.  */
 static bool mips_vpe_is_wfi(MIPSCPU *c)
 {
@@ -1667,10 +1666,8 @@ target_ulong helper_evpe(CPUMIPSState *env)
     }
     return prev;
 }
-#endif /* !CONFIG_USER_ONLY */
 
 /* R6 Multi-threading */
-#ifndef CONFIG_USER_ONLY
 target_ulong helper_dvp(CPUMIPSState *env)
 {
     CPUState *other_cs = first_cpu;
@@ -1709,4 +1706,3 @@ target_ulong helper_evp(CPUMIPSState *env)
     }
     return prev;
 }
-#endif /* !CONFIG_USER_ONLY */
target/mips/meson.build +1 -1
index fa1f024e782..681a5524c0e 100644
@@ -1,6 +1,5 @@
 mips_ss = ss.source_set()
 mips_ss.add(files(
-  'cp0_helper.c',
   'cpu.c',
   'dsp_helper.c',
   'fpu_helper.c',
@@ -15,6 +14,7 @@
 
 mips_softmmu_ss = ss.source_set()
 mips_softmmu_ss.add(files(
+  'cp0_helper.c',
   'cp0_timer.c',
   'machine.c',
   'mips-semi.c',
Signature · 1 line
2.26.2
#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

Based-on: <[email protected]>

Philippe Mathieu-Daudé (2):
target/mips: Replace magic values by CP0PM_MASK or
TARGET_PAGE_BITS_MIN
target/mips: Do not include CP0 helpers in user-mode emulation

 target/mips/cp0_helper.c | 9 +++------
 target/mips/helper.c     | 4 ++--
 target/mips/meson.build  | 2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

Thanks, applied to mips-next.