[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 14/20] accel/tcg: Move cpu_memory_rw_debug() user implementat
From: |
Richard Henderson |
Subject: |
Re: [PATCH 14/20] accel/tcg: Move cpu_memory_rw_debug() user implementation to user-exec.c |
Date: |
Sun, 26 Jan 2025 13:13:49 -0800 |
User-agent: |
Mozilla Thunderbird |
On 1/23/25 15:44, Philippe Mathieu-Daudé wrote:
cpu_memory_rw_debug() system implementation is defined in
system/physmem.c. Move the user one to accel/tcg/user-exec.c
to simplify cpu-target.c maintenance.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/user-exec.c | 92 +++++++++++++++++++++++++++++++++++++
cpu-target.c | 102 +-----------------------------------------
2 files changed, 94 insertions(+), 100 deletions(-)
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index c4454100ad7..e7e99a46087 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -19,6 +19,8 @@
#include "qemu/osdep.h"
#include "accel/tcg/cpu-ops.h"
#include "disas/disas.h"
+#include "exec/vaddr.h"
+#include "exec/tswap.h"
#include "exec/exec-all.h"
#include "tcg/tcg.h"
#include "qemu/bitops.h"
@@ -35,6 +37,7 @@
#include "internal-common.h"
#include "internal-target.h"
#include "tb-internal.h"
+#include "qemu.h"
What is required from *-user/qemu.h?
We really should not be including that in accel/tcg/.
+ if (flags & PAGE_WRITE) {
+ /* XXX: this code should not depend on lock_user */
+ p = lock_user(VERIFY_WRITE, addr, l, 0);
Ah, here it is, complete with comment.
Indeed, I don't think lock_user is required at all. page_get_flags() and g2h() are
sufficient.
+ mmap_lock();
+ tb_invalidate_phys_range(addr, addr + l - 1);
+ written = pwrite(fd, buf, l,
+ (off_t)(uintptr_t)g2h_untagged(addr));
+ mmap_unlock();
We probably want to own mmap_lock for the entire function.
r~
- [PATCH 10/20] accel/tcg: Rename 'hw/core/tcg-cpu-ops.h' -> 'accel/tcg/cpu-ops.h', (continued)
- [PATCH 10/20] accel/tcg: Rename 'hw/core/tcg-cpu-ops.h' -> 'accel/tcg/cpu-ops.h', Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 11/20] accel: Rename 'hw/core/accel-cpu.h' -> 'accel/accel-cpu-target.h', Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 12/20] accel/accel-cpu-target.h: Include missing 'cpu.h' header, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 13/20] accel: Forward-declare AccelOpsClass in 'qemu/typedefs.h', Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 14/20] accel/tcg: Move cpu_memory_rw_debug() user implementation to user-exec.c, Philippe Mathieu-Daudé, 2025/01/23
- Re: [PATCH 14/20] accel/tcg: Move cpu_memory_rw_debug() user implementation to user-exec.c,
Richard Henderson <=
- [PATCH 15/20] cpus: Fix style in cpu-target.c, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 16/20] cpus: Restrict cpu_common_post_load() code to TCG, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 17/20] cpus: Have cpu_class_init_props() per user / system emulation, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 18/20] cpus: Have cpu_exec_initfn() per user / system emulation, Philippe Mathieu-Daudé, 2025/01/23
- [PATCH 19/20] cpus: Register VMState per user / system emulation, Philippe Mathieu-Daudé, 2025/01/23