qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Ilya Leoshkevich" <iii@linux.ibm.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PULL 66/68] tcg: Document tb_lookup() and tcg_tb_lookup()
Date: Fri, 17 Jan 2025 10:24:54 -0800	[thread overview]
Message-ID: <20250117182456.2077110-67-richard.henderson@linaro.org> (raw)
In-Reply-To: <20250117182456.2077110-1-richard.henderson@linaro.org>

From: Ilya Leoshkevich <iii@linux.ibm.com>

These similarly named functions serve different purposes; add
docstrings to highlight them.

Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250116213214.5695-1-iii@linux.ibm.com>
---
 include/tcg/tcg.h    | 41 +++++++++++++++++++++++++++++++++++++++++
 accel/tcg/cpu-exec.c | 15 ++++++++++++++-
 2 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index e7ddf979f6..1d1d668f52 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -638,10 +638,51 @@ void tcg_region_reset_all(void);
 size_t tcg_code_size(void);
 size_t tcg_code_capacity(void);
 
+/**
+ * tcg_tb_insert:
+ * @tb: translation block to insert
+ *
+ * Insert @tb into the region trees.
+ */
 void tcg_tb_insert(TranslationBlock *tb);
+
+/**
+ * tcg_tb_remove:
+ * @tb: translation block to remove
+ *
+ * Remove @tb from the region trees.
+ */
 void tcg_tb_remove(TranslationBlock *tb);
+
+/**
+ * tcg_tb_lookup:
+ * @tc_ptr: host PC to look up
+ *
+ * Look up a translation block inside the region trees by @tc_ptr. This is
+ * useful for exception handling, but must not be used for the purposes of
+ * executing the returned translation block. See struct tb_tc for more
+ * information.
+ *
+ * Returns: a translation block previously inserted into the region trees,
+ * such that @tc_ptr points anywhere inside the code generated for it, or
+ * NULL.
+ */
 TranslationBlock *tcg_tb_lookup(uintptr_t tc_ptr);
+
+/**
+ * tcg_tb_foreach:
+ * @func: callback
+ * @user_data: opaque value to pass to @callback
+ *
+ * Call @func for each translation block inserted into the region trees.
+ */
 void tcg_tb_foreach(GTraverseFunc func, gpointer user_data);
+
+/**
+ * tcg_nb_tbs:
+ *
+ * Returns: the number of translation blocks inserted into the region trees.
+ */
 size_t tcg_nb_tbs(void);
 
 /* user-mode: Called with mmap_lock held.  */
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index d48b82a932..8b773d8847 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -249,7 +249,20 @@ static TranslationBlock *tb_htable_lookup(CPUState *cpu, vaddr pc,
     return qht_lookup_custom(&tb_ctx.htable, &desc, h, tb_lookup_cmp);
 }
 
-/* Might cause an exception, so have a longjmp destination ready */
+/**
+ * tb_lookup:
+ * @cpu: CPU that will execute the returned translation block
+ * @pc: guest PC
+ * @cs_base: arch-specific value associated with translation block
+ * @flags: arch-specific translation block flags
+ * @cflags: CF_* flags
+ *
+ * Look up a translation block inside the QHT using @pc, @cs_base, @flags and
+ * @cflags. Uses @cpu's tb_jmp_cache. Might cause an exception, so have a
+ * longjmp destination ready.
+ *
+ * Returns: an existing translation block or NULL.
+ */
 static inline TranslationBlock *tb_lookup(CPUState *cpu, vaddr pc,
                                           uint64_t cs_base, uint32_t flags,
                                           uint32_t cflags)
-- 
2.43.0



  parent reply	other threads:[~2025-01-17 18:31 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 18:23 [PULL 00/68] tcg patch queue Richard Henderson
2025-01-17 18:23 ` [PULL 01/68] disas/riscv: Guard dec->cfg dereference for host disassemble Richard Henderson
2025-01-17 18:23 ` [PULL 02/68] tcg: Move call abi parameters from tcg-target.h to tcg-target.c.inc Richard Henderson
2025-01-17 18:23 ` [PULL 03/68] tcg: Replace TCGOP_VECL with TCGOP_TYPE Richard Henderson
2025-01-17 18:23 ` [PULL 04/68] tcg: Move tcg_op_insert_{after, before} decls to tcg-internal.h Richard Henderson
2025-01-17 18:23 ` [PULL 05/68] tcg: Copy TCGOP_TYPE in tcg_op_insert_{after,before} Richard Henderson
2025-01-17 18:23 ` [PULL 06/68] tcg: Add TCGOP_FLAGS Richard Henderson
2025-01-17 18:23 ` [PULL 07/68] tcg: Add type and flags arguments to tcg_op_supported Richard Henderson
2025-01-17 18:23 ` [PULL 08/68] target/arm: Do not test TCG_TARGET_HAS_bitsel_vec Richard Henderson
2025-01-17 18:23 ` [PULL 09/68] target/arm: Use tcg_op_supported Richard Henderson
2025-01-17 18:23 ` [PULL 10/68] target/tricore: " Richard Henderson
2025-01-17 18:23 ` [PULL 11/68] tcg: Add tcg_op_deposit_valid Richard Henderson
2025-01-17 18:24 ` [PULL 12/68] target/i386: Remove TCG_TARGET_extract_tl_valid Richard Henderson
2025-01-17 18:24 ` [PULL 13/68] target/i386: Use tcg_op_deposit_valid Richard Henderson
2025-01-17 18:24 ` [PULL 14/68] target/i386: Use tcg_op_supported Richard Henderson
2025-01-17 18:24 ` [PULL 15/68] tcg: Remove TCG_TARGET_NEED_LDST_LABELS and TCG_TARGET_NEED_POOL_LABELS Richard Henderson
2025-01-17 18:24 ` [PULL 16/68] tcg: Rename tcg-target.opc.h to tcg-target-opc.h.inc Richard Henderson
2025-01-17 18:24 ` [PULL 17/68] tcg/tci: Move TCI specific opcodes " Richard Henderson
2025-01-17 18:24 ` [PULL 18/68] tcg: Move fallback tcg_can_emit_vec_op out of line Richard Henderson
2025-01-17 18:24 ` [PULL 19/68] tcg/ppc: Remove TCGPowerISA enum Richard Henderson
2025-01-17 18:24 ` [PULL 20/68] tcg: Extract default TCG_TARGET_HAS_foo definitions to 'tcg-has.h' Richard Henderson
2025-01-17 18:24 ` [PULL 21/68] tcg/aarch64: Extract TCG_TARGET_HAS_foo defs to 'tcg-target-has.h' Richard Henderson
2025-01-17 18:24 ` [PULL 22/68] tcg/arm: " Richard Henderson
2025-01-17 18:24 ` [PULL 23/68] tcg/i386: " Richard Henderson
2025-01-17 18:24 ` [PULL 24/68] tcg/loongarch64: " Richard Henderson
2025-01-17 18:24 ` [PULL 25/68] tcg/mips: " Richard Henderson
2025-01-17 18:24 ` [PULL 26/68] tcg/ppc: " Richard Henderson
2025-01-17 18:24 ` [PULL 27/68] tcg/riscv: " Richard Henderson
2025-01-17 18:24 ` [PULL 28/68] tcg/s390x: " Richard Henderson
2025-01-17 18:24 ` [PULL 29/68] tcg/sparc64: " Richard Henderson
2025-01-17 18:24 ` [PULL 30/68] tcg/tci: " Richard Henderson
2025-01-17 18:24 ` [PULL 31/68] tcg: Include 'tcg-target-has.h' once in 'tcg-has.h' Richard Henderson
2025-01-17 18:24 ` [PULL 32/68] tcg: Only include 'tcg-has.h' when necessary Richard Henderson
2025-01-17 18:24 ` [PULL 33/68] tcg: Split out tcg-target-mo.h Richard Henderson
2025-01-17 18:24 ` [PULL 34/68] tcg: Use C_NotImplemented in tcg_target_op_def Richard Henderson
2025-01-17 18:24 ` [PULL 35/68] tcg: Change have_vec to has_type in tcg_op_supported Richard Henderson
2025-01-17 18:24 ` [PULL 36/68] tcg: Reorg process_op_defs Richard Henderson
2025-01-17 18:24 ` [PULL 37/68] tcg: Remove args_ct from TCGOpDef Richard Henderson
2025-01-17 18:24 ` [PULL 38/68] tcg: Constify tcg_op_defs Richard Henderson
2025-01-17 18:24 ` [PULL 39/68] tcg: Validate op supported in opcode_args_ct Richard Henderson
2025-01-17 18:24 ` [PULL 40/68] tcg: Add TCG_OPF_NOT_PRESENT to opcodes without inputs or outputs Richard Henderson
2025-01-17 18:24 ` [PULL 41/68] tcg: Pass type and flags to tcg_target_op_def Richard Henderson
2025-01-17 18:24 ` [PULL 42/68] tcg: Add TCGType argument to tcg_out_op Richard Henderson
2025-01-17 18:24 ` [PULL 43/68] tcg: Remove TCG_OPF_64BIT Richard Henderson
2025-01-17 18:24 ` [PULL 44/68] tcg: Drop implementation checks from tcg-opc.h Richard Henderson
2025-01-17 18:24 ` [PULL 45/68] tcg: Replace IMPLVEC with TCG_OPF_VECTOR Richard Henderson
2025-01-17 18:24 ` [PULL 46/68] tcg/mips: Expand bswap unconditionally Richard Henderson
2025-01-17 18:24 ` [PULL 47/68] tcg/i386: Handle all 8-bit extensions for i686 Richard Henderson
2025-01-17 18:24 ` [PULL 48/68] tcg/i386: Fold the ext{8, 16, 32}[us] cases into {s}extract Richard Henderson
2025-01-17 18:24 ` [PULL 49/68] tcg/aarch64: Provide TCG_TARGET_{s}extract_valid Richard Henderson
2025-01-17 18:24 ` [PULL 50/68] tcg/aarch64: Expand extract with offset 0 with andi Richard Henderson
2025-01-17 18:24 ` [PULL 51/68] tcg/arm: Add full [US]XT[BH] into {s}extract Richard Henderson
2025-01-17 18:24 ` [PULL 52/68] tcg/loongarch64: Fold the ext{8, 16, 32}[us] cases " Richard Henderson
2025-01-17 18:24 ` [PULL 53/68] tcg/mips: " Richard Henderson
2025-01-17 18:24 ` [PULL 54/68] tcg/ppc: " Richard Henderson
2025-01-17 18:24 ` [PULL 55/68] tcg/riscv64: " Richard Henderson
2025-01-17 18:24 ` [PULL 56/68] tcg/riscv: Use SRAIW, SRLIW for {s}extract_i64 Richard Henderson
2025-01-17 18:24 ` [PULL 57/68] tcg/s390x: Fold the ext{8, 16, 32}[us] cases into {s}extract Richard Henderson
2025-01-17 18:24 ` [PULL 58/68] tcg/sparc64: Use SRA, SRL for {s}extract_i64 Richard Henderson
2025-01-17 18:24 ` [PULL 59/68] tcg/tci: Provide TCG_TARGET_{s}extract_valid Richard Henderson
2025-01-17 18:24 ` [PULL 60/68] tcg/tci: Remove assertions for deposit and extract Richard Henderson
2025-01-17 18:24 ` [PULL 61/68] tcg: Remove TCG_TARGET_HAS_{s}extract_{i32,i64} Richard Henderson
2025-01-17 18:24 ` [PULL 62/68] tcg: Remove TCG_TARGET_HAS_deposit_{i32,i64} Richard Henderson
2025-01-17 18:24 ` [PULL 63/68] util/cpuinfo-riscv: Detect Zbs Richard Henderson
2025-01-17 18:24 ` [PULL 64/68] tcg/riscv: Use BEXTI for single-bit extractions Richard Henderson
2025-01-17 18:24 ` [PULL 65/68] linux-user: Add missing /proc/cpuinfo fields for sparc Richard Henderson
2025-01-17 18:24 ` Richard Henderson [this message]
2025-01-17 18:24 ` [PULL 67/68] accel/tcg: Call tcg_tb_insert() for one-insn TBs Richard Henderson
2025-01-17 18:24 ` [PULL 68/68] softfloat: Constify helpers returning float_status field Richard Henderson
2025-01-18 23:49 ` [PULL 00/68] tcg patch queue Stefan Hajnoczi
2025-01-19 18:08   ` Richard Henderson
2025-01-22 12:43 ` Stefan Hajnoczi

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=20250117182456.2077110-67-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=iii@linux.ibm.com \
    --cc=qemu-devel@nongnu.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).