qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: stefanha@redhat.com, "Alex Bennée" <alex.bennee@linaro.org>
Subject: [PULL 23/47] accel/tcg: Move TARGET_PAGE_DATA_SIZE impl to user-exec.c
Date: Wed, 26 Oct 2022 12:10:52 +1000	[thread overview]
Message-ID: <20221026021116.1988449-24-richard.henderson@linaro.org> (raw)
In-Reply-To: <20221026021116.1988449-1-richard.henderson@linaro.org>

Since "target data" is always user-only, move it out of
translate-all.c to user-exec.c.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/translate-all.c | 50 ---------------------------------------
 accel/tcg/user-exec.c     | 50 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index eea24dea96..433fa247f4 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1399,56 +1399,6 @@ void page_set_flags(target_ulong start, target_ulong end, int flags)
     }
 }
 
-void page_reset_target_data(target_ulong start, target_ulong end)
-{
-#ifdef TARGET_PAGE_DATA_SIZE
-    target_ulong addr, len;
-
-    /*
-     * This function should never be called with addresses outside the
-     * guest address space.  If this assert fires, it probably indicates
-     * a missing call to h2g_valid.
-     */
-    assert(end - 1 <= GUEST_ADDR_MAX);
-    assert(start < end);
-    assert_memory_lock();
-
-    start = start & TARGET_PAGE_MASK;
-    end = TARGET_PAGE_ALIGN(end);
-
-    for (addr = start, len = end - start;
-         len != 0;
-         len -= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
-        PageDesc *p = page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
-
-        g_free(p->target_data);
-        p->target_data = NULL;
-    }
-#endif
-}
-
-#ifdef TARGET_PAGE_DATA_SIZE
-void *page_get_target_data(target_ulong address)
-{
-    PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
-    return p ? p->target_data : NULL;
-}
-
-void *page_alloc_target_data(target_ulong address)
-{
-    PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
-    void *ret = NULL;
-
-    if (p->flags & PAGE_VALID) {
-        ret = p->target_data;
-        if (!ret) {
-            p->target_data = ret = g_malloc0(TARGET_PAGE_DATA_SIZE);
-        }
-    }
-    return ret;
-}
-#endif /* TARGET_PAGE_DATA_SIZE */
-
 int page_check_range(target_ulong start, target_ulong len, int flags)
 {
     PageDesc *p;
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 521aa8b61e..927b91900f 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -210,6 +210,56 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, target_ulong addr,
     return addr;
 }
 
+void page_reset_target_data(target_ulong start, target_ulong end)
+{
+#ifdef TARGET_PAGE_DATA_SIZE
+    target_ulong addr, len;
+
+    /*
+     * This function should never be called with addresses outside the
+     * guest address space.  If this assert fires, it probably indicates
+     * a missing call to h2g_valid.
+     */
+    assert(end - 1 <= GUEST_ADDR_MAX);
+    assert(start < end);
+    assert_memory_lock();
+
+    start = start & TARGET_PAGE_MASK;
+    end = TARGET_PAGE_ALIGN(end);
+
+    for (addr = start, len = end - start;
+         len != 0;
+         len -= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
+        PageDesc *p = page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
+
+        g_free(p->target_data);
+        p->target_data = NULL;
+    }
+#endif
+}
+
+#ifdef TARGET_PAGE_DATA_SIZE
+void *page_get_target_data(target_ulong address)
+{
+    PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
+    return p ? p->target_data : NULL;
+}
+
+void *page_alloc_target_data(target_ulong address)
+{
+    PageDesc *p = page_find(address >> TARGET_PAGE_BITS);
+    void *ret = NULL;
+
+    if (p->flags & PAGE_VALID) {
+        ret = p->target_data;
+        if (!ret) {
+            p->target_data = ret = g_malloc0(TARGET_PAGE_DATA_SIZE);
+        }
+    }
+    return ret;
+}
+#endif
+
 /* The softmmu versions of these helpers are in cputlb.c.  */
 
 /*
-- 
2.34.1



  parent reply	other threads:[~2022-10-26  2:18 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  2:10 [PULL 00/47] tcg patch queue Richard Henderson
2022-10-26  2:10 ` [PULL 01/47] Revert "accel/tcg: Init TCG cflags in vCPU thread handler" Richard Henderson
2022-10-26  2:10 ` [PULL 02/47] tcg/loongarch64: Add direct jump support Richard Henderson
2022-10-26  2:10 ` [PULL 03/47] tcg/aarch64: Remove unused code in tcg_out_op Richard Henderson
2022-10-26  2:10 ` [PULL 04/47] accel/tcg: Add a quicker check for breakpoints Richard Henderson
2022-10-26  2:10 ` [PULL 05/47] include/qemu/osdep: Add qemu_build_assert Richard Henderson
2022-10-26  2:10 ` [PULL 06/47] include/qemu/atomic: Use qemu_build_assert Richard Henderson
2022-10-26  2:10 ` [PULL 07/47] include/qemu/thread: Use qatomic_* functions Richard Henderson
2022-10-26  2:10 ` [PULL 08/47] accel/tcg: Make page_alloc_target_data allocation constant Richard Henderson
2022-10-26  2:10 ` [PULL 09/47] accel/tcg: Remove disabled debug in translate-all.c Richard Henderson
2022-10-26  2:10 ` [PULL 10/47] accel/tcg: Split out PageDesc to internal.h Richard Henderson
2022-10-26  2:10 ` [PULL 11/47] accel/tcg: Split out tb-maint.c Richard Henderson
2022-10-26  2:10 ` [PULL 12/47] accel/tcg: Move assert_no_pages_locked to internal.h Richard Henderson
2022-10-26  2:10 ` [PULL 13/47] accel/tcg: Drop cpu_get_tb_cpu_state from TARGET_HAS_PRECISE_SMC Richard Henderson
2022-10-26  2:10 ` [PULL 14/47] accel/tcg: Remove duplicate store to tb->page_addr[] Richard Henderson
2022-10-26  2:10 ` [PULL 15/47] accel/tcg: Introduce tb_{set_}page_addr{0,1} Richard Henderson
2022-10-26  2:10 ` [PULL 16/47] accel/tcg: Rename tb_invalidate_phys_page Richard Henderson
2022-10-26  2:10 ` [PULL 17/47] accel/tcg: Rename tb_invalidate_phys_page_range and drop end parameter Richard Henderson
2022-10-26  2:10 ` [PULL 18/47] accel/tcg: Unify declarations of tb_invalidate_phys_range Richard Henderson
2022-10-26  2:10 ` [PULL 19/47] accel/tcg: Use tb_invalidate_phys_page in page_set_flags Richard Henderson
2022-10-26  2:10 ` [PULL 20/47] accel/tcg: Call tb_invalidate_phys_page for PAGE_RESET Richard Henderson
2022-10-26  2:10 ` [PULL 21/47] accel/tcg: Use page_reset_target_data in page_set_flags Richard Henderson
2022-10-26  2:10 ` [PULL 22/47] accel/tcg: Use tb_invalidate_phys_range " Richard Henderson
2022-10-26  2:10 ` Richard Henderson [this message]
2022-10-26  2:10 ` [PULL 24/47] accel/tcg: Simplify page_get/alloc_target_data Richard Henderson
2022-10-26  2:10 ` [PULL 25/47] accel/tcg: Add restore_state_to_opc to TCGCPUOps Richard Henderson
2022-10-29 10:42   ` Alex Bennée
2022-10-31  0:10     ` Richard Henderson
2022-10-31 17:56   ` Christian Schoenebeck
2022-10-31 20:35     ` Richard Henderson
2022-10-31 20:53       ` Stefan Hajnoczi
2022-10-31 21:27         ` Mark Cave-Ayland
2022-10-31 22:03           ` Richard Henderson
2022-10-26  2:10 ` [PULL 26/47] target/alpha: Convert to tcg_ops restore_state_to_opc Richard Henderson
2022-10-26  2:10 ` [PULL 27/47] target/arm: " Richard Henderson
2022-10-26  2:10 ` [PULL 28/47] target/avr: " Richard Henderson
2022-10-26  2:10 ` [PULL 29/47] target/cris: " Richard Henderson
2022-10-26  2:10 ` [PULL 30/47] target/hexagon: " Richard Henderson
2022-10-26  2:11 ` [PULL 31/47] target/hppa: " Richard Henderson
2022-10-26  2:11 ` [PULL 32/47] target/i386: " Richard Henderson
2022-10-26  2:11 ` [PULL 33/47] target/loongarch: " Richard Henderson
2022-10-26  2:11 ` [PULL 34/47] target/m68k: " Richard Henderson
2022-10-26  2:11 ` [PULL 35/47] target/microblaze: " Richard Henderson
2022-10-26  2:11 ` [PULL 36/47] target/mips: " Richard Henderson
2022-10-26  2:11 ` [PULL 37/47] target/nios2: " Richard Henderson
2022-10-26  2:11 ` [PULL 38/47] target/openrisc: " Richard Henderson
2022-10-26  2:11 ` [PULL 39/47] target/ppc: " Richard Henderson
2022-10-26  2:11 ` [PULL 40/47] target/riscv: " Richard Henderson
2022-10-26  2:11 ` [PULL 41/47] target/rx: " Richard Henderson
2022-10-26  2:11 ` [PULL 42/47] target/s390x: " Richard Henderson
2022-10-26  2:11 ` [PULL 43/47] target/sh4: " Richard Henderson
2022-10-26  2:11 ` [PULL 44/47] target/sparc: " Richard Henderson
2022-10-26  2:11 ` [PULL 45/47] target/tricore: " Richard Henderson
2022-10-26  2:11 ` [PULL 46/47] target/xtensa: " Richard Henderson
2022-10-26  2:11 ` [PULL 47/47] accel/tcg: Remove restore_state_to_opc function Richard Henderson
2022-10-26 18:54 ` [PULL 00/47] tcg patch queue 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=20221026021116.1988449-24-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).