Re: hda codec issue

2023-08-16 Thread Volker Rümelin
Cc: qemu-devel@nongnu.org cc Volker Rümelin == so I was curious about: 1. why using wpos, rpos which will increasing along the time, which may overflow in the feature time? wpos and rpos are 64 bit integers. At a sample rate of 96kHz and with 32 bit

[RFC 4/5] hw/nvme: refactor zone append writes using block layer APIs

2023-08-16 Thread Sam Li
Signed-off-by: Sam Li --- block/block-backend.c | 8 ++ block/qcow2.c | 7 +- hw/nvme/ctrl.c| 195 ++ include/sysemu/block-backend-io.h | 1 + include/sysemu/dma.h | 3 + softmmu/dma-helpers.c

[RFC 5/5] hw/nvme: make ZDED persistent

2023-08-16 Thread Sam Li
Zone descriptor extension data (ZDED) is not persistent across QEMU restarts. The zone descriptor extension valid bit (ZDEV) is part of zone attributes, which sets to one when the ZDED is associated with the zone. With the qcow2-ZNS file as the backing file, the NVMe ZNS device stores the zone att

Re: [PATCH v2 0/4] Add full zoned storage emulation to qcow2 driver

2023-08-16 Thread Klaus Jensen
On Aug 14 16:57, Sam Li wrote: > This patch series add a new extension - zoned format - to the > qcow2 driver thereby allowing full zoned storage emulation on > the qcow2 img file. Users can attach such a qcow2 file to the > guest as a zoned device. > > To create a qcow2 file with zoned format, us

Re: [PATCH] include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts

2023-08-16 Thread Marc-André Lureau
On Tue, Aug 15, 2023 at 4:20 PM Thomas Huth wrote: > > Using "-device virtio-gpu,blob=true" currently does not work on big > endian hosts (like s390x). The guest kernel prints an error message > like: > > [drm:virtio_gpu_dequeue_ctrl_func [virtio_gpu]] *ERROR* response 0x1200 > (command 0x10c) >

[PATCH v3 0/2] Fix overflow of the max number of IDs for logic processor and core

2023-08-16 Thread Qian Wen
CPUID.1.EBX[23:16]: Maximum number of addressable IDs for logical processors in this physical package. CPUID.4:EAX[31:26]: Maximum number of addressable IDs for processor cores in the physical package. The current qemu code doesn't limit the value written to these two fields. If the guest has a hu

[PATCH v3 1/2] target/i386: Avoid cpu number overflow in legacy topology

2023-08-16 Thread Qian Wen
The legacy topology enumerated by CPUID.1.EBX[23:16] is defined in SDM Vol2: Bits 23-16: Maximum number of addressable IDs for logical processors in this physical package. When threads_per_socket > 255, it will 1) overwrite bits[31:24] which is apic_id, 2) bits [23:16] get truncated. Specificall

[PATCH v3 2/2] target/i386: Avoid overflow of the cache parameter enumerated by leaf 4

2023-08-16 Thread Qian Wen
According to SDM, CPUID.0x4:EAX[31:26] indicates the Maximum number of addressable IDs for processor cores in the physical package. If we launch over 64 cores VM, the 6-bit field will overflow, and the wrong core_id number will be reported. Since the HW reports 0x3f when the intel processor has ov

Re: [PATCH v2 0/4] Add full zoned storage emulation to qcow2 driver

2023-08-16 Thread Sam Li
Klaus Jensen 于2023年8月16日周三 15:37写道: > > On Aug 14 16:57, Sam Li wrote: > > This patch series add a new extension - zoned format - to the > > qcow2 driver thereby allowing full zoned storage emulation on > > the qcow2 img file. Users can attach such a qcow2 file to the > > guest as a zoned device.

Re: [PATCH v3 1/3] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode

2023-08-16 Thread Cédric Le Goater
On 8/12/23 08:52, Hang Yu wrote: Fixed inconsistency between the regisiter bit field definition header file and the ast2600 datasheet. The reg name is I2CD1C:Pool Buffer Control Register in old register mode and I2CC0C: Master/Slave Pool Buffer Control Register in new register mode. They share b

Re: [PATCH v3 3/3] hw/i2c/aspeed: Add support for buffer organization

2023-08-16 Thread Cédric Le Goater
On 8/12/23 08:52, Hang Yu wrote: Added support for the buffer organization option in pool buffer control register.when set to 1,The buffer is split into two parts: Lower 16 bytes for Tx and higher 16 bytes for Rx. Signed-off-by: Hang Yu Reviewed-by: Cédric Le Goater Thanks, C. --- v2-->

Re: [PATCH v3 2/3] hw/i2c/aspeed: Fix TXBUF transmission start position error

2023-08-16 Thread Cédric Le Goater
On 8/12/23 08:52, Hang Yu wrote: According to the ast2600 datasheet and the linux aspeed i2c driver, the TXBUF transmission start position should be TXBUF[0] instead of TXBUF[1],so the arg pool_start is useless,and the address is not included in TXBUF.So even if Tx Count equals zero,there is at l

Re: [PATCH] target/i386: Fix reporting of CPU dies when nr_cores=nr_threads=1

2023-08-16 Thread Wen, Qian
On 7/24/2023 2:59 AM, 小太 wrote: > When QEMU is started with `-smp D,sockets=1,dies=D,cores=1,threads=1` (that > is, 1 socket with D dies but each die contains just a single thread), both > Linux and Windows guests incorrectly interprets the system as having D > sockets with 1 die each > > Ultimate

[PATCH] subprojects/berkeley-testfloat-3: Update to fix a problem with compiler warnings

2023-08-16 Thread Thomas Huth
Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC. Reported-by: Olaf Hering Signed-off-by: T

Re: [PATCH] target/riscv: Update CSR bits name for svadu extension

2023-08-16 Thread Daniel Henrique Barboza
On 8/14/23 23:24, Weiwei Li wrote: The Svadu specification updated the name of the *envcfg bit from HADE to ADUE. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang --- target/riscv/cpu.c| 4 ++-- target/riscv/cpu_bits.h | 8 target/riscv/cpu_helper.c | 4 ++--

Re: qemu-system-m68k: ../hw/scsi/scsi-disk.c:557: scsi_write_data: Assertion `r->req.aiocb == NULL' failed.

2023-08-16 Thread Philippe Mathieu-Daudé
Hi Waldemar On 13/8/23 09:46, Waldemar Brodkorb wrote: Hi, I am using Qemu 8.0.3 and getting this error: qemu-system-m68k: ../hw/scsi/scsi-disk.c:557: scsi_write_data: Assertion `r->req.aiocb == NULL' failed. It happens f.e. when I extract the glibc source code inside Linux. Linux 6.1.44, gli

Re: [PATCH v2 0/3] block: align CoR requests to subclusters

2023-08-16 Thread Andrey Drobyshev
On 7/31/23 17:51, Andrey Drobyshev wrote: > On 7/24/23 16:11, Andrey Drobyshev wrote: >> On 7/11/23 20:25, Andrey Drobyshev wrote: >>> v1 --> v2: >>> * Fixed line indentation; >>> * Fixed wording in a comment; >>> * Added R-b. >>> >>> v1: https://lists.nongnu.org/archive/html/qemu-block/2023-06/

Re: [PATCH 0/6] qemu-img: rebase: add compression support

2023-08-16 Thread Andrey Drobyshev
On 7/31/23 17:43, Andrey Drobyshev wrote: > On 7/24/23 16:11, Andrey Drobyshev wrote: >> On 6/30/23 13:54, Denis V. Lunev wrote: >>> On 6/1/23 21:28, Andrey Drobyshev wrote: This series is adding [-c | --compress] option to "qemu-img rebase" command, which might prove useful for saving so

Re: [PATCH v2 0/3] qemu-img: map: implement support for compressed clusters

2023-08-16 Thread Andrey Drobyshev
On 7/31/23 17:45, Andrey Drobyshev wrote: > On 7/24/23 16:10, Andrey Drobyshev wrote: >> On 7/6/23 19:30, Andrey Drobyshev wrote: >>> v1 --> v2: >>> * Add vmdk format to the 1st commit. Tweak commit message accordingly; >>> * Make "compressed" field in MapEntry optional. >>> >>> v1: https://li

Re: [PATCH for-8.2] target/m68k: Use tcg_gen_deposit_i32 in gen_partset_reg

2023-08-16 Thread Philippe Mathieu-Daudé
On 13/8/23 17:54, Richard Henderson wrote: Signed-off-by: Richard Henderson --- target/m68k/translate.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH 0/2] nvme: avoid dynamic stack allocations

2023-08-16 Thread Philippe Mathieu-Daudé
On 11/8/23 19:47, Peter Maydell wrote: The QEMU codebase has very few C variable length arrays, and if we can get rid of them all we can make the compiler error on new additions. This is a defensive measure against security bugs where an on-stack dynamic allocation isn't correctly size-checked (e

Re: [PATCH 4/9] tests: remove test-gdbstub.py

2023-08-16 Thread Ilya Leoshkevich
On Tue, 2023-08-15 at 15:51 +0100, Alex Bennée wrote: > This isn't directly called by our CI and because it doesn't run via > our run-test.py script does things slightly differently. Lets remove > it as we have plenty of working in-tree tests now for various aspects > of gdbstub. > > Signed-off-by

Re: [PATCH 5/9] tests/tcg: clean-up gdb confirm/pagination settings

2023-08-16 Thread Ilya Leoshkevich
On Tue, 2023-08-15 at 15:51 +0100, Alex Bennée wrote: > We can do this all in the run-test.py script so remove the extraneous > bits from the individual tests which got copied from the original > non-CI gdb tests. > > Signed-off-by: Alex Bennée > --- >  tests/guest-debug/run-test.py  

Re: qemu-system-m68k: ../hw/scsi/scsi-disk.c:557: scsi_write_data: Assertion `r->req.aiocb == NULL' failed.

2023-08-16 Thread Waldemar Brodkorb
Hi, Philippe Mathieu-Daudé wrote, > Hi Waldemar > > On 13/8/23 09:46, Waldemar Brodkorb wrote: > > Hi, > > > > I am using Qemu 8.0.3 and getting this error: > > qemu-system-m68k: ../hw/scsi/scsi-disk.c:557: scsi_write_data: Assertion > > `r->req.aiocb == NULL' failed. > > > > It happens f.e. w

Re: [PATCH] qemu_cleanup: begin drained section after vm_shutdown()

2023-08-16 Thread Kevin Wolf
Am 14.08.2023 um 15:53 hat Kevin Wolf geschrieben: > Am 06.07.2023 um 16:43 hat Paolo Bonzini geschrieben: > > Queued, thanks. > > This patch broke qemu-iotests 109 (for raw images), some block jobs get > now paused once more. This is probably okay, but please double check and > fix either the ref

Re: [PATCH] migrate/ram: let ram_save_target_page_legacy() return if qemu file got error

2023-08-16 Thread Fabiano Rosas
Guoyi Tu writes: > When the migration process of a virtual machine using huge pages is > cancelled, > QEMU will continue to complete the processing of the current huge page > through the qemu file object got an error set. These processing, such as > compression and encryption, will consume a lot

Re: [PATCH 7/9] gdbstub: remove unused user_ctx field

2023-08-16 Thread Ilya Leoshkevich
On Tue, 2023-08-15 at 15:51 +0100, Alex Bennée wrote: > This was always NULL so drop it. > > Signed-off-by: Alex Bennée > --- >  gdbstub/gdbstub.c | 16 >  1 file changed, 8 insertions(+), 8 deletions(-) Acked-by: Ilya Leoshkevich

Re: [PATCH 4/9] tests: remove test-gdbstub.py

2023-08-16 Thread Alex Bennée
Ilya Leoshkevich writes: > On Tue, 2023-08-15 at 15:51 +0100, Alex Bennée wrote: >> This isn't directly called by our CI and because it doesn't run via >> our run-test.py script does things slightly differently. Lets remove >> it as we have plenty of working in-tree tests now for various aspect

Re: qemu-system-x86 dependencies

2023-08-16 Thread Philippe Mathieu-Daudé
Cc'ing Michael On 16/8/23 13:52, Fourhundred Thecat wrote: Hello, I am trying to install qemu-system-x86 on Debian 12. But through the dependency cascade, it wants to install sound infrastructure with gstreamer libraries. Which leads to absurd dependencies, such as:   libasound2   libgstrea

Re: [PATCH 2/9] tests/docker: cleanup non-verbose output

2023-08-16 Thread Philippe Mathieu-Daudé
On 15/8/23 16:51, Alex Bennée wrote: Even with --quiet docker will spam the sha256 to the console. Avoid this by redirecting stdout. While we are at it fix the name we echo which was broken during 0b1a649047 (tests/docker: use direct RUNC call to build containers). Signed-off-by: Alex Bennée Re

Re: [PATCH 5/9] tests/tcg: clean-up gdb confirm/pagination settings

2023-08-16 Thread Philippe Mathieu-Daudé
On 15/8/23 16:51, Alex Bennée wrote: We can do this all in the run-test.py script so remove the extraneous bits from the individual tests which got copied from the original non-CI gdb tests. Signed-off-by: Alex Bennée --- tests/guest-debug/run-test.py | 2 ++ tests/tc

Re: [PATCH] subprojects/berkeley-testfloat-3: Update to fix a problem with compiler warnings

2023-08-16 Thread Philippe Mathieu-Daudé
On 16/8/23 11:15, Thomas Huth wrote: Update the berkeley-testfloat-3 wrap to include a patch provided by Olaf Hering. This fixes a problem with "control reaches end of non-void function [-Werror=return-type]" compiler warning/errors that are now enabled by default in certain versions of GCC. e7

Re: qemu-system-x86 dependencies

2023-08-16 Thread Michael Tokarev
16.08.2023 15:37, Philippe Mathieu-Daudé пишет: Cc'ing Michael On 16/8/23 13:52, Fourhundred Thecat wrote: Hello, I am trying to install qemu-system-x86 on Debian 12. But through the dependency cascade, it wants to install sound infrastructure with gstreamer libraries. Which leads to absurd d

Re:Re: [PATCH v3 1/3] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode

2023-08-16 Thread Hang Yu
Hello! Thank you for your review!Sorry I forgot to cc other maintainers so I resend this mail. From: "Cédric Le Goater" Date: 2023-08-16 16:32:58 To: Hang Yu ,qemu-devel@nongnu.org Cc: koml...@google.com,pe...@pjd.dev,Peter Maydell ,Andrew Jeffery ,Joel Stanley ,"open list:ASPEED BMCs" ,qe

Re: qemu-system-m68k: ../hw/scsi/scsi-disk.c:557: scsi_write_data: Assertion `r->req.aiocb == NULL' failed.

2023-08-16 Thread Mark Cave-Ayland
On 16/08/2023 12:30, Waldemar Brodkorb wrote: Hi, Philippe Mathieu-Daudé wrote, Hi Waldemar On 13/8/23 09:46, Waldemar Brodkorb wrote: Hi, I am using Qemu 8.0.3 and getting this error: qemu-system-m68k: ../hw/scsi/scsi-disk.c:557: scsi_write_data: Assertion `r->req.aiocb == NULL' failed.

Re: [PATCH 1/2] virtio: use blk_io_plug_call() in virtio_irqfd_notify()

2023-08-16 Thread Ilya Maximets
On 8/15/23 14:08, Stefan Hajnoczi wrote: > virtio-blk and virtio-scsi invoke virtio_irqfd_notify() to send Used > Buffer Notifications from an IOThread. This involves an eventfd > write(2) syscall. Calling this repeatedly when completing multiple I/O > requests in a row is wasteful. Hi, Stefan. T

[PATCH v3 00/25] plugins: Allow to read registers

2023-08-16 Thread Akihiko Odaki
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 capability to read registers from plugins. In this series, I propose to add such a capability by reusing gdbstub

[PATCH v3 03/25] gdbstub: Add num_regs member to GDBFeature

2023-08-16 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 --- include

[PATCH v3 01/25] contrib/plugins: Use GRWLock in execlog

2023-08-16 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 get

[PATCH v3 08/25] target/arm: Use GDBFeature for dynamic XML

2023-08-16 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/arm/cpu.h | 20 +++--- target/arm/internals.h | 2 +- target/arm/gdbst

[PATCH v3 06/25] hw/core/cpu: Replace gdb_core_xml_file with gdb_core_feature

2023-08-16 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 u

[PATCH v3 12/25] gdbstub: Use GDBFeature for GDBRegisterState

2023-08-16 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 7fa4b8b51f.

[PATCH v3 09/25] target/ppc: Use GDBFeature for dynamic XML

2023-08-16 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/ppc/cpu-qom.h | 3 +-- target/ppc/cpu.h | 2 +- target/ppc/cpu_init.c |

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

2023-08-16 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. Loo

[PATCH v3 13/25] hw/core/cpu: Return static value with gdb_arch_name()

2023-08-16 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 v3 19/25] gdbstub: Hide gdb_has_xml

2023-08-16 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 4876ebd74f..6a7c5

[PATCH v3 11/25] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-08-16 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 --- inclu

[PATCH v3 20/25] gdbstub: Expose functions to read registers

2023-08-16 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 v3 02/25] gdbstub: Introduce GDBFeature structure

2023-08-16 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 v3 15/25] gdbstub: Simplify XML lookup

2023-08-16 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 deleti

[PATCH v3 18/25] hw/core/cpu: Add a parameter to gdb_read_register/gdb_write_register

2023-08-16 Thread Akihiko Odaki
gdbstub has a static variable named gdb_has_xml that tells if workarounds for old GDB versions are required when manipulating registers for GDB. Now we are reusing the infrastructure to manipulate registers for plugins. Plugins will not need these workarounds even when an old GDB is attached. Conv

[PATCH v3 17/25] gdbstub: Add members to identify registers to GDBFeature

2023-08-16 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 | 8 ++-- target/arm/gdbst

[PATCH v3 07/25] gdbstub: Introduce GDBFeatureBuilder

2023-08-16 Thread Akihiko Odaki
GDBFeatureBuilder unifies the logic to generate dynamic GDBFeature. Signed-off-by: Akihiko Odaki --- include/exec/gdbstub.h | 20 ++ gdbstub/gdbstub.c | 59 ++ 2 files changed, 79 insertions(+) diff --git a/include/exec/gdbstub.h b/includ

[PATCH v3 21/25] cpu: Call plugin hooks only when ready

2023-08-16 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 v3 22/25] plugins: Allow to read registers

2023-08-16 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-plugin

[PATCH v3 24/25] plugins: Support C++

2023-08-16 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/i

[PATCH v3 14/25] gdbstub: Dynamically allocate target.xml buffer

2023-08-16 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 +- gdbstub/gdb

[PATCH v3 25/25] contrib/plugins: Add cc plugin

2023-08-16 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 v3 23/25] contrib/plugins: Allow to log registers

2023-08-16 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, 118 insertions(+), 32 deletions(-) diff --git a/docs/devel/tcg-plugins.rst

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

2023-08-16 Thread Akihiko Odaki
On 2023/08/14 20:59, Alex Bennée wrote: Akihiko Odaki writes: 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

[PATCH v3 16/25] hw/core/cpu: Remove gdb_get_dynamic_xml member

2023-08-16 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 v3 10/25] target/riscv: Use GDBFeature for dynamic XML

2023-08-16 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 +-- target/riscv/gdbstub

[PATCH v3 04/25] gdbstub: Introduce gdb_find_static_feature()

2023-08-16 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 --- include/exec/gdbstub.h | 2 ++ gdbstub/gdbstub.c | 13 + 2 files changed, 15 insertions

Re: [RFC PATCH 12/24] gdbstub: Simplify XML lookup

2023-08-16 Thread Akihiko Odaki
On 2023/08/14 22:27, Alex Bennée wrote: Akihiko Odaki writes: 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

Re: [PATCH v2 0/3] block: align CoR requests to subclusters

2023-08-16 Thread Stefan Hajnoczi
On Tue, Jul 11, 2023 at 08:25:50PM +0300, Andrey Drobyshev via wrote: > v1 --> v2: > * Fixed line indentation; > * Fixed wording in a comment; > * Added R-b. > > v1: https://lists.nongnu.org/archive/html/qemu-block/2023-06/msg00606.html > > Andrey Drobyshev (3): > block: add subcluster_size

Re: [PATCH 4/9] tests: remove test-gdbstub.py

2023-08-16 Thread Ilya Leoshkevich
On Wed, 2023-08-16 at 13:33 +0100, Alex Bennée wrote: > > Ilya Leoshkevich writes: > > > On Tue, 2023-08-15 at 15:51 +0100, Alex Bennée wrote: > > > This isn't directly called by our CI and because it doesn't run > > > via > > > our run-test.py script does things slightly differently. Lets > > >

Re: qemu-system-x86 dependencies

2023-08-16 Thread Fourhundred Thecat
> On 2023-08-16 14:52, Michael Tokarev wrote: 16.08.2023 15:37, Philippe Mathieu-Daudé пишет: Cc'ing Michael On 16/8/23 13:52, Fourhundred Thecat wrote: Hello, I am trying to install qemu-system-x86 on Debian 12. But through the dependency cascade, it wants to install sound infrastructure wi

[PATCH v2] target/riscv: Update CSR bits name for svadu extension

2023-08-16 Thread Weiwei Li
The Svadu specification updated the name of the *envcfg bit from HADE to ADUE. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang --- v2: * rename hade variable name to adue suggested by Daniel target/riscv/cpu.c| 4 ++-- target/riscv/cpu_bits.h | 8 target/riscv/cpu_h

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

2023-08-16 Thread Akihiko Odaki
On 2023/08/14 23:56, Alex Bennée wrote: Akihiko Odaki writes: 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 +--

[PATCH v4 0/8] Fix segfault on migration return path

2023-08-16 Thread Fabiano Rosas
The major change from v3 is the dropping of shutdown() before close() as suggested by Peter. I also added a yank handler to rp_state.from_dst_file. CI run: https://gitlab.com/farosas/qemu/-/pipelines/969570891 v3: https://lore.kernel.org/r/20230811150836.2895-1-faro...@suse.de I decided to fix

[PATCH v4 8/8] migration: Add a wrapper to cleanup migration files

2023-08-16 Thread Fabiano Rosas
We currently have a pattern for cleaning up a migration QEMUFile: qemu_mutex_lock(&s->qemu_file_lock); file = s->file_name; s->file_name = NULL; qemu_mutex_unlock(&s->qemu_file_lock); migration_ioc_unregister_yank_from_file(file); qemu_file_shutdown(file); qemu_fclose(file); There

[PATCH v4 3/8] migration: Fix possible race when shutting down to_dst_file

2023-08-16 Thread Fabiano Rosas
It's not safe to call qemu_file_shutdown() on the to_dst_file without first checking for the file's presence under the lock. The cleanup of this file happens at postcopy_pause() and migrate_fd_cleanup() which are not necessarily running in the same thread as migrate_fd_cancel(). Reviewed-by: Peter

[PATCH v4 5/8] migration: Consolidate return path closing code

2023-08-16 Thread Fabiano Rosas
We'll start calling the await_return_path_close_on_source() function from other parts of the code, so move all of the related checks and tracepoints into it. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 29 ++--- 1 file changed, 14 inser

[PATCH 0/4] tcg/aarch64: Enable BTI within the JIT

2023-08-16 Thread Richard Henderson
Patch 1 is cherry-picked from [PATCH v3 02/14] tcg: Add tcg_out_tb_start backend hook https://lore.kernel.org/qemu-devel/20230815195741.8325-3-richard.hender...@linaro.org/T/#u here used for a different application. There are not as many landing pads as I had imagined, so the overhead here is re

Re: [PATCH v3 10/10] migration: Add a wrapper to cleanup migration files

2023-08-16 Thread Peter Xu
On Tue, Aug 15, 2023 at 07:31:28PM -0300, Fabiano Rosas wrote: > Peter Xu writes: > > > On Fri, Aug 11, 2023 at 12:08:36PM -0300, Fabiano Rosas wrote: > >> We currently have a pattern for cleaning up a migration QEMUFile: > >> > >> qemu_mutex_lock(&s->qemu_file_lock); > >> file = s->file_nam

[PATCH v4 1/8] migration: Fix possible race when setting rp_state.error

2023-08-16 Thread Fabiano Rosas
We don't need to set the rp_state.error right after a shutdown because qemu_file_shutdown() always sets the QEMUFile error, so the return path thread would have seen it and set the rp error itself. Setting the error outside of the thread is also racy because the thread could clear it after we set

[PATCH v4 2/8] migration: Fix possible races when shutting down the return path

2023-08-16 Thread Fabiano Rosas
We cannot call qemu_file_shutdown() on the return path file without taking the file lock. The return path thread could be running it's cleanup code and have just cleared the from_dst_file pointer. Checking ms->to_dst_file for errors could also race with migrate_fd_cleanup() which clears the to_dst

[PATCH v4 6/8] migration: Replace the return path retry logic

2023-08-16 Thread Fabiano Rosas
Replace the return path retry logic with finishing and restarting the thread. This fixes a race when resuming the migration that leads to a segfault. Currently when doing postcopy we consider that an IO error on the return path file could be due to a network intermittency. We then keep the thread

[PATCH v4 4/8] migration: Remove redundant cleanup of postcopy_qemufile_src

2023-08-16 Thread Fabiano Rosas
This file is owned by the return path thread which is already doing cleanup. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 5e6a766235..195726eb4a 100644 --

[PATCH 2/4] util/cpuinfo-aarch64: Add CPUINFO_BTI

2023-08-16 Thread Richard Henderson
Signed-off-by: Richard Henderson --- host/include/aarch64/host/cpuinfo.h | 1 + util/cpuinfo-aarch64.c | 4 2 files changed, 5 insertions(+) diff --git a/host/include/aarch64/host/cpuinfo.h b/host/include/aarch64/host/cpuinfo.h index 769626b098..a59c8418d2 100644 --- a/host/in

[PATCH 1/4] tcg: Add tcg_out_tb_start backend hook

2023-08-16 Thread Richard Henderson
This hook may emit code at the beginning of the TB. Suggested-by: Jordan Niethe Signed-off-by: Richard Henderson --- tcg/tcg.c| 3 +++ tcg/aarch64/tcg-target.c.inc | 5 + tcg/arm/tcg-target.c.inc | 5 + tcg/i386/tcg-target.c.inc| 5 + tcg/

[PATCH 4/4] tcg: Map code_gen_buffer with PROT_BTI

2023-08-16 Thread Richard Henderson
For linux aarch64 host supporting BTI, map the buffer to require BTI instructions at branch landing pads. Signed-off-by: Richard Henderson --- tcg/region.c | 39 --- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/tcg/region.c b/tcg/region.c in

[PATCH v4 7/8] migration: Move return path cleanup to main migration thread

2023-08-16 Thread Fabiano Rosas
Now that the return path thread is allowed to finish during a paused migration, we can move the cleanup of the QEMUFiles to the main migration thread. Reviewed-by: Peter Xu Signed-off-by: Fabiano Rosas --- migration/migration.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-)

[PATCH 3/4] tcg/aarch64: Emit BTI insns at jump landing pads

2023-08-16 Thread Richard Henderson
The prologue is entered via "call"; the epilogue, each tb, and each goto_tb continuation point are all reached via "jump". As tcg_out_goto_long is only used by tcg_out_exit_tb, merge the two functions. Change the indirect register used to TCG_REG_TMP1, aka X16, so that the BTI condition created i

Re: [PATCH v2] target/riscv: Update CSR bits name for svadu extension

2023-08-16 Thread Daniel Henrique Barboza
On 8/16/23 11:19, Weiwei Li wrote: The Svadu specification updated the name of the *envcfg bit from HADE to ADUE. Signed-off-by: Weiwei Li Signed-off-by: Junqiang Wang --- Reviewed-by: Daniel Henrique Barboza v2: * rename hade variable name to adue suggested by Daniel target/riscv/

Re: [RFC PATCH 21/24] plugins: Allow to read registers

2023-08-16 Thread Akihiko Odaki
On 2023/08/15 0:05, Alex Bennée wrote: Akihiko Odaki writes: It is based on GDB protocol to ensure interface stability. See comments bellow. The timing of the vcpu init hook is also changed so that the hook will get called after GDB features are initialized. This might be worth splittin

Re: [PATCH] migrate/ram: let ram_save_target_page_legacy() return if qemu file got error

2023-08-16 Thread Peter Xu
On Tue, Aug 15, 2023 at 07:42:24PM -0300, Fabiano Rosas wrote: > Yep, I see that. I meant explicitly move the code into the loop. Feels a > bit weird to check the QEMUFile for errors first thing inside the > function when nothing around it should have touched the QEMUFile. Valid point. This remin

[PATCH v4 00/25] plugins: Allow to read registers

2023-08-16 Thread Akihiko Odaki
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 capability to read registers from plugins. In this series, I propose to add such a capability by reusing gdbstub

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

2023-08-16 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. Loo

[PATCH v4 01/25] contrib/plugins: Use GRWLock in execlog

2023-08-16 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 get

[PATCH v4 09/25] target/ppc: Use GDBFeature for dynamic XML

2023-08-16 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/ppc/cpu-qom.h | 3 +-- target/ppc/cpu.h | 2 +- target/ppc/cpu_init.c |

[PATCH v4 04/25] gdbstub: Introduce gdb_find_static_feature()

2023-08-16 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 --- include/exec/gdbstub.h | 2 ++ gdbstub/gdbstub.c | 13 + 2 files changed, 15 insertions

[PATCH v4 08/25] target/arm: Use GDBFeature for dynamic XML

2023-08-16 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/arm/cpu.h | 20 +++--- target/arm/internals.h | 2 +- target/arm/gdbst

[PATCH v4 10/25] target/riscv: Use GDBFeature for dynamic XML

2023-08-16 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 +-- target/riscv/gdbstub

[PATCH v4 11/25] gdbstub: Use GDBFeature for gdb_register_coprocessor

2023-08-16 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 --- inclu

[PATCH v4 14/25] gdbstub: Dynamically allocate target.xml buffer

2023-08-16 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 +- gdbstub/gdb

[PATCH v4 20/25] gdbstub: Expose functions to read registers

2023-08-16 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 2/3] tcg: Fold deposit with zero to and

2023-08-16 Thread Richard Henderson
Inserting a zero into a value, or inserting a value into zero at offset 0 my be implemented with AND. Signed-off-by: Richard Henderson --- tcg/optimize.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/tcg/optimize.c b/tcg/optimize.c index d2156367a3..956

[PATCH v4 22/25] plugins: Allow to read registers

2023-08-16 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-plugin

[PATCH v4 12/25] gdbstub: Use GDBFeature for GDBRegisterState

2023-08-16 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 7fa4b8b51f.

  1   2   3   >