Received: by 10.223.185.116 with SMTP id b49csp6427377wrg; Wed, 28 Feb 2018 09:13:18 -0800 (PST) X-Google-Smtp-Source: AH8x225OCCllI1ceSIL9POlBXIhMEWKjUSASZAr05oMEYGax8oueaZmnQOlcpMoFRTJzgIuGMV5j X-Received: by 10.99.127.69 with SMTP id p5mr14676060pgn.346.1519837998739; Wed, 28 Feb 2018 09:13:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519837998; cv=none; d=google.com; s=arc-20160816; b=QEL3q20BRzzrQXTQy+pnFJVaZphJboYQ0GBWgMbDQI2gKvTxWRoAGhqzWOxwB8meAL K6lzC+otUQz4oYCaHphxPACrEnRQzV7eObR3xv1QSb0c388ylsA4ETwy4ZiAdHS/ankF 8h235msamop4cDB0z9YFX1N5BXcR8R9qN62srD/fvdmhpDfJksMrIA9BXcZmKUb7Uzzh DRXv5//q9l6TexUZ3Oa1q0F6Ar8S/9/LYmoBIH/fXAVC4JL1bYynKPbm7aFMewWrMz7Y OZt1l7/R/Q4GbFiYkSVIXMTRI3wRwpw2um6rd4YV6dnBYmOOVnHyHoDDz0ELqrCD6NVu mmKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ReP1fM0wD4pmi5/4jeXwhA3OeVfVOBwoIn7hD4EPY3c=; b=Qz9zY3aZG33y4kPP8FrOj6sRCR11LVHXlnh4HJc51SjCAU/vykQAbpY2gI3FXRQU6A 3lV39rp31GGzpqzlW8UcergmiM7MoxvTTpgNQvvo8RH49cQcZU7x90j9V5EGGtoZjrhy Ylbbf9keQiSP18u5JoS15sUfrUHj9mvWx4pzEX4Xc204rvEdcuNY9ClMGUrhgvdF+SRU TKhV0eDeMstkbk+wsgqrKqjmYPduXGl53zif0B4l2z3B17szF5RNmhJ6YVnvXNzz2iqd ynfft8iVMi/PpI5RbbtcXIXauF1yoSeZbbcLtbJrB27Q1TBt+31KT4cUTrAVJxGKtgMe dBBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=NPMs4/V3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si1245437pgf.613.2018.02.28.09.13.03; Wed, 28 Feb 2018 09:13:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=NPMs4/V3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933004AbeB1RLt (ORCPT + 99 others); Wed, 28 Feb 2018 12:11:49 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38938 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932932AbeB1Ptx (ORCPT ); Wed, 28 Feb 2018 10:49:53 -0500 Received: by mail-wm0-f65.google.com with SMTP id i3so4564417wmi.4 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=j45pEU9d6bHdyY+SS5lOeJqdi8ZJTNQoQg3qjqy+SN44+F0AUjS1vjDE7LQWym5rf2 QDM98Onz2NCv6Axj94NAFVX2HaE1YqsLldK7g3e1utt1Ada57qqJ2ZfBC9mIrsJIIamA b41A0lL1WVfrqKuNGdwshY0PIYy6PJivMrYU3W2Mjiow3/4xK9bNYR9kJpRr6WtspWxz 9pOEuNGBlYAM4KNSVI9M15YLUerY3Snq5co0JftG3P+jngWgwrB8YkCSwKae1cAkBAs0 QXNfRK+TBhPGzk7iU4eRBhELDDNjGw4onYC3Togsjiz48w2A/0vtqiurTV+9NMsJmzxI dBgQ== X-Gm-Message-State: APf1xPAbpWlTF7aT1Hn5g24fDqG7PGnD/gLFK8PP1tI1WgO2J3fVN+a2 YvwYY9wAtdYhq9nUpvmzVwCM8g== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.7.4