From patchwork Wed Feb 28 15:49:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 10248817 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 75E3960365 for ; Wed, 28 Feb 2018 17:11:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63BBF28DFA for ; Wed, 28 Feb 2018 17:11:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57FDA28DFC; Wed, 28 Feb 2018 17:11:51 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham 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 E6E9F28DFA for ; Wed, 28 Feb 2018 17:11:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753192AbeB1RLs (ORCPT ); Wed, 28 Feb 2018 12:11:48 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37731 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932975AbeB1Ptx (ORCPT ); Wed, 28 Feb 2018 10:49:53 -0500 Received: by mail-wm0-f68.google.com with SMTP id 139so5991658wmn.2 for ; Wed, 28 Feb 2018 07:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ReP1fM0wD4pmi5/4jeXwhA3OeVfVOBwoIn7hD4EPY3c=; b=NPMs4/V3ZYPCvxO9q4eWpeMFCdxs+gEN+2k3Yq6Et+TTcaZ9zZDLeL5Az3KdCD+hTA MmFAla3kP9xISRBl5+Ht7iJsXBZXW1buqIg0rhgRfaJjhTlAKxw4ZUolGK3G2A+kweNT UVMyizfiTEl5JXfhknQPc77rSNQZwI0Fpc75D8vcIZR1S3Ka3daQWImj3JQctVuml/6/ 1y6wy1yHWm1BLvuvcFVoZIaHPgqPYO7hZUEIjT0bmxF14FJ2A6/4zyS5whUzKyxGSggr IkjT7YbfEhjcjsspE856XASFndmdM1C9maOnXz8itbI/6E4naDC2cmdwue8UNMoQ8oBP QEwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ReP1fM0wD4pmi5/4jeXwhA3OeVfVOBwoIn7hD4EPY3c=; b=qqqUPa+Eb1XAmg0hwVE6NvRO/9uOufFs5P0iG5D61WzZWzcHVHZM0thHJvJ7lFw+/w z0ERLOpnkUiirxAoEEAjNmVsz2757ujtx27WGh8UDvs5BOiiS51MAn7OdU9iIdT8nDeb YEtgTllE3fPnLwlX0VwiOodPuSlMfNTkUkmzJWPiC9LVKlT/oG9xRkc683mKrLyLT60r TpHZp4oOTuEuggz/Vt8LEIxwMxlt/NfP+zQ2btFnidoUxue6mAFpYgucHHE2NMewEYDh DKyMSnzcSIsu12jRsjKoLtDzpZ5/nBlfsAMUu6rEh9S6PG2xmh9CZY1Eg+1sN+r946SZ nhQw== X-Gm-Message-State: APf1xPBm/zmJhw9IGrfxU+RK+FpSU4Ok9Ghw2I38rclFdCZm5dG35l93 TZdQg/bkuKXJkWhmYQ+MRAj4jUf2 X-Google-Smtp-Source: AH8x227fRPlEk1WCtBa/B6qcg61AqHK+o6n73MrDhF5KI4lZ5cQDJJTvGnFBBzavCdn0RCrFZtCDMg== X-Received: by 10.80.171.78 with SMTP id t14mr23904434edc.170.1519832992639; Wed, 28 Feb 2018 07:49:52 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id n2sm1953056edb.62.2018.02.28.07.49.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Feb 2018 07:49:51 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 05/15] lightnvm: complete geo structure with maxoc* Date: Wed, 28 Feb 2018 16:49:25 +0100 Message-Id: <1519832975-25432-6-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519832975-25432-1-git-send-email-javier@cnexlabs.com> References: <1519832975-25432-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 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 Complete the generic geometry structure with the maxoc and maxocpu felds, present in the 2.0 spec. Also, expose them through sysfs. Signed-off-by: Javier González --- drivers/nvme/host/lightnvm.c | 17 +++++++++++++++++ include/linux/lightnvm.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 85f336a79cda..afb5f883f8c8 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -323,6 +323,13 @@ static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id, geo->ws_opt = sec_per_pg; geo->mw_cunits = geo->ws_opt << 3; /* default to MLC safe values */ + /* Do not impose values for maximum number of open blocks as it is + * unspecified in 1.2. Users of 1.2 must be aware of this and eventually + * specify these values through a quirk if restrictions apply. + */ + geo->maxoc = geo->all_luns * geo->nr_chks; + geo->maxocpu = geo->nr_chks; + geo->cap = le32_to_cpu(src->mccap); geo->trdt = le32_to_cpu(src->trdt); @@ -410,6 +417,8 @@ static int nvme_nvm_setup_20(struct nvme_nvm_id20 *id, geo->ws_min = le32_to_cpu(id->ws_min); geo->ws_opt = le32_to_cpu(id->ws_opt); geo->mw_cunits = le32_to_cpu(id->mw_cunits); + geo->maxoc = le32_to_cpu(id->maxoc); + geo->maxocpu = le32_to_cpu(id->maxocpu); geo->cap = le32_to_cpu(id->mccap); @@ -1054,6 +1063,10 @@ static ssize_t nvm_dev_attr_show_20(struct device *dev, return scnprintf(page, PAGE_SIZE, "%u\n", geo->ws_min); } else if (strcmp(attr->name, "ws_opt") == 0) { return scnprintf(page, PAGE_SIZE, "%u\n", geo->ws_opt); + } else if (strcmp(attr->name, "maxoc") == 0) { + return scnprintf(page, PAGE_SIZE, "%u\n", geo->maxoc); + } else if (strcmp(attr->name, "maxocpu") == 0) { + return scnprintf(page, PAGE_SIZE, "%u\n", geo->maxocpu); } else if (strcmp(attr->name, "mw_cunits") == 0) { return scnprintf(page, PAGE_SIZE, "%u\n", geo->mw_cunits); } else if (strcmp(attr->name, "write_typ") == 0) { @@ -1151,6 +1164,8 @@ static NVM_DEV_ATTR_20_RO(chunks); static NVM_DEV_ATTR_20_RO(clba); static NVM_DEV_ATTR_20_RO(ws_min); static NVM_DEV_ATTR_20_RO(ws_opt); +static NVM_DEV_ATTR_20_RO(maxoc); +static NVM_DEV_ATTR_20_RO(maxocpu); static NVM_DEV_ATTR_20_RO(mw_cunits); static NVM_DEV_ATTR_20_RO(write_typ); static NVM_DEV_ATTR_20_RO(write_max); @@ -1167,6 +1182,8 @@ static struct attribute *nvm_dev_attrs_20[] = { &dev_attr_clba.attr, &dev_attr_ws_min.attr, &dev_attr_ws_opt.attr, + &dev_attr_maxoc.attr, + &dev_attr_maxocpu.attr, &dev_attr_mw_cunits.attr, &dev_attr_read_typ.attr, diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index b8bc158a2472..2102b092c7eb 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -296,6 +296,8 @@ struct nvm_geo { u32 ws_min; /* minimum write size */ u32 ws_opt; /* optimal write size */ u32 mw_cunits; /* distance required for successful read */ + u32 maxoc; /* maximum open chunks */ + u32 maxocpu; /* maximum open chunks per parallel unit */ /* device capabilities. Note that this represents capabilities in 1.2 * and media and controller capabilities in 2.0