[PULL v2 00/33] Block layer patches

2023-12-21 Thread Kevin Wolf
The following changes since commit 191710c221f65b1542f6ea7fa4d30dde6e134fd7: Merge tag 'pull-request-2023-12-20' of https://gitlab.com/thuth/qemu into staging (2023-12-20 09:40:16 -0500) are available in the Git repository at: https://repo.or.cz/qemu/kevin.git tags/for-upstream for you to

[PULL 28/33] block: remove outdated AioContext locking comments

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The AioContext lock no longer exists. There is one noteworthy change: - * More specifically, these functions use BDRV_POLL_WHILE(bs), which - * requires the caller to be either in the main thread and hold - * the BlockdriverState (bs) AioContext lock, or directly in

[PULL 33/33] virtio-blk: add iothread-vq-mapping parameter

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Add the iothread-vq-mapping parameter to assign virtqueues to IOThreads. Store the vq:AioContext mapping in the new struct VirtIOBlockDataPlane->vq_aio_context[] field and refactor the code to use the per-vq AioContext instead of the BlockDriverState's AioContext. Reimpleme

[PULL 08/33] block: Fix crash when loading snapshot on inactive node

2023-12-21 Thread Kevin Wolf
bdrv_is_read_only() only checks if the node is configured to be read-only eventually, but even if it returns false, writing to the node may not be permitted at the moment (because it's inactive). bdrv_is_writable() checks that the node can be written to right now, and this is what the snapshot ope

[PULL 09/33] vl: Improve error message for conflicting -incoming and -loadvm

2023-12-21 Thread Kevin Wolf
Currently, the conflict between -incoming and -loadvm is only detected when loading the snapshot fails because the image is still inactive for the incoming migration. This results in a suboptimal error message: $ ./qemu-system-x86_64 -hda /tmp/test.qcow2 -loadvm foo -incoming defer qemu-system-x86

[PULL 05/33] virtio-blk: add lock to protect s->rq

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi s->rq is accessed from IO_CODE and GLOBAL_STATE_CODE. Introduce a lock to protect s->rq and eliminate reliance on the AioContext lock. Signed-off-by: Stefan Hajnoczi Message-ID: <20230914140101.1065008-3-stefa...@redhat.com> Reviewed-by: Kevin Wolf Reviewed-by: Eric Blake

[PULL 13/33] scsi: don't lock AioContext in I/O code path

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi blk_aio_*() doesn't require the AioContext lock and the SCSI subsystem's internal state also does not anymore. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Acked-by: Kevin Wolf Message-ID: <20231204164259.1515217-4-stefa...@redhat.com> Signed-off-by: Kevin Wolf

[PULL 14/33] dma-helpers: don't lock AioContext in dma_blk_cb()

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Commit abfcd2760b3e ("dma-helpers: prevent dma_blk_cb() vs dma_aio_cancel() race") acquired the AioContext lock inside dma_blk_cb() to avoid a race with scsi_device_purge_requests() running in the main loop thread. The SCSI code no longer calls dma_aio_cancel() from the mai

[PULL 02/33] nbd/server: only traverse NBDExport->clients from main loop thread

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The NBD clients list is currently accessed from both the export AioContext and the main loop thread. When the AioContext lock is removed there will be nothing protecting the clients list. Adding a lock around the clients list is tricky because NBDClient structs are refcount

[PULL 17/33] tests: remove aio_context_acquire() tests

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The aio_context_acquire() API is being removed. Drop the test case that calls the API. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-by: Kevin Wolf Message-ID: <20231205182011.1976568-4-stefa...@redhat.com> Signed-off-by: Kevin Wolf --- tests/unit/tes

[PULL 24/33] aio: remove aio_context_acquire()/aio_context_release() API

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Delete these functions because nothing calls these functions anymore. I introduced these APIs in commit 98563fc3ec44 ("aio: add aio_context_acquire() and aio_context_release()") in 2014. It's with a sigh of relief that I delete these APIs almost 10 years later. Thanks to P

[PULL 25/33] docs: remove AioContext lock from IOThread docs

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Encourage the use of locking primitives and stop mentioning the AioContext lock since it is being removed. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Message-ID: <20231205182011.1976568-12-stefa...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf

[PULL 10/33] iotests: Basic tests for internal snapshots

2023-12-21 Thread Kevin Wolf
We have a few test cases that include tests for corner case aspects of internal snapshots, but nothing that tests that they actually function as snapshots or that involves deleting a snapshot. Add a test for this kind of basic internal snapshot functionality. The error cases include a regression t

[PULL 32/33] qdev: add IOThreadVirtQueueMappingList property type

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi virtio-blk and virtio-scsi devices will need a way to specify the mapping between IOThreads and virtqueues. At the moment all virtqueues are assigned to a single IOThread or the main loop. This single thread can be a CPU bottleneck, so it is necessary to allow finer-grained

[PULL 26/33] scsi: remove outdated AioContext lock comment

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The SCSI subsystem no longer uses the AioContext lock. Request processing runs exclusively in the BlockBackend's AioContext since "scsi: only access SCSIDevice->requests from one thread" and hence the lock is unnecessary. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Bl

[PULL 30/33] string-output-visitor: show structs as ""

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi StringOutputVisitor crashes when it visits a struct because ->start_struct() is NULL. Show "" instead of crashing. This is necessary because the virtio-blk-pci iothread-vq-mapping parameter that I'd like to introduce soon is a list of IOThreadMapping structs. This patch is

[PULL 21/33] block: remove bdrv_co_lock()

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The bdrv_co_lock() and bdrv_co_unlock() functions are already no-ops. Remove them. Signed-off-by: Stefan Hajnoczi Message-ID: <20231205182011.1976568-8-stefa...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/block/block-global-state.h | 14 ---

[PULL 31/33] qdev-properties: alias all object class properties

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi qdev_alias_all_properties() aliases a DeviceState's qdev properties onto an Object. This is used for VirtioPCIProxy types so that --device virtio-blk-pci has properties of its embedded --device virtio-blk-device object. Currently this function is implemented using qdev prop

[PULL 27/33] job: remove outdated AioContext locking comments

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The AioContext lock no longer exists. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Message-ID: <20231205182011.1976568-14-stefa...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/qemu/job.h | 20 1 file changed,

[PULL 01/33] nbd/server: avoid per-NBDRequest nbd_client_get/put()

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi nbd_trip() processes a single NBD request from start to finish and holds an NBDClient reference throughout. NBDRequest does not outlive the scope of nbd_trip(). Therefore it is unnecessary to ref/unref NBDClient for each NBDRequest. Removing these nbd_client_get()/nbd_clien

[PULL 29/33] block-coroutine-wrapper: use qemu_get_current_aio_context()

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Use qemu_get_current_aio_context() in mixed wrappers and coroutine wrappers so that code runs in the caller's AioContext instead of moving to the BlockDriverState's AioContext. This change is necessary for the multi-queue block layer where any thread can call into the block

[PULL 23/33] aio-wait: draw equivalence between AIO_WAIT_WHILE() and AIO_WAIT_WHILE_UNLOCKED()

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Now that the AioContext lock no longer exists, AIO_WAIT_WHILE() and AIO_WAIT_WHILE_UNLOCKED() are equivalent. A future patch will get rid of AIO_WAIT_WHILE_UNLOCKED(). Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Message-ID: <20231205182011.1976568-10-stefa...@

[PULL 22/33] scsi: remove AioContext locking

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The AioContext lock no longer has any effect. Remove it. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Message-ID: <20231205182011.1976568-9-stefa...@redhat.com> Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf --- include/hw/virtio/virtio-scsi.h | 14 ---

[PULL 03/33] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi NBDClient has a number of fields that are accessed by both the export AioContext and the main loop thread. When the AioContext lock is removed these fields will need another form of protection. Add NBDClient->lock and protect fields that are accessed by both threads. Also a

[PULL 07/33] virtio-blk: don't lock AioContext in the submission code path

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi There is no need to acquire the AioContext lock around blk_aio_*() or blk_get_geometry() anymore. I/O plugging (defer_call()) also does not require the AioContext lock anymore. Signed-off-by: Stefan Hajnoczi Message-ID: <20230914140101.1065008-5-stefa...@redhat.com> Review

[PULL 06/33] virtio-blk: don't lock AioContext in the completion code path

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Nothing in the completion code path relies on the AioContext lock anymore. Virtqueues are only accessed from one thread at any moment and the s->rq global state is protected by its own lock now. Signed-off-by: Stefan Hajnoczi Message-ID: <20230914140101.1065008-4-stefa...@

[PULL 19/33] graph-lock: remove AioContext locking

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Stop acquiring/releasing the AioContext lock in bdrv_graph_wrlock()/bdrv_graph_unlock() since the lock no longer has any effect. The distinction between bdrv_graph_wrunlock() and bdrv_graph_wrunlock_ctx() becomes meaningless and they can be collapsed into one function. Sig

[PULL 12/33] virtio-scsi: don't lock AioContext around virtio_queue_aio_attach_host_notifier()

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi virtio_queue_aio_attach_host_notifier() does not require the AioContext lock. Stop taking the lock and add an explicit smp_wmb() because we were relying on the implicit barrier in the AioContext lock before. Signed-off-by: Stefan Hajnoczi Reviewed-by: Eric Blake Reviewed-

[PULL 18/33] aio: make aio_context_acquire()/aio_context_release() a no-op

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi aio_context_acquire()/aio_context_release() has been replaced by fine-grained locking to protect state shared by multiple threads. The AioContext lock still plays the role of balancing locking in AIO_WAIT_WHILE() and many functions in QEMU either require that the AioContext

[PULL 11/33] scsi: only access SCSIDevice->requests from one thread

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Stop depending on the AioContext lock and instead access SCSIDevice->requests from only one thread at a time: - When the VM is running only the BlockBackend's AioContext may access the requests list. - When the VM is stopped only the main loop may access the requests lis

[PULL 20/33] block: remove AioContext locking

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi This is the big patch that removes aio_context_acquire()/aio_context_release() from the block layer and affected block layer users. There isn't a clean way to split this patch and the reviewers are likely the same group of people, so I decided to do it in one patch. Signed

[PULL 16/33] scsi: assert that callbacks run in the correct AioContext

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Since the removal of AioContext locking, the correctness of the code relies on running requests from a single AioContext at any given time. Add assertions that verify that callbacks are invoked in the correct AioContext. Signed-off-by: Stefan Hajnoczi Message-ID: <2023120

[PULL 15/33] virtio-scsi: replace AioContext lock with tmf_bh_lock

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi Protect the Task Management Function BH state with a lock. The TMF BH runs in the main loop thread. An IOThread might process a TMF at the same time as the TMF BH is running. Therefore tmf_bh_list and tmf_bh must be protected by a lock. Run TMF request completion in the IOT

[PULL 04/33] block/file-posix: set up Linux AIO and io_uring in the current thread

2023-12-21 Thread Kevin Wolf
From: Stefan Hajnoczi The file-posix block driver currently only sets up Linux AIO and io_uring in the BDS's AioContext. In the multi-queue block layer we must be able to submit I/O requests in AioContexts that do not have Linux AIO and io_uring set up yet since any thread can call into the block

[PULL 00/33] Block layer patches

2023-12-21 Thread Kevin Wolf
The following changes since commit 191710c221f65b1542f6ea7fa4d30dde6e134fd7: Merge tag 'pull-request-2023-12-20' of https://gitlab.com/thuth/qemu into staging (2023-12-20 09:40:16 -0500) are available in the Git repository at: https://repo.or.cz/qemu/kevin.git tags/for-upstream for you to

Re: [PULL 0/3] Memory/SDHCI/ParallelFlash patches for v7.2.0-rc0

2023-12-21 Thread Salvatore Bonaccorso
Hi Philippe, On Wed, Nov 09, 2022 at 08:43:19AM +0100, Philippe Mathieu-Daudé wrote: > On 8/11/22 21:57, Stefan Hajnoczi wrote: > > I've dropped the SDHCI CVE fix due to the CI failure. > > > > The rest of the commits are still in the staging tree and I plan to > > include them in v7.2.0-rc0. >

Re: [PATCH v4 0/4] virtio-blk: add iothread-vq-mapping parameter

2023-12-21 Thread Kevin Wolf
Am 20.12.2023 um 14:47 hat Stefan Hajnoczi geschrieben: > v4: > - Use DummyVirtioForceArrays naming in QAPI schema [Markus] > v3: > - Rebased onto Kevin's block branch > - Add StringOutputVisitor "" patch to fix "info qtree" crash > - Fix QAPI schema formatting [Markus] > - Eliminate unnecessary lo

Re: [PATCH v3 0/6] qemu-iotests fixes for Kevin's block tree

2023-12-21 Thread Kevin Wolf
Am 21.12.2023 um 20:24 hat Stefan Hajnoczi geschrieben: > v3: > - Add aio_wait_kick() into nbd_read_eof() to avoid race with > nbd_drained_poll() > [Kevin] > > v2: > - Drop useless if (client->quiesing) check [Kevin] > - run qio_channel_read_wake() in export AioContext to avoid race [Kevin] > -

[PATCH v3 4/6] nbd/server: avoid per-NBDRequest nbd_client_get/put()

2023-12-21 Thread Stefan Hajnoczi
nbd_trip() processes a single NBD request from start to finish and holds an NBDClient reference throughout. NBDRequest does not outlive the scope of nbd_trip(). Therefore it is unnecessary to ref/unref NBDClient for each NBDRequest. Removing these nbd_client_get()/nbd_client_put() calls will make

[PATCH v3 2/6] fixup block: remove AioContext locking

2023-12-21 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi --- migration/block.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/migration/block.c b/migration/block.c index 2bcfcbfdf6..6ec6a1d6e6 100644 --- a/migration/block.c +++ b/migration/block.c @@ -311,10 +311,17 @@ static int mig_save_device_bulk(QEMUFile

[PATCH v3 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Stefan Hajnoczi
NBDClient has a number of fields that are accessed by both the export AioContext and the main loop thread. When the AioContext lock is removed these fields will need another form of protection. Add NBDClient->lock and protect fields that are accessed by both threads. Also add assertions where poss

[PATCH v3 5/6] nbd/server: only traverse NBDExport->clients from main loop thread

2023-12-21 Thread Stefan Hajnoczi
The NBD clients list is currently accessed from both the export AioContext and the main loop thread. When the AioContext lock is removed there will be nothing protecting the clients list. Adding a lock around the clients list is tricky because NBDClient structs are refcounted and may be freed from

[PATCH v3 1/6] fixup block-coroutine-wrapper: use qemu_get_current_aio_context()

2023-12-21 Thread Stefan Hajnoczi
qemu-iotests 051 fails on my machine so the change to 051.pc.out made by the above commit appears to be incorrect, at least against the current QEMU source tree. Revert it so that 051 passes again. Signed-off-by: Stefan Hajnoczi --- tests/qemu-iotests/051.pc.out | 4 ++-- 1 file changed, 2 inser

[PATCH v3 3/6] fixup scsi: only access SCSIDevice->requests from one thread

2023-12-21 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index df68a44b6a..5b08cbf60a 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -127,7 +127,8 @@

[PATCH v3 0/6] qemu-iotests fixes for Kevin's block tree

2023-12-21 Thread Stefan Hajnoczi
v3: - Add aio_wait_kick() into nbd_read_eof() to avoid race with nbd_drained_poll() [Kevin] v2: - Drop useless if (client->quiesing) check [Kevin] - run qio_channel_read_wake() in export AioContext to avoid race [Kevin] - Introduce nbd_client_put_nonzero() optimization [Paolo] - Reach goto label

Re: [PATCH v2 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Stefan Hajnoczi
On Thu, Dec 21, 2023 at 06:38:16PM +0100, Kevin Wolf wrote: > Am 21.12.2023 um 16:35 hat Stefan Hajnoczi geschrieben: > > NBDClient has a number of fields that are accessed by both the export > > AioContext and the main loop thread. When the AioContext lock is removed > > these fields will need ano

Re: [PATCH v2 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Kevin Wolf
Am 21.12.2023 um 16:35 hat Stefan Hajnoczi geschrieben: > NBDClient has a number of fields that are accessed by both the export > AioContext and the main loop thread. When the AioContext lock is removed > these fields will need another form of protection. > > Add NBDClient->lock and protect fields

Re: [PATCH v4 1/4] qdev-properties: alias all object class properties

2023-12-21 Thread Stefan Hajnoczi
On Thu, Dec 21, 2023 at 01:39:48PM +0100, Kevin Wolf wrote: > Am 20.12.2023 um 14:47 hat Stefan Hajnoczi geschrieben: > > qdev_alias_all_properties() aliases a DeviceState's qdev properties onto > > an Object. This is used for VirtioPCIProxy types so that --device > > virtio-blk-pci has properties

[PATCH v2 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Stefan Hajnoczi
NBDClient has a number of fields that are accessed by both the export AioContext and the main loop thread. When the AioContext lock is removed these fields will need another form of protection. Add NBDClient->lock and protect fields that are accessed by both threads. Also add assertions where poss

[PATCH v2 2/6] fixup block: remove AioContext locking

2023-12-21 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi --- migration/block.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/migration/block.c b/migration/block.c index 2bcfcbfdf6..6ec6a1d6e6 100644 --- a/migration/block.c +++ b/migration/block.c @@ -311,10 +311,17 @@ static int mig_save_device_bulk(QEMUFile

[PATCH v2 1/6] fixup block-coroutine-wrapper: use qemu_get_current_aio_context()

2023-12-21 Thread Stefan Hajnoczi
qemu-iotests 051 fails on my machine so the change to 051.pc.out made by the above commit appears to be incorrect, at least against the current QEMU source tree. Revert it so that 051 passes again. Signed-off-by: Stefan Hajnoczi --- tests/qemu-iotests/051.pc.out | 4 ++-- 1 file changed, 2 inser

[PATCH v2 3/6] fixup scsi: only access SCSIDevice->requests from one thread

2023-12-21 Thread Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index df68a44b6a..5b08cbf60a 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -127,7 +127,8 @@

[PATCH v2 5/6] nbd/server: only traverse NBDExport->clients from main loop thread

2023-12-21 Thread Stefan Hajnoczi
The NBD clients list is currently accessed from both the export AioContext and the main loop thread. When the AioContext lock is removed there will be nothing protecting the clients list. Adding a lock around the clients list is tricky because NBDClient structs are refcounted and may be freed from

[PATCH v2 4/6] nbd/server: avoid per-NBDRequest nbd_client_get/put()

2023-12-21 Thread Stefan Hajnoczi
nbd_trip() processes a single NBD request from start to finish and holds an NBDClient reference throughout. NBDRequest does not outlive the scope of nbd_trip(). Therefore it is unnecessary to ref/unref NBDClient for each NBDRequest. Removing these nbd_client_get()/nbd_client_put() calls will make

[PATCH v2 0/6] qemu-iotests fixes for Kevin's block tree

2023-12-21 Thread Stefan Hajnoczi
v2: - Drop useless if (client->quiesing) check [Kevin] - run qio_channel_read_wake() in export AioContext to avoid race [Kevin] - Introduce nbd_client_put_nonzero() optimization [Paolo] - Reach goto label disconnect with client->lock taken [Paolo] - Add doc comment explaining nbd_co_receive_request

[PATCH v3 09/11] hw/char/parallel-isa: Implement relocation and enabling/disabling for TYPE_ISA_PARALLEL

2023-12-21 Thread Bernhard Beschow
The real SuperI/O chips emulated by QEMU allow for relocating and enabling or disabling their SuperI/O functions via software. So far this is not implemented. Prepare for that by adding isa_parallel_set_{enabled,iobase}. Signed-off-by: Bernhard Beschow --- include/hw/char/parallel-isa.h | 3 +++

[PATCH v3 10/11] hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions

2023-12-21 Thread Bernhard Beschow
This is a preparation for implementing relocation and toggling of SuperI/O functions in the VT8231 device model. Upon reset, all SuperI/O functions will be deactivated, so in case if no -bios is given, let the machine configure those functions the same way Pegasos II firmware would do. Signed-off-

[PATCH v3 11/11] hw/isa/vt82c686: Implement relocation and toggling of SuperI/O functions

2023-12-21 Thread Bernhard Beschow
The VIA south bridges are able to relocate and toggle (enable or disable) their SuperI/O functions. So far this is hardcoded such that all functions are always enabled and are located at fixed addresses. Some PC BIOSes seem to probe for I/O occupancy before activating such a function and issue an

[PATCH v3 07/11] hw/block/fdc-isa: Implement relocation and enabling/disabling for TYPE_ISA_FDC

2023-12-21 Thread Bernhard Beschow
The real SuperI/O chips emulated by QEMU allow for relocating and enabling or disabling their SuperI/O functions via software. So far this is not implemented. Prepare for that by adding isa_fdc_set_{enabled,iobase}. Signed-off-by: Bernhard Beschow --- include/hw/block/fdc.h | 3 +++ hw/block/fd

[PATCH v3 00/11] hw/isa/vt82c686: Implement relocation and toggling of SuperI/O functions

2023-12-21 Thread Bernhard Beschow
This series implements relocation of the SuperI/O functions of the VIA south bridges which resolves some FIXME's. It is part of my via-apollo-pro-133t branch [1] which is an extension of bringing the VIA south bridges to the PC machine [2]. This branch is able to run some real-world X86 BIOSes in t

[PATCH v3 02/11] hw/block/fdc-sysbus: Move iomem from FDCtrl to FDCtrlSysBus

2023-12-21 Thread Bernhard Beschow
FDCtrl::iomem isn't used inside FDCtrl context but only inside FDCtrlSysBus context, so move it there. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan --- hw/block/fdc-internal.h | 2 -- hw/block/fdc-sysbus.c | 6 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git

[PATCH v3 04/11] exec/ioport: Resolve redundant .base attribute in struct MemoryRegionPortio

2023-12-21 Thread Bernhard Beschow
portio_list_add_1() creates a MemoryRegionPortioList instance which holds a MemoryRegion `mr` and an array of MemoryRegionPortio elements named `ports`. Each element in the array gets assigned the same value for its .base attribute. The same value also ends up as the .addr attribute of `mr` due to

[PATCH v3 03/11] hw/char/parallel: Move portio_list from ParallelState to ISAParallelState

2023-12-21 Thread Bernhard Beschow
ParallelState::portio_list isn't used inside ParallelState context but only inside ISAParallelState context, so move it there. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan --- include/hw/char/parallel-isa.h | 2 ++ include/hw/char/parallel.h | 2 -- hw/char/parallel.c

[PATCH v3 05/11] exec/ioport: Add portio_list_set_address()

2023-12-21 Thread Bernhard Beschow
Some SuperI/O devices such as the VIA south bridges or the PC87312 controller are able to relocate their SuperI/O functions. Add a convenience function for implementing this in the VIA south bridges. This convenience function relies on previous simplifications in exec/ioport which avoids some dupl

[PATCH v3 06/11] exec/ioport: Add portio_list_set_enabled()

2023-12-21 Thread Bernhard Beschow
Some SuperI/O devices such as the VIA south bridges or the PC87312 controller allow to enable or disable their SuperI/O functions. Add a convenience function for implementing this in the VIA south bridges. The naming of the functions is inspired by its memory_region_set_enabled() pendant. Signed-

[PATCH v3 01/11] hw/block/fdc-isa: Move portio_list from FDCtrl to FDCtrlISABus

2023-12-21 Thread Bernhard Beschow
FDCtrl::portio_list isn't used inside FDCtrl context but only inside FDCtrlISABus context, so move it there. Signed-off-by: Bernhard Beschow Reviewed-by: BALATON Zoltan --- hw/block/fdc-internal.h | 2 -- hw/block/fdc-isa.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff -

[PATCH v3 08/11] hw/char/serial-isa: Implement relocation and enabling/disabling for TYPE_ISA_SERIAL

2023-12-21 Thread Bernhard Beschow
The real SuperI/O chips emulated by QEMU allow for relocating and enabling or disabling their SuperI/O functions via software. So far this is not implemented. Prepare for that by adding isa_serial_set_{enabled,iobase}. Signed-off-by: Bernhard Beschow --- include/hw/char/serial.h | 2 ++ hw/char

Re: [PATCH v2 11/12] hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions

2023-12-21 Thread Bernhard Beschow
Am 19. Dezember 2023 00:11:37 UTC schrieb BALATON Zoltan : >On Mon, 18 Dec 2023, Bernhard Beschow wrote: >> This is a preparation for implementing relocation and toggling of SuperI/O >> functions in the VT8231 device model. Upon reset, all SuperI/O functions >> will be >> deactivated, so in cas

Re: [PATCH 5/6] nbd/server: only traverse NBDExport->clients from main loop thread

2023-12-21 Thread Stefan Hajnoczi
On Thu, Dec 21, 2023 at 08:23:15AM +0100, Paolo Bonzini wrote: > On 12/21/23 02:49, Stefan Hajnoczi wrote: > > The NBD clients list is currently accessed from both the export > > AioContext and the main loop thread. When the AioContext lock is removed > > there will be nothing protecting the client

Re: [PATCH v2 08/12] hw/block/fdc-isa: Implement relocation and toggling for TYPE_ISA_FDC

2023-12-21 Thread Bernhard Beschow
Am 19. Dezember 2023 00:09:23 UTC schrieb BALATON Zoltan : >On Mon, 18 Dec 2023, Bernhard Beschow wrote: >> Implement isa_fdc_set_{enabled,iobase} in order to implement relocation and >> toggling of SuperI/O functions in the VIA south bridges without breaking >> encapsulation. > >You may want to

Re: [PATCH 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Stefan Hajnoczi
On Thu, Dec 21, 2023 at 11:45:36AM +0100, Kevin Wolf wrote: > Am 21.12.2023 um 02:49 hat Stefan Hajnoczi geschrieben: > > NBDClient has a number of fields that are accessed by both the export > > AioContext and the main loop thread. When the AioContext lock is removed > > these fields will need ano

Re: [PATCH v4 4/4] virtio-blk: add iothread-vq-mapping parameter

2023-12-21 Thread Kevin Wolf
Am 20.12.2023 um 14:47 hat Stefan Hajnoczi geschrieben: > Add the iothread-vq-mapping parameter to assign virtqueues to IOThreads. > Store the vq:AioContext mapping in the new struct > VirtIOBlockDataPlane->vq_aio_context[] field and refactor the code to > use the per-vq AioContext instead of the B

Re: [PATCH v4 4/4] virtio-blk: add iothread-vq-mapping parameter

2023-12-21 Thread Kevin Wolf
Am 20.12.2023 um 14:47 hat Stefan Hajnoczi geschrieben: > Add the iothread-vq-mapping parameter to assign virtqueues to IOThreads. > Store the vq:AioContext mapping in the new struct > VirtIOBlockDataPlane->vq_aio_context[] field and refactor the code to > use the per-vq AioContext instead of the B

Re: [PATCH v4 1/4] qdev-properties: alias all object class properties

2023-12-21 Thread Kevin Wolf
Am 20.12.2023 um 14:47 hat Stefan Hajnoczi geschrieben: > qdev_alias_all_properties() aliases a DeviceState's qdev properties onto > an Object. This is used for VirtioPCIProxy types so that --device > virtio-blk-pci has properties of its embedded --device virtio-blk-device > object. > > Currently

Re: [PATCH 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Stefan Hajnoczi
On Thu, Dec 21, 2023 at 08:26:58AM +0100, Paolo Bonzini wrote: > On 12/21/23 02:49, Stefan Hajnoczi wrote: > > nbd_client_receive_next_request(client); > > + > > +qemu_mutex_unlock(&client->lock); > > + > > if (ret == -EIO) { > > goto disconnect; > > } > > I think I

Re: [PATCH 6/6] nbd/server: introduce NBDClient->lock to protect fields

2023-12-21 Thread Kevin Wolf
Am 21.12.2023 um 02:49 hat Stefan Hajnoczi geschrieben: > NBDClient has a number of fields that are accessed by both the export > AioContext and the main loop thread. When the AioContext lock is removed > these fields will need another form of protection. > > Add NBDClient->lock and protect fields