All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Anton Johansson" <anjo@rev.ng>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH-for-9.1 7/8] target/microblaze: Move MMU helpers to sys_helper.c
Date: Tue, 19 Mar 2024 07:28:54 +0100	[thread overview]
Message-ID: <20240319062855.8025-8-philmd@linaro.org> (raw)
In-Reply-To: <20240319062855.8025-1-philmd@linaro.org>

MMU helpers are only used during system emulation,
move them to sys_helper.c.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/microblaze/op_helper.c  | 48 ----------------------------------
 target/microblaze/sys_helper.c | 47 +++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 48 deletions(-)

diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
index f6378030b7..45dbed4aaa 100644
--- a/target/microblaze/op_helper.c
+++ b/target/microblaze/op_helper.c
@@ -381,51 +381,3 @@ void helper_stackprot(CPUMBState *env, target_ulong addr)
         cpu_loop_exit_restore(cs, GETPC());
     }
 }
-
-#if !defined(CONFIG_USER_ONLY)
-/* Writes/reads to the MMU's special regs end up here.  */
-uint32_t helper_mmu_read(CPUMBState *env, uint32_t ext, uint32_t rn)
-{
-    return mmu_read(env, ext, rn);
-}
-
-void helper_mmu_write(CPUMBState *env, uint32_t ext, uint32_t rn, uint32_t v)
-{
-    mmu_write(env, ext, rn, v);
-}
-
-void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
-                               unsigned size, MMUAccessType access_type,
-                               int mmu_idx, MemTxAttrs attrs,
-                               MemTxResult response, uintptr_t retaddr)
-{
-    MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
-    CPUMBState *env = &cpu->env;
-
-    qemu_log_mask(CPU_LOG_INT, "Transaction failed: vaddr 0x%" VADDR_PRIx
-                  " physaddr 0x" HWADDR_FMT_plx " size %d access type %s\n",
-                  addr, physaddr, size,
-                  access_type == MMU_INST_FETCH ? "INST_FETCH" :
-                  (access_type == MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_STORE"));
-
-    if (!(env->msr & MSR_EE)) {
-        return;
-    }
-
-    if (access_type == MMU_INST_FETCH) {
-        if (!cpu->cfg.iopb_bus_exception) {
-            return;
-        }
-        env->esr = ESR_EC_INSN_BUS;
-    } else {
-        if (!cpu->cfg.dopb_bus_exception) {
-            return;
-        }
-        env->esr = ESR_EC_DATA_BUS;
-    }
-
-    env->ear = addr;
-    cs->exception_index = EXCP_HW_EXCP;
-    cpu_loop_exit_restore(cs, retaddr);
-}
-#endif
diff --git a/target/microblaze/sys_helper.c b/target/microblaze/sys_helper.c
index 5180500354..7531f95ca7 100644
--- a/target/microblaze/sys_helper.c
+++ b/target/microblaze/sys_helper.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
+#include "exec/helper-proto.h"
 #include "qemu/host-utils.h"
 #include "exec/log.h"
 
@@ -292,3 +293,49 @@ void mb_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
     cs->exception_index = EXCP_HW_EXCP;
     cpu_loop_exit(cs);
 }
+
+/* Writes/reads to the MMU's special regs end up here.  */
+uint32_t helper_mmu_read(CPUMBState *env, uint32_t ext, uint32_t rn)
+{
+    return mmu_read(env, ext, rn);
+}
+
+void helper_mmu_write(CPUMBState *env, uint32_t ext, uint32_t rn, uint32_t v)
+{
+    mmu_write(env, ext, rn, v);
+}
+
+void mb_cpu_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
+                               unsigned size, MMUAccessType access_type,
+                               int mmu_idx, MemTxAttrs attrs,
+                               MemTxResult response, uintptr_t retaddr)
+{
+    MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
+    CPUMBState *env = &cpu->env;
+
+    qemu_log_mask(CPU_LOG_INT, "Transaction failed: vaddr 0x%" VADDR_PRIx
+                  " physaddr 0x" HWADDR_FMT_plx " size %d access type %s\n",
+                  addr, physaddr, size,
+                  access_type == MMU_INST_FETCH ? "INST_FETCH" :
+                  (access_type == MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_STORE"));
+
+    if (!(env->msr & MSR_EE)) {
+        return;
+    }
+
+    if (access_type == MMU_INST_FETCH) {
+        if (!cpu->cfg.iopb_bus_exception) {
+            return;
+        }
+        env->esr = ESR_EC_INSN_BUS;
+    } else {
+        if (!cpu->cfg.dopb_bus_exception) {
+            return;
+        }
+        env->esr = ESR_EC_DATA_BUS;
+    }
+
+    env->ear = addr;
+    cs->exception_index = EXCP_HW_EXCP;
+    cpu_loop_exit_restore(cs, retaddr);
+}
-- 
2.41.0



  parent reply	other threads:[~2024-03-19  6:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  6:28 [PATCH-for-9.1 0/8] target/microblaze: Sprint housekeeping Philippe Mathieu-Daudé
2024-03-19  6:28 ` [PATCH-for-9.1 1/8] target/microblaze: Use correct string format in do_unaligned_access() Philippe Mathieu-Daudé
2024-03-19 15:52   ` Anton Johansson via
2024-03-19 16:29   ` Edgar E. Iglesias
2024-03-19  6:28 ` [PATCH-for-9.1 2/8] target/microblaze: Use hwaddr/vaddr in cpu_get_phys_page_attrs_debug() Philippe Mathieu-Daudé
2024-03-19 15:53   ` Anton Johansson via
2024-03-19 16:29   ` Edgar E. Iglesias
2024-03-19  6:28 ` [PATCH-for-9.1 3/8] target/microblaze: Widen vaddr in mmu_translate() Philippe Mathieu-Daudé
2024-03-19 15:54   ` Anton Johansson via
2024-03-19 21:00   ` Edgar E. Iglesias
2024-03-19  6:28 ` [PATCH-for-9.1 4/8] target/microblaze: Use 32-bit destination in gen_goto_tb() Philippe Mathieu-Daudé
2024-03-19 15:57   ` Anton Johansson via
2024-03-19 21:01   ` Edgar E. Iglesias
2024-03-19  6:28 ` [PATCH-for-9.1 5/8] target/microblaze: Restrict 64-bit 'res_addr' to system emulation Philippe Mathieu-Daudé
2024-03-19 16:01   ` Anton Johansson via
2024-03-19 16:27   ` Edgar E. Iglesias
2024-03-19 18:17     ` Philippe Mathieu-Daudé
2024-03-19  6:28 ` [PATCH-for-9.1 6/8] target/microblaze: Rename helper.c -> sys_helper.c Philippe Mathieu-Daudé
2024-03-19 16:02   ` Anton Johansson via
2024-03-19 21:01   ` Edgar E. Iglesias
2024-03-19  6:28 ` Philippe Mathieu-Daudé [this message]
2024-03-19 16:03   ` [PATCH-for-9.1 7/8] target/microblaze: Move MMU helpers to sys_helper.c Anton Johansson via
2024-03-19 21:01   ` Edgar E. Iglesias
2024-03-19  6:28 ` [RFC PATCH-for-9.1 8/8] target/microblaze: Widen $ear to 64-bit Philippe Mathieu-Daudé
2024-03-19 16:21   ` Anton Johansson via
2024-03-19 21:07   ` Edgar E. Iglesias
2024-03-19  6:30 ` [PATCH-for-9.1 0/8] target/microblaze: Sprint housekeeping Philippe Mathieu-Daudé

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=20240319062855.8025-8-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=alistair@alistair23.me \
    --cc=anjo@rev.ng \
    --cc=edgar.iglesias@gmail.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.