All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Marek Vasut" <marex@denx.de>, "Chris Wulff" <crwulff@gmail.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Joe Komlodi" <komlodi@xilinx.com>
Subject: [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible
Date: Thu, 28 Jan 2021 00:41:19 +0100	[thread overview]
Message-ID: <20210127234119.3537399-3-f4bug@amsat.org> (raw)
In-Reply-To: <20210127234119.3537399-1-f4bug@amsat.org>

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



  parent reply	other threads:[~2021-01-27 23:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Philippe Mathieu-Daudé [this message]
2021-02-04  2:45   ` [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210127234119.3537399-3-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=crwulff@gmail.com \
    --cc=komlodi@xilinx.com \
    --cc=marex@denx.de \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --subject='Re: [PATCH 2/2] target/nios2: Use MMUAccessType enum type when possible' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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.