From patchwork Tue Jan 31 12:17:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 9547043 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 59AEE60425 for ; Tue, 31 Jan 2017 12:19:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4ADF1280FC for ; Tue, 31 Jan 2017 12:19:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FA8828372; Tue, 31 Jan 2017 12:19:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACC31280FC for ; Tue, 31 Jan 2017 12:19:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbdAaMTA (ORCPT ); Tue, 31 Jan 2017 07:19:00 -0500 Received: from mail-bn3nam01on0058.outbound.protection.outlook.com ([104.47.33.58]:53760 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751992AbdAaMSM (ORCPT ); Tue, 31 Jan 2017 07:18:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZWsCbnyVEdYfEnMvBUgBsVo6B5C8QBEmcuG2K+gSq1A=; b=Lh8f9OA2JrLaHVyu0nWX+n+4xJ5Z6SXOx8GT7RBGbmKD5Op9kAVYB9YNhMzo945WdizZhEn020H6HzKQ6g7xFr3HHfZQ480tvtRFR3tCsa8gscg4ilNSSR4wniIBHVH0JXOLbaCTz3Lz/b8S+CODYpiTmqqZWBRg27OqZrcRzyg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matias@cnexlabs.com; Received: from skyninja.cnexlabs.com (193.106.164.211) by DM5PR06MB2777.namprd06.prod.outlook.com (10.175.107.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.874.12; Tue, 31 Jan 2017 12:17:55 +0000 From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: CC: , , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 07/12] lightnvm: reduce number of nvm_id groups to one Date: Tue, 31 Jan 2017 13:17:15 +0100 Message-ID: <20170131121720.10971-8-matias@cnexlabs.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170131121720.10971-1-matias@cnexlabs.com> References: <20170131121720.10971-1-matias@cnexlabs.com> MIME-Version: 1.0 X-Originating-IP: [193.106.164.211] X-ClientProxiedBy: DB6PR0601CA0024.eurprd06.prod.outlook.com (10.168.88.162) To DM5PR06MB2777.namprd06.prod.outlook.com (10.175.107.139) X-MS-Office365-Filtering-Correlation-Id: 74fabf8e-35e9-4809-ba8a-08d449d33038 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM5PR06MB2777; X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 3:SIr7kyHns4uqyQr424dQ1cckcm0mgVB+qQwN2ea3blRpbsf8oJF8tlOgKseVviDw++0Qtyu1rB/jb4x4SavdcXHZGuHa8oAiEHPSMpzBlzTVIHs9jL9Dc7HcEsjw3GiO79V9GbX7SeI1RbdX+9Ev4w2RKp7BFW8beevFxHDlED/8s52tKJpLBww4MlI3X8kZZsyaihip8JYL0vB4qR0FUu4czRyVIwbWTy10WpoxWMzI1JZvA1I3l/IAq3busH4por39pdMgI5dCh5WsEDnEZw== X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 25:tg7+2jp6Uw0doOj3+P6dbhdWki/n/c3/4NKYgIETBsYGx0W2Emea0LoOHtqyv1Y1YXXXEUXPSudlbbMH1h906uqkSGs+87OTQUOQtso0AR8dJFVmArnxae2qcRO8Qr/STo87L0xKCeRhNG2UmdMsdlqkrnB7BImICT/647Zoo/sHGsikJgLUAO0oW2V0iriLAHlQPih8RosC32VZ0yKG9MXIguzEz1Ef+/YJmEftbY+HpfLlmIajd03IYyInRPRaEKPeVCM969AAam98N5PJH+ICW0IDivemi4d2gbybSPOQA/9KluIJvfPvrr0DSt/rBGmK5T1BWZ4QltOUPLkF9gesx/IOAwyQhDnvDo7IwLqlpNVD9Z94CqqkvSp5ip1rnv0cF1jShsCUYzO+gopTUi08F98LoT5VBxHBGoQlv7JhCVBWOeIbBNm9DnQStKs0EUVMoYgXjtY00/HjkKc8Adskr4pa4I00TMd7LJLeC8v73K3tsuaXjTNah4mrYIDRcH1mZfKy5pk4GEhfX0g+crLKglZoMQA5llhK815kM5WBgZoxf13nnw+MnJT/LW+Ff4AVb1SjZt4dZTD/h3UAX1CbCGUYdBLBmik/lpnMMRN4qdQJlS6kisF+hvwBeDoiAhXFo/poudafHEtFkPxseAe1Qi9wIzXPwA8xNCi74uS7V+E649eZd/hFYnShRFgl X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 31:8WEuttigsGnKsbKX/d6sQOGLJ8PiL4EJ4D0BKJPbDnCQNHU1XFv/paXNsIId9xDloG3pO/dxApNZF7UMWZaNoRX83z+hpUCERxH6CKdEPlMQluxQuEiavPBVH3awKLIkLfocxxqBzWItNIafnL0TvyQoyQPCksLhbn1vGQJ0K8ufXY0npOLQPR0wsf3wNlzhTpYR9lQWzL89o9lW5o7aS0VyV317w8ADv/MR92FhJote8Z5GetnjwKvqejAPi5z+; 20:40lyX1k9hWQfT5JA1J25JCOYXzktHa8mieW4Z/tSJ1r2MpLJX5tZcHzxJPeL1TcUkypyqjiFyaftliHePtqiGPMlimLFaDb/bnU0sDsLa0/zL6Ig/hPUgfqPpWym8N3r4g7XaH+BMPcskcehlIAKAd80r2CSsQRR9iTA25o318o= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6042181)(6072148); SRVR:DM5PR06MB2777; BCL:0; PCL:0; RULEID:; SRVR:DM5PR06MB2777; X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 4:FRBNc+CzgjecHqbARy1ZdFW+ZLxRUEslzbPdKLhJQDRhVENLBdLlo6usHjwD24/gzHzo7Lst9rXu0ljuvYvmZ4MqUAvXAQ9BrF6eQ3/rgVUrKRXWTLZbXowC4C4OQuot2XpQSgWBrw7vYLdIndAgI0TiFJ9gYNFIhzesutaz1hronGcZrzRuE1olNB4AmfYdVrclez6164sAd0S85UboGeBatRn8ihkW8FHThiSa1Cj3XRq3jEnjMEMHcALKc7i0QbQ2ol+4ZqjKa5Sy4UURmjh7jFycUfXuxPuQi5yzdPHXufgrt0s4HJCPcEN2ds21Zs05qqkUCxZiMms4WZ8Hm925guHvyFYfW1VCAejxxTXKMxTxHod5FFlA4z2oNiFP5w/qNAvamUCr7vaMQH1ZhRQAjqVus7E1A9HkGJCYO+siE6RB+EYei1RTRNG6L0UxohQ0Emv5dbxBMq0HszVgZwtUlgdhRfSLQ9LAYmUlLeCJ4cq3oqEDxvk/sfM/D/WNkouedfbmQv1RTxuqmJ/SSLNux5tv6YWnuU+CXHb6jh0FljZwyEksLJhJbZB0O5GjV5B56RFZdVzOhnoqa4eI0A== X-Forefront-PRVS: 0204F0BDE2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(42186005)(66066001)(50466002)(6486002)(47776003)(38730400001)(105586002)(54906002)(25786008)(106356001)(2351001)(36756003)(68736007)(4001430100002)(53416004)(50986999)(107886002)(7736002)(2906002)(305945005)(4326007)(110136003)(23676002)(575784001)(2870700001)(189998001)(5660300001)(92566002)(86362001)(1076002)(6116002)(3846002)(33646002)(6916009)(97736004)(2950100002)(5820100001)(6666003)(76176999)(101416001)(53936002)(81166006)(81156014)(8676002)(50226002)(69596002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR06MB2777; H:skyninja.cnexlabs.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cnexlabs.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTVQUjA2TUIyNzc3OzIzOlpmZnRqRW1XbFJjTnVFdWxqZnpOUUk1Nysy?= =?utf-8?B?Yk1OQTdpbnZhbVl3Mml2VG5JZmxKRmhVdi9Qc094aGxzNFc5TXBjOURGNzMw?= =?utf-8?B?cEJOWUEwQWVlRnpLMDdWYXR5anBKMlFWenZ5TVVZdnhYOVNubHIyZSsvb014?= =?utf-8?B?alJUYW54Q3pmdGhQMXBWWjRSNWp0clpjdVhpZlJtRnpxSnVXVjVqNHhERjRZ?= =?utf-8?B?bmI3QW5TWFc0cXpMaVVLTVlqNnRUR0dteldXakFVcGI4cUVGa1hJbU1uRThU?= =?utf-8?B?amg5NjJwMUtobW9ZNjNreFY0aW9mSHM2NndWSGJkV3pxMU9GNXQ3azA1MkRS?= =?utf-8?B?V2J3NzJYVGErQXhld0c3M2hMTDFjenlwNkFEZzNYeWZ4T1dUR1hRWlEyQzlR?= =?utf-8?B?Q2pWMWZzQUdxYmRPVm1hR3E4alkvODBGR1ozVzU1emQ5S0dvKzNxS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zmKQt/D5u9ihK2AbHMv1BiMlC0JBo/oyFnLBQCA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR06MB2777; 7:Q7uukJp4W8sD9O35Y0keqby/jo+jSV7BkpnfQhWR7YwpMc3KR27tB/iHZ0ZYnxkHc2caLX4269/6adPyn++ghknh51YtP6GYQcSUz2yiQMeRTdcr5OqWKG+1QQmwXgi0Snl0hhE8oyWrVUg0t0SdPXo6Z6XOOcxM4Vi9anZ6Rihu/LPTs0tW2yJkr3FFNLeoxVfrDTGQ3rVU5Mz0gJbq03JQHlWolmkOJs+LswH+77bnKHepdW4RxuUswm+Jjem79NUuBvZ/ExKCyY1OFkjB0RbULdmRtxM6E7cie5SuN75XtxIycDK1LoknvBlpw9RBMmdeoQ9d5wHuOEvCIwXbRyK6EXHnb7uTfYDX8/Ts8bQiYr+1RCXro8oGzLiF9vXL8UJsxWpYd/T+s2rWu6CVp9tpcyA0eToT0pra8n2WjXbcRtQXi1MoFr3U3koPjDRFO/QoTgEa39VBbTxMUbjorRv1nrSltWAI+gsZekKHxZzu1LlptMz0zau2/Jy40WPPQ/87tLpZM3waebAao5coOoyCu0kI15o/JXkRLXalXMNDDM9xaHonLWjESrL+BJeH X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2017 12:17:55.3756 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR06MB2777 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The number of configuration groups has been limited to one in current code, even if there is support for up to four. With the introduction of the open-channel SSD 1.3 specification, only a single group is exposed onwards. Reflect this in the nvm_id structure. Signed-off-by: Matias Bjørling --- drivers/block/null_blk.c | 3 +- drivers/lightnvm/core.c | 12 ++---- drivers/nvme/host/lightnvm.c | 87 +++++++++++++++++++++----------------------- include/linux/lightnvm.h | 3 +- 4 files changed, 47 insertions(+), 58 deletions(-) diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index c0e14e5..e666095 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c @@ -460,7 +460,6 @@ static int null_lnvm_id(struct nvm_dev *dev, struct nvm_id *id) id->ver_id = 0x1; id->vmnt = 0; - id->cgrps = 1; id->cap = 0x2; id->dom = 0x1; @@ -479,7 +478,7 @@ static int null_lnvm_id(struct nvm_dev *dev, struct nvm_id *id) sector_div(size, bs); /* convert size to pages */ size >>= 8; /* concert size to pgs pr blk */ - grp = &id->groups[0]; + grp = &id->grp; grp->mtype = 0; grp->fmtype = 0; grp->num_ch = 1; diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index 0842c85..80cd767 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -884,7 +884,7 @@ static int nvm_init_mlc_tbl(struct nvm_dev *dev, struct nvm_id_group *grp) static int nvm_core_init(struct nvm_dev *dev) { struct nvm_id *id = &dev->identity; - struct nvm_id_group *grp = &id->groups[0]; + struct nvm_id_group *grp = &id->grp; struct nvm_geo *geo = &dev->geo; int ret; @@ -988,20 +988,14 @@ static int nvm_init(struct nvm_dev *dev) goto err; } - pr_debug("nvm: ver:%x nvm_vendor:%x groups:%u\n", - dev->identity.ver_id, dev->identity.vmnt, - dev->identity.cgrps); + pr_debug("nvm: ver:%x nvm_vendor:%x\n", + dev->identity.ver_id, dev->identity.vmnt); if (dev->identity.ver_id != 1) { pr_err("nvm: device not supported by kernel."); goto err; } - if (dev->identity.cgrps != 1) { - pr_err("nvm: only one group configuration supported."); - goto err; - } - ret = nvm_core_init(dev); if (ret) { pr_err("nvm: could not initialize core structures.\n"); diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index ad54ec9..733992a 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -248,50 +248,48 @@ static int init_grps(struct nvm_id *nvm_id, struct nvme_nvm_id *nvme_nvm_id) { struct nvme_nvm_id_group *src; struct nvm_id_group *dst; - int i, end; - - end = min_t(u32, 4, nvm_id->cgrps); - - for (i = 0; i < end; i++) { - src = &nvme_nvm_id->groups[i]; - dst = &nvm_id->groups[i]; - - dst->mtype = src->mtype; - dst->fmtype = src->fmtype; - dst->num_ch = src->num_ch; - dst->num_lun = src->num_lun; - dst->num_pln = src->num_pln; - - dst->num_pg = le16_to_cpu(src->num_pg); - dst->num_blk = le16_to_cpu(src->num_blk); - dst->fpg_sz = le16_to_cpu(src->fpg_sz); - dst->csecs = le16_to_cpu(src->csecs); - dst->sos = le16_to_cpu(src->sos); - - dst->trdt = le32_to_cpu(src->trdt); - dst->trdm = le32_to_cpu(src->trdm); - dst->tprt = le32_to_cpu(src->tprt); - dst->tprm = le32_to_cpu(src->tprm); - dst->tbet = le32_to_cpu(src->tbet); - dst->tbem = le32_to_cpu(src->tbem); - dst->mpos = le32_to_cpu(src->mpos); - dst->mccap = le32_to_cpu(src->mccap); - - dst->cpar = le16_to_cpu(src->cpar); - - if (dst->fmtype == NVM_ID_FMTYPE_MLC) { - memcpy(dst->lptbl.id, src->lptbl.id, 8); - dst->lptbl.mlc.num_pairs = - le16_to_cpu(src->lptbl.mlc.num_pairs); - - if (dst->lptbl.mlc.num_pairs > NVME_NVM_LP_MLC_PAIRS) { - pr_err("nvm: number of MLC pairs not supported\n"); - return -EINVAL; - } - - memcpy(dst->lptbl.mlc.pairs, src->lptbl.mlc.pairs, - dst->lptbl.mlc.num_pairs); + + if (nvme_nvm_id->cgrps != 1) + return -EINVAL; + + src = &nvme_nvm_id->groups[0]; + dst = &nvm_id->grp; + + dst->mtype = src->mtype; + dst->fmtype = src->fmtype; + dst->num_ch = src->num_ch; + dst->num_lun = src->num_lun; + dst->num_pln = src->num_pln; + + dst->num_pg = le16_to_cpu(src->num_pg); + dst->num_blk = le16_to_cpu(src->num_blk); + dst->fpg_sz = le16_to_cpu(src->fpg_sz); + dst->csecs = le16_to_cpu(src->csecs); + dst->sos = le16_to_cpu(src->sos); + + dst->trdt = le32_to_cpu(src->trdt); + dst->trdm = le32_to_cpu(src->trdm); + dst->tprt = le32_to_cpu(src->tprt); + dst->tprm = le32_to_cpu(src->tprm); + dst->tbet = le32_to_cpu(src->tbet); + dst->tbem = le32_to_cpu(src->tbem); + dst->mpos = le32_to_cpu(src->mpos); + dst->mccap = le32_to_cpu(src->mccap); + + dst->cpar = le16_to_cpu(src->cpar); + + if (dst->fmtype == NVM_ID_FMTYPE_MLC) { + memcpy(dst->lptbl.id, src->lptbl.id, 8); + dst->lptbl.mlc.num_pairs = + le16_to_cpu(src->lptbl.mlc.num_pairs); + + if (dst->lptbl.mlc.num_pairs > NVME_NVM_LP_MLC_PAIRS) { + pr_err("nvm: number of MLC pairs not supported\n"); + return -EINVAL; } + + memcpy(dst->lptbl.mlc.pairs, src->lptbl.mlc.pairs, + dst->lptbl.mlc.num_pairs); } return 0; @@ -321,7 +319,6 @@ static int nvme_nvm_identity(struct nvm_dev *nvmdev, struct nvm_id *nvm_id) nvm_id->ver_id = nvme_nvm_id->ver_id; nvm_id->vmnt = nvme_nvm_id->vmnt; - nvm_id->cgrps = nvme_nvm_id->cgrps; nvm_id->cap = le32_to_cpu(nvme_nvm_id->cap); nvm_id->dom = le32_to_cpu(nvme_nvm_id->dom); memcpy(&nvm_id->ppaf, &nvme_nvm_id->ppaf, @@ -622,7 +619,7 @@ static ssize_t nvm_dev_attr_show(struct device *dev, return 0; id = &ndev->identity; - grp = &id->groups[0]; + grp = &id->grp; attr = &dattr->attr; if (strcmp(attr->name, "version") == 0) { diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index faa0fbf..ce0b2da 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -200,11 +200,10 @@ struct nvm_addr_format { struct nvm_id { u8 ver_id; u8 vmnt; - u8 cgrps; u32 cap; u32 dom; struct nvm_addr_format ppaf; - struct nvm_id_group groups[4]; + struct nvm_id_group grp; } __packed; struct nvm_target {