* [PATCH 0/3] semihosting: Restrict to TCG @ 2024-05-29 15:55 Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 1/3] target/mips: Restrict semihosting " Philippe Mathieu-Daudé ` (4 more replies) 0 siblings, 5 replies; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-05-29 15:55 UTC (permalink / raw) To: qemu-devel Cc: Paolo Bonzini, Alex Bennée, Philippe =?unknown-8bit?q?Mathieu-Daud=C3=A9?= It is pointless to build semihosting when TCG is not available. Philippe Mathieu-Daudé (3): target/mips: Restrict semihosting to TCG target/riscv: Restrict semihosting to TCG semihosting: Restrict to TCG semihosting/Kconfig | 1 + target/mips/Kconfig | 2 +- target/riscv/Kconfig | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) -- 2.41.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/3] target/mips: Restrict semihosting to TCG 2024-05-29 15:55 [PATCH 0/3] semihosting: Restrict to TCG Philippe Mathieu-Daudé @ 2024-05-29 15:55 ` Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 2/3] target/riscv: " Philippe Mathieu-Daudé ` (3 subsequent siblings) 4 siblings, 0 replies; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-05-29 15:55 UTC (permalink / raw) To: qemu-devel; +Cc: Paolo Bonzini, Alex Bennée, Philippe Mathieu-Daudé It is pointless to build semihosting when TCG is not available. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- target/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/mips/Kconfig b/target/mips/Kconfig index eb19c94c7d..4918fa42e9 100644 --- a/target/mips/Kconfig +++ b/target/mips/Kconfig @@ -1,6 +1,6 @@ config MIPS bool - select SEMIHOSTING + select SEMIHOSTING if TCG config MIPS64 bool -- 2.41.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/3] target/riscv: Restrict semihosting to TCG 2024-05-29 15:55 [PATCH 0/3] semihosting: Restrict to TCG Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 1/3] target/mips: Restrict semihosting " Philippe Mathieu-Daudé @ 2024-05-29 15:55 ` Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 3/3] semihosting: Restrict " Philippe Mathieu-Daudé ` (2 subsequent siblings) 4 siblings, 0 replies; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-05-29 15:55 UTC (permalink / raw) To: qemu-devel; +Cc: Paolo Bonzini, Alex Bennée, Philippe Mathieu-Daudé It is pointless to build semihosting when TCG is not available. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- target/riscv/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/riscv/Kconfig b/target/riscv/Kconfig index 5f30df22f2..5c360a70a9 100644 --- a/target/riscv/Kconfig +++ b/target/riscv/Kconfig @@ -1,9 +1,9 @@ config RISCV32 bool - select ARM_COMPATIBLE_SEMIHOSTING # for do_common_semihosting() + select ARM_COMPATIBLE_SEMIHOSTING if TCG # for do_common_semihosting() select DEVICE_TREE # needed by boot.c config RISCV64 bool - select ARM_COMPATIBLE_SEMIHOSTING # for do_common_semihosting() + select ARM_COMPATIBLE_SEMIHOSTING if TCG # for do_common_semihosting() select DEVICE_TREE # needed by boot.c -- 2.41.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 3/3] semihosting: Restrict to TCG 2024-05-29 15:55 [PATCH 0/3] semihosting: Restrict to TCG Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 1/3] target/mips: Restrict semihosting " Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 2/3] target/riscv: " Philippe Mathieu-Daudé @ 2024-05-29 15:55 ` Philippe Mathieu-Daudé 2024-05-30 6:02 ` Paolo Bonzini 2024-05-29 17:40 ` [PATCH 0/3] " Richard Henderson 2024-05-29 19:11 ` Alex Bennée 4 siblings, 1 reply; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-05-29 15:55 UTC (permalink / raw) To: qemu-devel; +Cc: Paolo Bonzini, Alex Bennée, Philippe Mathieu-Daudé It is pointless to build semihosting when TCG is not available. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- semihosting/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/semihosting/Kconfig b/semihosting/Kconfig index eaf3a20ef5..fbe6ac87f9 100644 --- a/semihosting/Kconfig +++ b/semihosting/Kconfig @@ -1,6 +1,7 @@ config SEMIHOSTING bool + depends on TCG config ARM_COMPATIBLE_SEMIHOSTING bool -- 2.41.0 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-05-29 15:55 ` [PATCH 3/3] semihosting: Restrict " Philippe Mathieu-Daudé @ 2024-05-30 6:02 ` Paolo Bonzini 2024-05-30 7:22 ` Philippe Mathieu-Daudé 2024-05-30 7:27 ` Alex Bennée 0 siblings, 2 replies; 19+ messages in thread From: Paolo Bonzini @ 2024-05-30 6:02 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Alex Bennée On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > It is pointless to build semihosting when TCG is not available. Why? I would have naively assumed that a suitable semihosting API could be implemented by KVM. The justification (and thus the commit message) needs to be different for each architecture if it's a matter of instruction set or insufficient KVM userspace API. Paolo > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > semihosting/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/semihosting/Kconfig b/semihosting/Kconfig > index eaf3a20ef5..fbe6ac87f9 100644 > --- a/semihosting/Kconfig > +++ b/semihosting/Kconfig > @@ -1,6 +1,7 @@ > > config SEMIHOSTING > bool > + depends on TCG > > config ARM_COMPATIBLE_SEMIHOSTING > bool > -- > 2.41.0 > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-05-30 6:02 ` Paolo Bonzini @ 2024-05-30 7:22 ` Philippe Mathieu-Daudé 2024-05-30 7:31 ` Paolo Bonzini 2024-05-30 7:27 ` Alex Bennée 1 sibling, 1 reply; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-05-30 7:22 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel, Alex Bennée, Anton Johansson On 30/5/24 08:02, Paolo Bonzini wrote: > On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé > <philmd@linaro.org> wrote: >> It is pointless to build semihosting when TCG is not available. > > Why? I would have naively assumed that a suitable semihosting API > could be implemented by KVM. The justification (and thus the commit > message) needs to be different for each architecture if it's a matter > of instruction set or insufficient KVM userspace API. I wasn't sure where semihosting could be used so asked on IRC and Alex told me TCG only. Maybe the current implementation is TCG only, and I can reword. It certainly need some refactor to work on KVM, because currently semihosting end calling the TCG probe_access API, which I'm trying to restrict to TCG in order to ease linking multiple libtcg for the single binary (see https://lore.kernel.org/qemu-devel/20240529155918.6221-1-philmd@linaro.org/). > Paolo > >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> semihosting/Kconfig | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/semihosting/Kconfig b/semihosting/Kconfig >> index eaf3a20ef5..fbe6ac87f9 100644 >> --- a/semihosting/Kconfig >> +++ b/semihosting/Kconfig >> @@ -1,6 +1,7 @@ >> >> config SEMIHOSTING >> bool >> + depends on TCG >> >> config ARM_COMPATIBLE_SEMIHOSTING >> bool >> -- >> 2.41.0 >> > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-05-30 7:22 ` Philippe Mathieu-Daudé @ 2024-05-30 7:31 ` Paolo Bonzini 2024-05-30 13:58 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 19+ messages in thread From: Paolo Bonzini @ 2024-05-30 7:31 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Alex Bennée, Anton Johansson On Thu, May 30, 2024 at 9:22 AM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > > On 30/5/24 08:02, Paolo Bonzini wrote: > > On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé > > <philmd@linaro.org> wrote: > >> It is pointless to build semihosting when TCG is not available. > > > > Why? I would have naively assumed that a suitable semihosting API > > could be implemented by KVM. The justification (and thus the commit > > message) needs to be different for each architecture if it's a matter > > of instruction set or insufficient KVM userspace API. > > I wasn't sure where semihosting could be used so asked on IRC and > Alex told me TCG only. Maybe the current implementation is TCG > only, and I can reword. It certainly need some refactor to work > on KVM, because currently semihosting end calling the TCG probe_access > API, which I'm trying to restrict to TCG in order to ease linking > multiple libtcg for the single binary (see > https://lore.kernel.org/qemu-devel/20240529155918.6221-1-philmd@linaro.org/). Ok, that goes in the commit message though. "Semihosting currently uses the TCG probe_access API. It is pointless to have it in the binary when TCG isn't". and in the first two patches: "Semihosting currently uses the TCG probe_access API. To prepare for encoding the TCG dependency in Kconfig, do not enable it unless TCG is available". But then, "select FOO if TCG" mean that it can be compiled out; so perhaps "imply SEMIHOSTING if TCG" is better? Same for RISC-V's "select ARM_COMPATIBLE_SEMIHOSTING if TCG". Paolo > > Paolo > > > >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > >> --- > >> semihosting/Kconfig | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff --git a/semihosting/Kconfig b/semihosting/Kconfig > >> index eaf3a20ef5..fbe6ac87f9 100644 > >> --- a/semihosting/Kconfig > >> +++ b/semihosting/Kconfig > >> @@ -1,6 +1,7 @@ > >> > >> config SEMIHOSTING > >> bool > >> + depends on TCG > >> > >> config ARM_COMPATIBLE_SEMIHOSTING > >> bool > >> -- > >> 2.41.0 > >> > > > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-05-30 7:31 ` Paolo Bonzini @ 2024-05-30 13:58 ` Philippe Mathieu-Daudé 2024-06-12 13:12 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-05-30 13:58 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel, Alex Bennée, Anton Johansson On 30/5/24 09:31, Paolo Bonzini wrote: > On Thu, May 30, 2024 at 9:22 AM Philippe Mathieu-Daudé > <philmd@linaro.org> wrote: >> >> On 30/5/24 08:02, Paolo Bonzini wrote: >>> On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé >>> <philmd@linaro.org> wrote: >>>> It is pointless to build semihosting when TCG is not available. >>> >>> Why? I would have naively assumed that a suitable semihosting API >>> could be implemented by KVM. The justification (and thus the commit >>> message) needs to be different for each architecture if it's a matter >>> of instruction set or insufficient KVM userspace API. >> >> I wasn't sure where semihosting could be used so asked on IRC and >> Alex told me TCG only. Maybe the current implementation is TCG >> only, and I can reword. It certainly need some refactor to work >> on KVM, because currently semihosting end calling the TCG probe_access >> API, which I'm trying to restrict to TCG in order to ease linking >> multiple libtcg for the single binary (see >> https://lore.kernel.org/qemu-devel/20240529155918.6221-1-philmd@linaro.org/). > > Ok, that goes in the commit message though. > > "Semihosting currently uses the TCG probe_access API. It is pointless > to have it in the binary when TCG isn't". > > and in the first two patches: > > "Semihosting currently uses the TCG probe_access API. To prepare for > encoding the TCG dependency in Kconfig, do not enable it unless TCG is > available". > > But then, "select FOO if TCG" mean that it can be compiled out; so > perhaps "imply SEMIHOSTING if TCG" is better? Same for RISC-V's > "select ARM_COMPATIBLE_SEMIHOSTING if TCG". You are right. Thanks for reminding me Kconfig "imply" :) Regards, Phil. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-05-30 13:58 ` Philippe Mathieu-Daudé @ 2024-06-12 13:12 ` Philippe Mathieu-Daudé 2024-06-18 11:33 ` Philippe Mathieu-Daudé 2024-06-19 7:49 ` Paolo Bonzini 0 siblings, 2 replies; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-06-12 13:12 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel, Alex Bennée, Anton Johansson Hi Paolo, On 30/5/24 15:58, Philippe Mathieu-Daudé wrote: > On 30/5/24 09:31, Paolo Bonzini wrote: >> On Thu, May 30, 2024 at 9:22 AM Philippe Mathieu-Daudé >> <philmd@linaro.org> wrote: >>> >>> On 30/5/24 08:02, Paolo Bonzini wrote: >>>> On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé >>>> <philmd@linaro.org> wrote: >>>>> It is pointless to build semihosting when TCG is not available. >>>> >>>> Why? I would have naively assumed that a suitable semihosting API >>>> could be implemented by KVM. The justification (and thus the commit >>>> message) needs to be different for each architecture if it's a matter >>>> of instruction set or insufficient KVM userspace API. >>> >>> I wasn't sure where semihosting could be used so asked on IRC and >>> Alex told me TCG only. Maybe the current implementation is TCG >>> only, and I can reword. It certainly need some refactor to work >>> on KVM, because currently semihosting end calling the TCG probe_access >>> API, which I'm trying to restrict to TCG in order to ease linking >>> multiple libtcg for the single binary (see >>> https://lore.kernel.org/qemu-devel/20240529155918.6221-1-philmd@linaro.org/). >> >> Ok, that goes in the commit message though. >> >> "Semihosting currently uses the TCG probe_access API. It is pointless >> to have it in the binary when TCG isn't". >> >> and in the first two patches: >> >> "Semihosting currently uses the TCG probe_access API. To prepare for >> encoding the TCG dependency in Kconfig, do not enable it unless TCG is >> available". >> >> But then, "select FOO if TCG" mean that it can be compiled out; so >> perhaps "imply SEMIHOSTING if TCG" is better? Same for RISC-V's >> "select ARM_COMPATIBLE_SEMIHOSTING if TCG". Building qemu-system-mips configured with --without-default-devices: Undefined symbols for architecture arm64: "_qemu_semihosting_console_write", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o "_semihost_sys_close", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o "_uaccess_strlen_user", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o ... So this one has to use "select". Similarly m68k: Undefined symbols for architecture arm64: "_semihost_sys_close", referenced from: _do_m68k_semihosting in target_m68k_m68k-semi.c.o ... I can link m68k using semihosting stubs but I'm not sure it is right: -- >8 -- diff --git a/semihosting/stubs-target-all.c b/semihosting/stubs-target-all.c new file mode 100644 index 0000000000..1f33173f43 --- /dev/null +++ b/semihosting/stubs-target-all.c @@ -0,0 +1,97 @@ +/* + * Semihosting Stubs + * + * Copyright (c) 2024 Linaro Ltd + * + * Stubs for semihosting targets that don't actually do semihosting. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "exec/exec-all.h" +#include "semihosting/syscalls.h" + +void semihost_sys_open(CPUState *cs, gdb_syscall_complete_cb complete, + target_ulong fname, target_ulong fname_len, + int gdb_flags, int mode) +{ +} + +void semihost_sys_close(CPUState *cs, gdb_syscall_complete_cb complete, int fd) +{ +} + +void semihost_sys_read_gf(CPUState *cs, gdb_syscall_complete_cb complete, + GuestFD *gf, target_ulong buf, target_ulong len) +{ +} + +void semihost_sys_read(CPUState *cs, gdb_syscall_complete_cb complete, + int fd, target_ulong buf, target_ulong len) +{ +} + +void semihost_sys_write_gf(CPUState *cs, gdb_syscall_complete_cb complete, + GuestFD *gf, target_ulong buf, target_ulong len) +{ +} + +void semihost_sys_write(CPUState *cs, gdb_syscall_complete_cb complete, + int fd, target_ulong buf, target_ulong len) +{ +} + +void semihost_sys_lseek(CPUState *cs, gdb_syscall_complete_cb complete, + int fd, int64_t off, int gdb_whence) +{ +} + +void semihost_sys_isatty(CPUState *cs, gdb_syscall_complete_cb complete, int fd) +{ +} + +void semihost_sys_flen(CPUState *cs, gdb_syscall_complete_cb fstat_cb, + gdb_syscall_complete_cb flen_cb, int fd, + target_ulong fstat_addr) +{ +} + +void semihost_sys_fstat(CPUState *cs, gdb_syscall_complete_cb complete, + int fd, target_ulong addr) +{ +} + +void semihost_sys_stat(CPUState *cs, gdb_syscall_complete_cb complete, + target_ulong fname, target_ulong fname_len, + target_ulong addr) +{ +} + +void semihost_sys_remove(CPUState *cs, gdb_syscall_complete_cb complete, + target_ulong fname, target_ulong fname_len) +{ +} + +void semihost_sys_rename(CPUState *cs, gdb_syscall_complete_cb complete, + target_ulong oname, target_ulong oname_len, + target_ulong nname, target_ulong nname_len) +{ +} + +void semihost_sys_system(CPUState *cs, gdb_syscall_complete_cb complete, + target_ulong cmd, target_ulong cmd_len) +{ +} + +void semihost_sys_gettimeofday(CPUState *cs, gdb_syscall_complete_cb complete, + target_ulong tv_addr, target_ulong tz_addr) +{ +} + +#ifndef CONFIG_USER_ONLY +void semihost_sys_poll_one(CPUState *cs, gdb_syscall_complete_cb complete, + int fd, GIOCondition cond, int timeout) +{ +} +#endif diff --git a/semihosting/meson.build b/semihosting/meson.build index 34933e5a19..aa8b7a9913 100644 --- a/semihosting/meson.build +++ b/semihosting/meson.build @@ -7,7 +7,7 @@ specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_true: fil 'config.c', 'console.c', 'uaccess.c', -)) +), if_false: files('stubs-target-all.c')) common_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_false: files('stubs-all.c')) system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_false: files('stubs-system.c')) --- For mips more stubs are needed: Undefined symbols for architecture arm64: "_qemu_semihosting_console_write", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o "_uaccess_lock_user", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o "_uaccess_lock_user_string", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o "_uaccess_strlen_user", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o "_uaccess_unlock_user", referenced from: _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o ... ^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-06-12 13:12 ` Philippe Mathieu-Daudé @ 2024-06-18 11:33 ` Philippe Mathieu-Daudé 2024-06-18 13:56 ` Alex Bennée 2024-06-19 7:49 ` Paolo Bonzini 1 sibling, 1 reply; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-06-18 11:33 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel, Alex Bennée, Anton Johansson ping :) On 12/6/24 15:12, Philippe Mathieu-Daudé wrote: > Hi Paolo, > > On 30/5/24 15:58, Philippe Mathieu-Daudé wrote: >> On 30/5/24 09:31, Paolo Bonzini wrote: >>> On Thu, May 30, 2024 at 9:22 AM Philippe Mathieu-Daudé >>> <philmd@linaro.org> wrote: >>>> >>>> On 30/5/24 08:02, Paolo Bonzini wrote: >>>>> On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé >>>>> <philmd@linaro.org> wrote: >>>>>> It is pointless to build semihosting when TCG is not available. >>>>> >>>>> Why? I would have naively assumed that a suitable semihosting API >>>>> could be implemented by KVM. The justification (and thus the commit >>>>> message) needs to be different for each architecture if it's a matter >>>>> of instruction set or insufficient KVM userspace API. >>>> >>>> I wasn't sure where semihosting could be used so asked on IRC and >>>> Alex told me TCG only. Maybe the current implementation is TCG >>>> only, and I can reword. It certainly need some refactor to work >>>> on KVM, because currently semihosting end calling the TCG probe_access >>>> API, which I'm trying to restrict to TCG in order to ease linking >>>> multiple libtcg for the single binary (see >>>> https://lore.kernel.org/qemu-devel/20240529155918.6221-1-philmd@linaro.org/). >>> >>> Ok, that goes in the commit message though. >>> >>> "Semihosting currently uses the TCG probe_access API. It is pointless >>> to have it in the binary when TCG isn't". >>> >>> and in the first two patches: >>> >>> "Semihosting currently uses the TCG probe_access API. To prepare for >>> encoding the TCG dependency in Kconfig, do not enable it unless TCG is >>> available". >>> >>> But then, "select FOO if TCG" mean that it can be compiled out; so >>> perhaps "imply SEMIHOSTING if TCG" is better? Same for RISC-V's >>> "select ARM_COMPATIBLE_SEMIHOSTING if TCG". > > Building qemu-system-mips configured with --without-default-devices: > > Undefined symbols for architecture arm64: > "_qemu_semihosting_console_write", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > "_semihost_sys_close", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > "_uaccess_strlen_user", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > ... > > So this one has to use "select". > > Similarly m68k: > > Undefined symbols for architecture arm64: > "_semihost_sys_close", referenced from: > _do_m68k_semihosting in target_m68k_m68k-semi.c.o > ... > > I can link m68k using semihosting stubs but I'm not sure it is right: > > -- >8 -- > diff --git a/semihosting/stubs-target-all.c > b/semihosting/stubs-target-all.c > new file mode 100644 > index 0000000000..1f33173f43 > --- /dev/null > +++ b/semihosting/stubs-target-all.c > @@ -0,0 +1,97 @@ > +/* > + * Semihosting Stubs > + * > + * Copyright (c) 2024 Linaro Ltd > + * > + * Stubs for semihosting targets that don't actually do semihosting. > + * > + * SPDX-License-Identifier: GPL-2.0-or-later > + */ > + > +#include "qemu/osdep.h" > +#include "exec/exec-all.h" > +#include "semihosting/syscalls.h" > + > +void semihost_sys_open(CPUState *cs, gdb_syscall_complete_cb complete, > + target_ulong fname, target_ulong fname_len, > + int gdb_flags, int mode) > +{ > +} > + > +void semihost_sys_close(CPUState *cs, gdb_syscall_complete_cb complete, > int fd) > +{ > +} > + > +void semihost_sys_read_gf(CPUState *cs, gdb_syscall_complete_cb complete, > + GuestFD *gf, target_ulong buf, target_ulong len) > +{ > +} > + > +void semihost_sys_read(CPUState *cs, gdb_syscall_complete_cb complete, > + int fd, target_ulong buf, target_ulong len) > +{ > +} > + > +void semihost_sys_write_gf(CPUState *cs, gdb_syscall_complete_cb complete, > + GuestFD *gf, target_ulong buf, target_ulong > len) > +{ > +} > + > +void semihost_sys_write(CPUState *cs, gdb_syscall_complete_cb complete, > + int fd, target_ulong buf, target_ulong len) > +{ > +} > + > +void semihost_sys_lseek(CPUState *cs, gdb_syscall_complete_cb complete, > + int fd, int64_t off, int gdb_whence) > +{ > +} > + > +void semihost_sys_isatty(CPUState *cs, gdb_syscall_complete_cb > complete, int fd) > +{ > +} > + > +void semihost_sys_flen(CPUState *cs, gdb_syscall_complete_cb fstat_cb, > + gdb_syscall_complete_cb flen_cb, int fd, > + target_ulong fstat_addr) > +{ > +} > + > +void semihost_sys_fstat(CPUState *cs, gdb_syscall_complete_cb complete, > + int fd, target_ulong addr) > +{ > +} > + > +void semihost_sys_stat(CPUState *cs, gdb_syscall_complete_cb complete, > + target_ulong fname, target_ulong fname_len, > + target_ulong addr) > +{ > +} > + > +void semihost_sys_remove(CPUState *cs, gdb_syscall_complete_cb complete, > + target_ulong fname, target_ulong fname_len) > +{ > +} > + > +void semihost_sys_rename(CPUState *cs, gdb_syscall_complete_cb complete, > + target_ulong oname, target_ulong oname_len, > + target_ulong nname, target_ulong nname_len) > +{ > +} > + > +void semihost_sys_system(CPUState *cs, gdb_syscall_complete_cb complete, > + target_ulong cmd, target_ulong cmd_len) > +{ > +} > + > +void semihost_sys_gettimeofday(CPUState *cs, gdb_syscall_complete_cb > complete, > + target_ulong tv_addr, target_ulong tz_addr) > +{ > +} > + > +#ifndef CONFIG_USER_ONLY > +void semihost_sys_poll_one(CPUState *cs, gdb_syscall_complete_cb complete, > + int fd, GIOCondition cond, int timeout) > +{ > +} > +#endif > diff --git a/semihosting/meson.build b/semihosting/meson.build > index 34933e5a19..aa8b7a9913 100644 > --- a/semihosting/meson.build > +++ b/semihosting/meson.build > @@ -7,7 +7,7 @@ specific_ss.add(when: ['CONFIG_SEMIHOSTING', > 'CONFIG_SYSTEM_ONLY'], if_true: fil > 'config.c', > 'console.c', > 'uaccess.c', > -)) > +), if_false: files('stubs-target-all.c')) > > common_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], > if_false: files('stubs-all.c')) > system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_false: > files('stubs-system.c')) > --- > > For mips more stubs are needed: > > Undefined symbols for architecture arm64: > "_qemu_semihosting_console_write", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > "_uaccess_lock_user", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o > "_uaccess_lock_user_string", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o > "_uaccess_strlen_user", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > "_uaccess_unlock_user", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o > ... > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-06-18 11:33 ` Philippe Mathieu-Daudé @ 2024-06-18 13:56 ` Alex Bennée 2024-06-18 14:16 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 19+ messages in thread From: Alex Bennée @ 2024-06-18 13:56 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: Paolo Bonzini, qemu-devel, Anton Johansson Philippe Mathieu-Daudé <philmd@linaro.org> writes: > ping :) > > On 12/6/24 15:12, Philippe Mathieu-Daudé wrote: >> Hi Paolo, >> On 30/5/24 15:58, Philippe Mathieu-Daudé wrote: >>> On 30/5/24 09:31, Paolo Bonzini wrote: >>>> On Thu, May 30, 2024 at 9:22 AM Philippe Mathieu-Daudé >>>> <philmd@linaro.org> wrote: >>>>> >>>>> On 30/5/24 08:02, Paolo Bonzini wrote: >>>>>> On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé >>>>>> <philmd@linaro.org> wrote: >>>>>>> It is pointless to build semihosting when TCG is not available. >>>>>> >>>>>> Why? I would have naively assumed that a suitable semihosting API >>>>>> could be implemented by KVM. The justification (and thus the commit >>>>>> message) needs to be different for each architecture if it's a matter >>>>>> of instruction set or insufficient KVM userspace API. >>>>> >>>>> I wasn't sure where semihosting could be used so asked on IRC and >>>>> Alex told me TCG only. Maybe the current implementation is TCG >>>>> only, and I can reword. It certainly need some refactor to work >>>>> on KVM, because currently semihosting end calling the TCG probe_access >>>>> API, which I'm trying to restrict to TCG in order to ease linking >>>>> multiple libtcg for the single binary (see >>>>> https://lore.kernel.org/qemu-devel/20240529155918.6221-1-philmd@linaro.org/). >>>> >>>> Ok, that goes in the commit message though. >>>> >>>> "Semihosting currently uses the TCG probe_access API. It is pointless >>>> to have it in the binary when TCG isn't". >>>> >>>> and in the first two patches: >>>> >>>> "Semihosting currently uses the TCG probe_access API. To prepare for >>>> encoding the TCG dependency in Kconfig, do not enable it unless TCG is >>>> available". >>>> >>>> But then, "select FOO if TCG" mean that it can be compiled out; so >>>> perhaps "imply SEMIHOSTING if TCG" is better? Same for RISC-V's >>>> "select ARM_COMPATIBLE_SEMIHOSTING if TCG". >> Building qemu-system-mips configured with --without-default-devices: >> Undefined symbols for architecture arm64: >> "_qemu_semihosting_console_write", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> "_semihost_sys_close", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> "_uaccess_strlen_user", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> ... >> So this one has to use "select". >> Similarly m68k: >> Undefined symbols for architecture arm64: >> "_semihost_sys_close", referenced from: >> _do_m68k_semihosting in target_m68k_m68k-semi.c.o >> ... >> I can link m68k using semihosting stubs but I'm not sure it is >> right: >> -- >8 -- >> diff --git a/semihosting/stubs-target-all.c >> b/semihosting/stubs-target-all.c >> new file mode 100644 >> index 0000000000..1f33173f43 >> --- /dev/null >> +++ b/semihosting/stubs-target-all.c >> @@ -0,0 +1,97 @@ >> +/* >> + * Semihosting Stubs >> + * >> + * Copyright (c) 2024 Linaro Ltd >> + * >> + * Stubs for semihosting targets that don't actually do semihosting. >> + * >> + * SPDX-License-Identifier: GPL-2.0-or-later >> + */ >> + >> +#include "qemu/osdep.h" >> +#include "exec/exec-all.h" >> +#include "semihosting/syscalls.h" >> + >> +void semihost_sys_open(CPUState *cs, gdb_syscall_complete_cb complete, >> + target_ulong fname, target_ulong fname_len, >> + int gdb_flags, int mode) >> +{ >> +} >> + >> +void semihost_sys_close(CPUState *cs, gdb_syscall_complete_cb >> complete, int fd) >> +{ >> +} >> + >> +void semihost_sys_read_gf(CPUState *cs, gdb_syscall_complete_cb complete, >> + GuestFD *gf, target_ulong buf, target_ulong len) >> +{ >> +} >> + >> +void semihost_sys_read(CPUState *cs, gdb_syscall_complete_cb complete, >> + int fd, target_ulong buf, target_ulong len) >> +{ >> +} >> + >> +void semihost_sys_write_gf(CPUState *cs, gdb_syscall_complete_cb complete, >> + GuestFD *gf, target_ulong buf, >> target_ulong len) >> +{ >> +} >> + >> +void semihost_sys_write(CPUState *cs, gdb_syscall_complete_cb complete, >> + int fd, target_ulong buf, target_ulong len) >> +{ >> +} >> + >> +void semihost_sys_lseek(CPUState *cs, gdb_syscall_complete_cb complete, >> + int fd, int64_t off, int gdb_whence) >> +{ >> +} >> + >> +void semihost_sys_isatty(CPUState *cs, gdb_syscall_complete_cb >> complete, int fd) >> +{ >> +} >> + >> +void semihost_sys_flen(CPUState *cs, gdb_syscall_complete_cb fstat_cb, >> + gdb_syscall_complete_cb flen_cb, int fd, >> + target_ulong fstat_addr) >> +{ >> +} >> + >> +void semihost_sys_fstat(CPUState *cs, gdb_syscall_complete_cb complete, >> + int fd, target_ulong addr) >> +{ >> +} >> + >> +void semihost_sys_stat(CPUState *cs, gdb_syscall_complete_cb complete, >> + target_ulong fname, target_ulong fname_len, >> + target_ulong addr) >> +{ >> +} >> + >> +void semihost_sys_remove(CPUState *cs, gdb_syscall_complete_cb complete, >> + target_ulong fname, target_ulong fname_len) >> +{ >> +} >> + >> +void semihost_sys_rename(CPUState *cs, gdb_syscall_complete_cb complete, >> + target_ulong oname, target_ulong oname_len, >> + target_ulong nname, target_ulong nname_len) >> +{ >> +} >> + >> +void semihost_sys_system(CPUState *cs, gdb_syscall_complete_cb complete, >> + target_ulong cmd, target_ulong cmd_len) >> +{ >> +} >> + >> +void semihost_sys_gettimeofday(CPUState *cs, >> gdb_syscall_complete_cb complete, >> + target_ulong tv_addr, target_ulong tz_addr) >> +{ >> +} >> + >> +#ifndef CONFIG_USER_ONLY >> +void semihost_sys_poll_one(CPUState *cs, gdb_syscall_complete_cb complete, >> + int fd, GIOCondition cond, int timeout) >> +{ >> +} >> +#endif >> diff --git a/semihosting/meson.build b/semihosting/meson.build >> index 34933e5a19..aa8b7a9913 100644 >> --- a/semihosting/meson.build >> +++ b/semihosting/meson.build >> @@ -7,7 +7,7 @@ specific_ss.add(when: ['CONFIG_SEMIHOSTING', >> 'CONFIG_SYSTEM_ONLY'], if_true: fil >> 'config.c', >> 'console.c', >> 'uaccess.c', >> -)) >> +), if_false: files('stubs-target-all.c')) >> common_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], >> if_false: files('stubs-all.c')) >> system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_false: >> files('stubs-system.c')) >> --- >> For mips more stubs are needed: >> Undefined symbols for architecture arm64: >> "_qemu_semihosting_console_write", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> "_uaccess_lock_user", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o >> "_uaccess_lock_user_string", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o >> "_uaccess_strlen_user", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> "_uaccess_unlock_user", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o >> ... >> Oh sorry I was waiting for a re-spin. I should just apply the above to 3/3? -- Alex Bennée Virtualisation Tech Lead @ Linaro ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-06-18 13:56 ` Alex Bennée @ 2024-06-18 14:16 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-06-18 14:16 UTC (permalink / raw) To: Alex Bennée; +Cc: Paolo Bonzini, qemu-devel, Anton Johansson On 18/6/24 15:56, Alex Bennée wrote: > Philippe Mathieu-Daudé <philmd@linaro.org> writes: > >> ping :) >> >> On 12/6/24 15:12, Philippe Mathieu-Daudé wrote: >>> Hi Paolo, >>> On 30/5/24 15:58, Philippe Mathieu-Daudé wrote: >>>> On 30/5/24 09:31, Paolo Bonzini wrote: >>>>> On Thu, May 30, 2024 at 9:22 AM Philippe Mathieu-Daudé >>>>> <philmd@linaro.org> wrote: >>>>>> >>>>>> On 30/5/24 08:02, Paolo Bonzini wrote: >>>>>>> On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé >>>>>>> <philmd@linaro.org> wrote: >>>>>>>> It is pointless to build semihosting when TCG is not available. >>>>>>> >>>>>>> Why? I would have naively assumed that a suitable semihosting API >>>>>>> could be implemented by KVM. The justification (and thus the commit >>>>>>> message) needs to be different for each architecture if it's a matter >>>>>>> of instruction set or insufficient KVM userspace API. >>>>>> >>>>>> I wasn't sure where semihosting could be used so asked on IRC and >>>>>> Alex told me TCG only. Maybe the current implementation is TCG >>>>>> only, and I can reword. It certainly need some refactor to work >>>>>> on KVM, because currently semihosting end calling the TCG probe_access >>>>>> API, which I'm trying to restrict to TCG in order to ease linking >>>>>> multiple libtcg for the single binary (see >>>>>> https://lore.kernel.org/qemu-devel/20240529155918.6221-1-philmd@linaro.org/). >>>>> >>>>> Ok, that goes in the commit message though. >>>>> >>>>> "Semihosting currently uses the TCG probe_access API. It is pointless >>>>> to have it in the binary when TCG isn't". >>>>> >>>>> and in the first two patches: >>>>> >>>>> "Semihosting currently uses the TCG probe_access API. To prepare for >>>>> encoding the TCG dependency in Kconfig, do not enable it unless TCG is >>>>> available". >>>>> >>>>> But then, "select FOO if TCG" mean that it can be compiled out; so >>>>> perhaps "imply SEMIHOSTING if TCG" is better? Same for RISC-V's >>>>> "select ARM_COMPATIBLE_SEMIHOSTING if TCG". >>> Building qemu-system-mips configured with --without-default-devices: >>> Undefined symbols for architecture arm64: >>> "_qemu_semihosting_console_write", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> "_semihost_sys_close", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> "_uaccess_strlen_user", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> ... >>> So this one has to use "select". >>> Similarly m68k: >>> Undefined symbols for architecture arm64: >>> "_semihost_sys_close", referenced from: >>> _do_m68k_semihosting in target_m68k_m68k-semi.c.o >>> ... >>> I can link m68k using semihosting stubs but I'm not sure it is >>> right: >>> -- >8 -- >>> diff --git a/semihosting/stubs-target-all.c >>> b/semihosting/stubs-target-all.c >>> new file mode 100644 >>> index 0000000000..1f33173f43 >>> --- /dev/null >>> +++ b/semihosting/stubs-target-all.c >>> @@ -0,0 +1,97 @@ >>> +/* >>> + * Semihosting Stubs >>> + * >>> + * Copyright (c) 2024 Linaro Ltd >>> + * >>> + * Stubs for semihosting targets that don't actually do semihosting. >>> + * >>> + * SPDX-License-Identifier: GPL-2.0-or-later >>> + */ >>> + >>> +#include "qemu/osdep.h" >>> +#include "exec/exec-all.h" >>> +#include "semihosting/syscalls.h" >>> + >>> +void semihost_sys_open(CPUState *cs, gdb_syscall_complete_cb complete, >>> + target_ulong fname, target_ulong fname_len, >>> + int gdb_flags, int mode) >>> +{ >>> +} >>> + >>> +void semihost_sys_close(CPUState *cs, gdb_syscall_complete_cb >>> complete, int fd) >>> +{ >>> +} >>> + >>> +void semihost_sys_read_gf(CPUState *cs, gdb_syscall_complete_cb complete, >>> + GuestFD *gf, target_ulong buf, target_ulong len) >>> +{ >>> +} >>> + >>> +void semihost_sys_read(CPUState *cs, gdb_syscall_complete_cb complete, >>> + int fd, target_ulong buf, target_ulong len) >>> +{ >>> +} >>> + >>> +void semihost_sys_write_gf(CPUState *cs, gdb_syscall_complete_cb complete, >>> + GuestFD *gf, target_ulong buf, >>> target_ulong len) >>> +{ >>> +} >>> + >>> +void semihost_sys_write(CPUState *cs, gdb_syscall_complete_cb complete, >>> + int fd, target_ulong buf, target_ulong len) >>> +{ >>> +} >>> + >>> +void semihost_sys_lseek(CPUState *cs, gdb_syscall_complete_cb complete, >>> + int fd, int64_t off, int gdb_whence) >>> +{ >>> +} >>> + >>> +void semihost_sys_isatty(CPUState *cs, gdb_syscall_complete_cb >>> complete, int fd) >>> +{ >>> +} >>> + >>> +void semihost_sys_flen(CPUState *cs, gdb_syscall_complete_cb fstat_cb, >>> + gdb_syscall_complete_cb flen_cb, int fd, >>> + target_ulong fstat_addr) >>> +{ >>> +} >>> + >>> +void semihost_sys_fstat(CPUState *cs, gdb_syscall_complete_cb complete, >>> + int fd, target_ulong addr) >>> +{ >>> +} >>> + >>> +void semihost_sys_stat(CPUState *cs, gdb_syscall_complete_cb complete, >>> + target_ulong fname, target_ulong fname_len, >>> + target_ulong addr) >>> +{ >>> +} >>> + >>> +void semihost_sys_remove(CPUState *cs, gdb_syscall_complete_cb complete, >>> + target_ulong fname, target_ulong fname_len) >>> +{ >>> +} >>> + >>> +void semihost_sys_rename(CPUState *cs, gdb_syscall_complete_cb complete, >>> + target_ulong oname, target_ulong oname_len, >>> + target_ulong nname, target_ulong nname_len) >>> +{ >>> +} >>> + >>> +void semihost_sys_system(CPUState *cs, gdb_syscall_complete_cb complete, >>> + target_ulong cmd, target_ulong cmd_len) >>> +{ >>> +} >>> + >>> +void semihost_sys_gettimeofday(CPUState *cs, >>> gdb_syscall_complete_cb complete, >>> + target_ulong tv_addr, target_ulong tz_addr) >>> +{ >>> +} >>> + >>> +#ifndef CONFIG_USER_ONLY >>> +void semihost_sys_poll_one(CPUState *cs, gdb_syscall_complete_cb complete, >>> + int fd, GIOCondition cond, int timeout) >>> +{ >>> +} >>> +#endif >>> diff --git a/semihosting/meson.build b/semihosting/meson.build >>> index 34933e5a19..aa8b7a9913 100644 >>> --- a/semihosting/meson.build >>> +++ b/semihosting/meson.build >>> @@ -7,7 +7,7 @@ specific_ss.add(when: ['CONFIG_SEMIHOSTING', >>> 'CONFIG_SYSTEM_ONLY'], if_true: fil >>> 'config.c', >>> 'console.c', >>> 'uaccess.c', >>> -)) >>> +), if_false: files('stubs-target-all.c')) >>> common_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], >>> if_false: files('stubs-all.c')) >>> system_ss.add(when: ['CONFIG_SEMIHOSTING'], if_false: >>> files('stubs-system.c')) >>> --- >>> For mips more stubs are needed: >>> Undefined symbols for architecture arm64: >>> "_qemu_semihosting_console_write", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> "_uaccess_lock_user", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o >>> "_uaccess_lock_user_string", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting.cold.6 in target_mips_tcg_sysemu_mips-semi.c.o >>> "_uaccess_strlen_user", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> "_uaccess_unlock_user", referenced from: >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >>> _uhi_fstat_cb in target_mips_tcg_sysemu_mips-semi.c.o >>> ... >>> > > Oh sorry I was waiting for a re-spin. I should just apply the above to > 3/3? No, this is still unresolved :/ (this is a ping for Paolo :p) ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-06-12 13:12 ` Philippe Mathieu-Daudé 2024-06-18 11:33 ` Philippe Mathieu-Daudé @ 2024-06-19 7:49 ` Paolo Bonzini 2024-07-17 10:49 ` Philippe Mathieu-Daudé 1 sibling, 1 reply; 19+ messages in thread From: Paolo Bonzini @ 2024-06-19 7:49 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Alex Bennée, Anton Johansson On Wed, Jun 12, 2024 at 3:13 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > Building qemu-system-mips configured with --without-default-devices: > > Undefined symbols for architecture arm64: > "_qemu_semihosting_console_write", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > "_semihost_sys_close", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > "_uaccess_strlen_user", referenced from: > _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o > ... > > So this one has to use "select". > > Similarly m68k: > > Undefined symbols for architecture arm64: > "_semihost_sys_close", referenced from: > _do_m68k_semihosting in target_m68k_m68k-semi.c.o > ... Go ahead and use "select" for these. The file to be stubbed would have to be target/m68k/m68k-semi.c (for do_m68k_semihosting) and target/mips/tcg/sysemu/mips-semi.c (for mips_semihosting), not the common code. Paolo ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-06-19 7:49 ` Paolo Bonzini @ 2024-07-17 10:49 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-07-17 10:49 UTC (permalink / raw) To: Paolo Bonzini; +Cc: qemu-devel, Alex Bennée, Anton Johansson On 19/6/24 09:49, Paolo Bonzini wrote: > On Wed, Jun 12, 2024 at 3:13 PM Philippe Mathieu-Daudé > <philmd@linaro.org> wrote: >> Building qemu-system-mips configured with --without-default-devices: >> >> Undefined symbols for architecture arm64: >> "_qemu_semihosting_console_write", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> "_semihost_sys_close", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> "_uaccess_strlen_user", referenced from: >> _mips_semihosting in target_mips_tcg_sysemu_mips-semi.c.o >> ... >> >> So this one has to use "select". >> >> Similarly m68k: >> >> Undefined symbols for architecture arm64: >> "_semihost_sys_close", referenced from: >> _do_m68k_semihosting in target_m68k_m68k-semi.c.o >> ... > > The file to be stubbed would have > to be target/m68k/m68k-semi.c (for do_m68k_semihosting) and > target/mips/tcg/sysemu/mips-semi.c (for mips_semihosting), not the > common code. Yes! Thank you, I'm was to blind to realize that... ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 3/3] semihosting: Restrict to TCG 2024-05-30 6:02 ` Paolo Bonzini 2024-05-30 7:22 ` Philippe Mathieu-Daudé @ 2024-05-30 7:27 ` Alex Bennée 1 sibling, 0 replies; 19+ messages in thread From: Alex Bennée @ 2024-05-30 7:27 UTC (permalink / raw) To: Paolo Bonzini; +Cc: Philippe Mathieu-Daudé, qemu-devel Paolo Bonzini <pbonzini@redhat.com> writes: > On Wed, May 29, 2024 at 5:56 PM Philippe Mathieu-Daudé > <philmd@linaro.org> wrote: >> It is pointless to build semihosting when TCG is not available. > > Why? I would have naively assumed that a suitable semihosting API > could be implemented by KVM. The justification (and thus the commit > message) needs to be different for each architecture if it's a matter > of instruction set or insufficient KVM userspace API. For Arm at least the HLT instruction is an external debug feature and as such not trappable by KVM. > > Paolo > >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> semihosting/Kconfig | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/semihosting/Kconfig b/semihosting/Kconfig >> index eaf3a20ef5..fbe6ac87f9 100644 >> --- a/semihosting/Kconfig >> +++ b/semihosting/Kconfig >> @@ -1,6 +1,7 @@ >> >> config SEMIHOSTING >> bool >> + depends on TCG >> >> config ARM_COMPATIBLE_SEMIHOSTING >> bool >> -- >> 2.41.0 >> -- Alex Bennée Virtualisation Tech Lead @ Linaro ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/3] semihosting: Restrict to TCG 2024-05-29 15:55 [PATCH 0/3] semihosting: Restrict to TCG Philippe Mathieu-Daudé ` (2 preceding siblings ...) 2024-05-29 15:55 ` [PATCH 3/3] semihosting: Restrict " Philippe Mathieu-Daudé @ 2024-05-29 17:40 ` Richard Henderson 2024-05-29 19:11 ` Alex Bennée 4 siblings, 0 replies; 19+ messages in thread From: Richard Henderson @ 2024-05-29 17:40 UTC (permalink / raw) To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Paolo Bonzini, Alex Bennée On 5/29/24 08:55, Philippe Mathieu-Daudé wrote: > Philippe Mathieu-Daudé (3): > target/mips: Restrict semihosting to TCG > target/riscv: Restrict semihosting to TCG > semihosting: Restrict to TCG Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/3] semihosting: Restrict to TCG 2024-05-29 15:55 [PATCH 0/3] semihosting: Restrict to TCG Philippe Mathieu-Daudé ` (3 preceding siblings ...) 2024-05-29 17:40 ` [PATCH 0/3] " Richard Henderson @ 2024-05-29 19:11 ` Alex Bennée 2024-05-30 6:03 ` Paolo Bonzini 4 siblings, 1 reply; 19+ messages in thread From: Alex Bennée @ 2024-05-29 19:11 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Paolo Bonzini Philippe Mathieu-Daudé <philmd@linaro.org> writes: > It is pointless to build semihosting when TCG is not available. > > Philippe Mathieu-Daudé (3): > target/mips: Restrict semihosting to TCG > target/riscv: Restrict semihosting to TCG > semihosting: Restrict to TCG Queued to semihosting/next, thanks. -- Alex Bennée Virtualisation Tech Lead @ Linaro ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/3] semihosting: Restrict to TCG 2024-05-29 19:11 ` Alex Bennée @ 2024-05-30 6:03 ` Paolo Bonzini 2024-05-30 7:23 ` Philippe Mathieu-Daudé 0 siblings, 1 reply; 19+ messages in thread From: Paolo Bonzini @ 2024-05-30 6:03 UTC (permalink / raw) To: Alex Bennée; +Cc: Philippe Mathieu-Daudé, qemu-devel On Wed, May 29, 2024 at 9:11 PM Alex Bennée <alex.bennee@linaro.org> wrote: > > Philippe Mathieu-Daudé <philmd@linaro.org> writes: > > > It is pointless to build semihosting when TCG is not available. > > > > Philippe Mathieu-Daudé (3): > > target/mips: Restrict semihosting to TCG > > target/riscv: Restrict semihosting to TCG > > semihosting: Restrict to TCG > > Queued to semihosting/next, thanks. Please don't, at least not in the current form. These are jokes, not commit messages... Paolo ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 0/3] semihosting: Restrict to TCG 2024-05-30 6:03 ` Paolo Bonzini @ 2024-05-30 7:23 ` Philippe Mathieu-Daudé 0 siblings, 0 replies; 19+ messages in thread From: Philippe Mathieu-Daudé @ 2024-05-30 7:23 UTC (permalink / raw) To: Paolo Bonzini, Alex Bennée; +Cc: qemu-devel On 30/5/24 08:03, Paolo Bonzini wrote: > On Wed, May 29, 2024 at 9:11 PM Alex Bennée <alex.bennee@linaro.org> wrote: >> >> Philippe Mathieu-Daudé <philmd@linaro.org> writes: >> >>> It is pointless to build semihosting when TCG is not available. >>> >>> Philippe Mathieu-Daudé (3): >>> target/mips: Restrict semihosting to TCG >>> target/riscv: Restrict semihosting to TCG >>> semihosting: Restrict to TCG >> >> Queued to semihosting/next, thanks. > > Please don't, at least not in the current form. These are jokes, not > commit messages... Sorry if it appears to you as a joke, I thought it would be something trivial :( ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-07-17 10:49 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-05-29 15:55 [PATCH 0/3] semihosting: Restrict to TCG Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 1/3] target/mips: Restrict semihosting " Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 2/3] target/riscv: " Philippe Mathieu-Daudé 2024-05-29 15:55 ` [PATCH 3/3] semihosting: Restrict " Philippe Mathieu-Daudé 2024-05-30 6:02 ` Paolo Bonzini 2024-05-30 7:22 ` Philippe Mathieu-Daudé 2024-05-30 7:31 ` Paolo Bonzini 2024-05-30 13:58 ` Philippe Mathieu-Daudé 2024-06-12 13:12 ` Philippe Mathieu-Daudé 2024-06-18 11:33 ` Philippe Mathieu-Daudé 2024-06-18 13:56 ` Alex Bennée 2024-06-18 14:16 ` Philippe Mathieu-Daudé 2024-06-19 7:49 ` Paolo Bonzini 2024-07-17 10:49 ` Philippe Mathieu-Daudé 2024-05-30 7:27 ` Alex Bennée 2024-05-29 17:40 ` [PATCH 0/3] " Richard Henderson 2024-05-29 19:11 ` Alex Bennée 2024-05-30 6:03 ` Paolo Bonzini 2024-05-30 7:23 ` Philippe Mathieu-Daudé
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).