hw/block/nvme: add optional parameter num_queues for nvme device

Add an optional paramter num_queues for device, and set it
to 64 by default.

Signed-off-by: Weiping Zhang <zhangweiping@didichuxing.com>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Weiping Zhang 2018-06-26 09:44:56 +08:00 committed by Kevin Wolf
parent b8efb36b9e
commit 7c8952697e

View File

@ -18,7 +18,8 @@
* Usage: add options: * Usage: add options:
* -drive file=<file>,if=none,id=<drive_id> * -drive file=<file>,if=none,id=<drive_id>
* -device nvme,drive=<drive_id>,serial=<serial>,id=<id[optional]>, \ * -device nvme,drive=<drive_id>,serial=<serial>,id=<id[optional]>, \
* cmb_size_mb=<cmb_size_mb[optional]> * cmb_size_mb=<cmb_size_mb[optional]>, \
* num_queues=<N[optional]>
* *
* Note cmb_size_mb denotes size of CMB in MB. CMB is assumed to be at * Note cmb_size_mb denotes size of CMB in MB. CMB is assumed to be at
* offset 0 in BAR2 and supports only WDS, RDS and SQS for now. * offset 0 in BAR2 and supports only WDS, RDS and SQS for now.
@ -1232,7 +1233,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
pcie_endpoint_cap_init(&n->parent_obj, 0x80); pcie_endpoint_cap_init(&n->parent_obj, 0x80);
n->num_namespaces = 1; n->num_namespaces = 1;
n->num_queues = 64;
n->reg_size = pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); n->reg_size = pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4);
n->ns_size = bs_size / (uint64_t)n->num_namespaces; n->ns_size = bs_size / (uint64_t)n->num_namespaces;
@ -1341,6 +1341,7 @@ static Property nvme_props[] = {
DEFINE_BLOCK_PROPERTIES(NvmeCtrl, conf), DEFINE_BLOCK_PROPERTIES(NvmeCtrl, conf),
DEFINE_PROP_STRING("serial", NvmeCtrl, serial), DEFINE_PROP_STRING("serial", NvmeCtrl, serial),
DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, cmb_size_mb, 0), DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, cmb_size_mb, 0),
DEFINE_PROP_UINT32("num_queues", NvmeCtrl, num_queues, 64),
DEFINE_PROP_END_OF_LIST(), DEFINE_PROP_END_OF_LIST(),
}; };