Re: [PATCH v2] vfio/pci: Verify each MSI vector to avoid invalid MSI vectors

2022-11-25 Thread chenxiang (M)
在 2022/11/23 20:08, Marc Zyngier 写道: On Wed, 23 Nov 2022 01:42:36 +, chenxiang wrote: From: Xiang Chen Currently the number of MSI vectors comes from register PCI_MSI_FLAGS which should be power-of-2 in qemu, in some scenaries it is not the same as the number that driver requires in

Re: [PATCH-for-8.0] block/nbd: Add missing include

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 20:53, Philippe Mathieu-Daudé wrote: The inlined nbd_readXX() functions call beXX_to_cpu(), themselves declared in . This fixes when refactoring: In file included from ../../block/nbd.c:44: include/block/nbd.h: In function 'nbd_read16': include/block/nbd.h:383:12: error:

Re: [PATCH v6 14/14] block/dirty-bitmap: convert coroutine-only functions to co_wrapper

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: bdrv_can_store_new_dirty_bitmap and bdrv_remove_persistent_dirty_bitmap check if they are running in a coroutine, directly calling the coroutine callback if it's the case. Except that no coroutine calls such functions, therefore that check can

Re: [PATCH v6 13/14] block: convert bdrv_create to co_wrapper

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: This function is never called in coroutine context, therefore instead of manually creating a new coroutine, delegate it to the block-coroutine-wrapper script, defining it as co_wrapper. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by:

Re: [PATCH v6 12/14] block-coroutine-wrapper.py: support also basic return types

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: Extend the regex to cover also return type, pointers included. This implies that the value returned by the function cannot be a simple "int" anymore, but the custom return type. Therefore remove poll_state->ret and instead use a per-function

Re: [PATCH] virtiofsd: Add `sigreturn` to the seccomp whitelist

2022-11-25 Thread Stefan Hajnoczi
Thanks, applied to qemu.git/master. Stefan

Re: [PATCH v6 11/14] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
too long subject. suggest: block-coroutine-wrapper.py: support functions without bs arg On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: Right now, we take the first parameter of the function to get the BlockDriverState to pass to bdrv_poll_co(), that internally calls functions that

Re: [PATCH v6 10/14] block-coroutine-wrapper.py: introduce co_wrapper

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: This new annotation creates just a function wrapper that creates a new coroutine. Actually, not just create, but create, start and wait for finish.. Maybe s/creates/starts/ It assumes the caller is not a coroutine. It will be the default

Re: [PATCH for 7.2-rc? v2 0/5] continuing efforts to fix vhost-user issues

2022-11-25 Thread Alex Bennée
Stefan Weil writes: > Am 25.11.22 um 18:30 schrieb Alex Bennée: >> Hi, >> This is continuing to attempt to fix the various vhost-user issues >> that are currently plaguing the release. One concrete bug I've come >> across is that all qtest MMIO devices where being treated as legacy >> which

Re: [PATCH for 7.2-rc? v2 0/5] continuing efforts to fix vhost-user issues

2022-11-25 Thread Alex Bennée
Alex Bennée writes: > Hi, > > I can replicate some of the other failures I've been seeing in CI by > running: > > ../../meson/meson.py test --repeat 10 --print-errorlogs qtest-arm/qos-test > > however this seems to run everything in parallel and maybe is better > at exposing race

Re: [PATCH for 7.2-rc? v2 0/5] continuing efforts to fix vhost-user issues

2022-11-25 Thread Stefan Weil via
Am 25.11.22 um 18:30 schrieb Alex Bennée: Hi, This is continuing to attempt to fix the various vhost-user issues that are currently plaguing the release. One concrete bug I've come across is that all qtest MMIO devices where being treated as legacy which caused the VIRTIO_F_VERSION_1 flag to

Re: [PATCH v6 09/14] block: rename generated_co_wrapper in co_wrapper_mixed

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: In preparation to the incoming new function specifiers, rename g_c_w with a more meaningful name and document it. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Vladimir Sementsov-Ogievskiy -- Best regards, Vladimir

Re: [PATCH v6 08/14] block: bdrv_create_file is a coroutine_fn

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: It is always called in coroutine_fn callbacks, therefore it can directly call bdrv_co_create(). Rename it to bdrv_co_create_file too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf Reviewed-by: Vladimir

Re: [RFC PATCH 3/3] hw/mips: Add MIPS VirtIO board

2022-11-25 Thread Jiaxun Yang
> 2022年11月25日 13:25,Philippe Mathieu-Daudé 写道: > > On 24/11/22 22:29, Jiaxun Yang wrote: >> MIPS VirtIO board is design to utilize existing VirtIO infrastures >> but also comptitable with MIPS's existing internal simulation tools. >> It includes virtio-mmio, pcie gpex, flash rom, fw_cfg,

Re: [PATCH v6 07/14] block: distinguish between bdrv_create running in coroutine and not

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: Call two different functions depending on whether bdrv_create is in coroutine or not, following the same pattern as generated_co_wrapper functions. This allows to also call the coroutine function directly, without using CreateCo or relying in

[PATCH-for-8.0] coroutine: Add missing include

2022-11-25 Thread Philippe Mathieu-Daudé
qemu_co_mutex_assert_locked() calls qatomic_read(), which is declared in . This fixes when refactoring: In file included from include/qemu/osdep.h:113, from ../../util/error-report.c:13: include/qemu/coroutine.h: In function 'qemu_co_mutex_assert_locked':

[PATCH-for-8.0] block/nbd: Add missing include

2022-11-25 Thread Philippe Mathieu-Daudé
The inlined nbd_readXX() functions call beXX_to_cpu(), themselves declared in . This fixes when refactoring: In file included from ../../block/nbd.c:44: include/block/nbd.h: In function 'nbd_read16': include/block/nbd.h:383:12: error: implicit declaration of function 'be16_to_cpu'

Re: [RFC PATCH-for-7.2 0/4] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt()

2022-11-25 Thread Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (4): hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler hw/display/qxl: Document qxl_phys2virt() hw/display/qxl: Pass qxl_phys2virt size hw/display/qxl: Avoid buffer overrun in qxl_phys2virt() hw/display/qxl-logger.c | 22

[PATCH v2 3/5] tests/qtests: override "force-legacy" for gpio virtio-mmio tests

2022-11-25 Thread Alex Bennée
The GPIO device is a VIRTIO_F_VERSION_1 devices but running with a legacy MMIO interface we miss out that feature bit causing confusion. For the GPIO test force the mmio bus to support non-legacy so we can properly test it. Signed-off-by: Alex Bennée Resolves:

[PATCH v2 2/5] include/hw: VM state takes precedence in virtio_device_should_start

2022-11-25 Thread Alex Bennée
The VM status should always preempt the device status for these checks. This ensures the device is in the correct state when we suspend the VM prior to migrations. This restores the checks to the order they where in before the refactoring moved things around. While we are at it lets improve our

[PATCH v2 4/5] hw/virtio: ensure a valid host_feature set for virtio-user-gpio

2022-11-25 Thread Alex Bennée
There was a disconnect here because vdev->host_features was set to random rubbish. This caused a weird negotiation between the driver and device that took no account of the features provided by the backend. To fix this we must set vdev->host_features once we have initialised the vhost backend.

[PATCH v2 5/5] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-11-25 Thread Alex Bennée
From: Stefano Garzarella Commit 02b61f38d3 ("hw/virtio: incorporate backend features in features") properly negotiates VHOST_USER_F_PROTOCOL_FEATURES with the vhost-user backend, but we forgot to enable vrings as specified in docs/interop/vhost-user.rst: If

[RFC PATCH-for-7.2 4/4] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt (CVE-2022-4144)

2022-11-25 Thread Philippe Mathieu-Daudé
Return NULL if the requested buffer size does not fit within the slot memory region. Reported-by: Wenxu Yin (@awxylitol) Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1336 Signed-off-by: Philippe Mathieu-Daudé --- hw/display/qxl.c | 11 ++- hw/display/qxl.h | 2 +- 2 files

[RFC PATCH-for-7.2 3/4] hw/display/qxl: Pass requested buffer size to qxl_phys2virt()

2022-11-25 Thread Philippe Mathieu-Daudé
Currently qxl_phys2virt() doesn't check for buffer overrun. In order to do so in the next commit, pass the buffer size as argument. Signed-off-by: Philippe Mathieu-Daudé --- RFC: Please double-check qxl_render_update_area_unlocked() --- hw/display/qxl-logger.c | 11 ---

[PATCH v2 1/5] include/hw: attempt to document VirtIO feature variables

2022-11-25 Thread Alex Bennée
We have a bunch of variables associated with the device and the vhost backend which are used inconsistently throughout the code base. Lets start trying to bring some order by agreeing what each variable is for. Signed-off-by: Alex Bennée Cc: Stefano Garzarella Cc: "Michael S. Tsirkin" Cc:

[PATCH for 7.2-rc? v2 0/5] continuing efforts to fix vhost-user issues

2022-11-25 Thread Alex Bennée
Hi, This is continuing to attempt to fix the various vhost-user issues that are currently plaguing the release. One concrete bug I've come across is that all qtest MMIO devices where being treated as legacy which caused the VIRTIO_F_VERSION_1 flag to get missed causing s390x to fall back to

Re: [PATCH v6 06/14] block: avoid duplicating filename string in bdrv_create

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: We know that the string will stay around until the function returns, and the parameter of drv->bdrv_co_create_opts is const char*, so it must not be modified either. Suggested-by: Kevin Wolf Signed-off-by: Emanuele Giuseppe Esposito

Re: [PATCH v6 05/14] block/vmdk: add missing coroutine_fn annotations

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: These functions end up calling bdrv_create() implemented as generated_co_wrapper functions. In addition, they also happen to be always called in coroutine context, meaning all callers are coroutine_fn. This means that the g_c_w function will

Re: [PATCH v6 04/14] block-backend: replace bdrv_*_above with blk_*_above

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: Avoid mixing bdrv_* functions with blk_*, so create blk_* counterparts for bdrv_block_status_above and bdrv_is_allocated_above. Note that since blk_co_block_status_above only calls the g_c_w function bdrv_common_block_status_above and is

Re: [PATCH v6 03/14] nbd/server.c: add missing coroutine_fn annotations

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: These functions end up calling bdrv_*() implemented as generated_co_wrapper functions. In addition, they also happen to be always called in coroutine context, meaning all callers are coroutine_fn. This means that the g_c_w function will enter

Re: [PATCH v6 02/14] block-copy: add missing coroutine_fn annotations

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: These functions end up calling bdrv_common_block_status_above(), a generated_co_wrapper function. In addition, they also happen to be always called in coroutine context, meaning all callers are coroutine_fn. This means that the g_c_w function

Re: [PATCH v6 01/14] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/25/22 16:35, Emanuele Giuseppe Esposito wrote: bdrv_common_block_status_above() is a g_c_w, and it is being called by many "wrapper" functions like bdrv_is_allocated(), bdrv_is_allocated_above() and bdrv_block_status_above(). Because we want to eventually split the coroutine from

Re: [Virtio-fs] [PATCH] virtiofsd: Add `sigreturn` to the seccomp whitelist

2022-11-25 Thread German Maglione
On Fri, Nov 25, 2022 at 3:40 PM Marc Hartmayer wrote: > > The virtiofsd currently crashes on s390x. This is because of a > `sigreturn` system call. See audit log below: > > type=SECCOMP msg=audit(1669382477.611:459): auid=4294967295 uid=0 gid=0 > ses=4294967295

Re: [RFC PATCH-for-7.2 0/4] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt()

2022-11-25 Thread Mauro Matteo Cascella
On Fri, Nov 25, 2022 at 4:40 PM Philippe Mathieu-Daudé wrote: > > memory_region_get_ram_ptr() returns a host pointer for a > MemoryRegion. Sometimes we do offset calculation using this > pointer without checking the underlying MemoryRegion size. > > Wenxu Yin reported a buffer overrun in QXL.

[PATCH] tests/qtest/vhost-user-blk-test: don't abort all qtests on missing envar

2022-11-25 Thread Christian Schoenebeck
This test requires environment variable QTEST_QEMU_STORAGE_DAEMON_BINARY to be defined for running. If not, it would immediately abort all qtests and prevent other, unrelated tests from running. To fix that, just skip vhost-user-blk-test instead and log a message about missing environment

Re: [PATCH] hw/display/next-fb: Fix comment typo

2022-11-25 Thread Peter Maydell
On Fri, 25 Nov 2022 at 16:10, Evgeny Ermakov wrote: > > Signed-off-by: Evgeny Ermakov > --- > hw/display/next-fb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c > index dd6a1aa8ae..8446ff3c00 100644 > ---

[PATCH] hw/display/next-fb: Fix comment typo

2022-11-25 Thread Evgeny Ermakov
Signed-off-by: Evgeny Ermakov --- hw/display/next-fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c index dd6a1aa8ae..8446ff3c00 100644 --- a/hw/display/next-fb.c +++ b/hw/display/next-fb.c @@ -126,7 +126,7 @@ static void

Re: [PATCH v2 15/15] block: Remove poll parameter from bdrv_parent_drained_begin_single()

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/18/22 20:41, Kevin Wolf wrote: All callers of bdrv_parent_drained_begin_single() pass poll=false now, so we don't need the parameter any more. Signed-off-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy -- Best regards, Vladimir

Re: [PATCH v2 14/15] block: Don't poll in bdrv_replace_child_noperm()

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/18/22 20:41, Kevin Wolf wrote: In order to make sure that bdrv_replace_child_noperm() doesn't have to poll any more, get rid of the bdrv_parent_drained_begin_single() call. This is possible now because we can require that the parent is already drained through the child in question when

[RFC PATCH-for-7.2 0/4] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt()

2022-11-25 Thread Philippe Mathieu-Daudé
memory_region_get_ram_ptr() returns a host pointer for a MemoryRegion. Sometimes we do offset calculation using this pointer without checking the underlying MemoryRegion size. Wenxu Yin reported a buffer overrun in QXL. This series aims to fix it. I haven't audited the other _get_ram_ptr() uses

[RFC PATCH-for-7.2 1/4] hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler

2022-11-25 Thread Philippe Mathieu-Daudé
Only 3 command types are logged: no need to call qxl_phys2virt() for the other types. Signed-off-by: Philippe Mathieu-Daudé --- hw/display/qxl-logger.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/hw/display/qxl-logger.c b/hw/display/qxl-logger.c index 68bfa47568..1bcf803db6

[RFC PATCH-for-7.2 2/4] hw/display/qxl: Document qxl_phys2virt()

2022-11-25 Thread Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé --- hw/display/qxl.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/hw/display/qxl.h b/hw/display/qxl.h index e74de9579d..78b3a6c9ba 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -147,6 +147,25 @@

Re: [PATCH v2] e1000e: Configure ResettableClass

2022-11-25 Thread Philippe Mathieu-Daudé
On 25/11/22 15:36, Akihiko Odaki wrote: This is part of recent efforts of refactoring e1000 and e1000e. DeviceClass's reset member is deprecated so migrate to ResettableClass. Thre is no behavioral difference. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- hw/net/e1000e.c

Re: [PATCH for 7.2-rc3 v1 0/2] virtio fixes

2022-11-25 Thread Alex Bennée
"Michael S. Tsirkin" writes: > On Thu, Nov 24, 2022 at 10:24:14PM +, Alex Bennée wrote: >> >> "Michael S. Tsirkin" writes: >> >> > On Thu, Nov 24, 2022 at 09:21:15AM +, Alex Bennée wrote: >> >> >> >> "Michael S. Tsirkin" writes: >> >> >> >> > On Wed, Nov 23, 2022 at 04:03:49PM

Re: [PATCH v2 13/15] block: Drop out of coroutine in bdrv_do_drained_begin_quiesce()

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/18/22 20:41, Kevin Wolf wrote: The next patch adds a parent drain to bdrv_attach_child_common(), which shouldn't be, but is currently called from coroutines in some cases (e.g. .bdrv_co_create implementations generally open new nodes). Therefore, the assertion that we're not in a coroutine

Re: [PATCH v2 12/15] block: Remove ignore_bds_parents parameter from drain_begin/end.

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/18/22 20:41, Kevin Wolf wrote: ignore_bds_parents is now ignored during drain_begin and drain_end, so we can just remove it there. It is still a valid optimisation for drain_all in bdrv_drained_poll(), so leave it around there. Signed-off-by: Kevin Wolf Reviewed-by: Vladimir

Re: [PATCH v2 11/15] block: Call drain callbacks only once

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/18/22 20:41, Kevin Wolf wrote: We only need to call both the BlockDriver's callback and the parent callbacks when going from undrained to drained or vice versa. A second drain section doesn't make a difference for the driver or the parent, they weren't supposed to send new requests before

Re: [PATCH] hw/intc/arm_gicv3: Fix GICD_TYPER ITLinesNumber advertisement

2022-11-25 Thread Luke Starrett
On 11/25/2022 8:34 AM, Peter Maydell wrote: On Tue, 22 Nov 2022 at 18:31, Luke Starrett wrote: The ARM GICv3 TRM describes that the ITLinesNumber field of GICD_TYPER register: "indicates the maximum SPI INTID that the GIC implementation supports" As SPI #0 is absolute IRQ #32, the max SPI

Re: [PATCH for 7.2-rc3 v1 0/2] virtio fixes

2022-11-25 Thread Alex Bennée
"Michael S. Tsirkin" writes: > On Thu, Nov 24, 2022 at 10:24:14PM +, Alex Bennée wrote: >> >> "Michael S. Tsirkin" writes: >> >> > On Thu, Nov 24, 2022 at 09:21:15AM +, Alex Bennée wrote: >> >> >> >> "Michael S. Tsirkin" writes: >> >> >> >> > On Wed, Nov 23, 2022 at 04:03:49PM

[RFC PATCH 1/3] virtio_net: export virtio_net_guest_offloads_by_features

2022-11-25 Thread Eugenio Pérez
vdpa NIC can use it to know if it needs to restore guest offloads at startup / migration. Signed-off-by: Eugenio Pérez --- include/hw/virtio/virtio-net.h | 1 + hw/net/virtio-net.c| 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio-net.h

[PATCH] virtiofsd: Add `sigreturn` to the seccomp whitelist

2022-11-25 Thread Marc Hartmayer
The virtiofsd currently crashes on s390x. This is because of a `sigreturn` system call. See audit log below: type=SECCOMP msg=audit(1669382477.611:459): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=system_u:system_r:virtd_t:s0-s0:c0.c1023 pid=6649 comm="virtiofsd"

[RFC PATCH 3/3] vdpa: add VIRTIO_NET_F_CTRL_GUEST_OFFLOADS to SVQ features

2022-11-25 Thread Eugenio Pérez
This way it is possible to migrate them. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 7ce094bd67..eca0184d3a 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -81,6 +81,7 @@ const int

[RFC PATCH 0/3] VIRTIO_NET_F_CTRL_GUEST_OFFLOADS vDPA Shadow VirtQueue implementation

2022-11-25 Thread Eugenio Pérez
This feature allows the driver to send control commands for dynamic offloads state configuration. When a guest is migrated the destination device needs to be restored with the same offloads. As other features configurable via CVQ, intercept the control messages, update the device model and load

[RFC PATCH 2/3] vdpa: load guest offloads at device start

2022-11-25 Thread Eugenio Pérez
This allows to migrate them. Save some device's startup time if they are the default. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index

[PATCH v2] e1000e: Configure ResettableClass

2022-11-25 Thread Akihiko Odaki
This is part of recent efforts of refactoring e1000 and e1000e. DeviceClass's reset member is deprecated so migrate to ResettableClass. Thre is no behavioral difference. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell --- hw/net/e1000e.c | 10 ++ hw/net/trace-events | 2

Re: [PATCH v2] e1000: Configure ResettableClass

2022-11-25 Thread Peter Maydell
On Fri, 25 Nov 2022 at 14:33, Akihiko Odaki wrote: > > This is part of recent efforts of refactoring e1000 and e1000e. > > DeviceClass's reset member is deprecated so migrate to ResettableClass. > Thre is no behavioral difference. > > Signed-off-by: Akihiko Odaki > --- Reviewed-by: Peter

[PATCH v2] e1000: Configure ResettableClass

2022-11-25 Thread Akihiko Odaki
This is part of recent efforts of refactoring e1000 and e1000e. DeviceClass's reset member is deprecated so migrate to ResettableClass. Thre is no behavioral difference. Signed-off-by: Akihiko Odaki --- hw/net/e1000.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff

[PATCH v2] e1000e: Remove pending interrupt flags

2022-11-25 Thread Akihiko Odaki
They are duplicate of running throttling timer flags and incomplete as the flags are not cleared when the interrupts are fired or the device is reset. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.h | 2 -- hw/net/e1000e.c | 5 ++--- hw/net/e1000e_core.c | 19 +++

Re: [PATCH] e1000e: Configure ResettableClass

2022-11-25 Thread Peter Maydell
On Fri, 25 Nov 2022 at 14:10, Akihiko Odaki wrote: > > This is part of recent efforts of refactoring e1000 and e1000e. > > DeviceClass's reset member is deprecated so migrate to ResettableClass. > Thre is no behavioral difference. > > Signed-off-by: Akihiko Odaki > --- > hw/net/e1000e.c | 8

Re: [PATCH] e1000: Configure ResettableClass

2022-11-25 Thread Peter Maydell
On Fri, 25 Nov 2022 at 14:09, Akihiko Odaki wrote: > > This is part of recent efforts of refactoring e1000 and e1000e. > > DeviceClass's reset member is deprecated so migrate to ResettableClass. > Thre is no behavioral difference. > > Signed-off-by: Akihiko Odaki > --- > hw/net/e1000.c | 7

Re: [PATCH] docs/devel/reset.rst: Correct function names

2022-11-25 Thread Peter Maydell
On Fri, 25 Nov 2022 at 14:06, Akihiko Odaki wrote: > > resettable_class_set_parent_phases() was mistakenly called > resettable_class_set_parent_reset_phases() in some places. > > Signed-off-by: Akihiko Odaki > --- > docs/devel/reset.rst | 17 - > 1 file changed, 8 insertions(+),

Re: [PATCH] docs/devel/reset.rst: Correct function names

2022-11-25 Thread Philippe Mathieu-Daudé
On 25/11/22 15:06, Akihiko Odaki wrote: resettable_class_set_parent_phases() was mistakenly called resettable_class_set_parent_reset_phases() in some places. Signed-off-by: Akihiko Odaki --- docs/devel/reset.rst | 17 - 1 file changed, 8 insertions(+), 9 deletions(-)

[PATCH] e1000e: Configure ResettableClass

2022-11-25 Thread Akihiko Odaki
This is part of recent efforts of refactoring e1000 and e1000e. DeviceClass's reset member is deprecated so migrate to ResettableClass. Thre is no behavioral difference. Signed-off-by: Akihiko Odaki --- hw/net/e1000e.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git

Re: [PATCH] e1000e: Remove pending interrupt flags

2022-11-25 Thread Philippe Mathieu-Daudé
On 25/11/22 15:02, Akihiko Odaki wrote: They are duplicate of running throttling timer flags and incomplete as the flags are not cleared when the interrupts are fired or the device is reset. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.h | 2 -- hw/net/e1000e.c | 3 ---

[PATCH] e1000: Configure ResettableClass

2022-11-25 Thread Akihiko Odaki
This is part of recent efforts of refactoring e1000 and e1000e. DeviceClass's reset member is deprecated so migrate to ResettableClass. Thre is no behavioral difference. Signed-off-by: Akihiko Odaki --- hw/net/e1000.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git

[PATCH] docs/devel/reset.rst: Correct function names

2022-11-25 Thread Akihiko Odaki
resettable_class_set_parent_phases() was mistakenly called resettable_class_set_parent_reset_phases() in some places. Signed-off-by: Akihiko Odaki --- docs/devel/reset.rst | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/devel/reset.rst

[PATCH] e1000e: Remove pending interrupt flags

2022-11-25 Thread Akihiko Odaki
They are duplicate of running throttling timer flags and incomplete as the flags are not cleared when the interrupts are fired or the device is reset. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.h | 2 -- hw/net/e1000e.c | 3 --- hw/net/e1000e_core.c | 19 +++

[PATCH] e1000e: Use memcpy to intialize registers

2022-11-25 Thread Akihiko Odaki
Use memcpy instead of memmove to initialize registers. The initial register templates and register table instances will never overlap. Signed-off-by: Akihiko Odaki --- hw/net/e1000e_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/e1000e_core.c

[PATCH v2] e1000: Use hw/net/mii.h

2022-11-25 Thread Akihiko Odaki
hw/net/mii.h provides common definitions for MII. Signed-off-by: Akihiko Odaki --- hw/net/e1000_regs.h| 46 hw/net/e1000x_common.h | 8 ++-- hw/net/e1000.c | 86 ++-- hw/net/e1000e.c| 1 + hw/net/e1000e_core.c | 99

Re: [PATCH for-8.0 6/7] hw/intc/xics: Convert TYPE_ICS to 3-phase reset

2022-11-25 Thread Greg Kurz
On Fri, 25 Nov 2022 11:52:39 + Peter Maydell wrote: > Convert the TYPE_ICS class to 3-phase reset; this will allow us > to convert the TYPE_PHB3_MSI class which inherits from it. > > Signed-off-by: Peter Maydell > --- Reviewed-by: Greg Kurz > hw/intc/xics.c | 9 + > 1 file

Re: [PATCH for-8.0 5/7] hw/intc/xics: Reset TYPE_ICS objects with device_cold_reset()

2022-11-25 Thread Greg Kurz
On Fri, 25 Nov 2022 13:24:00 +0100 Cédric Le Goater wrote: > On 11/25/22 12:52, Peter Maydell wrote: > > The realize method for the TYPE_ICS class uses qemu_register_reset() > > to register a reset handler, as a workaround for the fact that > > currently objects which directly inherit from

[PATCH v6 06/14] block: avoid duplicating filename string in bdrv_create

2022-11-25 Thread Emanuele Giuseppe Esposito
We know that the string will stay around until the function returns, and the parameter of drv->bdrv_co_create_opts is const char*, so it must not be modified either. Suggested-by: Kevin Wolf Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block.c | 7 ++- 1 file

[PATCH v6 10/14] block-coroutine-wrapper.py: introduce co_wrapper

2022-11-25 Thread Emanuele Giuseppe Esposito
This new annotation creates just a function wrapper that creates a new coroutine. It assumes the caller is not a coroutine. It will be the default annotation to be used in the future. This is much better as c_w_mixed, because it is clear if the caller is a coroutine or not, and provides the

[PATCH v6 14/14] block/dirty-bitmap: convert coroutine-only functions to co_wrapper

2022-11-25 Thread Emanuele Giuseppe Esposito
bdrv_can_store_new_dirty_bitmap and bdrv_remove_persistent_dirty_bitmap check if they are running in a coroutine, directly calling the coroutine callback if it's the case. Except that no coroutine calls such functions, therefore that check can be removed, and function creation can be offloaded to

[PATCH v6 00/14] Still more coroutine and various fixes in block layer

2022-11-25 Thread Emanuele Giuseppe Esposito
This is a dump of all minor coroutine-related fixes found while looking around and testing various things in the QEMU block layer. Patches aim to: - add missing coroutine_fn annotation to the functions - simplify to avoid the typical "if in coroutine: fn() // else create_coroutine(fn)" already

[PATCH v6 01/14] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers

2022-11-25 Thread Emanuele Giuseppe Esposito
bdrv_common_block_status_above() is a g_c_w, and it is being called by many "wrapper" functions like bdrv_is_allocated(), bdrv_is_allocated_above() and bdrv_block_status_above(). Because we want to eventually split the coroutine from non-coroutine case in g_c_w, create duplicate wrappers that

Re: [PATCH] target/i386/hax: Add XCR0 support

2022-11-25 Thread Philippe Mathieu-Daudé
Hi, On 25/11/22 13:18, Wang, Wenchao wrote: Hi, maintainers, As HAXM v7.8.0 is released and it added XCR0 support, could you help to merge this patch to add corresponding support into HAX user space of QEMU? The patch has been included in the attachment. Thanks. See

[PATCH v6 07/14] block: distinguish between bdrv_create running in coroutine and not

2022-11-25 Thread Emanuele Giuseppe Esposito
Call two different functions depending on whether bdrv_create is in coroutine or not, following the same pattern as generated_co_wrapper functions. This allows to also call the coroutine function directly, without using CreateCo or relying in bdrv_create(). Signed-off-by: Emanuele Giuseppe

[PATCH v6 11/14] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter

2022-11-25 Thread Emanuele Giuseppe Esposito
Right now, we take the first parameter of the function to get the BlockDriverState to pass to bdrv_poll_co(), that internally calls functions that figure in which aiocontext the coroutine should run. However, it is useless to pass a bs just to get its own AioContext, so instead pass it directly,

[PATCH v6 08/14] block: bdrv_create_file is a coroutine_fn

2022-11-25 Thread Emanuele Giuseppe Esposito
It is always called in coroutine_fn callbacks, therefore it can directly call bdrv_co_create(). Rename it to bdrv_co_create_file too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block.c| 5 +++-- block/crypto.c | 2 +-

[PATCH v6 04/14] block-backend: replace bdrv_*_above with blk_*_above

2022-11-25 Thread Emanuele Giuseppe Esposito
Avoid mixing bdrv_* functions with blk_*, so create blk_* counterparts for bdrv_block_status_above and bdrv_is_allocated_above. Note that since blk_co_block_status_above only calls the g_c_w function bdrv_common_block_status_above and is marked as coroutine_fn, call directly

[PATCH v6 03/14] nbd/server.c: add missing coroutine_fn annotations

2022-11-25 Thread Emanuele Giuseppe Esposito
These functions end up calling bdrv_*() implemented as generated_co_wrapper functions. In addition, they also happen to be always called in coroutine context, meaning all callers are coroutine_fn. This means that the g_c_w function will enter the qemu_in_coroutine() case and eventually suspend (or

[PATCH v6 05/14] block/vmdk: add missing coroutine_fn annotations

2022-11-25 Thread Emanuele Giuseppe Esposito
These functions end up calling bdrv_create() implemented as generated_co_wrapper functions. In addition, they also happen to be always called in coroutine context, meaning all callers are coroutine_fn. This means that the g_c_w function will enter the qemu_in_coroutine() case and eventually

[PATCH v6 12/14] block-coroutine-wrapper.py: support also basic return types

2022-11-25 Thread Emanuele Giuseppe Esposito
Extend the regex to cover also return type, pointers included. This implies that the value returned by the function cannot be a simple "int" anymore, but the custom return type. Therefore remove poll_state->ret and instead use a per-function custom "ret" field. Signed-off-by: Emanuele Giuseppe

[PATCH v6 09/14] block: rename generated_co_wrapper in co_wrapper_mixed

2022-11-25 Thread Emanuele Giuseppe Esposito
In preparation to the incoming new function specifiers, rename g_c_w with a more meaningful name and document it. Signed-off-by: Emanuele Giuseppe Esposito --- block/coroutines.h | 4 +- docs/devel/block-coroutine-wrapper.rst | 6 +-- include/block/block-common.h

[PATCH v6 13/14] block: convert bdrv_create to co_wrapper

2022-11-25 Thread Emanuele Giuseppe Esposito
This function is never called in coroutine context, therefore instead of manually creating a new coroutine, delegate it to the block-coroutine-wrapper script, defining it as co_wrapper. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block.c|

[PATCH v6 02/14] block-copy: add missing coroutine_fn annotations

2022-11-25 Thread Emanuele Giuseppe Esposito
These functions end up calling bdrv_common_block_status_above(), a generated_co_wrapper function. In addition, they also happen to be always called in coroutine context, meaning all callers are coroutine_fn. This means that the g_c_w function will enter the qemu_in_coroutine() case and eventually

Re: [PATCH] hw/intc/arm_gicv3: Fix GICD_TYPER ITLinesNumber advertisement

2022-11-25 Thread Peter Maydell
On Tue, 22 Nov 2022 at 18:31, Luke Starrett wrote: > > The ARM GICv3 TRM describes that the ITLinesNumber field of GICD_TYPER > register: > > "indicates the maximum SPI INTID that the GIC implementation supports" > > As SPI #0 is absolute IRQ #32, the max SPI INTID should have accounted > for the

Re: [PATCH for-8.0 1/7] hw/virtio: Convert TYPE_VIRTIO_PCI to 3-phase reset

2022-11-25 Thread Philippe Mathieu-Daudé
On 25/11/22 12:52, Peter Maydell wrote: Convert the TYPE_VIRTIO_PCI class to 3-phase reset. This is necessary so that we can convert the subclass TYPE_VIRTIO_VGA_BASE also to 3-phase reset. Signed-off-by: Peter Maydell --- hw/virtio/virtio-pci.c | 8 +--- 1 file changed, 5

Re: [RFC PATCH 1/3] hw/intc: Add missing include for goldfish_pic.h

2022-11-25 Thread Philippe Mathieu-Daudé
On 24/11/22 22:29, Jiaxun Yang wrote: hw/sysbus.h is missed in goldfish_pic.h. Signed-off-by: Jiaxun Yang --- include/hw/intc/goldfish_pic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/hw/intc/goldfish_pic.h b/include/hw/intc/goldfish_pic.h index e9d552f796..3e79580367

Re: [RFC PATCH 3/3] hw/mips: Add MIPS VirtIO board

2022-11-25 Thread Philippe Mathieu-Daudé
On 24/11/22 22:29, Jiaxun Yang wrote: MIPS VirtIO board is design to utilize existing VirtIO infrastures but also comptitable with MIPS's existing internal simulation tools. It includes virtio-mmio, pcie gpex, flash rom, fw_cfg, goldfish-rtc, and optional goldfish_pic in case MIPS GIC is not

Re: [PATCH v2 2/4] .gitlab-ci.d/windows.yml: Keep 64-bit and 32-bit build scripts consistent

2022-11-25 Thread Thomas Huth
On 25/11/2022 12.40, Bin Meng wrote: From: Bin Meng At present the build scripts of 32-bit and 64-bit are inconsistent. Let's keep them consistent for easier maintenance. While we are here, add some comments to explain that for the 64-bit job, "--without-default-devices" is a must have, at

Re: [PATCH v2 3/4] .gitlab-ci.d/windows.yml: Exclude qTests from 64-bit CI job for now

2022-11-25 Thread Thomas Huth
On 25/11/2022 12.40, Bin Meng wrote: From: Bin Meng qTests don't run successfully with "--without-default-devices", so let's exclude the qtests from CI for now. Suggested-by: Marc-André Lureau Signed-off-by: Bin Meng --- (no changes since v1) .gitlab-ci.d/windows.yml | 4 +++- 1 file

Re: [PATCH 3/4] .gitlab-ci.d/windows.yml: Exclude qTests from 64-bit CI job for now

2022-11-25 Thread Thomas Huth
On 25/11/2022 11.49, Bin Meng wrote: From: Bin Meng qTests don't run successfully with "--without-default-devices", so let's exclude the qtests from CI for now. Suggested-by: Marc-André Lureau Signed-off-by: Bin Meng --- .gitlab-ci.d/windows.yml | 4 +++- 1 file changed, 3

Re: [PATCH v2 07/15] block: Drain invidual nodes during reopen

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
in subject: s/invidual/individual/ On 11/18/22 20:41, Kevin Wolf wrote: bdrv_reopen() and friends use subtree drains as a lazy way of covering all the nodes they touch. Turns out that this lazy way is a lot more complicated than just draining the nodes individually, even not accounting for the

Re: [RFC PATCH 3/3] hw/mips: Add MIPS VirtIO board

2022-11-25 Thread BALATON Zoltan
On Thu, 24 Nov 2022, Jiaxun Yang wrote: MIPS VirtIO board is design to utilize existing VirtIO infrastures Only riscv seems to call it a VirtIO machine, which I think is a misnomer as it's called "virt" and does not only use virtio devices but some others too. Better call it a virt machine

Re: [RFC PATCH 2/3] hw/misc: Add MIPS Trickbox device

2022-11-25 Thread BALATON Zoltan
Hello, I can't review the patch, I can only correct grammar in commit message. (Also Philippe has a new preferred email address now.) On Thu, 24 Nov 2022, Jiaxun Yang wrote: MIPS Trickbox is a emulated device present in MIPS's proprietary an emulated simulators for decadeds. It's capable

Re: [PATCH v2 06/15] block: Fix locking for bdrv_reopen_queue_child()

2022-11-25 Thread Vladimir Sementsov-Ogievskiy
On 11/18/22 20:41, Kevin Wolf wrote: Callers don't agree whether bdrv_reopen_queue_child() should be called with the AioContext lock held or not. Standardise on holding the lock (as done by QMP blockdev-reopen and the replication block driver) and fix bdrv_reopen() to do the same.

Re: guest Linux Kernel hangs and reports CPU lockup/stuck gitlab bug

2022-11-25 Thread Gerd Hoffmann
> The last thing the X11 server sends is: > > 113.10: Client 1 --> 24 bytes > REQUEST: ConvertSelection >requestor: WIN 03c00b9b <--- qemu window >selection: > target: ATM 0201 >

Re: [PATCH for-8.0 7/7] hw/pci-host/pnv_phb3_msi: Convert TYPE_PHB3_MSI to 3-phase reset

2022-11-25 Thread Cédric Le Goater
On 11/25/22 12:52, Peter Maydell wrote: Convert the TYPE_PHB3_MSI class to 3-phase reset, so we can avoid using the device_class_set_parent_reset() function. Signed-off-by: Peter Maydell Reviewed-by: Cédric Le Goater Thanks, C. --- include/hw/ppc/xics.h | 2 +-

  1   2   >