exec: Split some user-mode specific declarations from 'exec/exec-all.h'
Subsystems (2)
cover exec: Split some user-mode specific declarations from 'exec/exec-all.h'
- Add missing headers
- Merge exec/user/ to user/
- Extract MMUAccessType from QOM "hw/core/cpu.h" to "exec/cpu-tlb.h"
- Extract user-specific declarations to "user/cpu-{common,target}.h"
- Share preexit_cleanup() from Linux with BSD
More to come, but flushing for early feedback.
Based-on: <[email protected]>
Philippe Mathieu-Daudé (9):
accel/tcg: Add missing 'tcg/tcg.h' header
coverity-scan: Cover common-user/
include: Move exec/user/ to user/
linux-user/exit: Add missing 'qemu/plugin.h' header linux-user/cpu_loop: Add missing 'exec/cpu-all.h' header
exec: Define MMUAccessType in 'exec/cpu-tlb.h' header
user: Declare target-specific prototypes in 'user/cpu-target.h'
user: Declare target-agnostic prototypes in 'user/cpu-common.h'
user: Share preexit_cleanup() with linux and bsd implementations
accel/tcg/tcg-accel-ops-icount.c | 1 +
accel/tcg/tcg-accel-ops-mttcg.c | 1 +
accel/tcg/tcg-accel-ops-rr.c | 1 +
accel/tcg/tcg-accel-ops.c | 1 +
accel/tcg/user-exec.c | 1 +
bsd-user/elfload.c | 1 +
bsd-user/main.c | 1 +
bsd-user/qemu.h | 6 ++--
bsd-user/signal.c | 1 +
{linux-user => common-user}/exit.c | 4 +--
common-user/meson.build | 1 +
include/exec/cpu-all.h | 5 ++-
include/exec/cpu-defs.h | 1 +
include/exec/cpu-tlb.h | 16 +++++++++
include/exec/cpu_ldst.h | 1 +
include/exec/exec-all.h | 54 ++--------------------------
include/hw/core/cpu.h | 6 ----
include/hw/core/tcg-cpu-ops.h | 1 +
include/{exec => }/user/abitypes.h | 0
include/user/cpu-common.h | 36 +++++++++++++++++++
include/user/cpu-target.h | 56 +++++++++++++++++++++++++++++
include/user/safe-syscall.h | 6 ++--
include/{exec => }/user/thunk.h | 2 +-
linux-user/aarch64/cpu_loop.c | 1 +
linux-user/alpha/cpu_loop.c | 1 +
linux-user/arm/cpu_loop.c | 1 +
linux-user/arm/signal.c | 1 +
linux-user/cpu_loop-common.h | 1 +
linux-user/cris/cpu_loop.c | 1 +
linux-user/elfload.c | 1 +
linux-user/hexagon/cpu_loop.c | 1 +
linux-user/hppa/cpu_loop.c | 1 +
linux-user/hppa/signal.c | 1 +
linux-user/i386/cpu_loop.c | 1 +
linux-user/linuxload.c | 1 +
linux-user/m68k/cpu_loop.c | 1 +
linux-user/main.c | 1 +
linux-user/meson.build | 1 -
linux-user/microblaze/cpu_loop.c | 1 +
linux-user/mips/cpu_loop.c | 1 +
linux-user/mmap.c | 1 +
linux-user/nios2/cpu_loop.c | 1 +
linux-user/openrisc/cpu_loop.c | 1 +
linux-user/ppc/cpu_loop.c | 1 +
linux-user/ppc/signal.c | 1 +
linux-user/qemu.h | 2 +-
linux-user/riscv/cpu_loop.c | 1 +
linux-user/s390x/cpu_loop.c | 1 +
linux-user/sh4/cpu_loop.c | 1 +
linux-user/signal.c | 1 +
linux-user/sparc/cpu_loop.c | 1 +
linux-user/syscall.c | 1 +
linux-user/thunk.c | 2 +-
linux-user/uaccess.c | 1 +
linux-user/user-internals.h | 12 +------
linux-user/xtensa/cpu_loop.c | 1 +
scripts/coverity-scan/COMPONENTS.md | 2 +-
target/arm/internals.h | 1 +
target/mips/internal.h | 1 +
target/ppc/internal.h | 2 ++
target/ppc/mmu-hash32.h | 2 ++
target/ppc/mmu-hash64.h | 2 ++
target/ppc/mmu-radix64.h | 2 ++
target/s390x/s390x-internal.h | 2 ++
64 files changed, 178 insertions(+), 85 deletions(-)
rename {linux-user => common-user}/exit.c (95%)
create mode 100644 include/exec/cpu-tlb.h
rename include/{exec => }/user/abitypes.h (100%)
create mode 100644 include/user/cpu-common.h
create mode 100644 include/user/cpu-target.h
rename include/{exec => }/user/thunk.h (99%)Signature · 1 line
2.34.1
PATCH 1/9 accel/tcg: Add missing 'tcg/tcg.h' header
--- accel/tcg/tcg-accel-ops-icount.c | 1 + accel/tcg/tcg-accel-ops-mttcg.c | 1 + accel/tcg/tcg-accel-ops-rr.c | 1 + accel/tcg/tcg-accel-ops.c | 1 + 4 files changed, 4 insertions(+)
accel/tcg/tcg-accel-ops-icount.c +1 -0
@@ -31,6 +31,7 @@#include "qemu/main-loop.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-icount.h"
accel/tcg/tcg-accel-ops-mttcg.c +1 -0
@@ -33,6 +33,7 @@#include "qemu/guest-random.h" #include "exec/exec-all.h" #include "hw/boards.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h"
accel/tcg/tcg-accel-ops-rr.c +1 -0
@@ -32,6 +32,7 @@#include "qemu/notify.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-rr.h"
accel/tcg/tcg-accel-ops.c +1 -0
@@ -33,6 +33,7 @@#include "qemu/main-loop.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h"
Signature · 1 line
2.34.1
Re: [PATCH 1/9] accel/tcg: Add missing 'tcg/tcg.h' header
Quoted 7 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/tcg/tcg-accel-ops-icount.c | 1 + accel/tcg/tcg-accel-ops-mttcg.c | 1 + accel/tcg/tcg-accel-ops-rr.c | 1 + accel/tcg/tcg-accel-ops.c | 1 + 4 files changed, 4 insertions(+)
What exactly are these files using from tcg.h?
I briefly scanned tcg-accel-ops-icount.c and didn't see anything.
r~
Quoted 49 lines
accel/tcg/tcg-accel-ops-icount.c +1
-0@@ -31,6 +31,7 @@#include "qemu/main-loop.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-icount.h" accel/tcg/tcg-accel-ops-mttcg.c +1
-0@@ -33,6 +33,7 @@#include "qemu/guest-random.h" #include "exec/exec-all.h" #include "hw/boards.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h" accel/tcg/tcg-accel-ops-rr.c +1
-0@@ -32,6 +32,7 @@#include "qemu/notify.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-rr.h" accel/tcg/tcg-accel-ops.c +1
-0@@ -33,6 +33,7 @@#include "qemu/main-loop.h" #include "qemu/guest-random.h" #include "exec/exec-all.h" +#include "tcg/tcg.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h"
Re: [PATCH 1/9] accel/tcg: Add missing 'tcg/tcg.h' header
Quoted 11 lines · Richard Henderson
Quoted 7 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
accel/tcg/tcg-accel-ops-icount.c| 1 +
accel/tcg/tcg-accel-ops-mttcg.c | 1 +
accel/tcg/tcg-accel-ops-rr.c | 1 +
accel/tcg/tcg-accel-ops.c | 1 +4 files changed, 4 insertions(+)What exactly are these files using from
tcg.h?
I briefly scannedtcg-accel-ops-icount.cand didn't see anything.
extern __thread TCGContext *tcg_ctx;
I'll mention it in the description.
PATCH 2/9 coverity-scan: Cover common-user/
In reply to Philippe Mathieu-Daudé viacommon-user/ has been added in commit bbf15aaf7c ("common-user: Move safe-syscall.* from linux-user").
--- scripts/coverity-scan/COMPONENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coverity-scan/COMPONENTS.md +1 -1
@@ -127,7 +127,7 @@ usb ~ (/qemu)?(/hw/usb/.*|/include/hw/usb/.*) user - ~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) + ~ (/qemu)?(/common-user/.*|/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) util ~ (/qemu)?(/util/.*|/include/qemu/.*)
Signature · 1 line
2.34.1
Re: [PATCH 2/9] coverity-scan: Cover common-user/
Quoted 7 lines · Philippe Mathieu-Daudé
common-user/ has been added in commit
bbf15aaf7c("common-user: Move safe-syscall.* from linux-user").Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- scripts/coverity-scan/COMPONENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
Re: [PATCH 2/9] coverity-scan: Cover common-user/
In reply to Philippe Mathieu-Daudé viaQuoted 14 lines · Philippe Mathieu-Daudé via
common-user/ has been added in commit
bbf15aaf7c("common-user: Move safe-syscall.* from linux-user").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/coverity-scan/COMPONENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/coverity-scan/COMPONENTS.md +0
-0
scripts/coverity-scan/COMPONENTS.md usb · line 133
Quoted 8 lines
scripts/coverity-scan/COMPONENTS.md +1
-1@@ -127,7 +127,7 @@ usb ~ (/qemu)?(/hw/usb/.*|/include/hw/usb/.*) user - ~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) + ~ (/qemu)?(/common-user/.*|/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) util ~ (/qemu)?(/util/.*|/include/qemu/.*)
Note that there is no automatic process by which changes to this file get applied to the coverity scan config, so hiding changes to it inside a larger patchset increases the chance they get overlooked (by Paolo, who gets to do the manual config update)...
-- PMM
Re: [PATCH 2/9] coverity-scan: Cover common-user/
Quoted 22 lines · Peter Maydell
Quoted 20 lines · Philippe Mathieu-Daudé via
common-user/ has been added in commit
bbf15aaf7c("common-user: Move safe-syscall.* from linux-user").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/coverity-scan/COMPONENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/coverity-scan/COMPONENTS.md +1
-1@@ -127,7 +127,7 @@ usb ~ (/qemu)?(/hw/usb/.*|/include/hw/usb/.*) user - ~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) + ~ (/qemu)?(/common-user/.*|/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*)
Quoted 7 lines
scripts/coverity-scan/COMPONENTS.md usb · line 133
Quoted 2 lines
scripts/coverity-scan/COMPONENTS.md +0
-0util ~ (/qemu)?(/util/.*|/include/qemu/.*)Note that there is no automatic process by which changes to this file get applied to the coverity scan config, so hiding changes to it inside a larger patchset increases the chance they get overlooked (by Paolo, who gets to do the manual config update)...
Oh OK, I thought this was consumed by a script.
Re: [PATCH 2/9] coverity-scan: Cover common-user/
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 22 lines · Peter Maydell
Quoted 20 lines · Philippe Mathieu-Daudé via
common-user/ has been added in commit
bbf15aaf7c("common-user: Move safe-syscall.* from linux-user").Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- scripts/coverity-scan/COMPONENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/coverity-scan/COMPONENTS.md +1
-1@@ -127,7 +127,7 @@ usb ~ (/qemu)?(/hw/usb/.*|/include/hw/usb/.*) user - ~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) + ~ (/qemu)?(/common-user/.*|/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*)Quoted 7 lines
scripts/coverity-scan/COMPONENTS.md usb · line 133
Quoted 2 lines
scripts/coverity-scan/COMPONENTS.md +0
-0util ~ (/qemu)?(/util/.*|/include/qemu/.*)Note that there is no automatic process by which changes to this file get applied to the coverity scan config, so hiding changes to it inside a larger patchset increases the chance they get overlooked (by Paolo, who gets to do the manual config update)...
Quoted 1 line
Oh OK, I thought this was consumed by a script.
Unfortunately Coverity don't provide an API for configuring components, so it all has to be done via their webpage GUI :-(
-- PMM
PATCH 3/9 include: Move exec/user/ to user/
In reply to Philippe Mathieu-Daudé viaAvoid spreading the headers in multiple directories, unify exec/user/ and user/.
---
bsd-user/qemu.h | 4 ++--
include/exec/cpu-all.h | 2 +-
include/{exec => }/user/abitypes.h | 0
include/user/safe-syscall.h | 6 +++---
include/{exec => }/user/thunk.h | 2 +-
linux-user/qemu.h | 2 +-
linux-user/thunk.c | 2 +-
linux-user/user-internals.h | 2 +-
scripts/coverity-scan/COMPONENTS.md | 2 +-
9 files changed, 11 insertions(+), 11 deletions(-)
rename include/{exec => }/user/abitypes.h (100%)
rename include/{exec => }/user/thunk.h (99%)bsd-user/qemu.h +2 -2
@@ -25,7 +25,7 @@#undef DEBUG_REMAP -#include "exec/user/abitypes.h" +#include "user/abitypes.h" extern char **environ;
@@ -36,7 +36,7 @@ enum BSDType { };extern enum BSDType bsd_type; -#include "exec/user/thunk.h" +#include "user/thunk.h" #include "target_arch.h" #include "syscall_defs.h" #include "target_syscall.h"
include/exec/cpu-all.h +1 -1
@@ -145,7 +145,7 @@ static inline void tswap64s(uint64_t *s)/* MMU memory access macros */ #if defined(CONFIG_USER_ONLY ) -#include "exec/user/abitypes.h" +#include "user/abitypes.h" /* On some host systems the guest address space is reserved on the host. * This allows the guest address space to be offset to a convenient location.
include/user/abitypes.h renamed from include/exec/user/abitypes.h +0 -0
include/user/safe-syscall.h +3 -3
@@ -1,5 +1,5 @@/* -* safe-syscall.h: prototypes for linux-user signal-race-safe syscalls +* safe-syscall.h: prototypes for user signal-race-safe syscalls * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -15,8 +15,8 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef LINUX_USER_SAFE_SYSCALL_H -#define LINUX_USER_SAFE_SYSCALL_H +#ifndef USER_SAFE_SYSCALL_H +#define USER_SAFE_SYSCALL_H /** * safe_syscall:
include/user/thunk.h renamed from include/exec/user/thunk.h +1 -1
@@ -21,7 +21,7 @@#define THUNK_H #include "cpu.h" -#include "exec/user/abitypes.h" +#include "user/abitypes.h" /* types enums definitions */
linux-user/qemu.h +1 -1
@@ -6,7 +6,7 @@#undef DEBUG_REMAP -#include "exec/user/abitypes.h" +#include "user/abitypes.h" #include "syscall_defs.h" #include "target_syscall.h"
linux-user/thunk.c +1 -1
@@ -20,7 +20,7 @@#include "qemu/log.h" #include "qemu.h" -#include "exec/user/thunk.h" +#include "user/thunk.h" //#define DEBUG
linux-user/user-internals.h +1 -1
@@ -18,7 +18,7 @@#ifndef LINUX_USER_USER_INTERNALS_H #define LINUX_USER_USER_INTERNALS_H -#include "exec/user/thunk.h" +#include "user/thunk.h" #include "exec/exec-all.h" #include "qemu/log.h"
scripts/coverity-scan/COMPONENTS.md +1 -1
@@ -127,7 +127,7 @@ usb ~ (/qemu)?(/hw/usb/.*|/include/hw/usb/.*) user - ~ (/qemu)?(/common-user/.*|/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) + ~ (/qemu)?(/common-user/.*|/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/user/.*) util ~ (/qemu)?(/util/.*|/include/qemu/.*)
Signature · 1 line
2.34.1
Re: [PATCH 3/9] include: Move exec/user/ to user/
Quoted 15 lines · Philippe Mathieu-Daudé
Avoid spreading the headers in multiple directories, unify exec/user/ and user/.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- bsd-user/qemu.h | 4 ++-- include/exec/cpu-all.h | 2 +- include/{exec => }/user/abitypes.h | 0 include/user/safe-syscall.h | 6 +++--- include/{exec => }/user/thunk.h | 2 +- linux-user/qemu.h | 2 +- linux-user/thunk.c | 2 +- linux-user/user-internals.h | 2 +- scripts/coverity-scan/COMPONENTS.md | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-)
Quoted 2 lines
rename
include/{exec=>}/user/abitypes.h(100%) renameinclude/{exec=>}/user/thunk.h(99%)
Something I noticed in passing: abitypes.h doesn't need all of cpu.h, only cpu-param.h.
r~
PATCH 4/9 linux-user/exit: Add missing 'qemu/plugin.h' header
In reply to Philippe Mathieu-Daudé viaqemu_plugin_user_exit() is declared in "qemu/plugin.h".
--- linux-user/exit.c | 1 + 1 file changed, 1 insertion(+)
linux-user/exit.c +1 -0
@@ -17,6 +17,7 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu/plugin.h" #include "exec/gdbstub.h" #include "qemu.h" #include "user-internals.h"
Signature · 1 line
2.34.1
Re: [PATCH 4/9] linux-user/exit: Add missing 'qemu/plugin.h' header
Quoted 6 lines · Philippe Mathieu-Daudé
qemu_plugin_user_exit()is declared in "qemu/plugin.h".Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- linux-user/exit.c | 1 + 1 file changed, 1 insertion(+)
r~
PATCH 5/9 linux-user/cpu_loop: Add missing 'exec/cpu-all.h' header
In reply to Philippe Mathieu-Daudé viaenv_cpu() is declared in "exec/cpu-all.h".
--- linux-user/cpu_loop-common.h | 1 + 1 file changed, 1 insertion(+)
linux-user/cpu_loop-common.h +1 -0
@@ -20,6 +20,7 @@#ifndef CPU_LOOP_COMMON_H #define CPU_LOOP_COMMON_H +#include "exec/cpu-all.h" #include "exec/log.h" #include "special-errno.h"
Signature · 1 line
2.34.1
Re: [PATCH 5/9] linux-user/cpu_loop: Add missing 'exec/cpu-all.h' header
Quoted 6 lines · Philippe Mathieu-Daudé
env_cpu()is declared in "exec/cpu-all.h".Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- linux-user/cpu_loop-common.h | 1 + 1 file changed, 1 insertion(+)
r~
PATCH 6/9 exec: Define MMUAccessType in 'exec/cpu-tlb.h' header
In reply to Philippe Mathieu-Daudé viaTo reduce the inclusion of "hw/core/cpu.h", extract MMUAccessType to its own "exec/cpu-tlb.h" header.
--- include/exec/cpu-defs.h | 1 + include/exec/cpu-tlb.h | 16 ++++++++++++++++ include/exec/cpu_ldst.h | 1 + include/exec/exec-all.h | 3 +++ include/hw/core/cpu.h | 6 ------ include/hw/core/tcg-cpu-ops.h | 1 + target/arm/internals.h | 1 + target/mips/internal.h | 1 + target/ppc/internal.h | 2 ++ target/ppc/mmu-hash32.h | 2 ++ target/ppc/mmu-hash64.h | 2 ++ target/ppc/mmu-radix64.h | 2 ++ target/s390x/s390x-internal.h | 2 ++ 13 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 include/exec/cpu-tlb.h
include/exec/cpu-defs.h +1 -0
@@ -29,6 +29,7 @@#include "exec/hwaddr.h" #endif #include "exec/memattrs.h" +#include "exec/cpu-tlb.h" #include "hw/core/cpu.h" #include "cpu-param.h"
include/exec/cpu-tlb.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* cpu-tlb.h: MMUAccessType definitions +* +*/ + +#ifndef EXEC_CPU_TLB_H +#define EXEC_CPU_TLB_H + +typedef enum MMUAccessType { +MMU_DATA_LOAD =0 , +MMU_DATA_STORE =1 , +MMU_INST_FETCH =2 +}MMUAccessType ; + +#endif
include/exec/cpu_ldst.h +1 -0
@@ -63,6 +63,7 @@#define CPU_LDST_H #include "exec/memopidx.h" +#include "exec/cpu-tlb.h" #include "qemu/int128.h" #include "cpu.h"
include/exec/exec-all.h +3 -0
@@ -381,6 +381,9 @@ static inline void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *cpu, { }#endif + +#include "exec/cpu-tlb.h" +/** * probe_access: * @env: CPUArchState
include/hw/core/cpu.h +0 -6
@@ -55,12 +55,6 @@ typedef struct CPUClass CPUClass;DECLARE_CLASS_CHECKERS (CPUClass,CPU , TYPE_CPU) -typedef enum MMUAccessType { -MMU_DATA_LOAD =0 , -MMU_DATA_STORE =1 , -MMU_INST_FETCH =2 -}MMUAccessType ; -typedef struct CPUWatchpoint CPUWatchpoint ;/* see tcg-cpu-ops.h */
include/hw/core/tcg-cpu-ops.h +1 -0
@@ -10,6 +10,7 @@#ifndef TCG_CPU_OPS_H #define TCG_CPU_OPS_H +#include "exec/cpu-tlb.h" #include "hw/core/cpu.h" struct TCGCPUOps {
target/arm/internals.h +1 -0
@@ -25,6 +25,7 @@#ifndef TARGET_ARM_INTERNALS_H #define TARGET_ARM_INTERNALS_H +#include "exec/cpu-tlb.h" #include "hw/registerfields.h" #include "tcg/tcg-gvec-desc.h" #include "syndrome.h"
target/mips/internal.h +1 -0
@@ -8,6 +8,7 @@#ifndef MIPS_INTERNAL_H #define MIPS_INTERNAL_H +#include "exec/cpu-tlb.h" #include "exec/memattrs.h" #ifdef CONFIG_TCG #include "tcg/tcg-internal.h"
target/ppc/internal.h +2 -0
@@ -18,6 +18,8 @@#ifndef PPC_INTERNAL_H #define PPC_INTERNAL_H +#include "exec/cpu-tlb.h" +#define FUNC_MASK (name, ret_type, size, max_val) \ static inline ret_type name(uint##size##_t start, \ uint##size##_t end) \
target/ppc/mmu-hash32.h +2 -0
@@ -3,6 +3,8 @@#ifndef CONFIG_USER_ONLY +#include "exec/cpu-tlb.h" +hwaddr get_pteg_offset32 (PowerPCCPU *cpu,hwaddr hash); bool ppc_hash32_xlate(PowerPCCPU *cpu, vaddr eaddr, MMUAccessType access_type, hwaddr *raddrp, int *psizep, int *protp, int mmu_idx,
target/ppc/mmu-hash64.h +2 -0
@@ -3,6 +3,8 @@#ifndef CONFIG_USER_ONLY +#include "exec/cpu-tlb.h" +#ifdef TARGET_PPC64 void dump_slb (PowerPCCPU *cpu); int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot,
target/ppc/mmu-radix64.h +2 -0
@@ -3,6 +3,8 @@#ifndef CONFIG_USER_ONLY +#include "exec/cpu-tlb.h" +/* Radix Quadrants */ #define R_EADDR_MASK 0x3FFFFFFFFFFFFFFF#define R_EADDR_VALID_MASK 0xC00FFFFFFFFFFFFF
target/s390x/s390x-internal.h +2 -0
@@ -10,6 +10,8 @@#ifndef S390X_INTERNAL_H #define S390X_INTERNAL_H +#include "exec/cpu-tlb.h" +#include "cpu.h" #ifndef CONFIG_USER_ONLY
Signature · 1 line
2.34.1
Re: [PATCH 6/9] exec: Define MMUAccessType in 'exec/cpu-tlb.h' header
Quoted 5 lines · Philippe Mathieu-Daudé
To reduce the inclusion of "
hw/core/cpu.h", extract MMUAccessType to its own "exec/cpu-tlb.h" header.Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
Not keen on the name, unless you plan to put something else in there.
r~
Re: [PATCH 6/9] exec: Define MMUAccessType in 'exec/cpu-tlb.h' header
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé
To reduce the inclusion of "
hw/core/cpu.h", extract MMUAccessType to its own "exec/cpu-tlb.h" header.Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
Not keen on the name, unless you plan to put something else in there.
Not yet.
What about "exec/mmu-types.h", kinda similar to "exec/memattrs.h"?
PATCH 7/9 user: Declare target-specific prototypes in 'user/cpu-target.h'
In reply to Philippe Mathieu-Daudé viaMove user-mode specific prototypes from "exec/exec-all.h" to "user/cpu-target.h".
--- accel/tcg/user-exec.c | 1 + bsd-user/elfload.c | 1 + bsd-user/main.c | 1 + bsd-user/signal.c | 1 + include/exec/exec-all.h | 41 ------------------------ include/user/cpu-target.h | 55 ++++++++++++++++++++++++++++++++ linux-user/aarch64/cpu_loop.c | 1 + linux-user/alpha/cpu_loop.c | 1 + linux-user/arm/cpu_loop.c | 1 + linux-user/arm/signal.c | 1 + linux-user/cris/cpu_loop.c | 1 + linux-user/elfload.c | 1 + linux-user/hexagon/cpu_loop.c | 1 + linux-user/hppa/cpu_loop.c | 1 + linux-user/hppa/signal.c | 1 + linux-user/i386/cpu_loop.c | 1 + linux-user/linuxload.c | 1 + linux-user/m68k/cpu_loop.c | 1 + linux-user/main.c | 1 + linux-user/microblaze/cpu_loop.c | 1 + linux-user/mips/cpu_loop.c | 1 + linux-user/mmap.c | 1 + linux-user/nios2/cpu_loop.c | 1 + linux-user/openrisc/cpu_loop.c | 1 + linux-user/ppc/cpu_loop.c | 1 + linux-user/ppc/signal.c | 1 + linux-user/riscv/cpu_loop.c | 1 + linux-user/s390x/cpu_loop.c | 1 + linux-user/sh4/cpu_loop.c | 1 + linux-user/signal.c | 1 + linux-user/sparc/cpu_loop.c | 1 + linux-user/syscall.c | 1 + linux-user/uaccess.c | 1 + linux-user/xtensa/cpu_loop.c | 1 + 34 files changed, 87 insertions(+), 41 deletions(-) create mode 100644 include/user/cpu-target.h
accel/tcg/user-exec.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/atomic128.h" #include "trace/trace-root.h" #include "tcg/tcg-ldst.h" +#include "user/cpu-target.h" #include "internal.h" __threaduintptr_t helper_retaddr;
bsd-user/elfload.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "disas/disas.h" #include "qemu/path.h"
bsd-user/main.c +1 -0
@@ -47,6 +47,7 @@#include "trace/control.h" #include "crypto/init.h" #include "qemu/guest-random.h" +#include "user/cpu-target.h" #include "host-os.h" #include "target_arch_cpu.h"
bsd-user/signal.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "qemu.h" +#include "user/cpu-target.h" #include "signal-common.h" #include "trace.h" #include "hw/core/tcg-cpu-ops.h"
include/exec/exec-all.h +0 -41
47 lines not on this page · raw message
include/user/cpu-target.h new file +55 -0
55 lines not on this page · raw message
linux-user/aarch64/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/alpha/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/arm/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "elf.h" #include "cpu_loop-common.h"
linux-user/arm/signal.c +1 -0
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "signal-common.h" #include "linux-user/trace.h"
linux-user/cris/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/elfload.c +1 -0
@@ -6,6 +6,7 @@#include <sys/shm.h> #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "signal-common.h" #include "loader.h"
linux-user/hexagon/cpu_loop.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/hppa/cpu_loop.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/hppa/signal.c +1 -0
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "signal-common.h" #include "linux-user/trace.h"
linux-user/i386/cpu_loop.c +1 -0
@@ -21,6 +21,7 @@#include "qemu-common.h" #include "qemu.h" #include "qemu/timer.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/linuxload.c +1 -0
@@ -2,6 +2,7 @@#include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "loader.h"
linux-user/m68k/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/main.c +1 -0
@@ -30,6 +30,7 @@#include "qapi/error.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "qemu/path.h" #include "qemu/queue.h"
linux-user/microblaze/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/mips/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/mmap.c +1 -0
@@ -20,6 +20,7 @@#include "trace.h" #include "exec/log.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "user-mmap.h"
linux-user/nios2/cpu_loop.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/openrisc/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/ppc/cpu_loop.c +1 -0
@@ -21,6 +21,7 @@#include "qemu-common.h" #include "qemu.h" #include "qemu/timer.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/ppc/signal.c +1 -0
@@ -18,6 +18,7 @@*/ #include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "signal-common.h" #include "linux-user/trace.h"
linux-user/riscv/cpu_loop.c +1 -0
@@ -21,6 +21,7 @@#include "qemu-common.h" #include "qemu/error-report.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/s390x/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/sh4/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/signal.c +1 -0
@@ -25,6 +25,7 @@#include <sys/resource.h> #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "strace.h" #include "loader.h"
linux-user/sparc/cpu_loop.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
linux-user/syscall.c +1 -0
@@ -127,6 +127,7 @@#include "uname.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "strace.h" #include "signal-common.h"
linux-user/uaccess.c +1 -0
@@ -1,6 +1,7 @@/* User memory access */ #include "qemu/osdep.h" #include "qemu/cutils.h" +#include "user/cpu-target.h" #include "qemu.h" #include "user-internals.h"
linux-user/xtensa/cpu_loop.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "qemu.h" +#include "user/cpu-target.h" #include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h"
Signature · 1 line
2.34.1
Re: [PATCH 7/9] user: Declare target-specific prototypes in 'user/cpu-target.h'
Quoted 5 lines · Philippe Mathieu-Daudé
Move user-mode specific prototypes from "
exec/exec-all.h" to "user/cpu-target.h".Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
Why a new cpu-target.h, and what is it supposed to mean? What else is going in there? It all looks cpu_loop related so far.
Why is this separate from the next patch, with "cpu-common.h", which also appears to be basically cpu_loop related?
r~
Re: [PATCH 7/9] user: Declare target-specific prototypes in 'user/cpu-target.h'
+Thomas
Quoted 8 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé
Move user-mode specific prototypes from "
exec/exec-all.h" to "user/cpu-target.h".Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
Why a new
cpu-target.h, and what is it supposed to mean? What else is going in there? It all lookscpu_looprelated so far.
I'd like to put all declarations using target_ulong in foo-target.h and the ones which don't in foo-common.h (cpu, user, exec).
That way I can move implementations from target-specific to target agnostic meson source set, and better isolate the target-specific APIs.
Quoted 1 line
Why is this separate from the next patch, with "
cpu-common.h", which also appears to be basicallycpu_looprelated?
I can squash both. The commit description could be "Move APIs using target_ulong to cpu-target.h, keep the rest in cpu-common.h".
PATCH 8/9 user: Declare target-agnostic prototypes in 'user/cpu-common.h'
In reply to Philippe Mathieu-Daudé viaMove user-mode common prototypes from "exec/exec-all.h" to "user/cpu-common.h".
--- bsd-user/qemu.h | 2 -- include/exec/cpu-all.h | 3 +-- include/exec/exec-all.h | 10 ---------- include/user/cpu-common.h | 36 ++++++++++++++++++++++++++++++++++++ include/user/cpu-target.h | 1 + linux-user/exit.c | 3 +-- linux-user/user-internals.h | 10 ---------- 7 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 include/user/cpu-common.h
bsd-user/qemu.h +0 -2
@@ -182,8 +182,6 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6); void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2); -extern __threadCPUState *thread_cpu; -void cpu_loop (CPUArchState *env);char *target_strerror (int err);int get_osversion (void );void fork_start (void );
include/exec/cpu-all.h +1 -2
@@ -296,9 +296,8 @@ void *page_alloc_target_data(target_ulong address, size_t size);* at @address, as per page_alloc_target_data. */ void *page_get_target_data (target_ulong address); -#endif -CPUArchState *cpu_copy (CPUArchState *env); +#endif /* CONFIG_USER_ONLY */ /* Flags for use in ENV->INTERRUPT_PENDING.
include/exec/exec-all.h +0 -10
@@ -639,16 +639,6 @@ static inline tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env, return addr; } -/** -* adjust_signal_pc: -* @pc: raw pc from the host signal ucontext_t. -* @is_write: host memory operation was write, or read-modify-write. -* -* Alter @pc as required for unwinding. Return the type of the -* guest memory access -- host reads may be for guest execution. -*/ -MMUAccessType adjust_signal_pc (uintptr_t *pc,bool is_write); -#else static inline void mmap_lock (void ) {}static inline void mmap_unlock (void ) {}
include/user/cpu-common.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* cpu-target.h: user-mode target-agnostic execution prototypes +* +*/ + +#ifndef USER_CPU_COMMON_H +#define USER_CPU_COMMON_H + +#include "exec/cpu-tlb.h" + +extern __threadCPUState *thread_cpu; + +/** +* adjust_signal_pc: +* @pc: raw pc from the host signal ucontext_t. +* @is_write: host memory operation was write, or read-modify-write. +* +* Alter @pc as required for unwinding. Return the type of the +* guest memory access -- host reads may be for guest execution. +*/ +MMUAccessType adjust_signal_pc (uintptr_t *pc,bool is_write); + +void QEMU_NORETURN cpu_loop(CPUArchState *env); + +CPUArchState *cpu_copy (CPUArchState *env); + +/** +* preexit_cleanup: housekeeping before the guest exits +* +* env: the CPU state +* code: the exit code +*/ +void preexit_cleanup (CPUArchState *env,int code); + +#endif
include/user/cpu-target.h +1 -0
@@ -9,6 +9,7 @@#include "exec/cpu-tlb.h" #include "exec/cpu_ldst.h" /* abi_ptr */ +#include "user/cpu-common.h" /** * handle_sigsegv_accerr_write:
linux-user/exit.c +1 -2
@@ -19,8 +19,7 @@#include "qemu/osdep.h" #include "qemu/plugin.h" #include "exec/gdbstub.h" -#include "qemu.h" -#include "user-internals.h" +#include "user/cpu-common.h" #ifdef CONFIG_GPROF #include <sys/gmon.h> #endif
linux-user/user-internals.h +0 -10
@@ -63,8 +63,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6, abi_long arg7, abi_long arg8); -extern __threadCPUState *thread_cpu; -void QEMU_NORETURN cpu_loop(CPUArchState *env);const char *target_strerror (int err);int get_osversion (void );void init_qemu_uname_release (void );
@@ -166,14 +164,6 @@ static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }static inline int regpairs_aligned (void *cpu_env,int num) {return 0 ; }#endif -/** -* preexit_cleanup: housekeeping before the guest exits -* -* env: the CPU state -* code: the exit code -*/ -void preexit_cleanup (CPUArchState *env,int code); -/* * Include target-specific struct and function definitions; * they may need access to the target-independent structures
Signature · 1 line
2.34.1
PATCH 9/9 user: Share preexit_cleanup() with linux and bsd implementations
In reply to Philippe Mathieu-Daudé viapreexit_cleanup() is not Linux specific, move it to common-user/.
---
{linux-user => common-user}/exit.c | 0
common-user/meson.build | 1 +
linux-user/meson.build | 1 -
3 files changed, 1 insertion(+), 1 deletion(-)
rename {linux-user => common-user}/exit.c (100%)common-user/exit.c renamed from linux-user/exit.c +0 -0
common-user/meson.build +1 -0
@@ -1,6 +1,7 @@ common_user_inc += include_directories('host/' / host_arch) user_ss.add(files( + 'exit.c', 'safe-syscall.S', 'safe-syscall-error.c', ))
linux-user/meson.build +0 -1
@@ -9,7 +9,6 @@ common_user_inc += include_directories('include') linux_user_ss.add(files( 'elfload.c', - 'exit.c', 'fd-trans.c', 'linuxload.c', 'main.c',
Signature · 1 line
2.34.1
Re: [PATCH 9/9] user: Share preexit_cleanup() with linux and bsd implementations
Quoted 9 lines · Philippe Mathieu-Daudé
preexit_cleanup()is not Linux specific, move it to common-user/.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- {linux-user => common-user}/exit.c | 0 common-user/meson.build | 1 + linux-user/meson.build | 1 - 3 files changed, 1 insertion(+), 1 deletion(-)rename {linux-user =>
common-user}/exit.c(100%)
Of course, the next step is to use the function (cc Warner).
r~
Quoted 29 lines
common-user/exit.c renamed from linux-user/exit.c +0
-0common-user/meson.build +1
-0@@ -1,6 +1,7 @@ common_user_inc += include_directories('host/' / host_arch) user_ss.add(files( + 'exit.c', 'safe-syscall.S', 'safe-syscall-error.c', ))linux-user/meson.build +0
-1@@ -9,7 +9,6 @@ common_user_inc += include_directories('include') linux_user_ss.add(files( 'elfload.c', - 'exit.c', 'fd-trans.c', 'linuxload.c', 'main.c',