[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 25/59] accel/tcg: Declare mmap_[un]lock() in 'exec/page-protection
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 25/59] accel/tcg: Declare mmap_[un]lock() in 'exec/page-protection.h' |
Date: |
Fri, 20 Dec 2024 17:15:16 +0100 |
Move mmap_lock(), mmap_unlock() declarations and the
WITH_MMAP_LOCK_GUARD() definition to 'exec/page-protection.h'.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20241212185341.2857-5-philmd@linaro.org>
---
include/exec/exec-all.h | 17 -----------------
include/exec/page-protection.h | 24 ++++++++++++++++++++++++
accel/tcg/cpu-exec.c | 1 +
accel/tcg/translate-all.c | 1 +
accel/tcg/watchpoint.c | 1 +
linux-user/flatload.c | 1 +
target/arm/helper.c | 1 +
7 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 2e4c4cc4b46..b5ea607cf45 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -27,7 +27,6 @@
#endif
#include "exec/mmu-access-type.h"
#include "exec/translation-block.h"
-#include "qemu/clang-tsa.h"
/**
* cpu_loop_exit_requested:
@@ -520,18 +519,6 @@ static inline tb_page_addr_t
get_page_addr_code(CPUArchState *env,
}
#if defined(CONFIG_USER_ONLY)
-void TSA_NO_TSA mmap_lock(void);
-void TSA_NO_TSA mmap_unlock(void);
-bool have_mmap_lock(void);
-
-static inline void mmap_unlock_guard(void *unused)
-{
- mmap_unlock();
-}
-
-#define WITH_MMAP_LOCK_GUARD() \
- for (int _mmap_lock_iter __attribute__((cleanup(mmap_unlock_guard))) \
- = (mmap_lock(), 0); _mmap_lock_iter == 0; _mmap_lock_iter = 1)
/**
* adjust_signal_pc:
@@ -585,10 +572,6 @@ G_NORETURN void cpu_loop_exit_sigbus(CPUState *cpu,
target_ulong addr,
uintptr_t ra);
#else
-static inline void mmap_lock(void) {}
-static inline void mmap_unlock(void) {}
-#define WITH_MMAP_LOCK_GUARD()
-
void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length);
void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length);
diff --git a/include/exec/page-protection.h b/include/exec/page-protection.h
index c43231af8b5..bae3355f62c 100644
--- a/include/exec/page-protection.h
+++ b/include/exec/page-protection.h
@@ -38,4 +38,28 @@
*/
#define PAGE_PASSTHROUGH 0x0800
+#ifdef CONFIG_USER_ONLY
+
+#include "qemu/clang-tsa.h"
+
+void TSA_NO_TSA mmap_lock(void);
+void TSA_NO_TSA mmap_unlock(void);
+bool have_mmap_lock(void);
+
+static inline void mmap_unlock_guard(void *unused)
+{
+ mmap_unlock();
+}
+
+#define WITH_MMAP_LOCK_GUARD() \
+ for (int _mmap_lock_iter __attribute__((cleanup(mmap_unlock_guard))) \
+ = (mmap_lock(), 0); _mmap_lock_iter == 0; _mmap_lock_iter = 1)
+#else
+
+static inline void mmap_lock(void) {}
+static inline void mmap_unlock(void) {}
+#define WITH_MMAP_LOCK_GUARD()
+
+#endif /* !CONFIG_USER_ONLY */
+
#endif
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index c13f4a7cbbf..f82870a1e2a 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -25,6 +25,7 @@
#include "trace.h"
#include "disas/disas.h"
#include "exec/exec-all.h"
+#include "exec/page-protection.h"
#include "tcg/tcg.h"
#include "qemu/atomic.h"
#include "qemu/rcu.h"
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index a8b24be0b96..d586ac9bb1d 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -44,6 +44,7 @@
#endif
#include "exec/cputlb.h"
+#include "exec/page-protection.h"
#include "exec/translate-all.h"
#include "exec/translator.h"
#include "exec/tb-flush.h"
diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c
index ca641eb95cf..8923301b8b8 100644
--- a/accel/tcg/watchpoint.c
+++ b/accel/tcg/watchpoint.c
@@ -22,6 +22,7 @@
#include "qemu/error-report.h"
#include "exec/exec-all.h"
#include "exec/translate-all.h"
+#include "exec/page-protection.h"
#include "system/tcg.h"
#include "system/replay.h"
#include "hw/core/tcg-cpu-ops.h"
diff --git a/linux-user/flatload.c b/linux-user/flatload.c
index 0e4be5bf44a..d5cb1830ddf 100644
--- a/linux-user/flatload.c
+++ b/linux-user/flatload.c
@@ -34,6 +34,7 @@
#include "qemu/osdep.h"
#include "qemu.h"
+#include "exec/page-protection.h"
#include "user-internals.h"
#include "loader.h"
#include "user-mmap.h"
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 146ddf06c5b..449e69a6e39 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -13,6 +13,7 @@
#include "internals.h"
#include "cpu-features.h"
#include "exec/helper-proto.h"
+#include "exec/page-protection.h"
#include "qemu/main-loop.h"
#include "qemu/timer.h"
#include "qemu/bitops.h"
--
2.47.1
- [PULL 12/59] system: Move 'exec/confidential-guest-support.h' to system/, (continued)
- [PULL 12/59] system: Move 'exec/confidential-guest-support.h' to system/, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 13/59] tcg/tci: Include missing 'disas/dis-asm.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 14/59] accel/tcg: Include missing 'exec/tswap.h' header in translator.c, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 15/59] accel/tcg: Have tlb_vaddr_to_host() use vaddr type, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 16/59] exec/cpu-all: Include missing 'exec/cpu-defs.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 19/59] linux-user/aarch64: Include missing 'user/abitypes.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 17/59] exec/cpu-defs: Remove unnecessary headers, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 21/59] target/arm/cpu: Restrict cpu_untagged_addr() to user emulation, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 18/59] exec/translation-block: Include missing 'exec/vaddr.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 22/59] target/arm/mte: Restrict 'exec/ram_addr.h' to system emulation, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 25/59] accel/tcg: Declare mmap_[un]lock() in 'exec/page-protection.h',
Philippe Mathieu-Daudé <=
- [PULL 26/59] accel/tcg: Use tb_page_addr_t type in page_unprotect(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 20/59] user: Introduce 'user/guest-host.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 32/59] accel/tcg: Really restrict cpu_io_recompile() to system emulation, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 34/59] accel/tcg: Move user-related declarations out of 'exec/cpu-all.h' (2/4), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 29/59] accel/tcg: Move 'exec/translate-all.h' -> 'tb-internal.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 30/59] accel/tcg: Un-inline log_pc(), Philippe Mathieu-Daudé, 2024/12/20
- [PULL 38/59] user: Move 'linux-user/cpu_loop-common.h' -> 'user/cpu_loop.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 23/59] exec/ram_addr: Include missing 'exec/hwaddr.h' and 'exec/cpu-common.h', Philippe Mathieu-Daudé, 2024/12/20
- [PULL 24/59] include: Include missing 'qemu/clang-tsa.h' header, Philippe Mathieu-Daudé, 2024/12/20
- [PULL 27/59] accel/tcg: Move page_[un]protect() to 'user/page-protection.h', Philippe Mathieu-Daudé, 2024/12/20