From nobody Fri May 3 02:01:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531974874920463.6007238340143; Wed, 18 Jul 2018 21:34:34 -0700 (PDT) Received: from localhost ([::1]:39564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg0dz-0005zq-7g for importer@patchew.org; Thu, 19 Jul 2018 00:34:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fg0cx-0005eQ-5y for qemu-devel@nongnu.org; Thu, 19 Jul 2018 00:33:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fg0cs-0005Zr-J5 for qemu-devel@nongnu.org; Thu, 19 Jul 2018 00:33:19 -0400 Received: from mx1.didichuxing.com ([111.202.154.82]:21590 helo=bsf01.didichuxing.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1fg0cs-0005Yp-2F for qemu-devel@nongnu.org; Thu, 19 Jul 2018 00:33:14 -0400 Received: from BJEXCAS006.didichuxing.com ([172.20.2.189]) by bsf01.didichuxing.com with ESMTP id fBS4SrZrMG5w6hJL; Thu, 19 Jul 2018 12:33:05 +0800 (CST) Received: from bogon.didichuxing.com (172.22.50.20) by BJSGEXMBX03.didichuxing.com (172.20.15.133) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Thu, 19 Jul 2018 12:33:05 +0800 X-ASG-Debug-ID: 1531974785-0e408816ae48b60001-jgbH7p X-Barracuda-Envelope-From: zhangweiping@didichuxing.com Date: Thu, 19 Jul 2018 12:33:00 +0800 From: Weiping Zhang To: Message-ID: <20180719043239.GA22006@bogon.didichuxing.com> X-ASG-Orig-Subj: [PATCH] hw/block/nvme: add optional parameter num_namespaces for nvme device MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [172.22.50.20] X-ClientProxiedBy: BJEXCAS004.didichuxing.com (172.20.1.44) To BJSGEXMBX03.didichuxing.com (172.20.15.133) X-Barracuda-Connect: UNKNOWN[172.20.2.189] X-Barracuda-Start-Time: 1531974785 X-Barracuda-URL: https://bsf01.didichuxing.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at didichuxing.com X-Barracuda-Scan-Msg-Size: 1562 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.53960 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 111.202.154.82 Subject: [Qemu-devel] [PATCH] hw/block/nvme: add optional parameter num_namespaces for nvme device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add an optional paramter num_namespaces for device, and set it to 1 by default. Signed-off-by: Weiping Zhang --- 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 156ecf3c41..b53be4b5c0 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -19,7 +19,7 @@ * -drive file=3D,if=3Dnone,id=3D * -device nvme,drive=3D,serial=3D,id=3D, \ * cmb_size_mb=3D, \ - * num_queues=3D + * num_queues=3D,num_namespaces=3D * * 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. @@ -1232,7 +1232,6 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS); pcie_endpoint_cap_init(&n->parent_obj, 0x80); =20 - n->num_namespaces =3D 1; n->reg_size =3D pow2ceil(0x1004 + 2 * (n->num_queues + 1) * 4); n->ns_size =3D bs_size / (uint64_t)n->num_namespaces; =20 @@ -1342,6 +1341,7 @@ static Property nvme_props[] =3D { DEFINE_PROP_STRING("serial", NvmeCtrl, serial), DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, cmb_size_mb, 0), DEFINE_PROP_UINT32("num_queues", NvmeCtrl, num_queues, 64), + DEFINE_PROP_UINT32("num_namespaces", NvmeCtrl, num_namespaces, 1), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.14.1