[PATCH v5 09/14] hw/block/nvme: Support Zoned Namespace Command Set

2020-09-27 Thread Dmitry Fomichev
The emulation code has been changed to advertise NVM Command Set when "zoned" device property is not set (default) and Zoned Namespace Command Set otherwise. Handlers for three new NVMe commands introduced in Zoned Namespace Command Set specification are added, namely for Zone Management Receive,

RE: [PATCH v4 00/14] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set

2020-09-27 Thread Dmitry Fomichev
> -Original Message- > From: Klaus Jensen > Sent: Thursday, September 24, 2020 5:08 PM > To: Dmitry Fomichev > Cc: Keith Busch ; Klaus Jensen > ; Kevin Wolf ; Philippe > Mathieu-Daudé ; Maxim Levitsky > ; Fam Zheng ; Niklas Cassel > ; Damien Le Moal ; > qemu-block@nongnu.org;

[PATCH v5 08/14] hw/block/nvme: Define Zoned NS Command Set trace events

2020-09-27 Thread Dmitry Fomichev
The Zoned Namespace Command Set / Namespace Types implementation that is being introduced in this series adds a good number of trace events. Combine all tracepoint definitions into a separate patch to make reviewing more convenient. Signed-off-by: Dmitry Fomichev --- hw/block/trace-events | 26

[PATCH v5 10/14] hw/block/nvme: Introduce max active and open zone limits

2020-09-27 Thread Dmitry Fomichev
Added two module properties, "max_active" and "max_open" to control the maximum number of zones that can be active or open. Once these variables are set to non-default values, these limits are checked during I/O and Too Many Active or Too Many Open command status is returned if they are exceeded.

[PATCH v5 00/14] hw/block/nvme: Support Namespace Types and Zoned Namespace Command Set

2020-09-27 Thread Dmitry Fomichev
v4 -> v5 - Rebase to the current qemu-nvme. - Use HostMemoryBackendFile as the backing storage for persistent zone metadata. - Fix the issue with filling the valid data in the next zone if RAZBi is enabled. v3 -> v4 - Fix bugs introduced in v2/v3 for QD > 1 operation. Now, all

[PATCH v5 02/14] hw/block/nvme: Add Commands Supported and Effects log

2020-09-27 Thread Dmitry Fomichev
This log page becomes necessary to implement to allow checking for Zone Append command support in Zoned Namespace Command Set. This commit adds the code to report this log page for NVM Command Set only. The parts that are specific to zoned operation will be added later in the series.

[PATCH v5 01/14] hw/block/nvme: Report actual LBA data shift in LBAF

2020-09-27 Thread Dmitry Fomichev
Calculate the data shift value to report based on the set value of logical_block_size device property. In the process, use a local variable to calculate the LBA format index instead of the hardcoded value 0. This makes the code more readable and it will make it easier to add support for multiple

[PATCH v5 12/14] hw/block/nvme: Add injection of Offline/Read-Only zones

2020-09-27 Thread Dmitry Fomichev
ZNS specification defines two zone conditions for the zones that no longer can function properly, possibly because of flash wear or other internal fault. It is useful to be able to "inject" a small number of such zones for testing purposes. This commit defines two optional device properties,

[PATCH v5 13/14] hw/block/nvme: Use zone metadata file for persistence

2020-09-27 Thread Dmitry Fomichev
A ZNS drive that is emulated by this module is currently initialized with all zones Empty upon startup. However, actual ZNS SSDs save the state and condition of all zones in their internal NVRAM in the event of power loss. When such a drive is powered up again, it closes or finishes all zones that

[PATCH v5 14/14] hw/block/nvme: Document zoned parameters in usage text

2020-09-27 Thread Dmitry Fomichev
Added brief descriptions of the new device properties that are now available to users to configure features of Zoned Namespace Command Set in the emulator. This patch is for documentation only, no functionality change. Signed-off-by: Dmitry Fomichev --- hw/block/nvme.c | 44

[PATCH v5 04/14] hw/block/nvme: Define trace events related to NS Types

2020-09-27 Thread Dmitry Fomichev
A few trace events are defined that are relevant to implementing Namespace Types (NVMe TP 4056). Signed-off-by: Dmitry Fomichev Reviewed-by: Klaus Jensen --- hw/block/trace-events | 10 ++ 1 file changed, 10 insertions(+) diff --git a/hw/block/trace-events b/hw/block/trace-events

[PATCH v5 03/14] hw/block/nvme: Introduce the Namespace Types definitions

2020-09-27 Thread Dmitry Fomichev
From: Niklas Cassel Define the structures and constants required to implement Namespace Types support. Signed-off-by: Niklas Cassel Signed-off-by: Dmitry Fomichev --- hw/block/nvme-ns.h | 2 ++ hw/block/nvme.c | 2 +- include/block/nvme.h | 74

[PATCH v5 05/14] hw/block/nvme: Add support for Namespace Types

2020-09-27 Thread Dmitry Fomichev
From: Niklas Cassel Namespace Types introduce a new command set, "I/O Command Sets", that allows the host to retrieve the command sets associated with a namespace. Introduce support for the command set and enable detection for the NVM Command Set. The new workflows for identify commands rely

[PATCH v5 06/14] hw/block/nvme: Add support for active/inactive namespaces

2020-09-27 Thread Dmitry Fomichev
From: Niklas Cassel In NVMe, a namespace is active if it exists and is attached to the controller. CAP.CSS (together with the I/O Command Set data structure) defines what command sets are supported by the controller. CC.CSS (together with Set Profile) can be set to enable a subset of the

[PATCH v5 07/14] hw/block/nvme: Make Zoned NS Command Set definitions

2020-09-27 Thread Dmitry Fomichev
Define values and structures that are needed to support Zoned Namespace Command Set (NVMe TP 4053) in PCI NVMe controller emulator. All new protocol definitions are located in include/block/nvme.h and everything added that is specific to this implementation is kept in hw/block/nvme.h. In order

[PATCH v5 11/14] hw/block/nvme: Support Zone Descriptor Extensions

2020-09-27 Thread Dmitry Fomichev
Zone Descriptor Extension is a label that can be assigned to a zone. It can be set to an Empty zone and it stays assigned until the zone is reset. This commit adds a new optional module property, "zone_descr_ext_size". Its value must be a multiple of 64 bytes. If this value is non-zero, it

Re: [PATCH v5 0/7] vhost-user-blk: fix the migration issue and enhance qtests

2020-09-27 Thread Dima Stepanov
On Thu, Sep 24, 2020 at 07:26:14AM -0400, Michael S. Tsirkin wrote: > On Fri, Sep 11, 2020 at 11:39:42AM +0300, Dima Stepanov wrote: > > v4 -> v5: > > - vhost: check queue state in the vhost_dev_set_log routine > > tests/qtest/vhost-user-test: prepare the tests for adding new > > dev