* [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible
@ 2021-01-28 14:41 Philippe Mathieu-Daudé
2021-01-28 14:41 ` [PATCH 01/13] target/mips: Remove access_type argument from map_address() handler Philippe Mathieu-Daudé
` (14 more replies)
0 siblings, 15 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
Taking notes while reviewing commit 671a0a1265a
("use MMUAccessType instead of int in mmu_translate").
Philippe Mathieu-Daudé (13):
target/mips: Remove access_type argument from map_address() handler
target/mips: Remove access_type argument from get_seg_physical_address
target/mips: Remove access_type arg from get_segctl_physical_address()
target/mips: Remove access_type argument from get_physical_address()
target/mips: Remove unused MMU definitions
target/mips: Replace magic value by MMU_DATA_LOAD definition
target/mips: Let page_table_walk_refill() take MMUAccessType argument
target/mips: Let do_translate_address() take MMUAccessType argument
target/mips: Let cpu_mips_translate_address() take MMUAccessType arg
target/mips: Let raise_mmu_exception() take MMUAccessType argument
target/mips: Let get_physical_address() take MMUAccessType argument
target/mips: Let get_seg*_physical_address() take MMUAccessType arg
target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType
target/mips/cpu.h | 16 ---------
target/mips/internal.h | 10 +++---
target/mips/op_helper.c | 9 ++---
target/mips/tlb_helper.c | 78 +++++++++++++++++++---------------------
4 files changed, 47 insertions(+), 66 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 01/13] target/mips: Remove access_type argument from map_address() handler
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:22 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 02/13] target/mips: Remove access_type argument from get_seg_physical_address Philippe Mathieu-Daudé
` (13 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
TLB map_address() handlers don't use the 'access_type' argument,
remove it to simplify.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/internal.h | 8 ++++----
target/mips/tlb_helper.c | 15 +++++++--------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/target/mips/internal.h b/target/mips/internal.h
index 5dd17ff7333..d09afded5ea 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -111,7 +111,7 @@ struct CPUMIPSTLBContext {
uint32_t nb_tlb;
uint32_t tlb_in_use;
int (*map_address)(struct CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw, int access_type);
+ target_ulong address, int rw);
void (*helper_tlbwi)(struct CPUMIPSState *env);
void (*helper_tlbwr)(struct CPUMIPSState *env);
void (*helper_tlbp)(struct CPUMIPSState *env);
@@ -126,11 +126,11 @@ struct CPUMIPSTLBContext {
};
int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw, int access_type);
+ target_ulong address, int rw);
int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw, int access_type);
+ target_ulong address, int rw);
int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw, int access_type);
+ target_ulong address, int rw);
void r4k_helper_tlbwi(CPUMIPSState *env);
void r4k_helper_tlbwr(CPUMIPSState *env);
void r4k_helper_tlbp(CPUMIPSState *env);
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 082c17928d3..1af2dc969d6 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -39,7 +39,7 @@ enum {
/* no MMU emulation */
int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw, int access_type)
+ target_ulong address, int rw)
{
*physical = address;
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
@@ -48,7 +48,7 @@ int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
/* fixed mapping MMU emulation */
int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw, int access_type)
+ target_ulong address, int rw)
{
if (address <= (int32_t)0x7FFFFFFFUL) {
if (!(env->CP0_Status & (1 << CP0St_ERL))) {
@@ -68,7 +68,7 @@ int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
/* MIPS32/MIPS64 R4000-style MMU emulation */
int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw, int access_type)
+ target_ulong address, int rw)
{
uint16_t ASID = env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask;
uint32_t MMID = env->CP0_MemoryMapID;
@@ -234,8 +234,7 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
return mapped;
} else if (mapped) {
/* The segment is TLB mapped */
- return env->tlb->map_address(env, physical, prot, real_address, rw,
- access_type);
+ return env->tlb->map_address(env, physical, prot, real_address, rw);
} else {
/* The segment is unmapped */
*physical = physical_base | (real_address & segmask);
@@ -314,7 +313,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
/* xuseg */
if (UX && address <= (0x3FFFFFFFFFFFFFFFULL & env->SEGMask)) {
ret = env->tlb->map_address(env, physical, prot,
- real_address, rw, access_type);
+ real_address, rw);
} else {
ret = TLBRET_BADADDR;
}
@@ -323,7 +322,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
if ((supervisor_mode || kernel_mode) &&
SX && address <= (0x7FFFFFFFFFFFFFFFULL & env->SEGMask)) {
ret = env->tlb->map_address(env, physical, prot,
- real_address, rw, access_type);
+ real_address, rw);
} else {
ret = TLBRET_BADADDR;
}
@@ -364,7 +363,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
if (kernel_mode && KX &&
address <= (0xFFFFFFFF7FFFFFFFULL & env->SEGMask)) {
ret = env->tlb->map_address(env, physical, prot,
- real_address, rw, access_type);
+ real_address, rw);
} else {
ret = TLBRET_BADADDR;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 02/13] target/mips: Remove access_type argument from get_seg_physical_address
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
2021-01-28 14:41 ` [PATCH 01/13] target/mips: Remove access_type argument from map_address() handler Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:25 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 03/13] target/mips: Remove access_type arg from get_segctl_physical_address() Philippe Mathieu-Daudé
` (12 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
get_seg_physical_address() doesn't use the 'access_type' argument,
remove it to simplify.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/tlb_helper.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 1af2dc969d6..9906292440c 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -222,7 +222,7 @@ static int is_seg_am_mapped(unsigned int am, bool eu, int mmu_idx)
static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
int *prot, target_ulong real_address,
- int rw, int access_type, int mmu_idx,
+ int rw, int mmu_idx,
unsigned int am, bool eu,
target_ulong segmask,
hwaddr physical_base)
@@ -253,7 +253,7 @@ static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
hwaddr pa = ((hwaddr)segctl & CP0SC_PA_MASK) << 20;
return get_seg_physical_address(env, physical, prot, real_address, rw,
- access_type, mmu_idx, am, eu, segmask,
+ mmu_idx, am, eu, segmask,
pa & ~(hwaddr)segmask);
}
@@ -349,7 +349,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
/* Does CP0_Status.KX/SX/UX permit the access mode (am) */
if (env->CP0_Status & am_ksux[am]) {
ret = get_seg_physical_address(env, physical, prot,
- real_address, rw, access_type,
+ real_address, rw,
mmu_idx, am, false, env->PAMask,
0);
} else {
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 03/13] target/mips: Remove access_type arg from get_segctl_physical_address()
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
2021-01-28 14:41 ` [PATCH 01/13] target/mips: Remove access_type argument from map_address() handler Philippe Mathieu-Daudé
2021-01-28 14:41 ` [PATCH 02/13] target/mips: Remove access_type argument from get_seg_physical_address Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:26 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 04/13] target/mips: Remove access_type argument from get_physical_address() Philippe Mathieu-Daudé
` (11 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
get_segctl_physical_address() doesn't use the 'access_type' argument,
remove it to simplify.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/tlb_helper.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 9906292440c..d89ad87cb9d 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -245,7 +245,7 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
int *prot, target_ulong real_address,
- int rw, int access_type, int mmu_idx,
+ int rw, int mmu_idx,
uint16_t segctl, target_ulong segmask)
{
unsigned int am = (segctl & CP0SC_AM_MASK) >> CP0SC_AM;
@@ -306,7 +306,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
segctl = env->CP0_SegCtl2 >> 16;
}
ret = get_segctl_physical_address(env, physical, prot,
- real_address, rw, access_type,
+ real_address, rw,
mmu_idx, segctl, 0x3FFFFFFF);
#if defined(TARGET_MIPS64)
} else if (address < 0x4000000000000000ULL) {
@@ -370,26 +370,26 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
#endif
} else if (address < KSEG1_BASE) {
/* kseg0 */
- ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
- access_type, mmu_idx,
+ ret = get_segctl_physical_address(env, physical, prot, real_address,
+ rw, mmu_idx,
env->CP0_SegCtl1 >> 16, 0x1FFFFFFF);
} else if (address < KSEG2_BASE) {
/* kseg1 */
- ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
- access_type, mmu_idx,
+ ret = get_segctl_physical_address(env, physical, prot, real_address,
+ rw, mmu_idx,
env->CP0_SegCtl1, 0x1FFFFFFF);
} else if (address < KSEG3_BASE) {
/* sseg (kseg2) */
- ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
- access_type, mmu_idx,
+ ret = get_segctl_physical_address(env, physical, prot, real_address,
+ rw, mmu_idx,
env->CP0_SegCtl0 >> 16, 0x1FFFFFFF);
} else {
/*
* kseg3
* XXX: debug segment is not emulated
*/
- ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
- access_type, mmu_idx,
+ ret = get_segctl_physical_address(env, physical, prot, real_address,
+ rw, mmu_idx,
env->CP0_SegCtl0, 0x1FFFFFFF);
}
return ret;
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 04/13] target/mips: Remove access_type argument from get_physical_address()
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 03/13] target/mips: Remove access_type arg from get_segctl_physical_address() Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:27 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 05/13] target/mips: Remove unused MMU definitions Philippe Mathieu-Daudé
` (10 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
get_physical_address() doesn't use the 'access_type' argument,
remove it to simplify.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/tlb_helper.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index d89ad87cb9d..c9535b7f72f 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -259,7 +259,7 @@ static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
int *prot, target_ulong real_address,
- int rw, int access_type, int mmu_idx)
+ int rw, int mmu_idx)
{
/* User mode can only access useg/xuseg */
#if defined(TARGET_MIPS64)
@@ -492,7 +492,7 @@ hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
hwaddr phys_addr;
int prot;
- if (get_physical_address(env, &phys_addr, &prot, addr, 0, ACCESS_INT,
+ if (get_physical_address(env, &phys_addr, &prot, addr, 0,
cpu_mmu_index(env, false)) != 0) {
return -1;
}
@@ -570,7 +570,7 @@ static int walk_directory(CPUMIPSState *env, uint64_t *vaddr,
uint64_t w = 0;
if (get_physical_address(env, &paddr, &prot, *vaddr, MMU_DATA_LOAD,
- ACCESS_INT, cpu_mmu_index(env, false)) !=
+ cpu_mmu_index(env, false)) !=
TLBRET_MATCH) {
/* wrong base address */
return 0;
@@ -598,7 +598,7 @@ static int walk_directory(CPUMIPSState *env, uint64_t *vaddr,
*pw_entrylo0 = entry;
}
if (get_physical_address(env, &paddr, &prot, vaddr2, MMU_DATA_LOAD,
- ACCESS_INT, cpu_mmu_index(env, false)) !=
+ cpu_mmu_index(env, false)) !=
TLBRET_MATCH) {
return 0;
}
@@ -752,7 +752,7 @@ static bool page_table_walk_refill(CPUMIPSState *env, vaddr address, int rw,
/* Leaf Level Page Table - First half of PTE pair */
vaddr |= ptoffset0;
if (get_physical_address(env, &paddr, &prot, vaddr, MMU_DATA_LOAD,
- ACCESS_INT, cpu_mmu_index(env, false)) !=
+ cpu_mmu_index(env, false)) !=
TLBRET_MATCH) {
return false;
}
@@ -765,7 +765,7 @@ static bool page_table_walk_refill(CPUMIPSState *env, vaddr address, int rw,
/* Leaf Level Page Table - Second half of PTE pair */
vaddr |= ptoffset1;
if (get_physical_address(env, &paddr, &prot, vaddr, MMU_DATA_LOAD,
- ACCESS_INT, cpu_mmu_index(env, false)) !=
+ cpu_mmu_index(env, false)) !=
TLBRET_MATCH) {
return false;
}
@@ -843,16 +843,14 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
#if !defined(CONFIG_USER_ONLY)
hwaddr physical;
int prot;
- int mips_access_type;
#endif
int ret = TLBRET_BADADDR;
/* data access */
#if !defined(CONFIG_USER_ONLY)
/* XXX: put correct access by using cpu_restore_state() correctly */
- mips_access_type = ACCESS_INT;
ret = get_physical_address(env, &physical, &prot, address,
- access_type, mips_access_type, mmu_idx);
+ access_type, mmu_idx);
switch (ret) {
case TLBRET_MATCH:
qemu_log_mask(CPU_LOG_MMU,
@@ -884,7 +882,7 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
env->hflags |= mode;
if (ret_walker) {
ret = get_physical_address(env, &physical, &prot, address,
- access_type, mips_access_type, mmu_idx);
+ access_type, mmu_idx);
if (ret == TLBRET_MATCH) {
tlb_set_page(cs, address & TARGET_PAGE_MASK,
physical & TARGET_PAGE_MASK, prot,
@@ -909,12 +907,10 @@ hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address,
{
hwaddr physical;
int prot;
- int access_type;
int ret = 0;
/* data access */
- access_type = ACCESS_INT;
- ret = get_physical_address(env, &physical, &prot, address, rw, access_type,
+ ret = get_physical_address(env, &physical, &prot, address, rw,
cpu_mmu_index(env, false));
if (ret != TLBRET_MATCH) {
raise_mmu_exception(env, address, rw, ret);
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 05/13] target/mips: Remove unused MMU definitions
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 04/13] target/mips: Remove access_type argument from get_physical_address() Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:36 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 06/13] target/mips: Replace magic value by MMU_DATA_LOAD definition Philippe Mathieu-Daudé
` (9 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
Remove these confusing and unused definitions.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/cpu.h | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/target/mips/cpu.h b/target/mips/cpu.h
index b9e227a30e9..9e6028f8e63 100644
--- a/target/mips/cpu.h
+++ b/target/mips/cpu.h
@@ -1220,22 +1220,6 @@ typedef MIPSCPU ArchCPU;
#include "exec/cpu-all.h"
-/*
- * Memory access type :
- * may be needed for precise access rights control and precise exceptions.
- */
-enum {
- /* 1 bit to define user level / supervisor access */
- ACCESS_USER = 0x00,
- ACCESS_SUPER = 0x01,
- /* 1 bit to indicate direction */
- ACCESS_STORE = 0x02,
- /* Type of instruction that generated the access */
- ACCESS_CODE = 0x10, /* Code fetch access */
- ACCESS_INT = 0x20, /* Integer load/store access */
- ACCESS_FLOAT = 0x30, /* floating point load/store access */
-};
-
/* Exceptions */
enum {
EXCP_NONE = -1,
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 06/13] target/mips: Replace magic value by MMU_DATA_LOAD definition
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 05/13] target/mips: Remove unused MMU definitions Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:37 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument Philippe Mathieu-Daudé
` (8 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/op_helper.c | 2 +-
target/mips/tlb_helper.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index 89c7d4556a0..9fce0194b3e 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -312,7 +312,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \
} \
do_raise_exception(env, EXCP_AdEL, GETPC()); \
} \
- env->CP0_LLAddr = do_translate_address(env, arg, 0, GETPC()); \
+ env->CP0_LLAddr = do_translate_address(env, arg, MMU_DATA_LOAD, GETPC()); \
env->lladdr = arg; \
env->llval = do_cast cpu_##insn##_mmuidx_ra(env, arg, mem_idx, GETPC()); \
return env->llval; \
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index c9535b7f72f..9216c7a91b3 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -492,7 +492,7 @@ hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
hwaddr phys_addr;
int prot;
- if (get_physical_address(env, &phys_addr, &prot, addr, 0,
+ if (get_physical_address(env, &phys_addr, &prot, addr, MMU_DATA_LOAD,
cpu_mmu_index(env, false)) != 0) {
return -1;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 06/13] target/mips: Replace magic value by MMU_DATA_LOAD definition Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:38 ` Jiaxun Yang
2021-02-04 2:36 ` Richard Henderson
2021-01-28 14:41 ` [PATCH 08/13] target/mips: Let do_translate_address() " Philippe Mathieu-Daudé
` (7 subsequent siblings)
14 siblings, 2 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
The single caller, mips_cpu_tlb_fill(), passes MMUAccessType
to page_table_walk_refill(). Let the prototype use it as
argument, as it is stricter than an integer.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/tlb_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 9216c7a91b3..afcc269750d 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -621,8 +621,8 @@ static int walk_directory(CPUMIPSState *env, uint64_t *vaddr,
}
}
-static bool page_table_walk_refill(CPUMIPSState *env, vaddr address, int rw,
- int mmu_idx)
+static bool page_table_walk_refill(CPUMIPSState *env, vaddr address,
+ MMUAccessType access_type, int mmu_idx)
{
int gdw = (env->CP0_PWSize >> CP0PS_GDW) & 0x3F;
int udw = (env->CP0_PWSize >> CP0PS_UDW) & 0x3F;
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 08/13] target/mips: Let do_translate_address() take MMUAccessType argument
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:39 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 09/13] target/mips: Let cpu_mips_translate_address() take MMUAccessType arg Philippe Mathieu-Daudé
` (6 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
The single caller, HELPER_LD_ATOMIC(), passes MMUAccessType to
do_translate_address(). Let the prototype use it as argument,
as it is stricter than an integer.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/op_helper.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
index 9fce0194b3e..b80e8f75401 100644
--- a/target/mips/op_helper.c
+++ b/target/mips/op_helper.c
@@ -288,13 +288,14 @@ target_ulong helper_rotx(target_ulong rs, uint32_t shift, uint32_t shiftx,
#ifndef CONFIG_USER_ONLY
static inline hwaddr do_translate_address(CPUMIPSState *env,
- target_ulong address,
- int rw, uintptr_t retaddr)
+ target_ulong address,
+ MMUAccessType access_type,
+ uintptr_t retaddr)
{
hwaddr paddr;
CPUState *cs = env_cpu(env);
- paddr = cpu_mips_translate_address(env, address, rw);
+ paddr = cpu_mips_translate_address(env, address, access_type);
if (paddr == -1LL) {
cpu_loop_exit_restore(cs, retaddr);
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 09/13] target/mips: Let cpu_mips_translate_address() take MMUAccessType arg
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 08/13] target/mips: Let do_translate_address() " Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:41 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 10/13] target/mips: Let raise_mmu_exception() take MMUAccessType argument Philippe Mathieu-Daudé
` (5 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
The single caller, do_translate_address(), passes MMUAccessType
to cpu_mips_translate_address(). Let the prototype use it as
argument, as it is stricter than an integer.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/internal.h | 2 +-
target/mips/tlb_helper.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/mips/internal.h b/target/mips/internal.h
index d09afded5ea..34915c275c4 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -146,7 +146,7 @@ void mips_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
int mmu_idx, MemTxAttrs attrs,
MemTxResult response, uintptr_t retaddr);
hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address,
- int rw);
+ MMUAccessType access_type);
#endif
#define cpu_signal_handler cpu_mips_signal_handler
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index afcc269750d..e9c3adeade6 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -903,17 +903,17 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
#ifndef CONFIG_USER_ONLY
hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address,
- int rw)
+ MMUAccessType access_type)
{
hwaddr physical;
int prot;
int ret = 0;
/* data access */
- ret = get_physical_address(env, &physical, &prot, address, rw,
+ ret = get_physical_address(env, &physical, &prot, address, access_type,
cpu_mmu_index(env, false));
if (ret != TLBRET_MATCH) {
- raise_mmu_exception(env, address, rw, ret);
+ raise_mmu_exception(env, address, access_type, ret);
return -1LL;
} else {
return physical;
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 10/13] target/mips: Let raise_mmu_exception() take MMUAccessType argument
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 09/13] target/mips: Let cpu_mips_translate_address() take MMUAccessType arg Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:41 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 11/13] target/mips: Let get_physical_address() " Philippe Mathieu-Daudé
` (4 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
Both mips_cpu_tlb_fill() and cpu_mips_translate_address() pass
MMUAccessType to raise_mmu_exception(). Let the prototype use it
as argument, as it is stricter than an integer.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/tlb_helper.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index e9c3adeade6..21b7d38f11c 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -405,12 +405,12 @@ void cpu_mips_tlb_flush(CPUMIPSState *env)
#endif /* !CONFIG_USER_ONLY */
static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
- int rw, int tlb_error)
+ MMUAccessType access_type, int tlb_error)
{
CPUState *cs = env_cpu(env);
int exception = 0, error_code = 0;
- if (rw == MMU_INST_FETCH) {
+ if (access_type == MMU_INST_FETCH) {
error_code |= EXCP_INST_NOTAVAIL;
}
@@ -419,7 +419,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
case TLBRET_BADADDR:
/* Reference to kernel address from user mode or supervisor mode */
/* Reference to supervisor address from user mode */
- if (rw == MMU_DATA_STORE) {
+ if (access_type == MMU_DATA_STORE) {
exception = EXCP_AdES;
} else {
exception = EXCP_AdEL;
@@ -427,7 +427,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
break;
case TLBRET_NOMATCH:
/* No TLB match for a mapped address */
- if (rw == MMU_DATA_STORE) {
+ if (access_type == MMU_DATA_STORE) {
exception = EXCP_TLBS;
} else {
exception = EXCP_TLBL;
@@ -436,7 +436,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
break;
case TLBRET_INVALID:
/* TLB match with no valid bit */
- if (rw == MMU_DATA_STORE) {
+ if (access_type == MMU_DATA_STORE) {
exception = EXCP_TLBS;
} else {
exception = EXCP_TLBL;
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 11/13] target/mips: Let get_physical_address() take MMUAccessType argument
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 10/13] target/mips: Let raise_mmu_exception() take MMUAccessType argument Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:42 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 12/13] target/mips: Let get_seg*_physical_address() take MMUAccessType arg Philippe Mathieu-Daudé
` (3 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
All these functions:
- mips_cpu_get_phys_page_debug()
- cpu_mips_translate_address()
- mips_cpu_tlb_fill()
- page_table_walk_refill()
- walk_directory()
call get_physical_address() passing a MMUAccessType type. Let the
prototype use it as argument, as it is stricter than an integer.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/tlb_helper.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 21b7d38f11c..64e89591abc 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -259,7 +259,7 @@ static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
int *prot, target_ulong real_address,
- int rw, int mmu_idx)
+ MMUAccessType access_type, int mmu_idx)
{
/* User mode can only access useg/xuseg */
#if defined(TARGET_MIPS64)
@@ -306,14 +306,14 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
segctl = env->CP0_SegCtl2 >> 16;
}
ret = get_segctl_physical_address(env, physical, prot,
- real_address, rw,
+ real_address, access_type,
mmu_idx, segctl, 0x3FFFFFFF);
#if defined(TARGET_MIPS64)
} else if (address < 0x4000000000000000ULL) {
/* xuseg */
if (UX && address <= (0x3FFFFFFFFFFFFFFFULL & env->SEGMask)) {
ret = env->tlb->map_address(env, physical, prot,
- real_address, rw);
+ real_address, access_type);
} else {
ret = TLBRET_BADADDR;
}
@@ -322,7 +322,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
if ((supervisor_mode || kernel_mode) &&
SX && address <= (0x7FFFFFFFFFFFFFFFULL & env->SEGMask)) {
ret = env->tlb->map_address(env, physical, prot,
- real_address, rw);
+ real_address, access_type);
} else {
ret = TLBRET_BADADDR;
}
@@ -349,7 +349,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
/* Does CP0_Status.KX/SX/UX permit the access mode (am) */
if (env->CP0_Status & am_ksux[am]) {
ret = get_seg_physical_address(env, physical, prot,
- real_address, rw,
+ real_address, access_type,
mmu_idx, am, false, env->PAMask,
0);
} else {
@@ -363,7 +363,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
if (kernel_mode && KX &&
address <= (0xFFFFFFFF7FFFFFFFULL & env->SEGMask)) {
ret = env->tlb->map_address(env, physical, prot,
- real_address, rw);
+ real_address, access_type);
} else {
ret = TLBRET_BADADDR;
}
@@ -371,17 +371,17 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
} else if (address < KSEG1_BASE) {
/* kseg0 */
ret = get_segctl_physical_address(env, physical, prot, real_address,
- rw, mmu_idx,
+ access_type, mmu_idx,
env->CP0_SegCtl1 >> 16, 0x1FFFFFFF);
} else if (address < KSEG2_BASE) {
/* kseg1 */
ret = get_segctl_physical_address(env, physical, prot, real_address,
- rw, mmu_idx,
+ access_type, mmu_idx,
env->CP0_SegCtl1, 0x1FFFFFFF);
} else if (address < KSEG3_BASE) {
/* sseg (kseg2) */
ret = get_segctl_physical_address(env, physical, prot, real_address,
- rw, mmu_idx,
+ access_type, mmu_idx,
env->CP0_SegCtl0 >> 16, 0x1FFFFFFF);
} else {
/*
@@ -389,7 +389,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
* XXX: debug segment is not emulated
*/
ret = get_segctl_physical_address(env, physical, prot, real_address,
- rw, mmu_idx,
+ access_type, mmu_idx,
env->CP0_SegCtl0, 0x1FFFFFFF);
}
return ret;
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 12/13] target/mips: Let get_seg*_physical_address() take MMUAccessType arg
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 11/13] target/mips: Let get_physical_address() " Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:43 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 13/13] target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType Philippe Mathieu-Daudé
` (2 subsequent siblings)
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
get_physical_address() calls get_seg_physical_address() and
get_segctl_physical_address() passing a MMUAccessType type.
Let the prototypes use it as argument, as it is stricter than
an integer.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/tlb_helper.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 64e89591abc..14f5b1a0a9c 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -222,7 +222,7 @@ static int is_seg_am_mapped(unsigned int am, bool eu, int mmu_idx)
static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
int *prot, target_ulong real_address,
- int rw, int mmu_idx,
+ MMUAccessType access_type, int mmu_idx,
unsigned int am, bool eu,
target_ulong segmask,
hwaddr physical_base)
@@ -234,7 +234,8 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
return mapped;
} else if (mapped) {
/* The segment is TLB mapped */
- return env->tlb->map_address(env, physical, prot, real_address, rw);
+ return env->tlb->map_address(env, physical, prot, real_address,
+ access_type);
} else {
/* The segment is unmapped */
*physical = physical_base | (real_address & segmask);
@@ -245,15 +246,15 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
int *prot, target_ulong real_address,
- int rw, int mmu_idx,
+ MMUAccessType access_type, int mmu_idx,
uint16_t segctl, target_ulong segmask)
{
unsigned int am = (segctl & CP0SC_AM_MASK) >> CP0SC_AM;
bool eu = (segctl >> CP0SC_EU) & 1;
hwaddr pa = ((hwaddr)segctl & CP0SC_PA_MASK) << 20;
- return get_seg_physical_address(env, physical, prot, real_address, rw,
- mmu_idx, am, eu, segmask,
+ return get_seg_physical_address(env, physical, prot, real_address,
+ access_type, mmu_idx, am, eu, segmask,
pa & ~(hwaddr)segmask);
}
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 13/13] target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 12/13] target/mips: Let get_seg*_physical_address() take MMUAccessType arg Philippe Mathieu-Daudé
@ 2021-01-28 14:41 ` Philippe Mathieu-Daudé
2021-02-02 3:44 ` Jiaxun Yang
2021-02-04 2:39 ` [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Richard Henderson
2021-02-21 8:33 ` Philippe Mathieu-Daudé
14 siblings, 1 reply; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-28 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi, Aurelien Jarno
get_seg_physical_address() calls CPUMIPSTLBContext::map_address()
handlers passing a MMUAccessType type. Update the prototype
handlers to take a MMUAccessType argument, as it is stricter than
an integer.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/mips/internal.h | 8 ++++----
target/mips/tlb_helper.c | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/target/mips/internal.h b/target/mips/internal.h
index 34915c275c4..99264b8bf6a 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -111,7 +111,7 @@ struct CPUMIPSTLBContext {
uint32_t nb_tlb;
uint32_t tlb_in_use;
int (*map_address)(struct CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw);
+ target_ulong address, MMUAccessType access_type);
void (*helper_tlbwi)(struct CPUMIPSState *env);
void (*helper_tlbwr)(struct CPUMIPSState *env);
void (*helper_tlbp)(struct CPUMIPSState *env);
@@ -126,11 +126,11 @@ struct CPUMIPSTLBContext {
};
int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw);
+ target_ulong address, MMUAccessType access_type);
int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw);
+ target_ulong address, MMUAccessType access_type);
int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw);
+ target_ulong address, MMUAccessType access_type);
void r4k_helper_tlbwi(CPUMIPSState *env);
void r4k_helper_tlbwr(CPUMIPSState *env);
void r4k_helper_tlbp(CPUMIPSState *env);
diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
index 14f5b1a0a9c..2dc8ecafc3b 100644
--- a/target/mips/tlb_helper.c
+++ b/target/mips/tlb_helper.c
@@ -39,7 +39,7 @@ enum {
/* no MMU emulation */
int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw)
+ target_ulong address, MMUAccessType access_type)
{
*physical = address;
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
@@ -48,7 +48,7 @@ int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
/* fixed mapping MMU emulation */
int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw)
+ target_ulong address, MMUAccessType access_type)
{
if (address <= (int32_t)0x7FFFFFFFUL) {
if (!(env->CP0_Status & (1 << CP0St_ERL))) {
@@ -68,7 +68,7 @@ int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
/* MIPS32/MIPS64 R4000-style MMU emulation */
int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
- target_ulong address, int rw)
+ target_ulong address, MMUAccessType access_type)
{
uint16_t ASID = env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask;
uint32_t MMID = env->CP0_MemoryMapID;
@@ -97,13 +97,13 @@ int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
if (!(n ? tlb->V1 : tlb->V0)) {
return TLBRET_INVALID;
}
- if (rw == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) {
+ if (access_type == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) {
return TLBRET_XI;
}
- if (rw == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) {
+ if (access_type == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) {
return TLBRET_RI;
}
- if (rw != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) {
+ if (access_type != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) {
*physical = tlb->PFN[n] | (address & (mask >> 1));
*prot = PAGE_READ;
if (n ? tlb->D1 : tlb->D0) {
--
2.26.2
^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH 01/13] target/mips: Remove access_type argument from map_address() handler
2021-01-28 14:41 ` [PATCH 01/13] target/mips: Remove access_type argument from map_address() handler Philippe Mathieu-Daudé
@ 2021-02-02 3:22 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:22 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> TLB map_address() handlers don't use the 'access_type' argument,
> remove it to simplify.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/internal.h | 8 ++++----
> target/mips/tlb_helper.c | 15 +++++++--------
> 2 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/target/mips/internal.h b/target/mips/internal.h
> index 5dd17ff7333..d09afded5ea 100644
> --- a/target/mips/internal.h
> +++ b/target/mips/internal.h
> @@ -111,7 +111,7 @@ struct CPUMIPSTLBContext {
> uint32_t nb_tlb;
> uint32_t tlb_in_use;
> int (*map_address)(struct CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw, int access_type);
> + target_ulong address, int rw);
> void (*helper_tlbwi)(struct CPUMIPSState *env);
> void (*helper_tlbwr)(struct CPUMIPSState *env);
> void (*helper_tlbp)(struct CPUMIPSState *env);
> @@ -126,11 +126,11 @@ struct CPUMIPSTLBContext {
> };
>
> int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw, int access_type);
> + target_ulong address, int rw);
> int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw, int access_type);
> + target_ulong address, int rw);
> int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw, int access_type);
> + target_ulong address, int rw);
> void r4k_helper_tlbwi(CPUMIPSState *env);
> void r4k_helper_tlbwr(CPUMIPSState *env);
> void r4k_helper_tlbp(CPUMIPSState *env);
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index 082c17928d3..1af2dc969d6 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -39,7 +39,7 @@ enum {
>
> /* no MMU emulation */
> int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw, int access_type)
> + target_ulong address, int rw)
> {
> *physical = address;
> *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
> @@ -48,7 +48,7 @@ int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
>
> /* fixed mapping MMU emulation */
> int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw, int access_type)
> + target_ulong address, int rw)
> {
> if (address <= (int32_t)0x7FFFFFFFUL) {
> if (!(env->CP0_Status & (1 << CP0St_ERL))) {
> @@ -68,7 +68,7 @@ int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
>
> /* MIPS32/MIPS64 R4000-style MMU emulation */
> int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw, int access_type)
> + target_ulong address, int rw)
> {
> uint16_t ASID = env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask;
> uint32_t MMID = env->CP0_MemoryMapID;
> @@ -234,8 +234,7 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
> return mapped;
> } else if (mapped) {
> /* The segment is TLB mapped */
> - return env->tlb->map_address(env, physical, prot, real_address, rw,
> - access_type);
> + return env->tlb->map_address(env, physical, prot, real_address, rw);
> } else {
> /* The segment is unmapped */
> *physical = physical_base | (real_address & segmask);
> @@ -314,7 +313,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> /* xuseg */
> if (UX && address <= (0x3FFFFFFFFFFFFFFFULL & env->SEGMask)) {
> ret = env->tlb->map_address(env, physical, prot,
> - real_address, rw, access_type);
> + real_address, rw);
> } else {
> ret = TLBRET_BADADDR;
> }
> @@ -323,7 +322,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> if ((supervisor_mode || kernel_mode) &&
> SX && address <= (0x7FFFFFFFFFFFFFFFULL & env->SEGMask)) {
> ret = env->tlb->map_address(env, physical, prot,
> - real_address, rw, access_type);
> + real_address, rw);
> } else {
> ret = TLBRET_BADADDR;
> }
> @@ -364,7 +363,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> if (kernel_mode && KX &&
> address <= (0xFFFFFFFF7FFFFFFFULL & env->SEGMask)) {
> ret = env->tlb->map_address(env, physical, prot,
> - real_address, rw, access_type);
> + real_address, rw);
> } else {
> ret = TLBRET_BADADDR;
> }
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 02/13] target/mips: Remove access_type argument from get_seg_physical_address
2021-01-28 14:41 ` [PATCH 02/13] target/mips: Remove access_type argument from get_seg_physical_address Philippe Mathieu-Daudé
@ 2021-02-02 3:25 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:25 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> get_seg_physical_address() doesn't use the 'access_type' argument,
> remove it to simplify.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/tlb_helper.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index 1af2dc969d6..9906292440c 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -222,7 +222,7 @@ static int is_seg_am_mapped(unsigned int am, bool eu, int mmu_idx)
>
> static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
> int *prot, target_ulong real_address,
> - int rw, int access_type, int mmu_idx,
> + int rw, int mmu_idx,
> unsigned int am, bool eu,
> target_ulong segmask,
> hwaddr physical_base)
> @@ -253,7 +253,7 @@ static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
> hwaddr pa = ((hwaddr)segctl & CP0SC_PA_MASK) << 20;
>
> return get_seg_physical_address(env, physical, prot, real_address, rw,
> - access_type, mmu_idx, am, eu, segmask,
> + mmu_idx, am, eu, segmask,
> pa & ~(hwaddr)segmask);
> }
>
> @@ -349,7 +349,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> /* Does CP0_Status.KX/SX/UX permit the access mode (am) */
> if (env->CP0_Status & am_ksux[am]) {
> ret = get_seg_physical_address(env, physical, prot,
> - real_address, rw, access_type,
> + real_address, rw,
> mmu_idx, am, false, env->PAMask,
> 0);
> } else {
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 03/13] target/mips: Remove access_type arg from get_segctl_physical_address()
2021-01-28 14:41 ` [PATCH 03/13] target/mips: Remove access_type arg from get_segctl_physical_address() Philippe Mathieu-Daudé
@ 2021-02-02 3:26 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> get_segctl_physical_address() doesn't use the 'access_type' argument,
> remove it to simplify.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/tlb_helper.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index 9906292440c..d89ad87cb9d 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -245,7 +245,7 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
>
> static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
> int *prot, target_ulong real_address,
> - int rw, int access_type, int mmu_idx,
> + int rw, int mmu_idx,
> uint16_t segctl, target_ulong segmask)
> {
> unsigned int am = (segctl & CP0SC_AM_MASK) >> CP0SC_AM;
> @@ -306,7 +306,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> segctl = env->CP0_SegCtl2 >> 16;
> }
> ret = get_segctl_physical_address(env, physical, prot,
> - real_address, rw, access_type,
> + real_address, rw,
> mmu_idx, segctl, 0x3FFFFFFF);
> #if defined(TARGET_MIPS64)
> } else if (address < 0x4000000000000000ULL) {
> @@ -370,26 +370,26 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> #endif
> } else if (address < KSEG1_BASE) {
> /* kseg0 */
> - ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
> - access_type, mmu_idx,
> + ret = get_segctl_physical_address(env, physical, prot, real_address,
> + rw, mmu_idx,
> env->CP0_SegCtl1 >> 16, 0x1FFFFFFF);
> } else if (address < KSEG2_BASE) {
> /* kseg1 */
> - ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
> - access_type, mmu_idx,
> + ret = get_segctl_physical_address(env, physical, prot, real_address,
> + rw, mmu_idx,
> env->CP0_SegCtl1, 0x1FFFFFFF);
> } else if (address < KSEG3_BASE) {
> /* sseg (kseg2) */
> - ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
> - access_type, mmu_idx,
> + ret = get_segctl_physical_address(env, physical, prot, real_address,
> + rw, mmu_idx,
> env->CP0_SegCtl0 >> 16, 0x1FFFFFFF);
> } else {
> /*
> * kseg3
> * XXX: debug segment is not emulated
> */
> - ret = get_segctl_physical_address(env, physical, prot, real_address, rw,
> - access_type, mmu_idx,
> + ret = get_segctl_physical_address(env, physical, prot, real_address,
> + rw, mmu_idx,
> env->CP0_SegCtl0, 0x1FFFFFFF);
> }
> return ret;
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 04/13] target/mips: Remove access_type argument from get_physical_address()
2021-01-28 14:41 ` [PATCH 04/13] target/mips: Remove access_type argument from get_physical_address() Philippe Mathieu-Daudé
@ 2021-02-02 3:27 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:27 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> get_physical_address() doesn't use the 'access_type' argument,
> remove it to simplify.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/tlb_helper.c | 22 +++++++++-------------
> 1 file changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index d89ad87cb9d..c9535b7f72f 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -259,7 +259,7 @@ static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
>
> static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> int *prot, target_ulong real_address,
> - int rw, int access_type, int mmu_idx)
> + int rw, int mmu_idx)
> {
> /* User mode can only access useg/xuseg */
> #if defined(TARGET_MIPS64)
> @@ -492,7 +492,7 @@ hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
> hwaddr phys_addr;
> int prot;
>
> - if (get_physical_address(env, &phys_addr, &prot, addr, 0, ACCESS_INT,
> + if (get_physical_address(env, &phys_addr, &prot, addr, 0,
> cpu_mmu_index(env, false)) != 0) {
> return -1;
> }
> @@ -570,7 +570,7 @@ static int walk_directory(CPUMIPSState *env, uint64_t *vaddr,
> uint64_t w = 0;
>
> if (get_physical_address(env, &paddr, &prot, *vaddr, MMU_DATA_LOAD,
> - ACCESS_INT, cpu_mmu_index(env, false)) !=
> + cpu_mmu_index(env, false)) !=
> TLBRET_MATCH) {
> /* wrong base address */
> return 0;
> @@ -598,7 +598,7 @@ static int walk_directory(CPUMIPSState *env, uint64_t *vaddr,
> *pw_entrylo0 = entry;
> }
> if (get_physical_address(env, &paddr, &prot, vaddr2, MMU_DATA_LOAD,
> - ACCESS_INT, cpu_mmu_index(env, false)) !=
> + cpu_mmu_index(env, false)) !=
> TLBRET_MATCH) {
> return 0;
> }
> @@ -752,7 +752,7 @@ static bool page_table_walk_refill(CPUMIPSState *env, vaddr address, int rw,
> /* Leaf Level Page Table - First half of PTE pair */
> vaddr |= ptoffset0;
> if (get_physical_address(env, &paddr, &prot, vaddr, MMU_DATA_LOAD,
> - ACCESS_INT, cpu_mmu_index(env, false)) !=
> + cpu_mmu_index(env, false)) !=
> TLBRET_MATCH) {
> return false;
> }
> @@ -765,7 +765,7 @@ static bool page_table_walk_refill(CPUMIPSState *env, vaddr address, int rw,
> /* Leaf Level Page Table - Second half of PTE pair */
> vaddr |= ptoffset1;
> if (get_physical_address(env, &paddr, &prot, vaddr, MMU_DATA_LOAD,
> - ACCESS_INT, cpu_mmu_index(env, false)) !=
> + cpu_mmu_index(env, false)) !=
> TLBRET_MATCH) {
> return false;
> }
> @@ -843,16 +843,14 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> #if !defined(CONFIG_USER_ONLY)
> hwaddr physical;
> int prot;
> - int mips_access_type;
> #endif
> int ret = TLBRET_BADADDR;
>
> /* data access */
> #if !defined(CONFIG_USER_ONLY)
> /* XXX: put correct access by using cpu_restore_state() correctly */
> - mips_access_type = ACCESS_INT;
> ret = get_physical_address(env, &physical, &prot, address,
> - access_type, mips_access_type, mmu_idx);
> + access_type, mmu_idx);
> switch (ret) {
> case TLBRET_MATCH:
> qemu_log_mask(CPU_LOG_MMU,
> @@ -884,7 +882,7 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
> env->hflags |= mode;
> if (ret_walker) {
> ret = get_physical_address(env, &physical, &prot, address,
> - access_type, mips_access_type, mmu_idx);
> + access_type, mmu_idx);
> if (ret == TLBRET_MATCH) {
> tlb_set_page(cs, address & TARGET_PAGE_MASK,
> physical & TARGET_PAGE_MASK, prot,
> @@ -909,12 +907,10 @@ hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address,
> {
> hwaddr physical;
> int prot;
> - int access_type;
> int ret = 0;
>
> /* data access */
> - access_type = ACCESS_INT;
> - ret = get_physical_address(env, &physical, &prot, address, rw, access_type,
> + ret = get_physical_address(env, &physical, &prot, address, rw,
> cpu_mmu_index(env, false));
> if (ret != TLBRET_MATCH) {
> raise_mmu_exception(env, address, rw, ret);
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 05/13] target/mips: Remove unused MMU definitions
2021-01-28 14:41 ` [PATCH 05/13] target/mips: Remove unused MMU definitions Philippe Mathieu-Daudé
@ 2021-02-02 3:36 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> Remove these confusing and unused definitions.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/cpu.h | 16 ----------------
> 1 file changed, 16 deletions(-)
>
> diff --git a/target/mips/cpu.h b/target/mips/cpu.h
> index b9e227a30e9..9e6028f8e63 100644
> --- a/target/mips/cpu.h
> +++ b/target/mips/cpu.h
> @@ -1220,22 +1220,6 @@ typedef MIPSCPU ArchCPU;
>
> #include "exec/cpu-all.h"
>
> -/*
> - * Memory access type :
> - * may be needed for precise access rights control and precise exceptions.
> - */
> -enum {
> - /* 1 bit to define user level / supervisor access */
> - ACCESS_USER = 0x00,
> - ACCESS_SUPER = 0x01,
> - /* 1 bit to indicate direction */
> - ACCESS_STORE = 0x02,
> - /* Type of instruction that generated the access */
> - ACCESS_CODE = 0x10, /* Code fetch access */
> - ACCESS_INT = 0x20, /* Integer load/store access */
> - ACCESS_FLOAT = 0x30, /* floating point load/store access */
> -};
> -
> /* Exceptions */
> enum {
> EXCP_NONE = -1,
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 06/13] target/mips: Replace magic value by MMU_DATA_LOAD definition
2021-01-28 14:41 ` [PATCH 06/13] target/mips: Replace magic value by MMU_DATA_LOAD definition Philippe Mathieu-Daudé
@ 2021-02-02 3:37 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:37 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/op_helper.c | 2 +-
> target/mips/tlb_helper.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
> index 89c7d4556a0..9fce0194b3e 100644
> --- a/target/mips/op_helper.c
> +++ b/target/mips/op_helper.c
> @@ -312,7 +312,7 @@ target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \
> } \
> do_raise_exception(env, EXCP_AdEL, GETPC()); \
> } \
> - env->CP0_LLAddr = do_translate_address(env, arg, 0, GETPC()); \
> + env->CP0_LLAddr = do_translate_address(env, arg, MMU_DATA_LOAD, GETPC()); \
> env->lladdr = arg; \
> env->llval = do_cast cpu_##insn##_mmuidx_ra(env, arg, mem_idx, GETPC()); \
> return env->llval; \
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index c9535b7f72f..9216c7a91b3 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -492,7 +492,7 @@ hwaddr mips_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
> hwaddr phys_addr;
> int prot;
>
> - if (get_physical_address(env, &phys_addr, &prot, addr, 0,
> + if (get_physical_address(env, &phys_addr, &prot, addr, MMU_DATA_LOAD,
> cpu_mmu_index(env, false)) != 0) {
> return -1;
> }
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument
2021-01-28 14:41 ` [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument Philippe Mathieu-Daudé
@ 2021-02-02 3:38 ` Jiaxun Yang
2021-02-04 2:36 ` Richard Henderson
1 sibling, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:38 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> The single caller, mips_cpu_tlb_fill(), passes MMUAccessType
> to page_table_walk_refill(). Let the prototype use it as
> argument, as it is stricter than an integer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/tlb_helper.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index 9216c7a91b3..afcc269750d 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -621,8 +621,8 @@ static int walk_directory(CPUMIPSState *env, uint64_t *vaddr,
> }
> }
>
> -static bool page_table_walk_refill(CPUMIPSState *env, vaddr address, int rw,
> - int mmu_idx)
> +static bool page_table_walk_refill(CPUMIPSState *env, vaddr address,
> + MMUAccessType access_type, int mmu_idx)
> {
> int gdw = (env->CP0_PWSize >> CP0PS_GDW) & 0x3F;
> int udw = (env->CP0_PWSize >> CP0PS_UDW) & 0x3F;
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 08/13] target/mips: Let do_translate_address() take MMUAccessType argument
2021-01-28 14:41 ` [PATCH 08/13] target/mips: Let do_translate_address() " Philippe Mathieu-Daudé
@ 2021-02-02 3:39 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> The single caller, HELPER_LD_ATOMIC(), passes MMUAccessType to
> do_translate_address(). Let the prototype use it as argument,
> as it is stricter than an integer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/op_helper.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/target/mips/op_helper.c b/target/mips/op_helper.c
> index 9fce0194b3e..b80e8f75401 100644
> --- a/target/mips/op_helper.c
> +++ b/target/mips/op_helper.c
> @@ -288,13 +288,14 @@ target_ulong helper_rotx(target_ulong rs, uint32_t shift, uint32_t shiftx,
> #ifndef CONFIG_USER_ONLY
>
> static inline hwaddr do_translate_address(CPUMIPSState *env,
> - target_ulong address,
> - int rw, uintptr_t retaddr)
> + target_ulong address,
> + MMUAccessType access_type,
> + uintptr_t retaddr)
> {
> hwaddr paddr;
> CPUState *cs = env_cpu(env);
>
> - paddr = cpu_mips_translate_address(env, address, rw);
> + paddr = cpu_mips_translate_address(env, address, access_type);
>
> if (paddr == -1LL) {
> cpu_loop_exit_restore(cs, retaddr);
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 09/13] target/mips: Let cpu_mips_translate_address() take MMUAccessType arg
2021-01-28 14:41 ` [PATCH 09/13] target/mips: Let cpu_mips_translate_address() take MMUAccessType arg Philippe Mathieu-Daudé
@ 2021-02-02 3:41 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> The single caller, do_translate_address(), passes MMUAccessType
> to cpu_mips_translate_address(). Let the prototype use it as
> argument, as it is stricter than an integer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/internal.h | 2 +-
> target/mips/tlb_helper.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/target/mips/internal.h b/target/mips/internal.h
> index d09afded5ea..34915c275c4 100644
> --- a/target/mips/internal.h
> +++ b/target/mips/internal.h
> @@ -146,7 +146,7 @@ void mips_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
> int mmu_idx, MemTxAttrs attrs,
> MemTxResult response, uintptr_t retaddr);
> hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address,
> - int rw);
> + MMUAccessType access_type);
> #endif
>
> #define cpu_signal_handler cpu_mips_signal_handler
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index afcc269750d..e9c3adeade6 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -903,17 +903,17 @@ bool mips_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
>
> #ifndef CONFIG_USER_ONLY
> hwaddr cpu_mips_translate_address(CPUMIPSState *env, target_ulong address,
> - int rw)
> + MMUAccessType access_type)
> {
> hwaddr physical;
> int prot;
> int ret = 0;
>
> /* data access */
> - ret = get_physical_address(env, &physical, &prot, address, rw,
> + ret = get_physical_address(env, &physical, &prot, address, access_type,
> cpu_mmu_index(env, false));
> if (ret != TLBRET_MATCH) {
> - raise_mmu_exception(env, address, rw, ret);
> + raise_mmu_exception(env, address, access_type, ret);
> return -1LL;
> } else {
> return physical;
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 10/13] target/mips: Let raise_mmu_exception() take MMUAccessType argument
2021-01-28 14:41 ` [PATCH 10/13] target/mips: Let raise_mmu_exception() take MMUAccessType argument Philippe Mathieu-Daudé
@ 2021-02-02 3:41 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:41 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> Both mips_cpu_tlb_fill() and cpu_mips_translate_address() pass
> MMUAccessType to raise_mmu_exception(). Let the prototype use it
> as argument, as it is stricter than an integer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/tlb_helper.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index e9c3adeade6..21b7d38f11c 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -405,12 +405,12 @@ void cpu_mips_tlb_flush(CPUMIPSState *env)
> #endif /* !CONFIG_USER_ONLY */
>
> static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
> - int rw, int tlb_error)
> + MMUAccessType access_type, int tlb_error)
> {
> CPUState *cs = env_cpu(env);
> int exception = 0, error_code = 0;
>
> - if (rw == MMU_INST_FETCH) {
> + if (access_type == MMU_INST_FETCH) {
> error_code |= EXCP_INST_NOTAVAIL;
> }
>
> @@ -419,7 +419,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
> case TLBRET_BADADDR:
> /* Reference to kernel address from user mode or supervisor mode */
> /* Reference to supervisor address from user mode */
> - if (rw == MMU_DATA_STORE) {
> + if (access_type == MMU_DATA_STORE) {
> exception = EXCP_AdES;
> } else {
> exception = EXCP_AdEL;
> @@ -427,7 +427,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
> break;
> case TLBRET_NOMATCH:
> /* No TLB match for a mapped address */
> - if (rw == MMU_DATA_STORE) {
> + if (access_type == MMU_DATA_STORE) {
> exception = EXCP_TLBS;
> } else {
> exception = EXCP_TLBL;
> @@ -436,7 +436,7 @@ static void raise_mmu_exception(CPUMIPSState *env, target_ulong address,
> break;
> case TLBRET_INVALID:
> /* TLB match with no valid bit */
> - if (rw == MMU_DATA_STORE) {
> + if (access_type == MMU_DATA_STORE) {
> exception = EXCP_TLBS;
> } else {
> exception = EXCP_TLBL;
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 11/13] target/mips: Let get_physical_address() take MMUAccessType argument
2021-01-28 14:41 ` [PATCH 11/13] target/mips: Let get_physical_address() " Philippe Mathieu-Daudé
@ 2021-02-02 3:42 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> All these functions:
> - mips_cpu_get_phys_page_debug()
> - cpu_mips_translate_address()
> - mips_cpu_tlb_fill()
> - page_table_walk_refill()
> - walk_directory()
> call get_physical_address() passing a MMUAccessType type. Let the
> prototype use it as argument, as it is stricter than an integer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/tlb_helper.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index 21b7d38f11c..64e89591abc 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -259,7 +259,7 @@ static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
>
> static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> int *prot, target_ulong real_address,
> - int rw, int mmu_idx)
> + MMUAccessType access_type, int mmu_idx)
> {
> /* User mode can only access useg/xuseg */
> #if defined(TARGET_MIPS64)
> @@ -306,14 +306,14 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> segctl = env->CP0_SegCtl2 >> 16;
> }
> ret = get_segctl_physical_address(env, physical, prot,
> - real_address, rw,
> + real_address, access_type,
> mmu_idx, segctl, 0x3FFFFFFF);
> #if defined(TARGET_MIPS64)
> } else if (address < 0x4000000000000000ULL) {
> /* xuseg */
> if (UX && address <= (0x3FFFFFFFFFFFFFFFULL & env->SEGMask)) {
> ret = env->tlb->map_address(env, physical, prot,
> - real_address, rw);
> + real_address, access_type);
> } else {
> ret = TLBRET_BADADDR;
> }
> @@ -322,7 +322,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> if ((supervisor_mode || kernel_mode) &&
> SX && address <= (0x7FFFFFFFFFFFFFFFULL & env->SEGMask)) {
> ret = env->tlb->map_address(env, physical, prot,
> - real_address, rw);
> + real_address, access_type);
> } else {
> ret = TLBRET_BADADDR;
> }
> @@ -349,7 +349,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> /* Does CP0_Status.KX/SX/UX permit the access mode (am) */
> if (env->CP0_Status & am_ksux[am]) {
> ret = get_seg_physical_address(env, physical, prot,
> - real_address, rw,
> + real_address, access_type,
> mmu_idx, am, false, env->PAMask,
> 0);
> } else {
> @@ -363,7 +363,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> if (kernel_mode && KX &&
> address <= (0xFFFFFFFF7FFFFFFFULL & env->SEGMask)) {
> ret = env->tlb->map_address(env, physical, prot,
> - real_address, rw);
> + real_address, access_type);
> } else {
> ret = TLBRET_BADADDR;
> }
> @@ -371,17 +371,17 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> } else if (address < KSEG1_BASE) {
> /* kseg0 */
> ret = get_segctl_physical_address(env, physical, prot, real_address,
> - rw, mmu_idx,
> + access_type, mmu_idx,
> env->CP0_SegCtl1 >> 16, 0x1FFFFFFF);
> } else if (address < KSEG2_BASE) {
> /* kseg1 */
> ret = get_segctl_physical_address(env, physical, prot, real_address,
> - rw, mmu_idx,
> + access_type, mmu_idx,
> env->CP0_SegCtl1, 0x1FFFFFFF);
> } else if (address < KSEG3_BASE) {
> /* sseg (kseg2) */
> ret = get_segctl_physical_address(env, physical, prot, real_address,
> - rw, mmu_idx,
> + access_type, mmu_idx,
> env->CP0_SegCtl0 >> 16, 0x1FFFFFFF);
> } else {
> /*
> @@ -389,7 +389,7 @@ static int get_physical_address(CPUMIPSState *env, hwaddr *physical,
> * XXX: debug segment is not emulated
> */
> ret = get_segctl_physical_address(env, physical, prot, real_address,
> - rw, mmu_idx,
> + access_type, mmu_idx,
> env->CP0_SegCtl0, 0x1FFFFFFF);
> }
> return ret;
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 12/13] target/mips: Let get_seg*_physical_address() take MMUAccessType arg
2021-01-28 14:41 ` [PATCH 12/13] target/mips: Let get_seg*_physical_address() take MMUAccessType arg Philippe Mathieu-Daudé
@ 2021-02-02 3:43 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:43 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> get_physical_address() calls get_seg_physical_address() and
> get_segctl_physical_address() passing a MMUAccessType type.
> Let the prototypes use it as argument, as it is stricter than
> an integer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/tlb_helper.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index 64e89591abc..14f5b1a0a9c 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -222,7 +222,7 @@ static int is_seg_am_mapped(unsigned int am, bool eu, int mmu_idx)
>
> static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
> int *prot, target_ulong real_address,
> - int rw, int mmu_idx,
> + MMUAccessType access_type, int mmu_idx,
> unsigned int am, bool eu,
> target_ulong segmask,
> hwaddr physical_base)
> @@ -234,7 +234,8 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
> return mapped;
> } else if (mapped) {
> /* The segment is TLB mapped */
> - return env->tlb->map_address(env, physical, prot, real_address, rw);
> + return env->tlb->map_address(env, physical, prot, real_address,
> + access_type);
> } else {
> /* The segment is unmapped */
> *physical = physical_base | (real_address & segmask);
> @@ -245,15 +246,15 @@ static int get_seg_physical_address(CPUMIPSState *env, hwaddr *physical,
>
> static int get_segctl_physical_address(CPUMIPSState *env, hwaddr *physical,
> int *prot, target_ulong real_address,
> - int rw, int mmu_idx,
> + MMUAccessType access_type, int mmu_idx,
> uint16_t segctl, target_ulong segmask)
> {
> unsigned int am = (segctl & CP0SC_AM_MASK) >> CP0SC_AM;
> bool eu = (segctl >> CP0SC_EU) & 1;
> hwaddr pa = ((hwaddr)segctl & CP0SC_PA_MASK) << 20;
>
> - return get_seg_physical_address(env, physical, prot, real_address, rw,
> - mmu_idx, am, eu, segmask,
> + return get_seg_physical_address(env, physical, prot, real_address,
> + access_type, mmu_idx, am, eu, segmask,
> pa & ~(hwaddr)segmask);
> }
>
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 13/13] target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType
2021-01-28 14:41 ` [PATCH 13/13] target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType Philippe Mathieu-Daudé
@ 2021-02-02 3:44 ` Jiaxun Yang
0 siblings, 0 replies; 30+ messages in thread
From: Jiaxun Yang @ 2021-02-02 3:44 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
在 2021/1/28 下午10:41, Philippe Mathieu-Daudé 写道:
> get_seg_physical_address() calls CPUMIPSTLBContext::map_address()
> handlers passing a MMUAccessType type. Update the prototype
> handlers to take a MMUAccessType argument, as it is stricter than
> an integer.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> target/mips/internal.h | 8 ++++----
> target/mips/tlb_helper.c | 12 ++++++------
> 2 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/target/mips/internal.h b/target/mips/internal.h
> index 34915c275c4..99264b8bf6a 100644
> --- a/target/mips/internal.h
> +++ b/target/mips/internal.h
> @@ -111,7 +111,7 @@ struct CPUMIPSTLBContext {
> uint32_t nb_tlb;
> uint32_t tlb_in_use;
> int (*map_address)(struct CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw);
> + target_ulong address, MMUAccessType access_type);
> void (*helper_tlbwi)(struct CPUMIPSState *env);
> void (*helper_tlbwr)(struct CPUMIPSState *env);
> void (*helper_tlbp)(struct CPUMIPSState *env);
> @@ -126,11 +126,11 @@ struct CPUMIPSTLBContext {
> };
>
> int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw);
> + target_ulong address, MMUAccessType access_type);
> int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw);
> + target_ulong address, MMUAccessType access_type);
> int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw);
> + target_ulong address, MMUAccessType access_type);
> void r4k_helper_tlbwi(CPUMIPSState *env);
> void r4k_helper_tlbwr(CPUMIPSState *env);
> void r4k_helper_tlbp(CPUMIPSState *env);
> diff --git a/target/mips/tlb_helper.c b/target/mips/tlb_helper.c
> index 14f5b1a0a9c..2dc8ecafc3b 100644
> --- a/target/mips/tlb_helper.c
> +++ b/target/mips/tlb_helper.c
> @@ -39,7 +39,7 @@ enum {
>
> /* no MMU emulation */
> int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw)
> + target_ulong address, MMUAccessType access_type)
> {
> *physical = address;
> *prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
> @@ -48,7 +48,7 @@ int no_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
>
> /* fixed mapping MMU emulation */
> int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw)
> + target_ulong address, MMUAccessType access_type)
> {
> if (address <= (int32_t)0x7FFFFFFFUL) {
> if (!(env->CP0_Status & (1 << CP0St_ERL))) {
> @@ -68,7 +68,7 @@ int fixed_mmu_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
>
> /* MIPS32/MIPS64 R4000-style MMU emulation */
> int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> - target_ulong address, int rw)
> + target_ulong address, MMUAccessType access_type)
> {
> uint16_t ASID = env->CP0_EntryHi & env->CP0_EntryHi_ASID_mask;
> uint32_t MMID = env->CP0_MemoryMapID;
> @@ -97,13 +97,13 @@ int r4k_map_address(CPUMIPSState *env, hwaddr *physical, int *prot,
> if (!(n ? tlb->V1 : tlb->V0)) {
> return TLBRET_INVALID;
> }
> - if (rw == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) {
> + if (access_type == MMU_INST_FETCH && (n ? tlb->XI1 : tlb->XI0)) {
> return TLBRET_XI;
> }
> - if (rw == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) {
> + if (access_type == MMU_DATA_LOAD && (n ? tlb->RI1 : tlb->RI0)) {
> return TLBRET_RI;
> }
> - if (rw != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) {
> + if (access_type != MMU_DATA_STORE || (n ? tlb->D1 : tlb->D0)) {
> *physical = tlb->PFN[n] | (address & (mask >> 1));
> *prot = PAGE_READ;
> if (n ? tlb->D1 : tlb->D0) {
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument
2021-01-28 14:41 ` [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument Philippe Mathieu-Daudé
2021-02-02 3:38 ` Jiaxun Yang
@ 2021-02-04 2:36 ` Richard Henderson
1 sibling, 0 replies; 30+ messages in thread
From: Richard Henderson @ 2021-02-04 2:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aurelien Jarno, Aleksandar Rikalo, Huacai Chen, Joe Komlodi
On 1/28/21 4:41 AM, Philippe Mathieu-Daudé wrote:
> -static bool page_table_walk_refill(CPUMIPSState *env, vaddr address, int rw,
> - int mmu_idx)
> +static bool page_table_walk_refill(CPUMIPSState *env, vaddr address,
> + MMUAccessType access_type, int mmu_idx)
The parameter name has changed without any other change to the function. If
this compiles, it surely means that the parameter is unused.
r~
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2021-01-28 14:41 ` [PATCH 13/13] target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType Philippe Mathieu-Daudé
@ 2021-02-04 2:39 ` Richard Henderson
2021-02-21 8:33 ` Philippe Mathieu-Daudé
14 siblings, 0 replies; 30+ messages in thread
From: Richard Henderson @ 2021-02-04 2:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Aurelien Jarno, Aleksandar Rikalo, Huacai Chen, Joe Komlodi
On 1/28/21 4:41 AM, Philippe Mathieu-Daudé wrote:
> Philippe Mathieu-Daudé (13):
> target/mips: Remove access_type argument from map_address() handler
> target/mips: Remove access_type argument from get_seg_physical_address
> target/mips: Remove access_type arg from get_segctl_physical_address()
> target/mips: Remove access_type argument from get_physical_address()
> target/mips: Remove unused MMU definitions
> target/mips: Replace magic value by MMU_DATA_LOAD definition
> target/mips: Let page_table_walk_refill() take MMUAccessType argument
> target/mips: Let do_translate_address() take MMUAccessType argument
> target/mips: Let cpu_mips_translate_address() take MMUAccessType arg
> target/mips: Let raise_mmu_exception() take MMUAccessType argument
> target/mips: Let get_physical_address() take MMUAccessType argument
> target/mips: Let get_seg*_physical_address() take MMUAccessType arg
> target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType
Modulo the comment vs patch 7,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2021-02-04 2:39 ` [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Richard Henderson
@ 2021-02-21 8:33 ` Philippe Mathieu-Daudé
14 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-21 8:33 UTC (permalink / raw)
To: qemu-devel
Cc: Aleksandar Rikalo, Huacai Chen, Richard Henderson,
Aurelien Jarno, Joe Komlodi
On 1/28/21 3:41 PM, Philippe Mathieu-Daudé wrote:
> Taking notes while reviewing commit 671a0a1265a
> ("use MMUAccessType instead of int in mmu_translate").
>
> Philippe Mathieu-Daudé (13):
> target/mips: Remove access_type argument from map_address() handler
> target/mips: Remove access_type argument from get_seg_physical_address
> target/mips: Remove access_type arg from get_segctl_physical_address()
> target/mips: Remove access_type argument from get_physical_address()
> target/mips: Remove unused MMU definitions
> target/mips: Replace magic value by MMU_DATA_LOAD definition
> target/mips: Let page_table_walk_refill() take MMUAccessType argument
> target/mips: Let do_translate_address() take MMUAccessType argument
> target/mips: Let cpu_mips_translate_address() take MMUAccessType arg
> target/mips: Let raise_mmu_exception() take MMUAccessType argument
> target/mips: Let get_physical_address() take MMUAccessType argument
> target/mips: Let get_seg*_physical_address() take MMUAccessType arg
> target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType
>
> target/mips/cpu.h | 16 ---------
> target/mips/internal.h | 10 +++---
> target/mips/op_helper.c | 9 ++---
> target/mips/tlb_helper.c | 78 +++++++++++++++++++---------------------
> 4 files changed, 47 insertions(+), 66 deletions(-)
Thanks, patches 1-6 and 8-13 applied to mips-next.
^ permalink raw reply [flat|nested] 30+ messages in thread
end of thread, other threads:[~2021-02-21 8:34 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28 14:41 [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Philippe Mathieu-Daudé
2021-01-28 14:41 ` [PATCH 01/13] target/mips: Remove access_type argument from map_address() handler Philippe Mathieu-Daudé
2021-02-02 3:22 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 02/13] target/mips: Remove access_type argument from get_seg_physical_address Philippe Mathieu-Daudé
2021-02-02 3:25 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 03/13] target/mips: Remove access_type arg from get_segctl_physical_address() Philippe Mathieu-Daudé
2021-02-02 3:26 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 04/13] target/mips: Remove access_type argument from get_physical_address() Philippe Mathieu-Daudé
2021-02-02 3:27 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 05/13] target/mips: Remove unused MMU definitions Philippe Mathieu-Daudé
2021-02-02 3:36 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 06/13] target/mips: Replace magic value by MMU_DATA_LOAD definition Philippe Mathieu-Daudé
2021-02-02 3:37 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 07/13] target/mips: Let page_table_walk_refill() take MMUAccessType argument Philippe Mathieu-Daudé
2021-02-02 3:38 ` Jiaxun Yang
2021-02-04 2:36 ` Richard Henderson
2021-01-28 14:41 ` [PATCH 08/13] target/mips: Let do_translate_address() " Philippe Mathieu-Daudé
2021-02-02 3:39 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 09/13] target/mips: Let cpu_mips_translate_address() take MMUAccessType arg Philippe Mathieu-Daudé
2021-02-02 3:41 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 10/13] target/mips: Let raise_mmu_exception() take MMUAccessType argument Philippe Mathieu-Daudé
2021-02-02 3:41 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 11/13] target/mips: Let get_physical_address() " Philippe Mathieu-Daudé
2021-02-02 3:42 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 12/13] target/mips: Let get_seg*_physical_address() take MMUAccessType arg Philippe Mathieu-Daudé
2021-02-02 3:43 ` Jiaxun Yang
2021-01-28 14:41 ` [PATCH 13/13] target/mips: Let CPUMIPSTLBContext::map_address() take MMUAccessType Philippe Mathieu-Daudé
2021-02-02 3:44 ` Jiaxun Yang
2021-02-04 2:39 ` [PATCH 00/13] target/mips: Replace integer by MMUAccessType enum when possible Richard Henderson
2021-02-21 8:33 ` Philippe Mathieu-Daudé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.