From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org,
"David Hildenbrand" <david@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Anton Johansson" <anjo@rev.ng>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Riku Voipio" <riku.voipio@iki.fi>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Bin Meng" <bin.meng@windriver.com>,
"Weiwei Li" <liwei1518@gmail.com>,
"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Artyom Tarasenko" <atar4qemu@gmail.com>
Subject: [PATCH 07/24] exec: Un-inline tlb_vaddr_to_host() and declare it in 'exec/cputlb.h'
Date: Thu, 18 Apr 2024 21:25:06 +0200 [thread overview]
Message-ID: <20240418192525.97451-8-philmd@linaro.org> (raw)
In-Reply-To: <20240418192525.97451-1-philmd@linaro.org>
Declare tlb_vaddr_to_host() in "exec/cputlb.h" with the CPU TLB
API. Un-inline the user emulation definition to avoid including
"exec/cpu_ldst.h" (which declares g2h) in "exec/cputlb.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/exec/cpu_ldst.h | 24 ------------------------
include/exec/cputlb.h | 18 ++++++++++++++++++
accel/tcg/user-exec.c | 7 +++++++
target/arm/tcg/helper-a64.c | 1 +
target/riscv/vector_helper.c | 1 +
target/sparc/mmu_helper.c | 1 +
6 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index 63186b07e4..7032949dba 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -418,28 +418,4 @@ static inline int cpu_ldsw_code(CPUArchState *env, abi_ptr addr)
return (int16_t)cpu_lduw_code(env, addr);
}
-/**
- * tlb_vaddr_to_host:
- * @env: CPUArchState
- * @addr: guest virtual address to look up
- * @access_type: 0 for read, 1 for write, 2 for execute
- * @mmu_idx: MMU index to use for lookup
- *
- * Look up the specified guest virtual index in the TCG softmmu TLB.
- * If we can translate a host virtual address suitable for direct RAM
- * access, without causing a guest exception, then return it.
- * Otherwise (TLB entry is for an I/O access, guest software
- * TLB fill required, etc) return NULL.
- */
-#ifdef CONFIG_USER_ONLY
-static inline void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
- MMUAccessType access_type, int mmu_idx)
-{
- return g2h(env_cpu(env), addr);
-}
-#else
-void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
- MMUAccessType access_type, int mmu_idx);
-#endif
-
#endif /* CPU_LDST_H */
diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
index ef18642a32..173eb98b9a 100644
--- a/include/exec/cputlb.h
+++ b/include/exec/cputlb.h
@@ -20,10 +20,28 @@
#ifndef CPUTLB_H
#define CPUTLB_H
+#include "exec/abi_ptr.h"
#include "exec/cpu-common.h"
+#include "exec/mmu-access-type.h"
#ifdef CONFIG_TCG
+/**
+ * tlb_vaddr_to_host:
+ * @env: CPUArchState
+ * @addr: guest virtual address to look up
+ * @access_type: 0 for read, 1 for write, 2 for execute
+ * @mmu_idx: MMU index to use for lookup
+ *
+ * Look up the specified guest virtual index in the TCG softmmu TLB.
+ * If we can translate a host virtual address suitable for direct RAM
+ * access, without causing a guest exception, then return it.
+ * Otherwise (TLB entry is for an I/O access, guest software
+ * TLB fill required, etc) return NULL.
+ */
+void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
+ MMUAccessType access_type, int mmu_idx);
+
#if !defined(CONFIG_USER_ONLY)
/* cputlb.c */
void tlb_protect_code(ram_addr_t ram_addr);
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 1c621477ad..54b35588b9 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -23,6 +23,7 @@
#include "tcg/tcg.h"
#include "qemu/bitops.h"
#include "qemu/rcu.h"
+#include "exec/cputlb.h"
#include "exec/cpu_ldst.h"
#include "exec/translate-all.h"
#include "exec/helper-proto.h"
@@ -138,6 +139,12 @@ bool handle_sigsegv_accerr_write(CPUState *cpu, sigset_t *old_set,
}
}
+void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
+ MMUAccessType access_type, int mmu_idx)
+{
+ return g2h(env_cpu(env), addr);
+}
+
typedef struct PageFlagsNode {
struct rcu_head rcu;
IntervalTreeNode itree;
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
index ebaa7f00df..9b3ae06207 100644
--- a/target/arm/tcg/helper-a64.c
+++ b/target/arm/tcg/helper-a64.c
@@ -29,6 +29,7 @@
#include "internals.h"
#include "qemu/crc32c.h"
#include "exec/exec-all.h"
+#include "exec/cputlb.h"
#include "exec/cpu_ldst.h"
#include "qemu/int128.h"
#include "qemu/atomic128.h"
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index fa139040f8..d3d9c33597 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -22,6 +22,7 @@
#include "cpu.h"
#include "exec/memop.h"
#include "exec/exec-all.h"
+#include "exec/cputlb.h"
#include "exec/cpu_ldst.h"
#include "exec/helper-proto.h"
#include "fpu/softfloat.h"
diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c
index ad1591d9fd..e79a33367a 100644
--- a/target/sparc/mmu_helper.c
+++ b/target/sparc/mmu_helper.c
@@ -21,6 +21,7 @@
#include "qemu/log.h"
#include "cpu.h"
#include "exec/exec-all.h"
+#include "exec/cputlb.h"
#include "qemu/qemu-print.h"
#include "trace.h"
--
2.41.0
next prev parent reply other threads:[~2024-04-18 19:28 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 19:24 [PATCH 00/24] include/exec: Rework (part 2) Philippe Mathieu-Daudé
2024-04-18 19:25 ` [PATCH 01/24] exec: Declare MMUAccessType type in 'mmu-access-type.h' header Philippe Mathieu-Daudé
2024-04-21 5:13 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 02/24] exec: Declare CPUBreakpoint/CPUWatchpoint type in 'breakpoint.h' header Philippe Mathieu-Daudé
2024-04-18 19:29 ` Philippe Mathieu-Daudé
2024-04-25 6:29 ` Anton Johansson via
2024-04-21 5:19 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 03/24] hw/core: Avoid including the full 'hw/core/cpu.h' in 'tcg-cpu-ops.h' Philippe Mathieu-Daudé
2024-04-21 5:20 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 04/24] exec: Restrict TCG specific declarations of 'cputlb.h' Philippe Mathieu-Daudé
2024-04-21 5:28 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 05/24] exec: Restrict 'cpu_ldst.h' to TCG accelerator Philippe Mathieu-Daudé
2024-04-21 16:27 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 06/24] exec: Have guest_addr_valid() methods take abi_ptr/size_t arguments Philippe Mathieu-Daudé
2024-04-21 16:29 ` Richard Henderson
2024-04-18 19:25 ` Philippe Mathieu-Daudé [this message]
2024-04-21 16:33 ` [PATCH 07/24] exec: Un-inline tlb_vaddr_to_host() and declare it in 'exec/cputlb.h' Richard Henderson
2024-04-25 6:43 ` Anton Johansson via
2024-04-25 7:52 ` Anton Johansson via
2024-04-18 19:25 ` [PATCH 08/24] physmem: Move TCG CPU IOTLB methods around Philippe Mathieu-Daudé
2024-04-21 16:34 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 09/24] physmem: Restrict TCG CPU IOTLB code to TCG accel Philippe Mathieu-Daudé
2024-04-25 7:30 ` Anton Johansson via
2024-04-18 19:25 ` [PATCH 10/24] exec: Reduce tlb_set_dirty() declaration scope Philippe Mathieu-Daudé
2024-04-21 16:36 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 11/24] exec: Move tlb_reset_dirty*() declarations to 'exec/cputlb.h' Philippe Mathieu-Daudé
2024-04-25 7:25 ` Anton Johansson via
2024-04-18 19:25 ` [PATCH 12/24] exec: Move CPUTLBEntry helpers to cputlb.c Philippe Mathieu-Daudé
2024-04-21 16:39 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 13/24] target/sparc: Replace abi_ulong by uint32_t for TARGET_ABI32 Philippe Mathieu-Daudé
2024-04-21 16:39 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 14/24] exec: Rename 'exec/user/guest-base.h' as 'user/guest-base.h' Philippe Mathieu-Daudé
2024-04-25 7:39 ` Anton Johansson via
2024-04-25 8:30 ` Philippe Mathieu-Daudé
2024-04-18 19:25 ` [PATCH 15/24] exec: Restrict inclusion of 'user/guest-base.h' Philippe Mathieu-Daudé
2024-04-25 7:42 ` Anton Johansson via
2024-04-18 19:25 ` [PATCH 16/24] exec: Move GUEST_ADDR_MAX definition to 'cpu_ldst.h' Philippe Mathieu-Daudé
2024-04-25 7:44 ` Anton Johansson via
2024-04-18 19:25 ` [PATCH 17/24] exec: Include missing 'qemu/log-for-trace.h' header in 'exec/log.h' Philippe Mathieu-Daudé
2024-04-21 16:44 ` Richard Henderson
2024-04-22 9:05 ` Philippe Mathieu-Daudé
2024-04-22 11:44 ` Philippe Mathieu-Daudé
2024-04-18 19:25 ` [PATCH 18/24] plugins: Include missing 'qemu/bitmap.h' header Philippe Mathieu-Daudé
2024-04-21 16:45 ` Richard Henderson
2024-04-26 19:34 ` Pierrick Bouvier
2024-04-18 19:25 ` [PATCH 19/24] gdbstub: Avoid including 'cpu.h' in 'gdbstub/helpers.h' Philippe Mathieu-Daudé
2024-04-21 16:49 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 20/24] hw/xtensa: Include missing 'exec/cpu-common.h' in 'bootparam.h' Philippe Mathieu-Daudé
2024-04-25 7:46 ` Anton Johansson via
2024-04-18 19:25 ` [PATCH 21/24] plugins: Un-inline qemu_plugin_disable_mem_helpers() Philippe Mathieu-Daudé
2024-04-21 16:52 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 22/24] exec: Remove 'exec/tswap.h' from 'exec/cpu-all.h' Philippe Mathieu-Daudé
2024-04-19 4:25 ` Harsh Prateek Bora
2024-04-18 19:25 ` [PATCH 23/24] exec: Remove 'disas/disas.h' from 'exec/log.h' Philippe Mathieu-Daudé
2024-04-21 17:00 ` Richard Henderson
2024-04-18 19:25 ` [PATCH 24/24] exec: Remove unnecessary inclusions of 'hw/core/cpu.h' Philippe Mathieu-Daudé
2024-04-21 17:02 ` Richard Henderson
2024-04-18 19:35 ` [PATCH 00/24] include/exec: Rework (part 2) 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=20240418192525.97451-8-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=anjo@rev.ng \
--cc=atar4qemu@gmail.com \
--cc=bin.meng@windriver.com \
--cc=david@redhat.com \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
--cc=zhiwei_liu@linux.alibaba.com \
/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).