[PATCH v4 01/20] tap: Remove tap_probe_vnet_hdr_len()

2023-10-15 Thread Akihiko Odaki
It was necessary since an Linux older than 2.6.35 may implement the virtio-net header but may not allow to change its length. Remove it since such an old Linux is no longer supported. Signed-off-by: Akihiko Odaki Acked-by: Michael S. Tsirkin --- net/tap_int.h | 1 - net/tap-bsd.c | 5

Re: [PATCH v2 2/3] target/riscv: Initialize gdb_core_xml_file only once

2023-10-14 Thread Akihiko Odaki
On 2023/10/15 3:19, Daniel Henrique Barboza wrote: On 10/14/23 00:35, Akihiko Odaki wrote: gdb_core_xml_file was assigned each time a CPU is instantiated before this change. Signed-off-by: Akihiko Odaki ---   target/riscv/cpu.c | 5 +   target/riscv/tcg/tcg-cpu.c | 4   2

[PATCH v12 04/18] target/arm: Use GDBFeature for dynamic XML

2023-10-13 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 | 21 +++ target/arm

[PATCH v12 09/18] gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb

2023-10-13 Thread Akihiko Odaki
Align the parameters of gdb_get_reg_cb and gdb_set_reg_cb with the gdb_read_register and gdb_write_register members of CPUClass to allow to unify the logic to access registers of the core and coprocessors in the future. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 4

[PATCH v12 08/18] gdbstub: Use GDBFeature for GDBRegisterState

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

[PATCH v12 15/18] cpu: Call plugin hooks only when ready

2023-10-13 Thread Akihiko Odaki
The initialization and exit hooks will not affect the state of vCPU outside TCG context, 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

[PATCH v12 16/18] plugins: Use different helpers when reading registers

2023-10-13 Thread Akihiko Odaki
This avoids optimizations incompatible when reading registers. Signed-off-by: Akihiko Odaki --- accel/tcg/plugin-helpers.h | 3 ++- include/exec/plugin-gen.h | 4 ++-- include/hw/core/cpu.h | 4 ++-- include/qemu/plugin.h | 3 +++ plugins/plugin.h | 5 +++-- accel/tcg

[PATCH v12 13/18] gdbstub: Add members to identify registers to GDBFeature

2023-10-13 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 -- target/riscv

[PATCH v12 17/18] plugins: Allow to read registers

2023-10-13 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 --- include/qemu/qemu

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

2023-10-13 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 --- include/exec/gdbstub.h | 2 + gdbstub/gdbstub.c | 85

[PATCH v12 12/18] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-10-13 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 v12 07/18] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-10-13 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 v12 18/18] contrib/plugins: Allow to log registers

2023-10-13 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 | 120 +++-- 2 files changed, 97 insertions(+), 33 deletions(-) diff --git a/docs/devel/tcg-plugins.rst

[PATCH v12 14/18] gdbstub: Expose functions to read registers

2023-10-13 Thread Akihiko Odaki
gdb_find_feature() and gdb_find_feature_register() find registers. gdb_read_register() actually reads registers. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 5 + gdbstub/gdbstub.c | 31 ++- 2 files changed, 35 insertions(+), 1 deletion

[PATCH v12 05/18] target/ppc: Use GDBFeature for dynamic XML

2023-10-13 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 | 4 ++-- target/ppc/cpu.h

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

2023-10-13 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 v12 11/18] gdbstub: Infer number of core registers from XML

2023-10-13 Thread Akihiko Odaki
GDBFeature has the num_regs member so use it where applicable to remove magic numbers. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 3 ++- target/s390x/cpu.h | 2 -- gdbstub/gdbstub.c | 5 - target/arm/cpu.c| 1 - target/arm/cpu64.c | 1 - target/avr

[PATCH v12 06/18] target/riscv: Use GDBFeature for dynamic XML

2023-10-13 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 | 5 +-- target/riscv/cpu.c | 4 +-- target/riscv

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

2023-10-13 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 v12 03/18] gdbstub: Introduce GDBFeatureBuilder

2023-10-13 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 v12 00/18] plugins: Allow to read registers

2023-10-13 Thread Akihiko Odaki
e) Dropped 0x prefixes for register value logs for conciseness. V1 -> V2: Added SPDX-License-Identifier: GPL-2.0-or-later. (Philippe Mathieu-Daudé) Split long lines. (Philippe Mathieu-Daudé) Renamed gdb_features to gdb_static_features (Philippe Mathieu-Daudé) Dropped RFC. Akihiko Odaki

[PATCH v2 0/3] gdbstub and TCG plugin improvements

2023-10-13 Thread Akihiko Odaki
ped patch "target/riscv: Move misa_mxl_max to class". Dropped patch "target/riscv: Validate misa_mxl_max only once". Akihiko Odaki (3): target/riscv: Do not allow MXL_RV32 for TARGET_RISCV64 target/riscv: Initialize gdb_core_xml_file only once plugins: Remove an extra p

[PATCH v2 2/3] target/riscv: Initialize gdb_core_xml_file only once

2023-10-13 Thread Akihiko Odaki
gdb_core_xml_file was assigned each time a CPU is instantiated before this change. Signed-off-by: Akihiko Odaki --- target/riscv/cpu.c | 5 + target/riscv/tcg/tcg-cpu.c | 4 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c

[PATCH v2 3/3] plugins: Remove an extra parameter

2023-10-13 Thread Akihiko Odaki
copy_call() has an unused parameter so remove it. Signed-off-by: Akihiko Odaki --- accel/tcg/plugin-gen.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 39b3c9351f..78b331b251 100644 --- a/accel/tcg/plugin-gen.c

[PATCH v2 1/3] target/riscv: Do not allow MXL_RV32 for TARGET_RISCV64

2023-10-13 Thread Akihiko Odaki
TARGET_RISCV64 does not have riscv-32bit-cpu.xml so it shouldn't accept MXL_RV32. Signed-off-by: Akihiko Odaki --- target/riscv/tcg/tcg-cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index a28918ab30

Re: [PATCH 7/8] contrib/gitdm: add Daynix to domain-map

2023-10-13 Thread Akihiko Odaki
On 2023/10/14 0:44, Alex Bennée wrote: Daynix describes itself as a cloud technology company so I assume employee contributions should count as such. Signed-off-by: Alex Bennée Cc: Viktor Prutyanov Cc: Akihiko Odaki --- contrib/gitdm/domain-map | 1 + 1 file changed, 1 insertion(+) diff

Re: [PATCH v3 01/11] tap: Remove tap_probe_vnet_hdr_len()

2023-10-13 Thread Akihiko Odaki
On 2023/10/13 23:32, Michael S. Tsirkin wrote: On Fri, Oct 13, 2023 at 11:22:10PM +0900, Akihiko Odaki wrote: On 2023/10/13 23:17, Michael S. Tsirkin wrote: On Fri, Oct 13, 2023 at 02:26:03PM +0900, Akihiko Odaki wrote: On 2023/10/13 14:00, Jason Wang wrote: On Fri, Oct 13, 2023 at 12:14 PM

Re: [PATCH v3 01/11] tap: Remove tap_probe_vnet_hdr_len()

2023-10-13 Thread Akihiko Odaki
On 2023/10/13 23:17, Michael S. Tsirkin wrote: On Fri, Oct 13, 2023 at 02:26:03PM +0900, Akihiko Odaki wrote: On 2023/10/13 14:00, Jason Wang wrote: On Fri, Oct 13, 2023 at 12:14 PM Akihiko Odaki wrote: On 2023/10/13 10:38, Jason Wang wrote: On Wed, Oct 11, 2023 at 11:40 PM Akihiko Odaki

Re: [PATCH v3 01/11] tap: Remove tap_probe_vnet_hdr_len()

2023-10-13 Thread Akihiko Odaki
On 2023/10/13 22:55, Michael S. Tsirkin wrote: On Fri, Oct 13, 2023 at 01:14:32PM +0900, Akihiko Odaki wrote: On 2023/10/13 10:38, Jason Wang wrote: On Wed, Oct 11, 2023 at 11:40 PM Akihiko Odaki wrote: It was necessary since an Linux older than 2.6.35 may implement the virtio-net header

Re: [RFC PATCH v3 57/78] hw/net: add fallthrough pseudo-keyword

2023-10-13 Thread Akihiko Odaki
On 2023/10/13 17:46, Emmanouil Pitsidianakis wrote: In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword. Signed-off-by: Emmanouil Pitsidianakis --- hw/net/cadence_gem.c | 4 ++-- hw/net/can/can_sja1000.c

Re: [PATCH v3 01/11] tap: Remove tap_probe_vnet_hdr_len()

2023-10-12 Thread Akihiko Odaki
On 2023/10/13 14:00, Jason Wang wrote: On Fri, Oct 13, 2023 at 12:14 PM Akihiko Odaki wrote: On 2023/10/13 10:38, Jason Wang wrote: On Wed, Oct 11, 2023 at 11:40 PM Akihiko Odaki wrote: It was necessary since an Linux older than 2.6.35 may implement the virtio-net header but may not allow

Re: [PATCH v3 01/11] tap: Remove tap_probe_vnet_hdr_len()

2023-10-12 Thread Akihiko Odaki
On 2023/10/13 10:38, Jason Wang wrote: On Wed, Oct 11, 2023 at 11:40 PM Akihiko Odaki wrote: It was necessary since an Linux older than 2.6.35 may implement the virtio-net header but may not allow to change its length. Remove it since such an old Linux is no longer supported. Where can I

Re: [PATCH v9 01/23] target/riscv: Move MISA limits to class

2023-10-12 Thread Akihiko Odaki
On 2023/10/13 4:10, Daniel Henrique Barboza wrote: On 10/11/23 04:02, Akihiko Odaki wrote: MISA limits are common for all instances of a RISC-V CPU class so they are better put into class. Signed-off-by: Akihiko Odaki --- This patch and patches 2 and 3 from this version (v9) got dropped

Re: [RFC PATCH] tests/tcg: add an explicit gdbstub register tester

2023-10-12 Thread Akihiko Odaki
er numbers are. My initial motivation was to see if there are any duplicate register names exposed via the gdbstub while I was reviewing the proposed register interface for TCG plugins. Signed-off-by: Alex Bennée Cc: Akihiko Odaki I have some comments for some implementation details, but the

Re: [PATCH v11 11/18] gdbstub: Infer number of core registers from XML

2023-10-12 Thread Akihiko Odaki
On 2023/10/12 22:43, Philippe Mathieu-Daudé wrote: Hi Akihiko, On 12/10/23 15:06, Akihiko Odaki wrote: GDBFeature has the num_regs member so use it where applicable to remove magic numbers. Signed-off-by: Akihiko Odaki ---   include/hw/core/cpu.h   | 3 ++-   target/s390x/cpu.h  | 2

[PATCH v11 06/18] target/riscv: Use GDBFeature for dynamic XML

2023-10-12 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 | 5 +-- target/riscv/cpu.c | 4 +-- target/riscv

[PATCH v11 09/18] gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb

2023-10-12 Thread Akihiko Odaki
Align the parameters of gdb_get_reg_cb and gdb_set_reg_cb with the gdb_read_register and gdb_write_register members of CPUClass to allow to unify the logic to access registers of the core and coprocessors in the future. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 4

[PATCH v11 14/18] gdbstub: Expose functions to read registers

2023-10-12 Thread Akihiko Odaki
gdb_find_feature() and gdb_find_feature_register() find registers. gdb_read_register() actually reads registers. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 5 + gdbstub/gdbstub.c | 31 ++- 2 files changed, 35 insertions(+), 1 deletion

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

2023-10-12 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 --- include/exec/gdbstub.h | 2 + gdbstub/gdbstub.c | 85

[PATCH v11 04/18] target/arm: Use GDBFeature for dynamic XML

2023-10-12 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 | 21 +++ target/arm

[PATCH v11 08/18] gdbstub: Use GDBFeature for GDBRegisterState

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

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

2023-10-12 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 | 120 +++-- 2 files changed, 97 insertions(+), 33 deletions(-) diff --git a/docs/devel/tcg-plugins.rst

[PATCH v11 13/18] gdbstub: Add members to identify registers to GDBFeature

2023-10-12 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 -- target/riscv

[PATCH v11 03/18] gdbstub: Introduce GDBFeatureBuilder

2023-10-12 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 v11 05/18] target/ppc: Use GDBFeature for dynamic XML

2023-10-12 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 | 4 ++-- target/ppc/cpu.h

[PATCH v11 15/18] cpu: Call plugin hooks only when ready

2023-10-12 Thread Akihiko Odaki
The initialization and exit hooks will not affect the state of vCPU outside TCG context, 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

[PATCH v11 17/18] plugins: Allow to read registers

2023-10-12 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 --- include/qemu/qemu

[PATCH v11 12/18] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-10-12 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 v11 11/18] gdbstub: Infer number of core registers from XML

2023-10-12 Thread Akihiko Odaki
GDBFeature has the num_regs member so use it where applicable to remove magic numbers. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 3 ++- target/s390x/cpu.h | 2 -- gdbstub/gdbstub.c | 5 - target/arm/cpu.c| 1 - target/arm/cpu64.c | 1 - target/avr

[PATCH v11 16/18] plugins: Use different helpers when reading registers

2023-10-12 Thread Akihiko Odaki
This avoids optimizations incompatible when reading registers. Signed-off-by: Akihiko Odaki --- accel/tcg/plugin-helpers.h | 3 ++- include/exec/plugin-gen.h | 4 ++-- include/hw/core/cpu.h | 4 ++-- include/qemu/plugin.h | 3 +++ plugins/plugin.h | 5 +++-- accel/tcg

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

2023-10-12 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 v11 07/18] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-10-12 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 v11 02/18] gdbstub: Introduce gdb_find_static_feature()

2023-10-12 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 v11 00/18] plugins: Allow to read registers

2023-10-12 Thread Akihiko Odaki
e-Identifier: GPL-2.0-or-later. (Philippe Mathieu-Daudé) Split long lines. (Philippe Mathieu-Daudé) Renamed gdb_features to gdb_static_features (Philippe Mathieu-Daudé) Dropped RFC. Akihiko Odaki (18): gdbstub: Add num_regs member to GDBFeature gdbstub: Introduce gdb_find_static_feature()

Re: [PATCH v9 01/23] target/riscv: Move MISA limits to class

2023-10-12 Thread Akihiko Odaki
On 2023/10/12 0:23, Alex Bennée wrote: Akihiko Odaki writes: MISA limits are common for all instances of a RISC-V CPU class so they are better put into class. Signed-off-by: Akihiko Odaki --- target/riscv/cpu-qom.h | 2 + target/riscv/cpu.h | 2 - hw/riscv/boot.c

[PATCH v10 11/18] gdbstub: Infer number of core registers from XML

2023-10-11 Thread Akihiko Odaki
GDBFeature has the num_regs member so use it where applicable to remove magic numbers. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 3 ++- target/s390x/cpu.h | 2 -- gdbstub/gdbstub.c | 5 - target/arm/cpu.c| 1 - target/arm/cpu64.c | 1 - target/avr

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

2023-10-11 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 | 120 +++-- 2 files changed, 97 insertions(+), 33 deletions(-) diff --git a/docs/devel/tcg-plugins.rst

[PATCH v10 13/18] gdbstub: Add members to identify registers to GDBFeature

2023-10-11 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 -- target/riscv

[PATCH v10 07/18] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-10-11 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 v10 02/18] gdbstub: Introduce gdb_find_static_feature()

2023-10-11 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 v10 17/18] plugins: Allow to read registers

2023-10-11 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 --- include/qemu/qemu

[PATCH v10 04/18] target/arm: Use GDBFeature for dynamic XML

2023-10-11 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 | 21 +++ target/arm

[PATCH v10 08/18] gdbstub: Use GDBFeature for GDBRegisterState

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

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

2023-10-11 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 --- include/exec/gdbstub.h | 2 + gdbstub/gdbstub.c | 85

[PATCH v10 09/18] gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb

2023-10-11 Thread Akihiko Odaki
Align the parameters of gdb_get_reg_cb and gdb_set_reg_cb with the gdb_read_register and gdb_write_register members of CPUClass to allow to unify the logic to access registers of the core and coprocessors in the future. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 4

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

2023-10-11 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 v10 16/18] plugins: Use different helpers when reading registers

2023-10-11 Thread Akihiko Odaki
This avoids optimizations incompatible when reading registers. Signed-off-by: Akihiko Odaki --- accel/tcg/plugin-helpers.h | 3 ++- include/exec/plugin-gen.h | 4 ++-- include/hw/core/cpu.h | 4 ++-- include/qemu/plugin.h | 3 +++ plugins/plugin.h | 5 +++-- accel/tcg

[PATCH v10 12/18] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-10-11 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 v10 06/18] target/riscv: Use GDBFeature for dynamic XML

2023-10-11 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 | 5 +-- target/riscv/cpu.c | 4 +-- target/riscv

[PATCH v10 15/18] cpu: Call plugin hooks only when ready

2023-10-11 Thread Akihiko Odaki
The initialization and exit hooks will not affect the state of vCPU outside TCG context, 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

[PATCH v10 14/18] gdbstub: Expose functions to read registers

2023-10-11 Thread Akihiko Odaki
gdb_find_feature() and gdb_find_feature_register() find registers. gdb_read_register() actually reads registers. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 5 + gdbstub/gdbstub.c | 31 ++- 2 files changed, 35 insertions(+), 1 deletion

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

2023-10-11 Thread Akihiko Odaki
Changed gdb_find_static_feature() to abort on failure. (Alex Bennée) Changed the execlog plugin to log the register value only when changed. (Alex Bennée) Dropped 0x prefixes for register value logs for conciseness. V1 -> V2: Added SPDX-License-Identifier: GPL-2.0-or-later. (Philipp

[PATCH v10 03/18] gdbstub: Introduce GDBFeatureBuilder

2023-10-11 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 v10 05/18] target/ppc: Use GDBFeature for dynamic XML

2023-10-11 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 | 4 ++-- target/ppc/cpu.h

[PATCH 3/4] target/riscv: Validate misa_mxl_max only once

2023-10-11 Thread Akihiko Odaki
misa_mxl_max is now a class member and initialized only once for each class. This also moves the initialization of gdb_core_xml_file which will be referenced before realization in the future. Signed-off-by: Akihiko Odaki --- target/riscv/cpu.c | 6 ++ 1 file changed, 2 insertions(+), 4

[PATCH 2/4] target/riscv: Move misa_mxl_max to class

2023-10-11 Thread Akihiko Odaki
misa_mxl_max is common for all instances of a RISC-V CPU class so they are better put into class. Signed-off-by: Akihiko Odaki --- target/riscv/cpu-qom.h | 1 + target/riscv/cpu.h | 1 - hw/riscv/boot.c | 2 +- target/riscv/cpu.c | 127

[PATCH 4/4] plugins: Remove an extra parameter

2023-10-11 Thread Akihiko Odaki
copy_call() has an unused parameter so remove it. Signed-off-by: Akihiko Odaki --- accel/tcg/plugin-gen.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 39b3c9351f..78b331b251 100644 --- a/accel/tcg/plugin-gen.c

[PATCH 1/4] target/riscv: Remove misa_mxl validation

2023-10-11 Thread Akihiko Odaki
It is initialized with a simple assignment and there is little room for error. In fact, the validation is even more complex. Signed-off-by: Akihiko Odaki --- target/riscv/cpu.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv

[PATCH 0/4] gdbstub and TCG plugin improvements

2023-10-11 Thread Akihiko Odaki
d instances may have different misa_ext_mask. Akihiko Odaki (4): target/riscv: Remove misa_mxl validation target/riscv: Move misa_mxl_max to class target/riscv: Validate misa_mxl_max only once plugins: Remove an extra parameter target/riscv/cpu-qom.h | 1 + target/riscv/cpu.h |

Re: [PATCH v9 23/23] plugins: Support C++

2023-10-11 Thread Akihiko Odaki
On 2023/10/12 1:21, Thomas Huth wrote: On 11/10/2023 17.48, Akihiko Odaki wrote: On 2023/10/11 17:51, Daniel P. Berrangé wrote: On Wed, Oct 11, 2023 at 04:03:09PM +0900, Akihiko Odaki wrote: Make qemu-plugin.h consumable for C++ platform. Signed-off-by: Akihiko Odaki ---   docs/devel/tcg

Re: [PATCH v9 23/23] plugins: Support C++

2023-10-11 Thread Akihiko Odaki
On 2023/10/11 17:51, Daniel P. Berrangé wrote: On Wed, Oct 11, 2023 at 04:03:09PM +0900, Akihiko Odaki wrote: Make qemu-plugin.h consumable for C++ platform. Signed-off-by: Akihiko Odaki --- docs/devel/tcg-plugins.rst | 4 meson.build| 2 +- include/qemu/qemu

Re: [PATCH v2 1/7] tap: Fix virtio-net header buffer size

2023-10-11 Thread Akihiko Odaki
On 2023/10/11 15:43, Akihiko Odaki wrote: On 2023/10/10 16:56, Michael Tokarev wrote: 10.10.2023 05:59, Akihiko Odaki wrote: The largest possible virtio-net header is struct virtio_net_hdr_v1_hash. Fixes: fbbdbddec0 ("tap: allow extended virtio header with hash info") Signed-off-b

[PATCH v3 08/11] virtio-net: Unify the logic to update NIC state for RSS

2023-10-11 Thread Akihiko Odaki
The code to attach or detach the eBPF program to RSS were duplicated so unify them into one function to save some code. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 90 ++--- 1 file changed, 36 insertions(+), 54 deletions(-) diff --git a/hw/net

[PATCH v3 03/11] net: Move virtio-net header length assertion

2023-10-11 Thread Akihiko Odaki
The virtio-net header length assertion should happen for any clients. Signed-off-by: Akihiko Odaki --- net/net.c | 5 + net/tap.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/net.c b/net/net.c index 1bb4f33a63..6d2fa8d40f 100644 --- a/net/net.c +++ b/net/net.c

[PATCH v3 07/11] virtio-net: Disable RSS on reset

2023-10-11 Thread Akihiko Odaki
RSS is disabled by default. Fixes: 590790297c ("virtio-net: implement RSS configuration command") Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 70 +++-- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/hw/net/virtio-net.

[PATCH v3 04/11] net: Remove receive_raw()

2023-10-11 Thread Akihiko Odaki
t;tap: allow extended virtio header with hash info") Signed-off-by: Akihiko Odaki --- include/net/filter.h| 3 --- include/net/net.h | 1 - include/net/queue.h | 7 - include/sysemu/replay.h | 2 +- net/dump.c | 4 +-- net/filter-buffer.c | 4 +--

[PATCH v3 06/11] virtio-net: Copy header only when necessary

2023-10-11 Thread Akihiko Odaki
o-net: reference implementation of hash report") Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index cab79f19cb..b1cc74881a 100644 --- a/hw/net/virtio-n

[PATCH v3 05/11] tap: Shrink zeroed virtio-net header

2023-10-11 Thread Akihiko Odaki
tap prepends a zeroed virtio-net header when writing a packet to a tap with virtio-net header enabled but not in use. This only happens when s->host_vnet_hdr_len == sizeof(struct virtio_net_hdr). Signed-off-by: Akihiko Odaki --- net/tap.c | 2 +- 1 file changed, 1 insertion(+), 1 delet

[PATCH v3 11/11] ebpf: Fix RSS error handling

2023-10-11 Thread Akihiko Odaki
calculate_rss_hash() was using hash value 0 to tell if it calculated a hash, but the hash value may be 0 on a rare occasion. Have a distinct bool value for correctness. Fixes: f3fa412de2 ("ebpf: Added eBPF RSS program.") Signed-off-by: Akihiko Odaki --- tools/ebpf/rss.

[PATCH v3 00/11] virtio-net RSS/hash report fixes

2023-10-11 Thread Akihiko Odaki
quot;. Added patch "net: Remove receive_raw()". Added patch "tap: Shrink zeroed virtio-net header". Dropped patch "tap: Fix virtio-net header buffer size". V1 -> V2: Added patch "ebpf: Fix RSS error handling". Akihiko Odaki (11): tap: Remove tap

[PATCH v3 09/11] virtio-net: Return an error when vhost cannot enable RSS

2023-10-11 Thread Akihiko Odaki
is requested but not available. Assert RSS availability when the guest actually requests the feature. Signed-off-by: Akihiko Odaki --- ebpf/ebpf_rss.h | 2 +- ebpf/ebpf_rss-stub.c | 4 +- ebpf/ebpf_rss.c | 68 +- hw/net/virtio-net.c | 114

[PATCH v3 02/11] tap: Remove qemu_using_vnet_hdr()

2023-10-11 Thread Akihiko Odaki
(). Signed-off-by: Akihiko Odaki --- include/net/net.h | 6 -- hw/net/e1000e.c | 1 - hw/net/igb.c| 1 - hw/net/net_tx_pkt.c | 4 ++-- hw/net/virtio-net.c | 3 --- hw/net/vmxnet3.c| 2 -- net/dump.c | 4 +--- net/net.c | 18 -- net

[PATCH v3 10/11] virtio-net: Do not clear VIRTIO_NET_F_RSS

2023-10-11 Thread Akihiko Odaki
is not loaded. Signed-off-by: Akihiko Odaki --- hw/net/virtio-net.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 20feb20bb1..31a32bdff9 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -775,9 +775,6 @@ static uint64_t

[PATCH v3 01/11] tap: Remove tap_probe_vnet_hdr_len()

2023-10-11 Thread Akihiko Odaki
It was necessary since an Linux older than 2.6.35 may implement the virtio-net header but may not allow to change its length. Remove it since such an old Linux is no longer supported. Signed-off-by: Akihiko Odaki --- net/tap_int.h | 1 - net/tap-bsd.c | 5 - net/tap-linux.c | 20

[PATCH v9 03/23] target/riscv: Validate misa_mxl_max only once

2023-10-11 Thread Akihiko Odaki
misa_mxl_max is now a class member and initialized only once for each class. This also moves the initialization of gdb_core_xml_file which will be referenced before realization in the future. Signed-off-by: Akihiko Odaki --- target/riscv/cpu.c | 7 +++ 1 file changed, 3 insertions(+), 4

[PATCH v9 14/23] gdbstub: Infer number of core registers from XML

2023-10-11 Thread Akihiko Odaki
GDBFeature has the num_regs member so use it where applicable to remove magic numbers. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 3 ++- target/s390x/cpu.h | 2 -- gdbstub/gdbstub.c | 5 - target/arm/cpu.c| 1 - target/arm/cpu64.c | 1 - target/avr

[PATCH v9 05/23] gdbstub: Introduce gdb_find_static_feature()

2023-10-11 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 v9 02/23] target/riscv: Remove misa_mxl validation

2023-10-11 Thread Akihiko Odaki
It is initialized with a simple assignment and there is little room for error. In fact, the validation is even more complex. Signed-off-by: Akihiko Odaki --- target/riscv/cpu.c | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/target/riscv/cpu.c b/target/riscv

[PATCH v9 15/23] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-10-11 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 v9 20/23] plugins: Use different helpers when reading registers

2023-10-11 Thread Akihiko Odaki
This avoids optimizations incompatible when reading registers. Signed-off-by: Akihiko Odaki --- accel/tcg/plugin-helpers.h | 3 ++- include/exec/plugin-gen.h | 4 ++-- include/hw/core/cpu.h | 4 ++-- include/qemu/plugin.h | 3 +++ plugins/plugin.h | 5 +++-- accel/tcg

<    5   6   7   8   9   10   11   12   13   14   >