[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 19/21] nvme: make lba data size configurable
From: |
Klaus Jensen |
Subject: |
[PATCH v3 19/21] nvme: make lba data size configurable |
Date: |
Mon, 11 Nov 2019 13:25:43 +0100 |
Signed-off-by: Klaus Jensen <address@hidden>
---
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/nvme-ns.c
@@ -18,7 +18,7 @@ static int nvme_ns_init(NvmeNamespace *ns)
{
NvmeIdNs *id_ns = &ns->id_ns;
- id_ns->lbaf[0].ds = BDRV_SECTOR_BITS;
+ id_ns->lbaf[0].ds = ns->params.lbads;
id_ns->nuse = id_ns->ncap = id_ns->nsze =
cpu_to_le64(nvme_ns_nlbas(ns));
diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
index b564bac25f6d..9d519182c3a5 100644
--- a/hw/block/nvme-ns.h
+++ b/hw/block/nvme-ns.h
@@ -7,10 +7,12 @@
#define DEFINE_NVME_NS_PROPERTIES(_state, _props) \
DEFINE_PROP_DRIVE("drive", _state, blk), \
- DEFINE_PROP_UINT32("nsid", _state, _props.nsid, 0)
+ DEFINE_PROP_UINT32("nsid", _state, _props.nsid, 0), \
+ DEFINE_PROP_UINT8("lbads", _state, _props.lbads, 9)
typedef struct NvmeNamespaceParams {
uint32_t nsid;
+ uint8_t lbads;
} NvmeNamespaceParams;
typedef struct NvmeNamespace {
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 81322bb79e4c..3acbaaa79008 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -2599,6 +2599,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
if (n->namespace.blk) {
ns = &n->namespace;
ns->params.nsid = 1;
+ ns->params.lbads = 9;
if (nvme_ns_setup(n, ns, &local_err)) {
error_propagate_prepend(errp, local_err, "nvme_ns_setup: ");
--
2.24.0
- [PATCH v3 10/21] nvme: add logging to error information log page, (continued)
- [PATCH v3 10/21] nvme: add logging to error information log page, Klaus Jensen, 2019/11/11
- [PATCH v3 05/21] nvme: allow completion queues in the cmb, Klaus Jensen, 2019/11/11
- [PATCH v3 04/21] nvme: populate the mandatory subnqn and ver fields, Klaus Jensen, 2019/11/11
- [PATCH v3 02/21] nvme: move device parameters to separate struct, Klaus Jensen, 2019/11/11
- [PATCH v3 08/21] nvme: add support for the get log page command, Klaus Jensen, 2019/11/11
- [PATCH v3 07/21] nvme: refactor device realization, Klaus Jensen, 2019/11/11
- [PATCH v3 09/21] nvme: add support for the asynchronous event request command, Klaus Jensen, 2019/11/11
- [PATCH v3 11/21] nvme: add missing mandatory features, Klaus Jensen, 2019/11/11
- [PATCH v3 17/21] nvme: bump controller pci device id, Klaus Jensen, 2019/11/11
- [PATCH v3 21/21] nvme: handle dma errors, Klaus Jensen, 2019/11/11
- [PATCH v3 19/21] nvme: make lba data size configurable,
Klaus Jensen <=
- [PATCH v3 20/21] pci: pass along the return value of dma_memory_rw, Klaus Jensen, 2019/11/11
- [PATCH v3 12/21] nvme: bump supported specification version to 1.3, Klaus Jensen, 2019/11/11
- [PATCH v3 13/21] nvme: refactor prp mapping, Klaus Jensen, 2019/11/11
- [PATCH v3 15/21] nvme: add support for scatter gather lists, Klaus Jensen, 2019/11/11
- [PATCH v3 14/21] nvme: allow multiple aios per command, Klaus Jensen, 2019/11/11
- [PATCH v3 18/21] nvme: remove redundant NvmeCmd pointer parameter, Klaus Jensen, 2019/11/11
- [PATCH v3 16/21] nvme: support multiple namespaces, Klaus Jensen, 2019/11/11
- Re: [PATCH v3 00/20] nvme: support NVMe v1.3d, SGLs and multiple namespaces, no-reply, 2019/11/11