[PATCH v3 20/21] pci: pass along the return value of dma_memory_rw

2019-11-11 Thread Klaus Jensen
Some might actually care about the return value of dma_memory_rw. So let us pass it along instead of ignoring it. There are no existing users of the return value, so this patch should be safe. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin

[PATCH v3 19/21] nvme: make lba data size configurable

2019-11-11 Thread Klaus Jensen
Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.c | 2 +- hw/block/nvme-ns.h | 4 +++- hw/block/nvme.c| 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 36deedee07a6..dc7e63b01037 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block

[PATCH v3 11/21] nvme: add missing mandatory features

2019-11-11 Thread Klaus Jensen
Add support for returning a resonable response to Get/Set Features of mandatory features. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 51 --- hw/block/trace-events | 2 ++ include/block/nvme.h | 3 ++- 3 files changed, 52 insertions(+), 4

[PATCH v3 21/21] nvme: handle dma errors

2019-11-11 Thread Klaus Jensen
ission queue entries). If DMA errors occur at any other point in the execution of the command (say, while mapping the PRPs or SGLs), the command is aborted with a Data Transfer Error status code. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 63 +--

[PATCH v3 14/21] nvme: allow multiple aios per command

2019-11-11 Thread Klaus Jensen
entry. Because the device is currently guaranteed to only issue a single aio request per command, the benefit is not immediately obvious. But this functionality is required to support metadata. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 455

[PATCH v3 16/21] nvme: support multiple namespaces

2019-11-11 Thread Klaus Jensen
the change backward compatible, but the property is now optional. Specifying a drive for the nvme device will always create the namespace with nsid 1. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/Makefile.objs | 2 +- hw/block/nvme-ns.c | 158

[PATCH v3 15/21] nvme: add support for scatter gather lists

2019-11-11 Thread Klaus Jensen
For now, support the Data Block, Segment and Last Segment descriptor types. See NVM Express 1.3d, Section 4.4 ("Scatter Gather List (SGL)"). Signed-off-by: Klaus Jensen Acked-by: Fam Zheng --- block/nvme.c | 18 +- hw/block/nvme.c

[PATCH v3 12/21] nvme: bump supported specification version to 1.3

2019-11-11 Thread Klaus Jensen
Add the new Namespace Identification Descriptor List (CNS 03h) and track creation of queues to enable the controller to return Command Sequence Error if Set Features is called for Number of Queues after any queues have been created. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 82

[PATCH v3 09/21] nvme: add support for the asynchronous event request command

2019-11-11 Thread Klaus Jensen
Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 180 -- hw/block/nvme.h | 13 ++- hw/block/trace-events | 8 ++ include/block/nvme.h | 4 +- 4 files changed, 196 insertions(+), 9 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nv

[PATCH v3 08/21] nvme: add support for the get log page command

2019-11-11 Thread Klaus Jensen
of the controller because the device has no place to store such persistent state. Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.10 ("Get Log Page command"). Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 149

[PATCH v3 07/21] nvme: refactor device realization

2019-11-11 Thread Klaus Jensen
This patch splits up nvme_realize into multiple individual functions, each initializing a different subset of the device. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 176 +++- hw/block/nvme.h | 22 ++ 2 files changed, 135 insertions(+), 63

[PATCH v3 18/21] nvme: remove redundant NvmeCmd pointer parameter

2019-11-11 Thread Klaus Jensen
The command struct is available in the NvmeRequest that we generally pass around anyway. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 218 +++- 1 file changed, 106 insertions(+), 112 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c

[PATCH v3 00/20] nvme: support NVMe v1.3d, SGLs and multiple namespaces

2019-11-11 Thread Klaus Jensen
i: pass along the return value of dma_memory_rw") is now included in this series (with Reviewed-By by Philippe and Michael). The patch is required for patch "nvme: handle dma errors" to actually do fix anything. [1]: https://patchwork.kernel.org/cover/11190045/ Klaus Jensen (21):

[PATCH v3 06/21] nvme: add support for the abort command

2019-11-11 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.1 ("Abort command"). The Abort command is a best effort command; for now, the device always fails to abort the given command. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 16 1 fi

[PATCH v3 02/21] nvme: move device parameters to separate struct

2019-11-11 Thread Klaus Jensen
Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 44 ++-- hw/block/nvme.h | 16 +--- 2 files changed, 35 insertions

[PATCH v3 04/21] nvme: populate the mandatory subnqn and ver fields

2019-11-11 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1 or later. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90 and Section 7.9 ("NVMe Qualified Names"). This also bumps the supported version to 1.2.1. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 11

[PATCH v3 10/21] nvme: add logging to error information log page

2019-11-11 Thread Klaus Jensen
Count field is *not* retained across power off conditions because the device currently has no place to store this kind of persistent state. Cribbed from Keith's qemu-nvme tree. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 22 -- hw/block/nvme.h | 2 ++ 2 files changed, 22

[PATCH v3 01/21] nvme: remove superfluous breaks

2019-11-11 Thread Klaus Jensen
These break statements was left over when commit 3036a626e9ef ("nvme: add Get/Set Feature Timestamp support") was merged. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 1 file changed, 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 12d825425016..c0

[PATCH v3 03/21] nvme: add missing fields in the identify controller data structure

2019-11-11 Thread Klaus Jensen
Not used by the device model but added for completeness. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90. Signed-off-by: Klaus Jensen --- include/block/nvme.h | 34 +- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git

[PATCH v3 05/21] nvme: allow completion queues in the cmb

2019-11-11 Thread Klaus Jensen
Allow completion queues in the controller memory buffer. This also inlines the nvme_addr_{read,write} functions and adds an nvme_addr_is_cmb helper. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 38 +- 1 file changed, 29 insertions(+), 9 deletions

[PATCH v3 13/21] nvme: refactor prp mapping

2019-11-11 Thread Klaus Jensen
helpers anyway, so the CMB path is not unfairly affected by this simplifying change. As a side-effect, this patch also allows PRPs to be located in the CMB. The logic ensures that if some of the PRP is in the CMB, all of it must be located there, as per the specification. Signed-off-by: Klaus

[PATCH v3 17/21] nvme: bump controller pci device id

2019-11-11 Thread Klaus Jensen
the device id to get rid of them. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 7bd5c1bb2f55..57e3a465c688 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -2496,7 +2496,7 @@ stati

[PATCH v2 07/20] nvme: refactor device realization

2019-10-15 Thread Klaus Jensen
This patch splits up nvme_realize into multiple individual functions, each initializing a different subset of the device. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 176 +++- hw/block/nvme.h | 22 ++ 2 files changed, 135 insertions(+), 63

[PATCH v2 00/20] nvme: support NVMe v1.3d, SGLs and multiple namespaces

2019-10-15 Thread Klaus Jensen
/project/qemu-devel/list/?series=142383 [2]: https://patchwork.kernel.org/patch/11184911/ Klaus Jensen (20): nvme: remove superfluous breaks nvme: move device parameters to separate struct nvme: add missing fields in the identify controller data structure nvme: populate the mand

[PATCH v2 06/20] nvme: add support for the abort command

2019-10-15 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.1 ("Abort command"). The Abort command is a best effort command; for now, the device always fails to abort the given command. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 16 1 fi

[PATCH v2 02/20] nvme: move device parameters to separate struct

2019-10-15 Thread Klaus Jensen
Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 44 ++-- hw/block/nvme.h | 16 +--- 2 files changed, 35 insertions

[PATCH v2 03/20] nvme: add missing fields in the identify controller data structure

2019-10-15 Thread Klaus Jensen
Not used by the device model but added for completeness. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90. Signed-off-by: Klaus Jensen --- include/block/nvme.h | 34 +- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git

[PATCH v2 04/20] nvme: populate the mandatory subnqn and ver fields

2019-10-15 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1 or later. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90 and Section 7.9 ("NVMe Qualified Names"). This also bumps the supported version to 1.2.1. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 11

[PATCH v2 10/20] nvme: add logging to error information log page

2019-10-15 Thread Klaus Jensen
Count field is *not* retained across power off conditions because the device currently has no place to store this kind of persistent state. Cribbed from Keith's qemu-nvme tree. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 22 -- hw/block/nvme.h | 2 ++ 2 files changed, 22

[PATCH v2 09/20] nvme: add support for the asynchronous event request command

2019-10-15 Thread Klaus Jensen
Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 180 -- hw/block/nvme.h | 13 ++- hw/block/trace-events | 8 ++ include/block/nvme.h | 4 +- 4 files changed, 196 insertions(+), 9 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nv

[PATCH v2 08/20] nvme: add support for the get log page command

2019-10-15 Thread Klaus Jensen
of the controller because the device has no place to store such persistent state. Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.10 ("Get Log Page command"). Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 150

[PATCH v2 11/20] nvme: add missing mandatory features

2019-10-15 Thread Klaus Jensen
Add support for returning a resonable response to Get/Set Features of mandatory features. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 51 --- hw/block/trace-events | 2 ++ include/block/nvme.h | 3 ++- 3 files changed, 52 insertions(+), 4

[PATCH v2 15/20] nvme: add support for scatter gather lists

2019-10-15 Thread Klaus Jensen
For now, support the Data Block, Segment and Last Segment descriptor types. See NVM Express 1.3d, Section 4.4 ("Scatter Gather List (SGL)"). Signed-off-by: Klaus Jensen --- block/nvme.c | 18 +- hw/block/nvme.c | 380 -- hw/b

[PATCH v2 01/20] nvme: remove superfluous breaks

2019-10-15 Thread Klaus Jensen
These break statements was left over when commit 3036a626e9ef ("nvme: add Get/Set Feature Timestamp support") was merged. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 1 file changed, 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 12d825425016..c0

[PATCH v2 05/20] nvme: allow completion queues in the cmb

2019-10-15 Thread Klaus Jensen
Allow completion queues in the controller memory buffer. This also inlines the nvme_addr_{read,write} functions and adds an nvme_addr_is_cmb helper. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 38 +- 1 file changed, 29 insertions(+), 9 deletions

[PATCH v2 12/20] nvme: bump supported specification version to 1.3

2019-10-15 Thread Klaus Jensen
Add the new Namespace Identification Descriptor List (CNS 03h) and track creation of queues to enable the controller to return Command Sequence Error if Set Features is called for Number of Queues after any queues have been created. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 82

[PATCH v2 18/20] nvme: remove redundant NvmeCmd pointer parameter

2019-10-15 Thread Klaus Jensen
The command struct is available in the NvmeRequest that we generally pass around anyway. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 219 +++- 1 file changed, 106 insertions(+), 113 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c

[PATCH v2 14/20] nvme: allow multiple aios per command

2019-10-15 Thread Klaus Jensen
entry. Because the device is currently guaranteed to only issue a single aio request per command, the benefit is not immediately obvious. But this functionality is required to support metadata. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 455

[PATCH v2 20/20] nvme: handle dma errors

2019-10-15 Thread Klaus Jensen
ission queue entries). If DMA errors occur at any other point in the execution of the command (say, while mapping the PRPs or SGLs), the command is aborted with a Data Transfer Error status code. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 63 +--

[PATCH v2 16/20] nvme: support multiple namespaces

2019-10-15 Thread Klaus Jensen
the change backward compatible, but the property is now optional. Specifying a drive for the nvme device will always create the namespace with nsid 1. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/Makefile.objs | 2 +- hw/block/nvme-ns.c | 139 +++ hw

[PATCH v2 13/20] nvme: refactor prp mapping

2019-10-15 Thread Klaus Jensen
helpers anyway, so the CMB path is not unfairly affected by this simplifying change. As a side-effect, this patch also allows PRPs to be located in the CMB. The logic ensures that if some of the PRP is in the CMB, all of it must be located there, as per the specification. Signed-off-by: Klaus

[PATCH v2 19/20] nvme: make lba data size configurable

2019-10-15 Thread Klaus Jensen
Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.c | 2 +- hw/block/nvme-ns.h | 4 +++- hw/block/nvme.c| 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index aa76bb63ef45..70ff622a5729 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block

[PATCH v2 17/20] nvme: bump controller pci device id

2019-10-15 Thread Klaus Jensen
the device id to get rid of them. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index a23e9bc4e5ef..bcd801c345b6 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -2500,7 +2500,7 @@ stati

[PATCH] nvme: fix NSSRS offset in CAP register

2019-10-23 Thread Klaus Jensen
Fix the offset of the NSSRS field the CAP register. Signed-off-by: Klaus Jensen Reported-by: Javier Gonzalez --- include/block/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/block/nvme.h b/include/block/nvme.h index 3ec8efcc435e..fa15b51c33bb 100644

[PATCH v4 20/24] nvme: add support for scatter gather lists

2019-12-19 Thread Klaus Jensen
For now, support the Data Block, Segment and Last Segment descriptor types. See NVM Express 1.3d, Section 4.4 ("Scatter Gather List (SGL)"). Signed-off-by: Klaus Jensen Acked-by: Fam Zheng --- block/nvme.c | 18 +- hw/block/nvme.c

[PATCH v4 24/24] nvme: make lba data size configurable

2019-12-19 Thread Klaus Jensen
Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.c | 2 +- hw/block/nvme-ns.h | 4 +++- hw/block/nvme.c| 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 36deedee07a6..dc7e63b01037 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block

[PATCH v4 16/24] nvme: refactor prp mapping

2019-12-19 Thread Klaus Jensen
. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 245 +++--- hw/block/nvme.h | 2 +- hw/block/trace-events | 1 + include/block/nvme.h | 1 + 4 files changed, 160 insertions(+), 89 deletions(-) diff --git a/hw

[PATCH v4 19/24] nvme: handle dma errors

2019-12-19 Thread Klaus Jensen
ission queue entries). If DMA errors occur at any other point in the execution of the command (say, while mapping the PRPs), the command is aborted with a Data Transfer Error status code. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 37 + hw/blo

[PATCH v4 10/24] nvme: add support for the get log page command

2019-12-19 Thread Klaus Jensen
with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.10 ("Get Log Page command"). Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 122 +- hw/block/nvme.h | 10 hw/block/trace-events | 2 + include/block/nvme.h | 2 +

[PATCH v4 18/24] pci: pass along the return value of dma_memory_rw

2019-12-19 Thread Klaus Jensen
The nvme device needs to know the return value of dma_memory_rw to pass block/011 from blktests. So pass it along instead of ignoring it. There are no existing users of the return value, so this patch should be safe. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed

[PATCH v4 14/24] nvme: make sure ncqr and nsqr is valid

2019-12-19 Thread Klaus Jensen
0x is not an allowed value for NCQR and NSQR in Set Features on Number of Queues. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index fbf6a52c7103..040dec234714 100644 --- a/hw/block/nvme.c +++ b/hw

[PATCH v4 02/24] nvme: remove superfluous breaks

2019-12-19 Thread Klaus Jensen
These break statements was left over when commit 3036a626e9ef ("nvme: add Get/Set Feature Timestamp support") was merged. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 1 file changed, 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index bcb1ca77e1bd..10

[PATCH v4 21/24] nvme: support multiple namespaces

2019-12-19 Thread Klaus Jensen
the change backward compatible, but the property is now optional. Specifying a drive for the nvme device will always create the namespace with nsid 1. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/Makefile.objs | 2 +- hw/block/nvme-ns.c | 158

[PATCH v4 15/24] nvme: bump supported specification to 1.3

2019-12-19 Thread Klaus Jensen
Command Sequence Error if a Set Features command is submitted for the Number of Queues feature after any I/O queues have been created. - The addition of the Log Specific Field (LSP) in the Get Log Page command. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 57

[PATCH v4 00/24] nvme: support NVMe v1.3d, SGLs and multiple namespaces

2019-12-19 Thread Klaus Jensen
controller pci device id' 023/24:[0110] [FC] 'nvme: remove redundant NvmeCmd pointer parameter' 024/24:[0004] [FC] 'nvme: make lba data size configurable' Klaus Jensen (24): nvme: rename trace events to nvme_dev nvme: remove superfluous breaks nvme: move device parameters to separate struct

[PATCH v4 08/24] nvme: refactor device realization

2019-12-19 Thread Klaus Jensen
This patch splits up nvme_realize into multiple individual functions, each initializing a different subset of the device. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 175 +++- hw/block/nvme.h | 21 ++ 2 files changed, 133 insertions(+), 63

[PATCH v4 01/24] nvme: rename trace events to nvme_dev

2019-12-19 Thread Klaus Jensen
Change the prefix of all nvme device related trace events to 'nvme_dev' to not clash with trace events from the nvme block driver. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 185 +- hw/block/trace-events | 172

[PATCH v4 11/24] nvme: add support for the asynchronous event request command

2019-12-19 Thread Klaus Jensen
pec states that the controller *should* retain events, so we do best effort here. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 167 +- hw/block/nvme.h | 14 +++- hw/block/trace-events | 9 +++ include/block/nvme.h | 8 +- 4 files changed, 191

[PATCH v4 23/24] nvme: remove redundant NvmeCmd pointer parameter

2019-12-19 Thread Klaus Jensen
The command struct is available in the NvmeRequest that we generally pass around anyway. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 198 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c

[PATCH v4 03/24] nvme: move device parameters to separate struct

2019-12-19 Thread Klaus Jensen
Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 44 ++-- hw/block/nvme.h | 16 +--- 2 files changed, 35 insertions

[PATCH v4 04/24] nvme: add missing fields in the identify data structures

2019-12-19 Thread Klaus Jensen
Not used by the device model but added for completeness. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90 and Figure 93. Signed-off-by: Klaus Jensen --- include/block/nvme.h | 48 1 file changed, 40 insertions(+), 8

[PATCH v4 07/24] nvme: add support for the abort command

2019-12-19 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.1 ("Abort command"). The Abort command is a best effort command; for now, the device always fails to abort the given command. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 28 +

[PATCH v4 17/24] nvme: allow multiple aios per command

2019-12-19 Thread Klaus Jensen
entry. Because the device is currently guaranteed to only issue a single aio request per command, the benefit is not immediately obvious. But this functionality is required to support metadata, the dataset management command and other features. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen

[PATCH v4 13/24] nvme: additional tracing

2019-12-19 Thread Klaus Jensen
Add a trace call for nvme_enqueue_req_completion. Also, streamline nvme_identify_ns and nvme_identify_ns_list. They do not need to repeat the command, it is already in the trace name. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 8 +--- hw/block/trace-events | 5 +++-- 2 files

[PATCH v4 06/24] nvme: refactor nvme_addr_read

2019-12-19 Thread Klaus Jensen
Pull the controller memory buffer check to its own function. The check will be used on its own in later patches. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

[PATCH v4 05/24] nvme: populate the mandatory subnqn and ver fields

2019-12-19 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1 or later. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90 and Section 7.9 ("NVMe Qualified Names"). This also bumps the supported version to 1.2.1. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 13 +

[PATCH v4 22/24] nvme: bump controller pci device id

2019-12-19 Thread Klaus Jensen
the device id to get rid of them. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index e1bf9bf3798b..68c433415169 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -2480,7 +2480,7 @@ stati

[PATCH v4 12/24] nvme: add missing mandatory features

2019-12-19 Thread Klaus Jensen
Add support for returning a resonable response to Get/Set Features of mandatory features. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 58 --- hw/block/trace-events | 2 ++ include/block/nvme.h | 3 ++- 3 files changed, 59 insertions(+), 4

[PATCH v4 09/24] nvme: add temperature threshold feature

2019-12-19 Thread Klaus Jensen
It might seem wierd to implement this feature for an emulated device, but it is mandatory to support and the feature is useful for testing asynchronous event request support, which will be added in a later patch. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 47

[PATCH v5 07/26] nvme: add support for the abort command

2020-02-04 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.1 ("Abort command"). The Abort command is a best effort command; for now, the device always fails to abort the given command. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 28 +

[PATCH v5 01/26] nvme: rename trace events to nvme_dev

2020-02-04 Thread Klaus Jensen
Change the prefix of all nvme device related trace events to 'nvme_dev' to not clash with trace events from the nvme block driver. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 185 +- hw/block/trace-events | 172

[PATCH v5 10/26] nvme: add support for the get log page command

2020-02-04 Thread Klaus Jensen
with NVMe revision 1.2.1. See NVM Express 1.2.1, Section 5.10 ("Get Log Page command"). Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 122 +- hw/block/nvme.h | 10 hw/block/trace-events | 2 + include/block/nvme.h | 2 +

[PATCH v5 15/26] nvme: bump supported specification to 1.3

2020-02-04 Thread Klaus Jensen
Command Sequence Error if a Set Features command is submitted for the Number of Queues feature after any I/O queues have been created. - The addition of the Log Specific Field (LSP) in the Get Log Page command. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 57

[PATCH v5 12/26] nvme: add missing mandatory features

2020-02-04 Thread Klaus Jensen
Add support for returning a resonable response to Get/Set Features of mandatory features. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 57 --- hw/block/trace-events | 2 ++ include/block/nvme.h | 3 ++- 3 files changed, 58 insertions(+), 4

[PATCH v5 13/26] nvme: additional tracing

2020-02-04 Thread Klaus Jensen
Add a trace call for nvme_enqueue_req_completion. Also, streamline nvme_identify_ns and nvme_identify_ns_list. They do not need to repeat the command, it is already in the trace name. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 8 +--- hw/block/trace-events | 5 +++-- 2 files

[PATCH v5 09/26] nvme: add temperature threshold feature

2020-02-04 Thread Klaus Jensen
It might seem wierd to implement this feature for an emulated device, but it is mandatory to support and the feature is useful for testing asynchronous event request support, which will be added in a later patch. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 50

[PATCH v5 03/26] nvme: move device parameters to separate struct

2020-02-04 Thread Klaus Jensen
Move device configuration parameters to separate struct to make it explicit what is configurable and what is set internally. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 44 ++-- hw/block/nvme.h | 16 +--- 2 files changed, 35 insertions

[PATCH v5 06/26] nvme: refactor nvme_addr_read

2020-02-04 Thread Klaus Jensen
Pull the controller memory buffer check to its own function. The check will be used on its own in later patches. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index

[PATCH v5 21/26] nvme: add support for scatter gather lists

2020-02-04 Thread Klaus Jensen
For now, support the Data Block, Segment and Last Segment descriptor types. See NVM Express 1.3d, Section 4.4 ("Scatter Gather List (SGL)"). Signed-off-by: Klaus Jensen Acked-by: Fam Zheng --- block/nvme.c | 18 +- hw/block/nvme.c

[PATCH v5 05/26] nvme: populate the mandatory subnqn and ver fields

2020-02-04 Thread Klaus Jensen
Required for compliance with NVMe revision 1.2.1 or later. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90 and Section 7.9 ("NVMe Qualified Names"). This also bumps the supported version to 1.2.1. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 13 +

[PATCH v5 17/26] nvme: allow multiple aios per command

2020-02-04 Thread Klaus Jensen
entry. Because the device is currently guaranteed to only issue a single aio request per command, the benefit is not immediately obvious. But this functionality is required to support metadata, the dataset management command and other features. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen

[PATCH v5 25/26] nvme: remove redundant NvmeCmd pointer parameter

2020-02-04 Thread Klaus Jensen
The command struct is available in the NvmeRequest that we generally pass around anyway. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 198 1 file changed, 98 insertions(+), 100 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c

[PATCH v5 00/26] nvme: support NVMe v1.3d, SGLs and multiple namespaces

2020-02-04 Thread Klaus Jensen
your comment on the correctness of: if (unlikely((slba + nlb) > nsze)) { `slba` *is* the "address" of the first logical block, but it is in terms of logical blocks, so the condition should be correct. (and at this point `nlb` is no longer a 0's based value) Klaus J

[PATCH v5 02/26] nvme: remove superfluous breaks

2020-02-04 Thread Klaus Jensen
These break statements was left over when commit 3036a626e9ef ("nvme: add Get/Set Feature Timestamp support") was merged. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 1 file changed, 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index dd548d9b6605..c9

[PATCH v5 04/26] nvme: add missing fields in the identify data structures

2020-02-04 Thread Klaus Jensen
Not used by the device model but added for completeness. See NVM Express 1.2.1, Section 5.11 ("Identify command"), Figure 90 and Figure 93. Signed-off-by: Klaus Jensen --- include/block/nvme.h | 48 1 file changed, 40 insertions(+), 8

[PATCH v5 11/26] nvme: add support for the asynchronous event request command

2020-02-04 Thread Klaus Jensen
pec states that the controller *should* retain events, so we do best effort here. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 167 +- hw/block/nvme.h | 14 +++- hw/block/trace-events | 9 +++ include/block/nvme.h | 8 +- 4 files changed, 191

[PATCH v5 20/26] nvme: handle dma errors

2020-02-04 Thread Klaus Jensen
ission queue entries). If DMA errors occur at any other point in the execution of the command (say, while mapping the PRPs), the command is aborted with a Data Transfer Error status code. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 42 +- hw/blo

[PATCH v5 19/26] pci: pass along the return value of dma_memory_rw

2020-02-04 Thread Klaus Jensen
The nvme device needs to know the return value of dma_memory_rw to pass block/011 from blktests. So pass it along instead of ignoring it. There are no existing users of the return value, so this patch should be safe. Signed-off-by: Klaus Jensen Reviewed-by: Philippe Mathieu-Daudé Reviewed

[PATCH v5 23/26] pci: allocate pci id for nvme

2020-02-04 Thread Klaus Jensen
The emulated nvme device (hw/block/nvme.c) is currently using an internal Intel device id. Prepare to change that by allocating a device id under the 1b36 (Red Hat, Inc.) vendor id. Signed-off-by: Klaus Jensen --- MAINTAINERS| 1 + docs/specs/nvme.txt| 10 ++ docs

[PATCH v5 24/26] nvme: change controller pci id

2020-02-04 Thread Klaus Jensen
dd a compat property to set this for machines 4.2 and older. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 13 + hw/block/nvme.h | 4 +++- hw/core/machine.c | 1 + 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 3a377b

[PATCH v5 16/26] nvme: refactor prp mapping

2020-02-04 Thread Klaus Jensen
. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 245 +++--- hw/block/nvme.h | 2 +- hw/block/trace-events | 1 + include/block/nvme.h | 1 + 4 files changed, 160 insertions(+), 89 deletions(-) diff --git a/hw

[PATCH v5 08/26] nvme: refactor device realization

2020-02-04 Thread Klaus Jensen
This patch splits up nvme_realize into multiple individual functions, each initializing a different subset of the device. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 175 +++- hw/block/nvme.h | 21 ++ 2 files changed, 133 insertions(+), 63

[PATCH v5 22/26] nvme: support multiple namespaces

2020-02-04 Thread Klaus Jensen
the change backward compatible, but the property is now optional. Specifying a drive for the nvme device will always create the namespace with nsid 1. Signed-off-by: Klaus Jensen Signed-off-by: Klaus Jensen --- hw/block/Makefile.objs | 2 +- hw/block/nvme-ns.c | 158 +++ hw

[PATCH v5 14/26] nvme: make sure ncqr and nsqr is valid

2020-02-04 Thread Klaus Jensen
0x is not an allowed value for NCQR and NSQR in Set Features on Number of Queues. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 30c5b3e7a67d..900732bb2f38 100644 --- a/hw/block/nvme.c +++ b/hw

[PATCH v5 26/26] nvme: make lba data size configurable

2020-02-04 Thread Klaus Jensen
Signed-off-by: Klaus Jensen --- hw/block/nvme-ns.c | 2 +- hw/block/nvme-ns.h | 4 +++- hw/block/nvme.c| 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c index 0e5be44486f4..981d7101b8f2 100644 --- a/hw/block/nvme-ns.c +++ b/hw/block

[PATCH v5 18/26] nvme: use preallocated qsg/iov in nvme_dma_prp

2020-02-04 Thread Klaus Jensen
Since clean up of the request qsg/iov has been moved to the common nvme_enqueue_req_completion function, there is no need to use a stack allocated qsg/iov in nvme_dma_prp. Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletions

[PATCH v7 34/48] nvme: refactor NvmeRequest

2020-04-15 Thread Klaus Jensen
From: Klaus Jensen Add a reference to the NvmeNamespace and move clearing of the structure from "clear before use" to "clear after use". Signed-off-by: Klaus Jensen --- hw/block/nvme.c | 38 +- hw/block/nvme.h | 1 + 2 files changed,

[PATCH v7 38/48] nvme: use preallocated qsg/iov in nvme_dma_prp

2020-04-15 Thread Klaus Jensen
From: Klaus Jensen Since clean up of the request qsg/iov has been moved to the common nvme_enqueue_req_completion function, there is no need to use a stack allocated qsg/iov in nvme_dma_prp. Signed-off-by: Klaus Jensen Acked-by: Keith Busch Reviewed-by: Maxim Levitsky --- hw/block/nvme.c

[PATCH v7 23/48] nvme: memset preallocated requests structures

2020-04-15 Thread Klaus Jensen
From: Klaus Jensen This is preparatory to subsequent patches that change how QSGs/IOVs are handled. It is important that the qsg and iov members of the NvmeRequest are initially zeroed. Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky --- hw/block/nvme.c | 2 +- 1 file changed, 1

[PATCH v7 21/48] nvme: provide the mandatory subnqn field

2020-04-15 Thread Klaus Jensen
From: Klaus Jensen Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky --- hw/block/nvme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index d88e21a14b77..d5c293476411 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1940,6 +1940,9

  1   2   3   4   5   6   7   8   9   10   >