[PULL 09/15] hw/nvme: Add support for the Virtualization Management command

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk With the new command one can: - assign flexible resources (queues, interrupts) to primary and secondary controllers, - toggle the online/offline state of given controller. Signed-off-by: Łukasz Gieryk Acked-by: Michael S. Tsirkin Reviewed-by: Klaus Jensen Signed-off-b

[PULL 10/15] docs: Add documentation for SR-IOV and Virtualization Enhancements

2022-06-23 Thread Klaus Jensen
From: Lukasz Maniak Documentation describes 5 new parameters being added regarding SR-IOV: sriov_max_vfs sriov_vq_flexible sriov_vi_flexible sriov_max_vi_per_vf sriov_max_vq_per_vf The description also includes the simplest possible QEMU invocation and the series of NVMe commands required to ena

[PULL 11/15] hw/nvme: Update the initalization place for the AER queue

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk This patch updates the initialization place for the AER queue, so it’s initialized once, at controller initialization, and not every time controller is enabled. While the original version works for a non-SR-IOV device, as it’s hard to interact with the controller if it’s not

[PULL 12/15] hw/acpi: Make the PCI hot-plug aware of SR-IOV

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk PCI device capable of SR-IOV support is a new, still-experimental feature with only a single working example of the Nvme device. This patch in an attempt to fix a double-free problem when a SR-IOV-capable Nvme device is hot-unplugged in the following scenario: Qemu CLI:

[PULL 14/15] Revert "hw/block/nvme: add support for sgl bit bucket descriptor"

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen This reverts commit d97eee64fef35655bd06f5c44a07fdb83a6274ae. The emulated controller correctly accounts for not including bit buckets in the controller-to-host data transfer, however it doesn't correctly account for the holes for the on-disk data offsets. Reported-by: Keith

[PULL 13/15] hw/nvme: clean up CC register write logic

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen The SRIOV series exposed an issued with how CC register writes are handled and how CSTS is set in response to that. Specifically, after applying the SRIOV series, the controller could end up in a state with CC.EN set to '1' but with CSTS.RDY cleared to '0', causing drivers to e

Re: [PATCH v5 07/10] block: Implement bdrv_{pread,pwrite,pwrite_zeroes}() using generated_co_wrapper

2022-06-23 Thread Eric Blake
On Thu, Jun 09, 2022 at 04:27:41PM +0100, Alberto Faria wrote: > bdrv_{pread,pwrite}() now return -EIO instead of -EINVAL when 'bytes' is > negative, making them consistent with bdrv_{preadv,pwritev}() and > bdrv_co_{pread,pwrite,preadv,pwritev}(). > > bdrv_pwrite_zeroes() now also calls trace_bdr

Re: [RFC v2] Adding block layer APIs resembling Linux ZoneBlockDevice ioctls.

2022-06-23 Thread Sam Li
Hi Stefan, Stefan Hajnoczi 于2022年6月20日周一 15:55写道: > > On Mon, Jun 20, 2022 at 11:36:11AM +0800, Sam Li wrote: > > Hi Sam, > Is this version 2 of "[RFC v1] Add support for zoned device"? Please > keep the email subject line the same (except for "v2", "v3", etc) so > that it's clear which patch ser

Re: [PATCH v3 2/2] hw: m25p80: add tests for write protect (WP# and SRWD bit)

2022-06-23 Thread Cédric Le Goater
Hello Iris, Could please resend with a Sob tag ? Thanks, C. On 6/18/22 00:06, Iris Chen wrote: --- Fixing suggestions to move testing related code to a different commit. tests/qtest/aspeed_smc-test.c | 62 +++ 1 file changed, 62 insertions(+) diff --git a

Re: [PATCH 8/9] scripts/qapi-gen: add -i option

2022-06-23 Thread Marc-André Lureau
Hi On Tue, Jun 21, 2022 at 6:14 PM Markus Armbruster wrote: > > marcandre.lur...@redhat.com writes: > > > From: Marc-André Lureau > > > > Replace hard-coded "qemu/osdep.h" include with a qapi-gen option to > > specify the headers to include. This will allow to substitute QEMU > > osdep.h with g

Re: [PATCH v7 10/18] jobs: rename static functions called with job_mutex held

2022-06-23 Thread Emanuele Giuseppe Esposito
Am 22/06/2022 um 20:38 schrieb Vladimir Sementsov-Ogievskiy: > On 6/22/22 17:26, Emanuele Giuseppe Esposito wrote: >> >> >> Am 21/06/2022 um 19:26 schrieb Vladimir Sementsov-Ogievskiy: >>> On 6/16/22 16:18, Emanuele Giuseppe Esposito wrote: With the*nop*  job_lock/unlock placed, rename the

Re: [PATCH v7 10/18] jobs: rename static functions called with job_mutex held

2022-06-23 Thread Vladimir Sementsov-Ogievskiy
On 6/23/22 12:08, Emanuele Giuseppe Esposito wrote: Am 22/06/2022 um 20:38 schrieb Vladimir Sementsov-Ogievskiy: On 6/22/22 17:26, Emanuele Giuseppe Esposito wrote: Am 21/06/2022 um 19:26 schrieb Vladimir Sementsov-Ogievskiy: On 6/16/22 16:18, Emanuele Giuseppe Esposito wrote: With the*no

Re: [PATCH v7 10/18] jobs: rename static functions called with job_mutex held

2022-06-23 Thread Emanuele Giuseppe Esposito
Am 23/06/2022 um 13:10 schrieb Vladimir Sementsov-Ogievskiy: > On 6/23/22 12:08, Emanuele Giuseppe Esposito wrote: >> >> >> Am 22/06/2022 um 20:38 schrieb Vladimir Sementsov-Ogievskiy: >>> On 6/22/22 17:26, Emanuele Giuseppe Esposito wrote: Am 21/06/2022 um 19:26 schrieb Vladimir

Re: [PATCH v7 10/18] jobs: rename static functions called with job_mutex held

2022-06-23 Thread Vladimir Sementsov-Ogievskiy
On 6/23/22 14:19, Emanuele Giuseppe Esposito wrote: Am 23/06/2022 um 13:10 schrieb Vladimir Sementsov-Ogievskiy: On 6/23/22 12:08, Emanuele Giuseppe Esposito wrote: Am 22/06/2022 um 20:38 schrieb Vladimir Sementsov-Ogievskiy: On 6/22/22 17:26, Emanuele Giuseppe Esposito wrote: Am 21/06/202

Re: [PATCH 9/9] scripts/qapi: add required system includes to visitor

2022-06-23 Thread Markus Armbruster
marcandre.lur...@redhat.com writes: > From: Marc-André Lureau > > The generated visitor code includes abort() & assert(), we shouldn't > rely on the global "-i" headers to include the necessary system headers. Suggest ", even though the default qemu/osdep.h always does. > > Signed-off-by: Marc-

Re: [PATCH v5 00/10] Implement bdrv_{pread, pwrite, pwrite_sync, pwrite_zeroes}() using generated_co_wrapper

2022-06-23 Thread Alberto Faria
On Thu, Jun 9, 2022 at 4:27 PM Alberto Faria wrote: > Start by making the interfaces of analogous non-coroutine and coroutine > functions consistent with each other, then implement the non-coroutine > ones using generated_co_wrapper. > > For the bdrv_pwrite_sync() case, also add the missing > bdrv

[PATCH 00/12] hw/nvme: misc fixes and updates

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen This series includes a couple of misc fixes as well as some cleanup pertaining to the aio handling in flush, dsm, copy and zone reset. As Jinhao gets around to iothread stuff, it might come in handy to have this stuff cleaned up a bit. Dmitrys fix (nvme-next commit "hw/nvme: a

[PATCH 03/12] hw/nvme: cleanup error reporting in nvme_init_pci()

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Replace the local Error variable with errp and ERRP_GUARD(). Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index b688afccbe5a..af82daa304bf 100644 --- a/hw/nvme/

[PATCH 07/12] hw/nvme: fix flush cancel

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Make sure that iocb->aiocb is NULL'ed when cancelling. Fixes: 38f4ac65ac88 ("hw/nvme: reimplement flush to allow cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index a85eabfa8b

[PATCH 04/12] hw/nvme: fix numzrwa handling

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Number of ZRWA Resources should be initialized to Max Active Resources, and not the total number of zones. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 8 ++-- hw/nvme/ns.c | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw

[PATCH 09/12] hw/nvme: improve cancellation handling in zone reset

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen If the zone reset operation is cancelled but the block unmap operation completes normally, the callback will continue resetting the next zone since it neglects to check iocb->ret which will have been set to -ECANCELED. Make sure that this is checked and bail out if an error is

[PATCH 05/12] hw/nvme: fix accidental reintroduction of redundant code

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Commit 44219b6029fc ("hw/nvme: 64-bit pi support") accidentially reintroduced code that was removed in commit a6de6ed5092c ("hw/nvme: move format parameter parsing"). It is beneign, but get rid of it anyway. Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support") Signed-off-by: Kl

[PATCH 10/12] hw/nvme: improve cancellation handling in dsm

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen When the DSM operation is cancelled asynchronously, we set iocb->ret to -ECANCELED. However, the callback function only checks the return value of the completed aio, which may have completed succesfully prior to the cancellation and thus the callback ends up continuing the dsm

[PATCH 06/12] hw/nvme: fix cancellation of format operations

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Cancelling a format operation neglects to set iocb->ret as well as clearing the iocb->aiocb after cancelling the underlying aiocb. Fix this. Fixes: 3bcf26d3d619 ("hw/nvme: reimplement format nvm to allow cancellation") Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 3 +++

[PATCH 01/12] hw/nvme: fix incorrect use of errp/local_err

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Make nvme_check_constraints() return an int and fix incorrect use of errp/local_err. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 48 +++- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme

[PATCH 02/12] hw/nvme: remove redundant passing of PCIDevice

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen The NvmeCtrl is a PCIDevice, so remove the redundant passing of the PCIDevice parameter. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index c8c4a0718f

[PATCH 11/12] hw/nvme: simplify copy command error handling

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Move error handling down in the call stack to simplify the control flow. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 50 -- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c in

[PATCH 12/12] hw/nvme: align logic of format with flush

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Use the same logic in format as in flush, saving a bh scheduling at the start of the operation and moving completion handling to a separately invoked bottom halve. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 43 ++- 1 file changed

[PATCH 08/12] hw/nvme: rework flush bh scheduling

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Remove an initial bh scheduling and move the completion invocation into a separate bh. Also, make sure that iocb->aiocb is NULL'ed when cancelling. Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 32 +++- 1 file changed, 19 insertions(+), 13 dele

Re: [PATCH v5 06/10] block: Make 'bytes' param of bdrv_co_{pread,pwrite,preadv,pwritev}() an int64_t

2022-06-23 Thread Eric Blake
On Thu, Jun 09, 2022 at 04:27:40PM +0100, Alberto Faria wrote: > For consistency with other I/O functions, and in preparation to > implement bdrv_{pread,pwrite}() using generated_co_wrapper. > > unsigned int fits in int64_t, so all callers remain correct. > > bdrv_check_request32() is called furt

[PULL 00/15] hw/nvme updates

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen Hi, The following changes since commit 7db86fe2ed220c196061824e652b94e7a2acbabf: Merge tag 'pull-migration-20220623b' of https://gitlab.com/dagrh/qemu into staging (2022-06-23 10:14:20 -0700) are available in the Git repository at: git://git.infradead.org/qemu-nvme.git

[PULL 01/15] hw/nvme: Add support for SR-IOV

2022-06-23 Thread Klaus Jensen
From: Lukasz Maniak This patch implements initial support for Single Root I/O Virtualization on an NVMe device. Essentially, it allows to define the maximum number of virtual functions supported by the NVMe controller via sriov_max_vfs parameter. Passing a non-zero value to sriov_max_vfs trigge

[PULL 05/15] hw/nvme: Make max_ioqpairs and msix_qsize configurable in runtime

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk The NVMe device defines two properties: max_ioqpairs, msix_qsize. Having them as constants is problematic for SR-IOV support. SR-IOV introduces virtual resources (queues, interrupts) that can be assigned to PF and its dependent VFs. Each device, following a reset, should work

[PULL 02/15] hw/nvme: Add support for Primary Controller Capabilities

2022-06-23 Thread Klaus Jensen
From: Lukasz Maniak Implementation of Primary Controller Capabilities data structure (Identify command with CNS value of 14h). Currently, the command returns only ID of a primary controller. Handling of remaining fields are added in subsequent patches implementing virtualization enhancements. S

[PULL 15/15] hw/nvme: clear aen mask on reset

2022-06-23 Thread Klaus Jensen
From: Klaus Jensen The internally maintained AEN mask is not cleared on reset. Fix this. Reviewed-by: Keith Busch Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 15d580a904ef..d349b3e42620 100644 --- a/hw

[PULL 03/15] hw/nvme: Add support for Secondary Controller List

2022-06-23 Thread Klaus Jensen
From: Lukasz Maniak Introduce handling for Secondary Controller List (Identify command with CNS value of 15h). Secondary controller ids are unique in the subsystem, hence they are reserved by it upon initialization of the primary controller to the number of sriov_max_vfs. ID reservation require

[PULL 04/15] hw/nvme: Implement the Function Level Reset

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk This patch implements the Function Level Reset, a feature currently not implemented for the Nvme device, while listed as a mandatory ("shall") in the 1.4 spec. The implementation reuses FLR-related building blocks defined for the pci-bridge module, and follows the same logic:

[PULL 07/15] hw/nvme: Calculate BAR attributes in a function

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk An NVMe device with SR-IOV capability calculates the BAR size differently for PF and VF, so it makes sense to extract the common code to a separate function. Signed-off-by: Łukasz Gieryk Reviewed-by: Klaus Jensen Acked-by: Michael S. Tsirkin Signed-off-by: Klaus Jensen --

[PULL 06/15] hw/nvme: Remove reg_size variable and update BAR0 size calculation

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk The n->reg_size parameter unnecessarily splits the BAR0 size calculation in two phases; removed to simplify the code. With all the calculations done in one place, it seems the pow2ceil, applied originally to reg_size, is unnecessary. The rounding should happen as the last ste

[PULL 08/15] hw/nvme: Initialize capability structures for primary/secondary controllers

2022-06-23 Thread Klaus Jensen
From: Łukasz Gieryk With four new properties: - sriov_v{i,q}_flexible, - sriov_max_v{i,q}_per_vf, one can configure the number of available flexible resources, as well as the limits. The primary and secondary controller capability structures are initialized accordingly. Since the number of ava