* [PATCH 0/2] target/nios2: Pass MMUAccessType to mmu_translate()
@ 2021-01-27 23:41 Philippe Mathieu-Daudé
2021-01-27 23:41 ` [PATCH 1/2] target/nios2: Replace magic value by MMU definitions Philippe Mathieu-Daudé
2021-01-27 23:41 ` [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible Philippe Mathieu-Daudé
0 siblings, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-27 23:41 UTC (permalink / raw)
To: qemu-devel
Cc: Marek Vasut, Chris Wulff, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi
Taking notes while reviewing commit 671a0a1265a
("use MMUAccessType instead of int in mmu_translate").
Philippe Mathieu-Daudé (2):
target/nios2: Replace magic value by MMU definitions
target/nios2: Use MMUAccessType enum type when possible
target/nios2/mmu.h | 3 ++-
target/nios2/helper.c | 2 +-
target/nios2/mmu.c | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] target/nios2: Replace magic value by MMU definitions
2021-01-27 23:41 [PATCH 0/2] target/nios2: Pass MMUAccessType to mmu_translate() Philippe Mathieu-Daudé
@ 2021-01-27 23:41 ` Philippe Mathieu-Daudé
2021-02-04 2:44 ` Richard Henderson
2021-01-27 23:41 ` [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible Philippe Mathieu-Daudé
1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-27 23:41 UTC (permalink / raw)
To: qemu-devel
Cc: Marek Vasut, Chris Wulff, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi
cpu_get_phys_page_debug() uses 'DATA LOAD' MMU access type.
The first MMU is the supervisor one.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/nios2/helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/nios2/helper.c b/target/nios2/helper.c
index 57c97bde3c6..fea34c957d9 100644
--- a/target/nios2/helper.c
+++ b/target/nios2/helper.c
@@ -209,7 +209,7 @@ hwaddr nios2_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
unsigned int hit;
if (cpu->mmu_present && (addr < 0xC0000000)) {
- hit = mmu_translate(env, &lu, addr, 0, 0);
+ hit = mmu_translate(env, &lu, addr, MMU_DATA_LOAD, MMU_SUPERVISOR_IDX);
if (hit) {
vaddr = addr & TARGET_PAGE_MASK;
paddr = lu.paddr + vaddr - lu.vaddr;
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible
2021-01-27 23:41 [PATCH 0/2] target/nios2: Pass MMUAccessType to mmu_translate() Philippe Mathieu-Daudé
2021-01-27 23:41 ` [PATCH 1/2] target/nios2: Replace magic value by MMU definitions Philippe Mathieu-Daudé
@ 2021-01-27 23:41 ` Philippe Mathieu-Daudé
2021-02-04 2:45 ` Richard Henderson
1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-27 23:41 UTC (permalink / raw)
To: qemu-devel
Cc: Marek Vasut, Chris Wulff, Richard Henderson,
Philippe Mathieu-Daudé,
Joe Komlodi
All callers of mmu_translate() provide it a MMUAccessType
type. Let the prototype use it as argument, as it is stricter
than an integer. We can remove the documentation as enum
names are self explicit.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
target/nios2/mmu.h | 3 ++-
target/nios2/mmu.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/target/nios2/mmu.h b/target/nios2/mmu.h
index 4f46fbb82e2..2f4e325a81e 100644
--- a/target/nios2/mmu.h
+++ b/target/nios2/mmu.h
@@ -43,7 +43,8 @@ typedef struct Nios2MMULookup {
void mmu_flip_um(CPUNios2State *env, unsigned int um);
unsigned int mmu_translate(CPUNios2State *env,
Nios2MMULookup *lu,
- target_ulong vaddr, int rw, int mmu_idx);
+ target_ulong vaddr,
+ MMUAccessType access_type, int mmu_idx);
void mmu_read_debug(CPUNios2State *env, uint32_t rn);
void mmu_write(CPUNios2State *env, uint32_t rn, uint32_t v);
void mmu_init(CPUNios2State *env);
diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c
index 2545c06761f..ebe13b89f68 100644
--- a/target/nios2/mmu.c
+++ b/target/nios2/mmu.c
@@ -55,10 +55,10 @@ void mmu_read_debug(CPUNios2State *env, uint32_t rn)
}
}
-/* rw - 0 = read, 1 = write, 2 = fetch. */
unsigned int mmu_translate(CPUNios2State *env,
Nios2MMULookup *lu,
- target_ulong vaddr, int rw, int mmu_idx)
+ target_ulong vaddr,
+ MMUAccessType access_type, int mmu_idx)
{
Nios2CPU *cpu = env_archcpu(env);
int pid = (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4;
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] target/nios2: Replace magic value by MMU definitions
2021-01-27 23:41 ` [PATCH 1/2] target/nios2: Replace magic value by MMU definitions Philippe Mathieu-Daudé
@ 2021-02-04 2:44 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2021-02-04 2:44 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Marek Vasut, Chris Wulff, Joe Komlodi
On 1/27/21 1:41 PM, Philippe Mathieu-Daudé wrote:
> cpu_get_phys_page_debug() uses 'DATA LOAD' MMU access type.
> The first MMU is the supervisor one.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> target/nios2/helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I'll note that mmu_idx isn't used by mmu_translate.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible
2021-01-27 23:41 ` [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible Philippe Mathieu-Daudé
@ 2021-02-04 2:45 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2021-02-04 2:45 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Marek Vasut, Chris Wulff, Joe Komlodi
On 1/27/21 1:41 PM, Philippe Mathieu-Daudé wrote:
> All callers of mmu_translate() provide it a MMUAccessType
> type. Let the prototype use it as argument, as it is stricter
> than an integer. We can remove the documentation as enum
> names are self explicit.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> target/nios2/mmu.h | 3 ++-
> target/nios2/mmu.c | 4 ++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-04 3:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 23:41 [PATCH 0/2] target/nios2: Pass MMUAccessType to mmu_translate() Philippe Mathieu-Daudé
2021-01-27 23:41 ` [PATCH 1/2] target/nios2: Replace magic value by MMU definitions Philippe Mathieu-Daudé
2021-02-04 2:44 ` Richard Henderson
2021-01-27 23:41 ` [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible Philippe Mathieu-Daudé
2021-02-04 2:45 ` Richard Henderson
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.