Re: [PATCH 15/23] i386: Destructive vector helpers for AVX

2022-08-27 Thread Paolo Bonzini
Il sab 27 ago 2022, 01:46 Richard Henderson ha scritto: > +#define PACK_WIDTH (4 << SHIFT) > > Incorrect for AVX, it was correct with the ifdef in v1. > Perhaps just (SHIFT ? 8 : 4)? > That's intentional, the AVX patches change it to an #ifndef that AVX overrides. For now the purpose of the

[PATCH v3 3/4] hw/nvme: add iothread support

2022-08-27 Thread Jinhao Fan
Add an option "iothread=x" to do emulation in a seperate iothread. This improves the performance because QEMU's main loop is responsible for a lot of other work while iothread is dedicated to NVMe emulation. Moreover, emulating in iothread brings the potential of polling on SQ/CQ doorbells, which

[PATCH] hw/net/tulip: Fix DMA reentrancy issue with stack overflow (CVE-2022-2962)

2022-08-27 Thread Thomas Huth
The Tulip NIC can be used to trigger an endless recursion when its descriptors are set up to its own MMIO address space. Fix it by limiting the DMA accesses to normal memory. Fixes: CVE-2022-2962 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1171 Signed-off-by: Thomas Huth ---

Re: [PATCH] ui/cocoa: Support hardware cursor interface

2022-08-27 Thread Elliot Nunn
Resending this patch now that 7.1 is released (well done). > On 4 Aug 2022, at 2:27 pm, Elliot Nunn wrote: > > Implement dpy_cursor_define() and dpy_mouse_set() on macOS. > > The main benefit is from dpy_cursor_define: in absolute pointing mode, the > host can redraw the cursor on the guest's

Re: [PATCH 12/20] disas/nanomips: Replace std::string type

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: The return type of typedef disassembly_function is changed to const char * instead of std::string. Therefore, for every particular disassembly_function function signature is changed. For example: - static std::string ABS_D(uint64 instruction) {...} is

Re: [PATCH 13/20] disas/nanomips: Add free() calls

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: The free() function is called for every string allocated using the strdup() function to prevent memory leaking. The implementation of the several functions working with dynamically allocated strings is slightly changed so we can free those strings.

Re: [PATCH 16/20] disas/nanomips: Replace Cpp enums for C enums

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: Change enums to typedef enums to keep naming clear Signed-off-by: Milica Lazarevic --- disas/nanomips.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index

[PATCH v3 2/4] hw/nvme: use KVM irqfd when available

2022-08-27 Thread Jinhao Fan
Use KVM's irqfd to send interrupts when possible. This approach is thread safe. Moreover, it does not have the inter-thread communication overhead of plain event notifiers since handler callback are called in the same system call as irqfd write. Signed-off-by: Jinhao Fan Signed-off-by: Klaus

[PATCH v3 1/4] hw/nvme: support irq(de)assertion with eventfd

2022-08-27 Thread Jinhao Fan
When the new option 'irq-eventfd' is turned on, the IO emulation code signals an eventfd when it want to (de)assert an irq. The main loop eventfd handler does the actual irq (de)assertion. This paves the way for iothread support since QEMU's interrupt emulation is not thread safe. Asserting and

Re: [PATCH 14/20] disas/nanomips: Remove function overloading

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: Renamed the following functions by adding a suffix: - copy to copy_ui and copy_i - IMMEDIATE to IMMEDIATE_UI and IMMEDIATE_I Calls to copy and IMMEDIATE functions are replaced based on the type of arguments. Disassemble function that calls the other

Re: [PATCH 15/20] disas/nanomips: Replace exception handling

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: Since there's no support for exception handling in C, the try-catch blocks have been deleted, and throw clauses are replaced. When a runtime error happens, we're printing out the error message. Disassembling of the current instruction interrupts. This

Re: [PATCH 18/20] disas/nanomips: Add struct keyword

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: Changed the type of the table parameter in Disassemble function: - from const Pool * - to const struct Pool * Signed-off-by: Milica Lazarevic --- disas/nanomips.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v3 4/4] hw/nvme: add polling support

2022-08-27 Thread Jinhao Fan
Add AioContext polling handlers for NVMe SQ and CQ. By employing polling, the latency of NVMe IO emulation is greatly reduced. The SQ polling handler checks for updates on the SQ tail shadow doorbell buffer. The CQ polling handler is an empty function because we procatively polls the CQ head

[PATCH v2] KVM: dirty ring: add missing memory barrier

2022-08-27 Thread Paolo Bonzini
The KVM_DIRTY_GFN_F_DIRTY flag ensures that the entry is valid. If the read of the fields are not ordered after the read of the flag, QEMU might see stale values. Cc: Peter Xu Cc: Gavin Shan Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 6 +- 1 file changed, 5 insertions(+), 1

Re: [PATCH 19/20] disas/nanomips: Add modifier static

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: Modifier static has been added to the remaining functions that shouldn't be used outside of the nanomips disassembler. Signed-off-by: Milica Lazarevic --- disas/nanomips.cpp | 8 1 file changed, 4 insertions(+), 4 deletions(-)

Re: [PATCH 17/20] disas/nanomips: Remove argument passing by ref

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: Replaced argument passing by reference with passing by address. Signed-off-by: Milica Lazarevic --- disas/nanomips.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp index

Re: [PATCH 20/20] disas/nanomips: Rename nanomips.cpp to nanomips.c

2022-08-27 Thread Thomas Huth
On 15/08/2022 09.26, Milica Lazarevic wrote: Now that everything has been converted to C code the nanomips.cpp file has been renamed. Therefore, meson.build file is also changed. Signed-off-by: Milica Lazarevic --- disas/meson.build | 2 +- disas/{nanomips.cpp =>

Re: [PATCH v2 2/3] hw/nvme: use KVM irqfd when available

2022-08-27 Thread Jinhao Fan
at 11:34 PM, Keith Busch wrote: > On Fri, Aug 26, 2022 at 11:12:04PM +0800, Jinhao Fan wrote: >> Use KVM's irqfd to send interrupts when possible. This approach is >> thread safe. Moreover, it does not have the inter-thread communication >> overhead of plain event notifiers since handler

[PATCH v3 0/4] irqfd, iothread and polling support

2022-08-27 Thread Jinhao Fan
This series of performance enhancements brings iothread and polling capabilities to qemu-nvme. The first two patches implements support for irqfd, which solves thread safety problems for interrupt emulation outside the main loop thread. The third patch adds support for emulating NVMe IO queues in

Re: [PATCH v1 22/25] tests/docker: update and flatten debian-toolchain

2022-08-27 Thread Alex Bennée
Thomas Huth writes: > On 26/08/2022 19.21, Alex Bennée wrote: >> Update to the latest stable Debian. While we are at it flatten into a >> single dockerfile as we do not need anything from the base image to >> build the toolchain. This is used to build both the nios and >> microblaze

[PATCH v2] hw/arm: fix the position of vcram for raspi

2022-08-27 Thread Frederik van Hövell
From: Alex Bennée The previous calculation fell over when I tried to create a 8gb Pi 4 because the values were only 32 bit. However the quirk of the Pi hardware is the vcram can only appear in the first 1gb of address space. This also limits where the initial kernel and DTB can be loaded (notice

Re: [PATCH 40/51] chardev/char-file: Add FILE_SHARE_WRITE when openning the file for win32

2022-08-27 Thread Bin Meng
On Fri, Aug 26, 2022 at 9:23 PM Marc-André Lureau wrote: > > Hi > > On Fri, Aug 26, 2022 at 5:16 PM Bin Meng wrote: >> >> On Thu, Aug 25, 2022 at 3:59 PM Marc-André Lureau >> wrote: >> > >> > Hi >> > >> > On Wed, Aug 24, 2022 at 1:43 PM Bin Meng wrote: >> > > >> > > From: Xuzhou Cheng >> > >

Re: [PATCH 2/3] target/avr: Only execute one interrupt at a time

2022-08-27 Thread Michael Rolnik
Reviewed-by: Michael Rolnik On Fri, Aug 26, 2022 at 11:55 PM Richard Henderson < richard.hender...@linaro.org> wrote: > We cannot deliver two interrupts simultaneously; > the first interrupt handler must execute first. > > Signed-off-by: Richard Henderson > --- > target/avr/helper.c | 9

Re: [PATCH] softmmu/physmem: Fix address of FlatView access in address_space_(read|write)_cached_slow()

2022-08-27 Thread Peter Xu
Hi, Alberto, On Fri, Aug 26, 2022 at 05:09:27PM +0100, Alberto Faria wrote: > Apply cache->xlat to addr before passing it to > flatview_(read|write)_continue(), to convert it from the > MemoryRegionCache's address space to the FlatView's. Any bug encountered? It'll be great to add more

Re: [RFC PATCH 2/2] kvm/kvm-all.c: listener should delay kvm_vm_ioctl to the commit phase

2022-08-27 Thread Peter Xu
Hi, Emanuele, On Fri, Aug 26, 2022 at 04:07:01PM +0200, Emanuele Giuseppe Esposito wrote: > > > Am 22/08/2022 um 16:10 schrieb Peter Xu: > > On Thu, Aug 18, 2022 at 09:55:20PM -0300, Leonardo Bras Soares Passos wrote: > >> On Thu, Aug 18, 2022 at 5:05 PM Peter Xu wrote: > >>> > >>> On Tue, Aug

Re: [PATCH 1/3] target/avr: Call avr_cpu_do_interrupt directly

2022-08-27 Thread Michael Rolnik
Reviewed-by: Michael Rolnik On Fri, Aug 26, 2022 at 11:55 PM Richard Henderson < richard.hender...@linaro.org> wrote: > There is no need to go through cc->tcg_ops when > we know what value that must have. > > Signed-off-by: Richard Henderson > --- > target/avr/helper.c | 5 ++--- > 1 file

Re: [PATCH 3/3] target/avr: Disable interrupts when env->skip set

2022-08-27 Thread Michael Rolnik
Reviewed-by: Michael Rolnik On Fri, Aug 26, 2022 at 11:55 PM Richard Henderson < richard.hender...@linaro.org> wrote: > This bit is not saved across interrupts, so we must > delay delivering the interrupt until the skip has > been processed. > > Resolves:

Re: [PATCH 0/3] target/avr: Fix skips vs interrupts

2022-08-27 Thread Michael Rolnik
Reviewed-by: Michael Rolnik On Fri, Aug 26, 2022 at 11:55 PM Richard Henderson < richard.hender...@linaro.org> wrote: > Fixes https://gitlab.com/qemu-project/qemu/-/issues/1118 > > r~ > > Richard Henderson (3): > target/avr: Call avr_cpu_do_interrupt directly > target/avr: Only execute one

Re: [RFC PATCH 1/2] softmmu/memory: add missing begin/commit callback calls

2022-08-27 Thread Peter Xu
On Fri, Aug 26, 2022 at 10:13:47AM -0400, Peter Xu wrote: > On Fri, Aug 26, 2022 at 03:53:09PM +0200, Emanuele Giuseppe Esposito wrote: > > What do you mean "will empty all regions with those listeners"? > > But yes theoretically vhost-vdpa and physmem have commit callbacks that > > are