[PATCH v2 02/24] gdbstub: Introduce GDBFeature structure

2023-08-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é --- MAINTAINERS

[PATCH v2 00/24] plugins: Allow to read registers

2023-08-02 Thread Akihiko Odaki
atic_features (Philippe Mathieu-Daudé) Dropped RFC. Akihiko Odaki (24): contrib/plugins: Use GRWLock in execlog gdbstub: Introduce GDBFeature structure gdbstub: Add num_regs member to GDBFeature gdbstub: Introduce gdb_find_static_feature() target/arm: Move the reference to arm-core.xml

[PATCH v2 05/24] target/arm: Move the reference to arm-core.xml

2023-08-02 Thread Akihiko Odaki
tten later. Looking up arm-core.xml results in an error as it will not be embedded in the AArch64 build. Signed-off-by: Akihiko Odaki --- target/arm/cpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 93c28d50e5..d71a162070 100644 --

[PATCH v2 04/24] gdbstub: Introduce gdb_find_static_feature()

2023-08-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é --- include/exec/gdbstub.h | 2 ++ gdbstub/gdbstub.c | 13 + 2 files changed, 15 insertions(+) diff --git a/include

[PATCH v2 06/24] hw/core/cpu: Replace gdb_core_xml_file with gdb_core_feature

2023-08-02 Thread Akihiko Odaki
utilize additional information provided by GDBFeature to simplify XML file lookup. Signed-off-by: Akihiko Odaki --- include/hw/core/cpu.h | 5 +++-- target/s390x/cpu.h | 2 -- gdbstub/gdbstub.c | 6 +++--- target/arm/cpu.c| 4 ++-- target/arm/cpu64.c | 4 ++-- target/arm

[PATCH v2 07/24] target/arm: Use GDBFeature for dynamic XML

2023-08-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: Philippe Mathieu-Daudé --- target/arm/cpu.h | 20 +-- target

[PATCH v2 11/24] gdbstub: Use GDBFeature for GDBRegisterState

2023-08-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 e84364e97c

[PATCH v2 10/24] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-08-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 --- include/exec/gdbstub.h

[PATCH v2 08/24] target/ppc: Use GDBFeature for dynamic XML

2023-08-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: Philippe Mathieu-Daudé --- target/ppc/cpu-qom.h | 3 +-- target/ppc/cpu.h

[PATCH v2 09/24] target/riscv: Use GDBFeature for dynamic XML

2023-08-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: Philippe Mathieu-Daudé --- target/riscv/cpu.h | 4 ++-- target/riscv

[PATCH v2 12/24] gdbstub: Simplify XML lookup

2023-08-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 | 28 +--- 1 file changed, 9 insertions(+), 19

[PATCH v2 01/24] contrib/plugins: Use GRWLock in execlog

2023-08-02 Thread Akihiko Odaki
he ptr array gets reallocated, the other threads may have a stale reference to the old buffer. This results in use-after-free. Use GRWLock to properly fix this issue. Fixes: 3d7caf145e ("contrib/plugins: add execlog to log instruction execution and memory access") Signed-off-by: Akihi

[PATCH v2 15/24] target/arm: Fill new members of GDBFeature

2023-08-02 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. Signed-off-by: Akihiko Odaki --- target/arm/gdbstub.c | 46 +++--- target/arm/gdbstub64.c | 42 +- 2 files changed, 58 insertions(+), 30 deletions(-) diff

[PATCH v2 16/24] target/ppc: Fill new members of GDBFeature

2023-08-02 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. Signed-off-by: Akihiko Odaki --- target/ppc/gdbstub.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/ppc/gdbstub.c b/target/ppc/gdbstub.c index 19c4935260..ac4ed12371 100644 --- a/target/ppc

[PATCH v2 18/24] hw/core/cpu: Add a parameter to gdb_read_register/gdb_write_register

2023-08-02 Thread Akihiko Odaki
: Akihiko Odaki --- include/hw/core/cpu.h | 6 -- target/alpha/cpu.h| 6 -- target/arm/cpu.h | 13 + target/avr/cpu.h | 6 -- target/cris/cpu.h | 9 ++--- target/hexagon/internal.h | 6 -- target/hppa

[PATCH v2 14/24] gdbstub: Add members to identify registers to GDBFeature

2023-08-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 | 2 ++ scripts/feature_to_c.py | 14 +- 2 files

[PATCH v2 20/24] gdbstub: Expose functions to read registers

2023-08-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 | 38 ++ 2 files changed, 36 insertions

[PATCH v2 13/24] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-08-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 v2 22/24] contrib/plugins: Allow to log registers

2023-08-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 | 130 - 2 files changed, 108 insertions(+), 32 deletions(-) diff --git a/docs/devel/tcg-plugins.rst

[PATCH v2 19/24] gdbstub: Hide gdb_has_xml

2023-08-02 Thread Akihiko Odaki
gdb_has_xml is no longer referenced by the other components. Signed-off-by: Akihiko Odaki --- gdbstub/internals.h| 8 include/exec/gdbstub.h | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdbstub/internals.h b/gdbstub/internals.h index f2b46cce41

[PATCH v2 23/24] plugins: Support C++

2023-08-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 +++ b

[PATCH v2 24/24] contrib/plugins: Add cc plugin

2023-08-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 v2 21/24] plugins: Allow to read registers

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

[PATCH v2 17/24] target/riscv: Fill new members of GDBFeature

2023-08-02 Thread Akihiko Odaki
These members will be used to help plugins to identify registers. Signed-off-by: Akihiko Odaki --- target/riscv/gdbstub.c | 21 ++--- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c index 224c69ea99..b3d4d4de3e

Re: [PATCH v6 8/8] linux-user: Load pie executables at upper memory

2023-08-02 Thread Akihiko Odaki
On 2023/08/02 18:34, Helge Deller wrote: On 8/2/23 10:44, Akihiko Odaki wrote: On 2023/08/02 17:42, Helge Deller wrote: On 8/2/23 09:49, Akihiko Odaki wrote: On 2023/08/02 8:27, Helge Deller wrote: Fix the elf loader to calculate a valid TASK_UNMAPPED_BASE address for all 32-bit

Re: [PATCH v8 07/17] linux-user: Remove last_brk

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: This variable is unused. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 08/17] linux-user: Adjust task_unmapped_base for reserved_va

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Ensure that the chosen values for mmap_next_start and task_unmapped_base are within the guest address space. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 09/17] linux-user: Define TASK_UNMAPPED_BASE in $guest/target_mman.h

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Provide default values that are as close as possible to the values used by the guest's kernel. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 10/17] linux-user: Define ELF_ET_DYN_BASE in $guest/target_mman.h

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Copy each guest kernel's default value, then bound it against reserved_va or the host address space. Signed-off-by: Richard Henderson --- linux-user/aarch64/target_mman.h | 3 +++ linux-user/alpha/target_mman.h | 3 +++ linux-user/ar

Re: [PATCH v8 11/17] linux-user: Use MAP_FIXED_NOREPLACE for initial image mmap

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Use this as extra protection for the guest mapping over any qemu host mappings. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 12/17] linux-user: Use elf_et_dyn_base for ET_DYN with interpreter

2023-08-03 Thread Akihiko Odaki
-by: Akihiko Odaki

Re: [PATCH v8 13/17] linux-user: Adjust initial brk when interpreter is close to executable

2023-08-03 Thread Akihiko Odaki
brk. Signed-off-by: Helge Deller [rth: Re-order after ELF_ET_DYN_BASE patch so that we do not "temporarily break" tsan, and also to minimize the changes required. Remove image_info.reserve_brk as unused.] Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 14/17] linux-user: Properly set image_info.brk in flatload

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: The heap starts at "brk" not "start_brk". With this fixed, image_info.start_brk is unused and may be removed. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 15/17] linux-user: Do not adjust image mapping for host page size

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Remove TARGET_ELF_EXEC_PAGESIZE, and 3 other TARGET_ELF_PAGE* macros based off of that. Rely on target_mmap to handle guest vs host page size mismatch. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 16/17] linux-user: Do not adjust zero_bss for host page size

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: Rely on target_mmap to handle guest vs host page size mismatch. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

Re: [PATCH v8 17/17] linux-user: Use zero_bss for PT_LOAD with no file contents too

2023-08-03 Thread Akihiko Odaki
On 2023/08/04 10:45, Richard Henderson wrote: If p_filesz == 0, then vaddr_ef == vaddr. We can reuse the code in zero_bss rather than incompletely duplicating it in load_elf_image. Signed-off-by: Richard Henderson Reviewed-by: Akihiko Odaki

[PATCH] linux-user: Undo incomplete mmap

2023-08-03 Thread Akihiko Odaki
Signed-off-by: Akihiko Odaki --- Based-on: <20230804014517.6361-1-richard.hender...@linaro.org> ("[PATCH for-8.1 v8 00/17] linux-user: brk fixes") linux-user/mmap.c | 65 +-- 1 file changed, 40 insertions(+), 25 deletions(-) diff -

Re: [PATCH v3 6/9] gfxstream + rutabaga: add initial support for gfxstream

2023-08-04 Thread Akihiko Odaki
rtwl Signed-off-by: Gurchetan Singh --- v1: Incorported various suggestions by Akihiko Odaki and Bernard Berschow - Removed GET_VIRTIO_GPU_GL / GET_RUTABAGA macros - Used error_report(..) - Used g_autofree to fix leaks on error paths - Removed unnecessary casts - added virtio-

Re: [PATCH v3 9/9] docs/system: add basic virtio-gpu documentation

2023-08-04 Thread Akihiko Odaki
On 2023/08/04 8:55, Gurchetan Singh wrote: From: Gurchetan Singh This adds basic documentation for virtio-gpu. Suggested-by: Akihiko Odaki Signed-off-by: Gurchetan Singh --- v2: - Incorporated suggestions by Akihiko Odaki - Listed the currently supported capset_names (Bernard) v3

Re: [PATCH v3 21/27] plugins: add an API to read registers

2024-02-26 Thread Akihiko Odaki
ehind an opaque handle. For now this is just the gdb_regnum encapsulated in an anonymous GPOINTER but in future as we add more state for plugins to track we can expand it. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1706 Cc: Akihiko Odaki Message-Id: <20240103173349.398526-39-

Re: [PATCH v3 21/27] plugins: add an API to read registers

2024-02-27 Thread Akihiko Odaki
On 2024/02/27 19:08, Alex Bennée wrote: Akihiko Odaki writes: On 2024/02/27 1:56, Alex Bennée wrote: We can only request a list of registers once the vCPU has been initialised so the user needs to use either call the get function on vCPU initialisation or during the translation phase. We

Re: [PATCH v3 21/27] plugins: add an API to read registers

2024-02-27 Thread Akihiko Odaki
On 2024/02/27 19:29, Alex Bennée wrote: Akihiko Odaki writes: On 2024/02/27 19:08, Alex Bennée wrote: Akihiko Odaki writes: On 2024/02/27 1:56, Alex Bennée wrote: We can only request a list of registers once the vCPU has been initialised so the user needs to use either call the get

Re: [PATCH v4 21/29] gdbstub: expose api to find registers

2024-02-27 Thread Akihiko Odaki
On 2024/02/27 23:43, Alex Bennée wrote: Expose an internal API to QEMU to return all the registers for a vCPU. The list containing the details required to called gdb_read_register(). Based-on: <20231025093128.33116-15-akihiko.od...@daynix.com> Cc: Akihiko Odaki Mess

Re: [PATCH v4 23/29] plugins: add an API to read registers

2024-02-27 Thread Akihiko Odaki
ehind an opaque handle. For now this is just the gdb_regnum encapsulated in an anonymous GPOINTER but in future as we add more state for plugins to track we can expand it. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1706 Cc: Akihiko Odaki Message-Id: <20240103173349.398526-39-

[PATCH v8 01/15] hw/nvme: Use pcie_sriov_num_vfs()

2024-02-28 Thread Akihiko Odaki
ualization Management command") Suggested-by: Michael S. Tsirkin Signed-off-by: Akihiko Odaki --- hw/nvme/ctrl.c | 26 -- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index f026245d1e9e..7a56e7b79b4d 100644 --- a/hw/nv

[PATCH v8 08/15] pcie_sriov: Reuse SR-IOV VF device instances

2024-02-28 Thread Akihiko Odaki
Disable SR-IOV VF devices by reusing code to power down PCI devices instead of removing them when the guest requests to disable VFs. This allows to realize devices and report VF realization errors at PF realization time. Signed-off-by: Akihiko Odaki --- docs/pcie_sriov.txt | 8

[PATCH v8 13/15] hw/pci: Use UINT32_MAX as a default value for rombar

2024-02-28 Thread Akihiko Odaki
e literal UINT32_MAX (0x or 4294967295) by chance. Signed-off-by: Akihiko Odaki --- hw/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 84df07a2789b..cb5ac46e9f27 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -71,7 +71,7 @@ sta

[PATCH v8 14/15] hw/pci: Determine if rombar is explicitly enabled

2024-02-28 Thread Akihiko Odaki
. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci_device.h | 5 + hw/vfio/pci.c | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h index ca151325085d..6be0f989ebe0 100644 --- a/include/hw/pci

[PATCH v8 07/15] pcie_sriov: Do not manually unrealize

2024-02-28 Thread Akihiko Odaki
A device gets automatically unrealized when being unparented. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 5 - 1 file changed, 5 deletions(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index e9b23221d713..8b1fd2a89ad7 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci

[PATCH v8 06/15] hw/pci: Rename has_power to enabled

2024-02-28 Thread Akihiko Odaki
The renamed state will not only represent powering state of PFs, but also represent SR-IOV VF enablement in the future. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci.h| 7 ++- include/hw/pci/pci_device.h | 2 +- hw/pci/pci.c| 14 +++--- hw/pci

[PATCH v8 05/15] hw/pci: Always call pcie_sriov_pf_reset()

2024-02-28 Thread Akihiko Odaki
Call pcie_sriov_pf_reset() from pci_do_device_reset() just as we do for msi_reset() and msix_reset() to prevent duplicating code for each SR-IOV PF. Signed-off-by: Akihiko Odaki --- hw/net/igb.c | 2 -- hw/nvme/ctrl.c | 4 hw/pci/pci.c | 1 + 3 files changed, 1 insertion(+), 6

[PATCH v8 03/15] pcie_sriov: Reset SR-IOV extended capability

2024-02-28 Thread Akihiko Odaki
not only disable VFs but also resets the capability. Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 4 ++-- hw/net/igb.c| 2 +- hw/nvme/ctrl.c | 2 +- hw/pci/pcie_sriov.c | 26 ++ 4 files changed, 22 insertions(+), 12

[PATCH v8 04/15] pcie_sriov: Do not reset NumVFs after disabling VFs

2024-02-28 Thread Akihiko Odaki
n (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 51b66d1bb342..e9b23221d713 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -215,7 +215,6

[PATCH v8 11/15] pcie_sriov: Register VFs after migration

2024-02-28 Thread Akihiko Odaki
pcie_sriov doesn't have code to restore its state after migration, but igb, which uses pcie_sriov, naively claimed its migration capability. Add code to register VFs after migration and fix igb migration. Fixes: 3a977deebe6b ("Intrdocue igb device emulation") Signed-off-by

[PATCH v8 10/15] pcie_sriov: Remove num_vfs from PCIESriovPF

2024-02-28 Thread Akihiko Odaki
num_vfs is not migrated so use PCI_SRIOV_CTRL_VFE and PCI_SRIOV_NUM_VF instead. Signed-off-by: Akihiko Odaki --- include/hw/pci/pcie_sriov.h | 1 - hw/pci/pcie_sriov.c | 28 hw/pci/trace-events | 2 +- 3 files changed, 21 insertions(+), 10

[PATCH v8 12/15] hw/pci: Replace -1 with UINT32_MAX for romsize

2024-02-28 Thread Akihiko Odaki
prevent potential breakage. Signed-off-by: Akihiko Odaki Reviewed-by: Markus Armbruster --- hw/pci/pci.c | 8 hw/xen/xen_pt_load_rom.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 54b375da2d26..84df07a2789b 100644 --- a

[PATCH v8 02/15] pcie_sriov: Validate NumVFs

2024-02-28 Thread Akihiko Odaki
The guest may write NumVFs greater than TotalVFs and that can lead to buffer overflow in VF implementations. Cc: qemu-sta...@nongnu.org Fixes: CVE-2024-26327 Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki -

[PATCH v8 15/15] hw/qdev: Remove opts member

2024-02-28 Thread Akihiko Odaki
It is no longer used. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- include/hw/qdev-core.h | 4 hw/core/qdev.c | 1 - system/qdev-monitor.c | 12 +++- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a

[PATCH v8 09/15] pcie_sriov: Release VFs failed to realize

2024-02-28 Thread Akihiko Odaki
Release VFs failed to realize just as we do in unregister_vfs(). Fixes: 7c0fa8dff811 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)") Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pcie_sriov.

[PATCH v8 00/15] hw/pci: SR-IOV related fixes and improvements

2024-02-28 Thread Akihiko Odaki
://patchew.org/QEMU/20231210-sriov-v2-0-b959e8a6d...@daynix.com/ Signed-off-by: Akihiko Odaki --- Changes in v8: - Clarified that "hw/pci: Replace -1 with UINT32_MAX for romsize" is not a bug fix. (Markus Armbruster) - Squashed patch "vfio: Avoid inspecting option QDict for rombar&

Re: [PATCH v8 03/15] pcie_sriov: Reset SR-IOV extended capability

2024-02-28 Thread Akihiko Odaki
On 2024/02/29 1:23, Sriram Yagnaraman wrote: -Original Message- From: Akihiko Odaki Sent: Wednesday, 28 February 2024 12:33 To: Philippe Mathieu-Daudé ; Michael S. Tsirkin ; Marcel Apfelbaum ; Alex Williamson ; Cédric Le Goater ; Paolo Bonzini ; Daniel P. Berrangé ; Eduardo Habkost

[PATCH] plugins: Ensure register handles are not NULL

2024-02-29 Thread Akihiko Odaki
Ensure register handles are not NULL so that a plugin can assume NULL is invalid as a register handle. Signed-off-by: Akihiko Odaki --- plugins/api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/api.c b/plugins/api.c index 81f43c9ce8a4..74e24f0697cd 100644

[PATCH 6/7] contrib/elf2dmp: Continue even contexts are lacking

2024-03-03 Thread Akihiko Odaki
Contexts of some CPUs may be lacking or corrupted due to premature boot, but the output may still contain valuable information of other CPUs and memory. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/main.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a

[PATCH 5/7] contrib/elf2dmp: Use rol64() to decode

2024-03-03 Thread Akihiko Odaki
rol64() is roubust against too large shift values and fixes UBSan warnings. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/main.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index dd686280f981..432f8629f321 100644

[PATCH 3/7] contrib/elf2dmp: Ensure segment fits in file

2024-03-03 Thread Akihiko Odaki
This makes elf2dmp more robust against corrupted inputs. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index 980a7aa5f8fb..d546a400dfda 100644 --- a

[PATCH 7/7] MAINTAINERS: Add Akihiko Odaki as a elf2dmp reviewer

2024-03-03 Thread Akihiko Odaki
Signed-off-by: Akihiko Odaki --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 65dfdc9677e4..d25403f3709b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3583,6 +3583,7 @@ F: util/iova-tree.c elf2dmp M: Viktor Prutyanov +R: Akihiko Odaki S

[PATCH 4/7] contrib/elf2dmp: Use lduw_le_p() to read PDB

2024-03-03 Thread Akihiko Odaki
This resolved UBSan warnings. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/pdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index 40991f5f4c34..2541234205c3 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp

[PATCH 0/7] contrib/elf2dmp: Improve robustness

2024-03-03 Thread Akihiko Odaki
elf2dmp sometimes fails to work with partially corrupted dumps, and also emits warnings when sanitizers are in use. This series are collections of changes to improve the situation. Signed-off-by: Akihiko Odaki --- Akihiko Odaki (7): contrib/elf2dmp: Always check for PA resolution failure

[PATCH 2/7] contrib/elf2dmp: Always destroy PA space

2024-03-03 Thread Akihiko Odaki
Destroy PA space even if paging base couldn't be found, fixing memory leak. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index cbc38a7c103a..dd686280f981 100644

[PATCH 1/7] contrib/elf2dmp: Always check for PA resolution failure

2024-03-03 Thread Akihiko Odaki
Not checking PA resolution failure can result in NULL deference. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.c | 46 - 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp

[PATCH] meson: Remove --warn-common ldflag

2024-03-03 Thread Akihiko Odaki
don't use common blocks by default[1][2] so any remaining use of common blocks should be intentional. Remove --warn-common ldflag to suppress warnings for intentional use of common blocks. [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678 [2]: https://reviews.llvm.org/D75056 Signed-off-by

Re: [PATCH 3/7] contrib/elf2dmp: Ensure segment fits in file

2024-03-04 Thread Akihiko Odaki
On 2024/03/05 2:52, Peter Maydell wrote: On Sun, 3 Mar 2024 at 10:53, Akihiko Odaki wrote: This makes elf2dmp more robust against corrupted inputs. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a

[PATCH v2 00/13] contrib/elf2dmp: Improve robustness

2024-03-04 Thread Akihiko Odaki
elf2dmp sometimes fails to work with partially corrupted dumps, and also emits warnings when sanitizers are in use. This series are collections of changes to improve the situation. Signed-off-by: Akihiko Odaki --- Changes in v2: - Added patch "contrib/elf2dmp: Remove unnecessary err

[PATCH v2 04/13] contrib/elf2dmp: Conform to the error reporting pattern

2024-03-04 Thread Akihiko Odaki
include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.h | 6 +-- contrib/elf2dmp/download.h | 2 +- contrib/elf2dmp/pdb.h | 2 +- contrib/elf2dmp/q

[PATCH v2 02/13] contrib/elf2dmp: Assume error by default

2024-03-04 Thread Akihiko Odaki
A common construct in contrib/elf2dmp is to set "err" flag and goto in error paths. In such a construct, there is only one successful path while there are several error paths, so it will be more simpler to initialize "err" flag set, and clear it in the successful path. Si

[PATCH v2 01/13] contrib/elf2dmp: Remove unnecessary err flags

2024-03-04 Thread Akihiko Odaki
They are always evaluated to 1. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/pdb.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index 40991f5f4c34..abf17c2e7c12 100644 --- a/contrib/elf2dmp/pdb.c +++ b

[PATCH v2 09/13] contrib/elf2dmp: Use rol64() to decode

2024-03-04 Thread Akihiko Odaki
rol64() is roubust against too large shift values and fixes UBSan warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- contrib/elf2dmp/main.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index

[PATCH v2 10/13] MAINTAINERS: Add Akihiko Odaki as a elf2dmp reviewer

2024-03-04 Thread Akihiko Odaki
Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 65dfdc9677e4..d25403f3709b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3583,6 +3583,7 @@ F: util/iova-tree.c elf2dmp M: Viktor

[PATCH v2 11/13] contrib/elf2dmp: Build only for little endian host

2024-03-04 Thread Akihiko Odaki
elf2dmp assumes little endian host in many places. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/elf2dmp/meson.build b/contrib/elf2dmp/meson.build index 6707d43c4fa5..046569861f7a 100644 --- a/contrib

[PATCH v2 13/13] contrib/elf2dmp: Clamp QEMU note to file size

2024-03-04 Thread Akihiko Odaki
This fixes crashes with truncated dumps. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2202 Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/qemu_elf.c | 87 +- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/contrib/elf2dmp

[PATCH v2 12/13] contrib/elf2dmp: Use GPtrArray

2024-03-04 Thread Akihiko Odaki
This removes the need to enumarate QEMUCPUState twice and saves code. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/qemu_elf.c | 25 - 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c index

[PATCH v2 06/13] contrib/elf2dmp: Always destroy PA space

2024-03-04 Thread Akihiko Odaki
Destroy PA space even if paging base couldn't be found, fixing memory leak. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- contrib/elf2dmp/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c

[PATCH v2 08/13] contrib/elf2dmp: Use lduw_le_p() to read PDB

2024-03-04 Thread Akihiko Odaki
This resolved UBSan warnings. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/pdb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index 1c5051425185..492aca4434c8 100644 --- a/contrib/elf2dmp/pdb.c +++ b/contrib/elf2dmp

[PATCH v2 05/13] contrib/elf2dmp: Always check for PA resolution failure

2024-03-04 Thread Akihiko Odaki
Not checking PA resolution failure can result in NULL deference. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.c | 46 - 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp

[PATCH v2 07/13] contrib/elf2dmp: Ensure segment fits in file

2024-03-04 Thread Akihiko Odaki
This makes elf2dmp more robust against corrupted inputs. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index e01860d15b07..81295a11534a 100644 --- a

[PATCH v2 03/13] contrib/elf2dmp: Continue even contexts are lacking

2024-03-04 Thread Akihiko Odaki
Let fill_context() continue even if it fails to fill contexts of some CPUs. A dump may still contain valuable information even if it lacks contexts of some CPUs due to dump corruption or a failure before starting CPUs. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- contrib/elf2dmp

[PATCH RFC v3 3/6] pcie_sriov: Check PCI Express for SR-IOV PF

2024-03-05 Thread Akihiko Odaki
SR-IOV requires PCI Express. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index aac12e70f122..c449ddd0ac39 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -41,6 +41,11

[PATCH RFC v3 1/6] hw/pci: Do not add ROM BAR for SR-IOV VF

2024-03-05 Thread Akihiko Odaki
A SR-IOV VF cannot have a ROM BAR. Co-developed-by: Yui Washizu Signed-off-by: Akihiko Odaki --- hw/pci/pci.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index cb5ac46e9f27..201ff64e11cc 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -2359,6

[PATCH RFC v3 5/6] virtio-pci: Implement SR-IOV PF

2024-03-05 Thread Akihiko Odaki
Allow user to attach SR-IOV VF to a virtio-pci PF. Signed-off-by: Akihiko Odaki --- hw/virtio/virtio-pci.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 1a7039fb0c68..f6a2dbb3b5e2 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw

[PATCH RFC v3 4/6] pcie_sriov: Allow user to create SR-IOV device

2024-03-05 Thread Akihiko Odaki
-creatable VFs can be attached calls pcie_sriov_pf_init_from_user_created_vfs() during realization and pcie_sriov_pf_exit() when exiting. Signed-off-by: Akihiko Odaki --- include/hw/pci/pci_device.h | 6 +- include/hw/pci/pcie_sriov.h | 19 +++ hw/pci/pci.c| 62 ++ hw/pci

[PATCH RFC v3 2/6] pcie_sriov: Ensure PF and VF are mutually exclusive

2024-03-05 Thread Akihiko Odaki
A device cannot be a SR-IOV PF and a VF at the same time. Signed-off-by: Akihiko Odaki --- hw/pci/pcie_sriov.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 09a53ed30027..aac12e70f122 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci

[PATCH RFC v3 6/6] virtio-net: Implement SR-IOV VF

2024-03-05 Thread Akihiko Odaki
A virtio-net device can be added as a SR-IOV VF to another virtio-pci device that will be the PF. Signed-off-by: Akihiko Odaki --- hw/virtio/virtio-net-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-net-pci.c b/hw/virtio/virtio-net-pci.c index e03543a70a75

[PATCH RFC v3 0/6] virtio-net: add support for SR-IOV emulation

2024-03-05 Thread Akihiko Odaki
689731808-3009-1-git-send-email-yui.wash...@gmail.com/ [2] https://lore.kernel.org/all/5d46f455-f530-4e5e-9ae7-13a2297d4...@daynix.com/ Co-developed-by: Yui Washizu Signed-off-by: Akihiko Odaki --- Changes in v3: - Rebased. - Link to v2: https://lore.kernel.org/r/20231210-sriov-v2-0-b959e8a

Re: [PATCH v2 04/13] contrib/elf2dmp: Conform to the error reporting pattern

2024-03-05 Thread Akihiko Odaki
On 2024/03/05 22:28, Peter Maydell wrote: On Tue, 5 Mar 2024 at 07:36, Akihiko Odaki wrote: include/qapi/error.h says: We recommend * bool-valued functions return true on success / false on failure, ... Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.h | 6 +-- contrib

Re: [PATCH v2 11/13] contrib/elf2dmp: Build only for little endian host

2024-03-05 Thread Akihiko Odaki
On 2024/03/05 22:33, Peter Maydell wrote: On Tue, 5 Mar 2024 at 07:37, Akihiko Odaki wrote: elf2dmp assumes little endian host in many places. Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/elf2dmp

[PATCH v3 01/19] contrib/elf2dmp: Remove unnecessary err flags

2024-03-05 Thread Akihiko Odaki
They are always evaluated to 1. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- contrib/elf2dmp/pdb.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c index 40991f5f4c34..abf17c2e7c12 100644 --- a

[PATCH v3 02/19] contrib/elf2dmp: Assume error by default

2024-03-05 Thread Akihiko Odaki
A common construct in contrib/elf2dmp is to set "err" flag and goto in error paths. In such a construct, there is only one successful path while there are several error paths, so it will be more simpler to initialize "err" flag set, and clear it in the successful path. Si

[PATCH v3 05/19] contrib/elf2dmp: Fix error reporting style in addrspace.c

2024-03-05 Thread Akihiko Odaki
include/qapi/error.h says: > We recommend > * bool-valued functions return true on success / false on failure, > ... Signed-off-by: Akihiko Odaki --- contrib/elf2dmp/addrspace.h | 4 ++-- contrib/elf2dmp/addrspace.c | 8 contrib/elf2dmp/main.c

[PATCH v3 14/19] contrib/elf2dmp: Use rol64() to decode

2024-03-05 Thread Akihiko Odaki
rol64() is roubust against too large shift values and fixes UBSan warnings. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- contrib/elf2dmp/main.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index

[PATCH v3 12/19] contrib/elf2dmp: Ensure segment fits in file

2024-03-05 Thread Akihiko Odaki
This makes elf2dmp more robust against corrupted inputs. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- contrib/elf2dmp/addrspace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c index e01860d15b07

<    1   2   3   4   5   6   7   8   9   10   >