Re: [PATCH v2] util: Delete checks for old host definitions

2023-09-02 Thread Akihiko Odaki
Hi, Can anyone have look at this? I also have another patch similar but for thunk. It was reviewed but no one has made a pull request yet: https://patchew.org/QEMU/20230808152314.102036-1-akihiko.od...@daynix.com/ Regards, Akihiko Odaki On 2023/08/11 7:59, Akihiko Odaki wrote: IA-64 and

[PATCH v2] linux-user: Undo incomplete mmap

2023-09-02 Thread Akihiko Odaki
When the host page size is greater than the target page size and MAP_FIXED or MAP_FIXED_NOREPLACE is requested, mmap will be done for three parts: start, middle, and end. If a later part of mmap fail, mmap done in the earlier parts must be reverted. Fixes: 54936004fd ("mmap emulation")

[PATCH v6 15/18] plugins: Allow to read registers

2023-09-02 Thread Akihiko Odaki
It is based on GDB protocol to ensure interface stability. The timing of the vcpu init hook is also changed so that the hook will get called after GDB features are initialized. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1706 Signed-off-by: Akihiko Odaki ---

[PATCH v6 16/18] contrib/plugins: Allow to log registers

2023-09-02 Thread Akihiko Odaki
This demonstrates how a register can be read from a plugin. Signed-off-by: Akihiko Odaki --- docs/devel/tcg-plugins.rst | 10 ++- contrib/plugins/execlog.c | 140 - 2 files changed, 117 insertions(+), 33 deletions(-) diff --git a/docs/devel/tcg-plugins.rst

[PATCH v6 03/18] hw/core/cpu: Replace gdb_core_xml_file with gdb_core_feature

2023-09-02 Thread Akihiko Odaki
This is a tree-wide change to replace gdb_core_xml_file, the path to GDB XML file with gdb_core_feature, the pointer to GDBFeature. This also replaces the values assigned to gdb_num_core_regs with the num_regs member of GDBFeature where applicable to remove magic numbers. A following change will

[PATCH v6 14/18] cpu: Call plugin hooks only when ready

2023-09-02 Thread Akihiko Odaki
The initialization and exit hooks will not affect the state of vCPU, but they may depend on the state of vCPU. Therefore, it's better to call plugin hooks after the vCPU state is fully initialized and before it gets uninitialized. Signed-off-by: Akihiko Odaki --- cpu.c| 11

[PATCH v6 05/18] target/arm: Use GDBFeature for dynamic XML

2023-09-02 Thread Akihiko Odaki
In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki Acked-by: Richard Henderson --- target/arm/cpu.h | 20 +++---

[PATCH v6 06/18] target/ppc: Use GDBFeature for dynamic XML

2023-09-02 Thread Akihiko Odaki
In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki Reviewed-by: Richard Henderson --- target/ppc/cpu-qom.h | 3 +-- target/ppc/cpu.h

[PATCH v6 04/18] gdbstub: Introduce GDBFeatureBuilder

2023-09-02 Thread Akihiko Odaki
GDBFeatureBuilder unifies the logic to generate dynamic GDBFeature. Signed-off-by: Akihiko Odaki Reviewed-by: Richard Henderson --- include/exec/gdbstub.h | 20 ++ gdbstub/gdbstub.c | 59 ++ 2 files changed, 79 insertions(+) diff --git

[PATCH v6 07/18] target/riscv: Use GDBFeature for dynamic XML

2023-09-02 Thread Akihiko Odaki
In preparation for a change to use GDBFeature as a parameter of gdb_register_coprocessor(), convert the internal representation of dynamic feature from plain XML to GDBFeature. Signed-off-by: Akihiko Odaki --- target/riscv/cpu.h | 4 +-- target/riscv/cpu.c | 4 +--

[PATCH v6 11/18] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-09-02 Thread Akihiko Odaki
This function is no longer used. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 4 target/arm/cpu.h | 6 -- target/ppc/cpu.h | 1 - target/arm/cpu.c | 1 - target/arm/gdbstub.c | 18 -- target/ppc/cpu_init.c | 3 --- target/ppc/gdbstub.c

[PATCH v6 13/18] gdbstub: Expose functions to read registers

2023-09-02 Thread Akihiko Odaki
gdb_foreach_feature() enumerates features that are useful to identify registers. gdb_read_register() actually reads registers. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 6 ++ gdbstub/gdbstub.c | 20 +++- 2 files changed, 25 insertions(+), 1 deletion(-)

[PATCH v6 01/18] gdbstub: Add num_regs member to GDBFeature

2023-09-02 Thread Akihiko Odaki
Currently the number of registers exposed to GDB is written as magic numbers in code. Derive the number of registers GDB actually see from XML files to replace the magic numbers in code later. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée ---

[PATCH v6 12/18] gdbstub: Add members to identify registers to GDBFeature

2023-09-02 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. The added members in instances of GDBFeature dynamically generated by CPUs will be filled in later changes. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 3 +++ gdbstub/gdbstub.c | 10 --

[PATCH v6 17/18] plugins: Support C++

2023-09-02 Thread Akihiko Odaki
Make qemu-plugin.h consumable for C++ platform. Signed-off-by: Akihiko Odaki --- include/qemu/qemu-plugin.h | 4 1 file changed, 4 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 214b12bfd6..8637e3d8cf 100644 --- a/include/qemu/qemu-plugin.h +++

[PATCH v6 08/18] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-09-02 Thread Akihiko Odaki
This is a tree-wide change to introduce GDBFeature parameter to gdb_register_coprocessor(). The new parameter just replaces num_regs and xml parameters for now. GDBFeature will be utilized to simplify XML lookup in a following change. Signed-off-by: Akihiko Odaki Acked-by: Alex Bennée ---

[PATCH v6 10/18] gdbstub: Simplify XML lookup

2023-09-02 Thread Akihiko Odaki
Now we know all instances of GDBFeature that is used in CPU so we can traverse them to find XML. This removes the need for a CPU-specific lookup function for dynamic XMLs. Signed-off-by: Akihiko Odaki --- gdbstub/gdbstub.c | 24 1 file changed, 8 insertions(+), 16

[PATCH v6 09/18] gdbstub: Use GDBFeature for GDBRegisterState

2023-09-02 Thread Akihiko Odaki
Simplify GDBRegisterState by replacing num_regs and xml members with one member that points to GDBFeature. Signed-off-by: Akihiko Odaki --- gdbstub/gdbstub.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index

[PATCH v6 02/18] gdbstub: Introduce gdb_find_static_feature()

2023-09-02 Thread Akihiko Odaki
This function is useful to determine the number of registers exposed to GDB from the XML name. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Reviewed-by: Richard Henderson --- include/exec/gdbstub.h | 2 ++ gdbstub/gdbstub.c | 13

[PATCH v6 00/18] plugins: Allow to read registers

2023-09-02 Thread Akihiko Odaki
Based-on: <20230903043030.20708-1-akihiko.od...@daynix.com> ("[PATCH 0/8] gdbstub and TCG plugin improvements") I and other people in the University of Tokyo, where I research processor design, found TCG plugins are very useful for processor design exploration. The feature we find missing is the

[PATCH v6 18/18] contrib/plugins: Add cc plugin

2023-09-02 Thread Akihiko Odaki
This demonstrates how to write a plugin in C++. Signed-off-by: Akihiko Odaki --- docs/devel/tcg-plugins.rst | 8 configure | 15 --- contrib/plugins/Makefile | 5 + contrib/plugins/cc.cc | 17 + tests/tcg/Makefile.target | 3

[PATCH 7/8] target/ppc: Remove references to gdb_has_xml

2023-09-02 Thread Akihiko Odaki
GDB has XML support since 6.7 which was released in 2007. It's time to remove support for old GDB versions without XML support. Signed-off-by: Akihiko Odaki --- target/ppc/gdbstub.c | 18 -- 1 file changed, 18 deletions(-) diff --git a/target/ppc/gdbstub.c

[PATCH 4/8] hw/core/cpu: Return static value with gdb_arch_name()

2023-09-02 Thread Akihiko Odaki
All implementations of gdb_arch_name() returns dynamic duplicates of static strings. It's also unlikely that there will be an implementation of gdb_arch_name() that returns a truly dynamic value due to the nature of the function returning a well-known identifiers. Qualify the value gdb_arch_name()

[PATCH 3/8] target/arm: Move the reference to arm-core.xml

2023-09-02 Thread Akihiko Odaki
Some subclasses overwrite gdb_core_xml_file member but others don't. Always initialize the member in the subclasses for consistency. This especially helps for AArch64; in a following change, the file specified by gdb_core_xml_file is always looked up even if it's going to be overwritten later.

[PATCH 5/8] gdbstub: Dynamically allocate target.xml buffer

2023-09-02 Thread Akihiko Odaki
There is no guarantee that target.xml fits in 1024 bytes, and the fixed buffer length requires tedious buffer overflow check. Dynamically allocate the target.xml buffer to resolve these problems. Suggested-by: Alex Bennée Signed-off-by: Akihiko Odaki --- gdbstub/internals.h | 2 +-

[PATCH 0/8] gdbstub and TCG plugin improvements

2023-09-02 Thread Akihiko Odaki
This series extracts fixes and refactorings that can be applied independently from "[PATCH RESEND v5 00/26] plugins: Allow to read registers" as suggested by Nicholas Piggin. Patch "target/ppc: Remove references to gdb_has_xml" is also updated to remove some dead code I missed earlier and thus

[PATCH 2/8] gdbstub: Introduce GDBFeature structure

2023-09-02 Thread Akihiko Odaki
Before this change, the information from a XML file was stored in an array that is not descriptive. Introduce a dedicated structure type to make it easier to understand and to extend with more fields. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée

[PATCH 6/8] target/arm: Remove references to gdb_has_xml

2023-09-02 Thread Akihiko Odaki
GDB has XML support since 6.7 which was released in 2007. It's time to remove support for old GDB versions without XML support. Signed-off-by: Akihiko Odaki Acked-by: Alex Bennée --- target/arm/gdbstub.c | 32 ++-- 1 file changed, 2 insertions(+), 30 deletions(-)

[PATCH 1/8] contrib/plugins: Use GRWLock in execlog

2023-09-02 Thread Akihiko Odaki
execlog had the following comment: > As we could have multiple threads trying to do this we need to > serialise the expansion under a lock. Threads accessing already > created entries can continue without issue even if the ptr array > gets reallocated during resize. However, when the ptr array

[PATCH 8/8] gdbstub: Remove gdb_has_xml variable

2023-09-02 Thread Akihiko Odaki
GDB has XML support since 6.7 which was released in 2007. It's time to remove support for old GDB versions without XML support. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 8 gdbstub/gdbstub.c | 13 - gdbstub/softmmu.c | 1 - gdbstub/user.c

Re: [PATCH v3 16/16] tcg/loongarch64: Implement 128-bit load & store

2023-09-02 Thread Jiajie Chen
On 2023/9/3 09:06, Richard Henderson wrote: On 9/1/23 22:02, Jiajie Chen wrote: If LSX is available, use LSX instructions to implement 128-bit load & store. Is this really guaranteed to be an atomic 128-bit operation? Song Gao, please check this. Or, as for many vector processors, is

Re: [PATCH v3 16/16] tcg/loongarch64: Implement 128-bit load & store

2023-09-02 Thread Richard Henderson
On 9/1/23 22:02, Jiajie Chen wrote: If LSX is available, use LSX instructions to implement 128-bit load & store. Is this really guaranteed to be an atomic 128-bit operation? Or, as for many vector processors, is this really two separate 64-bit memory operations under the hood? +static

Re: [PATCH v3 05/16] tcg/loongarch64: Lower add/sub_vec to vadd/vsub

2023-09-02 Thread Richard Henderson
On 9/1/23 22:02, Jiajie Chen wrote: Lower the following ops: - add_vec - sub_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc | 60 3 files

Re: [PATCH v3 04/16] tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

2023-09-02 Thread Richard Henderson
On 9/1/23 22:02, Jiajie Chen wrote: Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc | 65 3 files changed, 67 insertions(+) Reviewed-by: Richard

Re: [PATCH v3 03/16] tcg: pass vece to tcg_target_const_match()

2023-09-02 Thread Richard Henderson
On 9/1/23 22:02, Jiajie Chen wrote: Pass vece to tcg_target_const_match() to allow correct interpretation of const args of vector ops. Signed-off-by: Jiajie Chen --- tcg/aarch64/tcg-target.c.inc | 2 +- tcg/arm/tcg-target.c.inc | 2 +- tcg/i386/tcg-target.c.inc| 2 +-

Re: [PATCH 06/15] configure: remove boolean variables for targets

2023-09-02 Thread Richard Henderson
On 9/2/23 05:59, Paolo Bonzini wrote: Just use $targetos always. Signed-off-by: Paolo Bonzini --- configure | 55 +-- 1 file changed, 13 insertions(+), 42 deletions(-) Reviewed-by: Richard Henderson r~

Re: Error: .seh_endproc used in segment '.text' instead of expected '.text$qemu_close_socket_osfhandle'

2023-09-02 Thread Liviu Ionescu
> On 2 Sep 2023, at 21:43, Liviu Ionescu wrote: > > ... With the same build scripts, compiling QEMU 7.1.0 was ok, the problem was > introduced in the last year. I also tried 7.2.5, and it passed the build, with the same scripts and the same toolchain, so the problem seems to be specific to

Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2023-09-02 Thread Michael Tokarev
02.09.2023 23:01, Marcin Juszkiewicz wrote: ... The offending code in `/util/cpuinfo-aarch64.c` is: > ```c > #ifdef CONFIG_LINUX >  unsigned long hwcap = qemu_getauxval(AT_HWCAP); >  info |= (hwcap & HWCAP_ATOMICS ? CPUINFO_LSE : 0); >  info |= (hwcap & HWCAP_USCAT ?

Re: /util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2023-09-02 Thread Marcin Juszkiewicz
W dniu 2.09.2023 o 20:11, Liviu Ionescu pisze: When trying to build 8.1.0 on an Ubuntu 18.04 aarch64, I get the above error. Ubuntu 18.04 is not supported anymore by Canonical. End-Of-Life was in May 2023. The offending code in `/util/cpuinfo-aarch64.c` is: > ```c > #ifdef CONFIG_LINUX >

Error: .seh_endproc used in segment '.text' instead of expected '.text$qemu_close_socket_osfhandle'

2023-09-02 Thread Liviu Ionescu
When compiling 8.1.0 for Windows (with mingw-w64-gcc on Linux), I got the following error: ``` [634/1917] Compiling C object libqemuutil.a.p/util_oslib-win32.c.obj FAILED: libqemuutil.a.p/util_oslib-win32.c.obj

/util/cpuinfo-aarch64.c:58:22: error: 'HWCAP_USCAT' undeclared

2023-09-02 Thread Liviu Ionescu
When trying to build 8.1.0 on an Ubuntu 18.04 aarch64, I get the above error. The offending code in `/util/cpuinfo-aarch64.c` is: ```c #ifdef CONFIG_LINUX unsigned long hwcap = qemu_getauxval(AT_HWCAP); info |= (hwcap & HWCAP_ATOMICS ? CPUINFO_LSE : 0); info |= (hwcap & HWCAP_USCAT ?

[PATCH 15/15] configure: remove dead code

2023-09-02 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- configure | 8 1 file changed, 8 deletions(-) diff --git a/configure b/configure index 6404b659718..a8d79602098 100755 --- a/configure +++ b/configure @@ -1126,14 +1126,6 @@ else done fi -# see if system emulation was really requested -case "

[PATCH 13/15] configure, meson: remove target OS symbols from config-host.mak

2023-09-02 Thread Paolo Bonzini
Stop applying config-host.mak to the sourcesets, since it does not have any more CONFIG_* symbols coming from the command line. Signed-off-by: Paolo Bonzini --- Makefile | 2 +- chardev/meson.build| 2 +- configure | 18 -

[PATCH 14/15] meson: list leftover CONFIG_* symbols

2023-09-02 Thread Paolo Bonzini
There are no config-host.mak symbols anymore that are needed in config-host.h; the only symbols that are included in config_host_data via the foreach loop are: - CONFIG_DEFAULT_TARGETS, which is not used by C code. - CONFIG_TCG and CONFIG_TCG_INTERPRETER, which are not part of config-host.mak

[PATCH 03/15] configure: remove HOST_CC

2023-09-02 Thread Paolo Bonzini
$(HOST_CC) is only used to invoke the preprocessor, and $(CC) can be used instead now that there is a Tricore C compiler. Remove the variable from config-host.mak. Reviewed-by: Richard Henderson Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure

[PATCH 12/15] configure, meson: remove CONFIG_SOLARIS from config-host.mak

2023-09-02 Thread Paolo Bonzini
CONFIG_SOLARIS is only used to pick tap implementations. But the target OS is invariant and does not depend on the configuration, so move away from config_host and just use unconditional rules in softmmu_ss. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- configure

[PATCH 07/15] configure: move --enable-debug-tcg to meson

2023-09-02 Thread Paolo Bonzini
Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- configure | 11 +-- meson.build | 3 ++- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 4 files changed, 8 insertions(+), 11

[PATCH 05/15] meson: compile bundled device trees

2023-09-02 Thread Paolo Bonzini
If dtc is available, compile the .dts files in the pc-bios directory instead of using the precompiled binaries. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- pc-bios/Makefile| 19 --- pc-bios/meson.build | 25 + 2 files changed, 21

[PATCH 11/15] configure, meson: move --enable-plugins to meson

2023-09-02 Thread Paolo Bonzini
While the option still needs to be parsed in the configure script (it's needed by tests/tcg, and also to decide about recursing into contrib/plugins), passing it to Meson can be done with -D instead of using config-host.mak. Signed-off-by: Paolo Bonzini --- accel/tcg/meson.build | 4

[PATCH 02/15] meson: update unsupported host/CPU messages

2023-09-02 Thread Paolo Bonzini
Unsupported CPU and OSes are not really going away, but the project simply does not guarantee that they work. Rephrase the messages accordingly. While at it, move the warning for TCI performance at the end where it is more visible. Signed-off-by: Paolo Bonzini --- meson.build | 45

[PATCH 06/15] configure: remove boolean variables for targets

2023-09-02 Thread Paolo Bonzini
Just use $targetos always. Signed-off-by: Paolo Bonzini --- configure | 55 +-- 1 file changed, 13 insertions(+), 42 deletions(-) diff --git a/configure b/configure index 378a0de9fb6..f96f7359a83 100755 --- a/configure +++ b/configure @@

[PATCH 09/15] contrib/plugins: use an independent makefile

2023-09-02 Thread Paolo Bonzini
The initial reason to write this patch was to remove the last use of CONFIG_DEBUG_TCG from the makefiles; the flags to use to build TCG plugins are unrelated to --enable-debug-tcg, and instead they should be the same as those used to build emulators (the plugins are not build via meson for

[PATCH v2 00/15] configure cleanups for QEMU 8.2

2023-09-02 Thread Paolo Bonzini
This includes a few more patches cleaning up the configure/meson separation. The highlights are fixing --host-cc, removing the last traces of compiler detection from config-host.mak, and dropping the useless pc-bios/Makefile. Compared to v1, I have also removed the loop that takes random

[PATCH 10/15] configure: unify recursion into sub-Makefiles

2023-09-02 Thread Paolo Bonzini
Treat contrib/plugins the same as the firmware. Signed-off-by: Paolo Bonzini --- Makefile | 27 --- configure | 13 - 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 5d48dfac18a..118c28e80d9 100644 --- a/Makefile

[PATCH 04/15] configure: create native file with contents of $host_cc

2023-09-02 Thread Paolo Bonzini
The argument of --host-cc is not obeyed when cross compiling. To avoid this issue, place it in a configuration file and pass it to meson with --native-file. While at it, clarify that --host-cc is not obeyed anyway when _not_ cross compiling, because cc="$host_cc" is placed before --host-cc is

[PATCH 01/15] meson: do not unnecessarily use cmake for dependencies

2023-09-02 Thread Paolo Bonzini
Both gvnc and sysprof-capture come with pkg-config files, so specify the method to find them. Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- tests/migration/meson.build | 2 +- tests/qtest/meson.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH 08/15] meson: test for CONFIG_TCG in config_all

2023-09-02 Thread Paolo Bonzini
CONFIG_TCG is not included in *-config-devices.h, so the test is always failing. Fixes: 74884cb1a6d ("qtest/meson.build: check CONFIG_TCG for boot-serial-test in qtests_ppc", 2022-03-14) Fixes: 44d827ea69e ("qtest/meson.build: check CONFIG_TCG for prom-env-test in qtests_ppc", 2022-03-14)