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 5/8] target/microblaze: Restrict 64-bit 'res_addr' to system emulation
Date: Tue, 19 Mar 2024 07:28:52 +0100 [thread overview]
Message-ID: <20240319062855.8025-6-philmd@linaro.org> (raw)
In-Reply-To: <20240319062855.8025-1-philmd@linaro.org>
'res_addr' is only used in system emulation, where we have
TARGET_LONG_BITS = 64, so we can directly use the native
uint64_t type instead of target_ulong.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/microblaze/cpu.h | 10 +++++-----
target/microblaze/cpu.c | 2 ++
target/microblaze/machine.c | 2 +-
target/microblaze/translate.c | 9 +++++++--
4 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h
index c0c7574dbd..c3e2aba0ec 100644
--- a/target/microblaze/cpu.h
+++ b/target/microblaze/cpu.h
@@ -260,11 +260,6 @@ struct CPUArchState {
/* Stack protectors. Yes, it's a hw feature. */
uint32_t slr, shr;
- /* lwx/swx reserved address */
-#define RES_ADDR_NONE 0xffffffff /* Use 0xffffffff to indicate no reservation */
- target_ulong res_addr;
- uint32_t res_val;
-
/* Internal flags. */
#define IMM_FLAG (1 << 0)
#define BIMM_FLAG (1 << 1)
@@ -286,6 +281,11 @@ struct CPUArchState {
uint32_t iflags;
#if !defined(CONFIG_USER_ONLY)
+ /* lwx/swx reserved address */
+#define RES_ADDR_NONE 0xffffffff /* Use 0xffffffff to indicate no reservation */
+ uint64_t res_addr;
+ uint32_t res_val;
+
/* Unified MMU. */
MicroBlazeMMU mmu;
#endif
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index 96c2b71f7f..9e393cf217 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -193,7 +193,9 @@ static void mb_cpu_reset_hold(Object *obj)
}
memset(env, 0, offsetof(CPUMBState, end_reset_fields));
+#ifndef CONFIG_USER_ONLY
env->res_addr = RES_ADDR_NONE;
+#endif
/* Disable stack protector. */
env->shr = ~0;
diff --git a/target/microblaze/machine.c b/target/microblaze/machine.c
index 51705e4f5c..4daf8a2471 100644
--- a/target/microblaze/machine.c
+++ b/target/microblaze/machine.c
@@ -78,7 +78,7 @@ static const VMStateField vmstate_env_fields[] = {
VMSTATE_UINT32(iflags, CPUMBState),
VMSTATE_UINT32(res_val, CPUMBState),
- VMSTATE_UINTTL(res_addr, CPUMBState),
+ VMSTATE_UINT64(res_addr, CPUMBState),
VMSTATE_STRUCT(mmu, CPUMBState, 0, vmstate_mmu, MicroBlazeMMU),
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index d6a42381bb..493850c544 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -1872,7 +1872,9 @@ void mb_tcg_init(void)
SP(iflags),
SP(bvalue),
SP(btarget),
+#if !defined(CONFIG_USER_ONLY)
SP(res_val),
+#endif
};
#undef R
@@ -1883,6 +1885,9 @@ void mb_tcg_init(void)
tcg_global_mem_new_i32(tcg_env, i32s[i].ofs, i32s[i].name);
}
- cpu_res_addr =
- tcg_global_mem_new(tcg_env, offsetof(CPUMBState, res_addr), "res_addr");
+#if !defined(CONFIG_USER_ONLY)
+ cpu_res_addr = tcg_global_mem_new_i64(tcg_env,
+ offsetof(CPUMBState, res_addr),
+ "res_addr");
+#endif
}
--
2.41.0
next prev parent reply other threads:[~2024-03-19 6:31 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 ` Philippe Mathieu-Daudé [this message]
2024-03-19 16:01 ` [PATCH-for-9.1 5/8] target/microblaze: Restrict 64-bit 'res_addr' to system emulation 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 ` [PATCH-for-9.1 7/8] target/microblaze: Move MMU helpers to sys_helper.c Philippe Mathieu-Daudé
2024-03-19 16:03 ` 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-6-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).