From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: Richard Henderson <richard.henderson@linaro.org>,
Pierrick Bouvier <pierrick.bouvier@linaro.org>
Subject: [PATCH-for-10.1 v3 15/19] tcg: Move cpu_req_mo() macro to target-agnostic 'backend-ldst.h'
Date: Fri, 4 Apr 2025 00:04:15 +0200 [thread overview]
Message-ID: <20250403220420.78937-16-philmd@linaro.org> (raw)
In-Reply-To: <20250403220420.78937-1-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/backend-ldst.h | 41 +++++++++++++++++++++++++++++++++++++
accel/tcg/internal-target.h | 28 -------------------------
accel/tcg/cputlb.c | 1 +
accel/tcg/user-exec.c | 1 +
4 files changed, 43 insertions(+), 28 deletions(-)
create mode 100644 accel/tcg/backend-ldst.h
diff --git a/accel/tcg/backend-ldst.h b/accel/tcg/backend-ldst.h
new file mode 100644
index 00000000000..9c3a407a5af
--- /dev/null
+++ b/accel/tcg/backend-ldst.h
@@ -0,0 +1,41 @@
+/*
+ * Internal memory barrier helpers for QEMU (target agnostic)
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef ACCEL_TCG_BACKEND_LDST_H
+#define ACCEL_TCG_BACKEND_LDST_H
+
+#include "tcg-target-mo.h"
+
+/**
+ * tcg_req_mo:
+ * @guest_mo: Guest default memory order
+ * @type: TCGBar
+ *
+ * Filter @type to the barrier that is required for the guest
+ * memory ordering vs the host memory ordering. A non-zero
+ * result indicates that some barrier is required.
+ */
+#define tcg_req_mo(guest_mo, type) \
+ ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO)
+
+/**
+ * cpu_req_mo:
+ * @cpu: CPUState
+ * @type: TCGBar
+ *
+ * If tcg_req_mo indicates a barrier for @type is required
+ * for the guest memory model, issue a host memory barrier.
+ */
+#define cpu_req_mo(cpu, type) \
+ do { \
+ if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \
+ smp_mb(); \
+ } \
+ } while (0)
+
+#endif
diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h
index f5a3fd7e402..9a9cef31406 100644
--- a/accel/tcg/internal-target.h
+++ b/accel/tcg/internal-target.h
@@ -13,7 +13,6 @@
#include "exec/exec-all.h"
#include "exec/translation-block.h"
#include "tb-internal.h"
-#include "tcg-target-mo.h"
#include "exec/mmap-lock.h"
/*
@@ -44,31 +43,4 @@ void page_table_config_init(void);
G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
#endif /* CONFIG_USER_ONLY */
-/**
- * tcg_req_mo:
- * @guest_mo: Guest default memory order
- * @type: TCGBar
- *
- * Filter @type to the barrier that is required for the guest
- * memory ordering vs the host memory ordering. A non-zero
- * result indicates that some barrier is required.
- */
-#define tcg_req_mo(guest_mo, type) \
- ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO)
-
-/**
- * cpu_req_mo:
- * @cpu: CPUState
- * @type: TCGBar
- *
- * If tcg_req_mo indicates a barrier for @type is required
- * for the guest memory model, issue a host memory barrier.
- */
-#define cpu_req_mo(cpu, type) \
- do { \
- if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \
- smp_mb(); \
- } \
- } while (0)
-
#endif /* ACCEL_TCG_INTERNAL_H */
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 35b1ff03a51..d9fb68d7198 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -48,6 +48,7 @@
#include "qemu/plugin-memory.h"
#endif
#include "tcg/tcg-ldst.h"
+#include "backend-ldst.h"
/* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 3f4d6824460..5eef8e7f186 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -37,6 +37,7 @@
#include "qemu/int128.h"
#include "trace.h"
#include "tcg/tcg-ldst.h"
+#include "backend-ldst.h"
#include "internal-common.h"
#include "internal-target.h"
#include "tb-internal.h"
--
2.47.1
next prev parent reply other threads:[~2025-04-03 22:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-03 22:04 [PATCH-for-10.1 v3 00/19] tcg: philmd's queue Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 01/19] target/riscv: Do not expose rv128 CPU on user mode emulation Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 02/19] tcg: Include missing 'cpu.h' in translate-all.c Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 03/19] tcg: Declare TARGET_INSN_START_EXTRA_WORDS in 'cpu-param.h' Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 04/19] tcg: Always define TARGET_INSN_START_EXTRA_WORDS Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 05/19] exec: Restrict 'cpu-ldst-common.h' to accel/tcg/ Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 06/19] exec: Restrict 'cpu_ldst.h' " Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 07/19] exec: Do not include 'accel/tcg/cpu-ldst.h' in 'exec-all.h' Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 08/19] tcg: Always define TCG_GUEST_DEFAULT_MO Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 09/19] tcg: Simplify tcg_req_mo() macro Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 10/19] tcg: Define guest_default_memory_order in TCGCPUOps Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 11/19] tcg: Remove use of TCG_GUEST_DEFAULT_MO in tb_gen_code() Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 12/19] tcg: Propagate CPUState argument to cpu_req_mo() Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 13/19] tcg: Have tcg_req_mo() use TCGCPUOps::guest_default_memory_order Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 14/19] tcg: Remove the TCG_GUEST_DEFAULT_MO definition globally Philippe Mathieu-Daudé
2025-04-04 23:48 ` Philippe Mathieu-Daudé
2025-04-03 22:04 ` Philippe Mathieu-Daudé [this message]
2025-04-03 22:04 ` [PATCH-for-10.1 v3 16/19] tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h' Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 17/19] tcg: Convert TCGState::mttcg_enabled to TriState Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 18/19] tcg: Factor mttcg_init() out Philippe Mathieu-Daudé
2025-04-03 22:04 ` [PATCH-for-10.1 v3 19/19] tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field Philippe Mathieu-Daudé
2025-04-05 11:29 ` Richard Henderson
2025-04-05 14:14 ` 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=20250403220420.78937-16-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--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).