From patchwork Thu Mar 29 22:05:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10316517 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 48F9160353 for ; Thu, 29 Mar 2018 22:10:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3442A2A545 for ; Thu, 29 Mar 2018 22:10:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276E82A542; Thu, 29 Mar 2018 22:10:36 +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=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 9B7A42A547 for ; Thu, 29 Mar 2018 22:10:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752709AbeC2WHe (ORCPT ); Thu, 29 Mar 2018 18:07:34 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33195 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752644AbeC2WH1 (ORCPT ); Thu, 29 Mar 2018 18:07:27 -0400 Received: by mail-lf0-f66.google.com with SMTP id x70-v6so3502188lfa.0 for ; Thu, 29 Mar 2018 15:07:27 -0700 (PDT) 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=XQ/+WpYIT2cq2EyeQ/3PB5OgGH1fapzf/Ga8PnwMC5c=; b=H29kWRDd1l2wF5stdYYmLnrcxe5e9b44h2f8Kyo1lvw2qfmzxbEQoORciKG9dvNTdz yV6ls1MDqLQQEFUSr/TkytCYJbjBfD9b83MeqSZkf6TymUn/WQXIiFg1asunzZIX6+Zn Yi0gTxy6bV4rJ+iaGL+iLQ58INDHmwgSOFa0QLABAMxIwfaDfqAyiCqEGVjp/PYoE75m cNvH0P3Xtnq77ZTlknGr9d7bsG91BN2bG7LAlWKICDhHgEYWZxabr0fOtX7zlwkoYyfW UBXCcKmWRQ2N4FThP+TiyA+DHo8qUIW3O+j561ANwMkLe8B8qA6HIWWkKDm2+IzQoNPu 6ENA== 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=XQ/+WpYIT2cq2EyeQ/3PB5OgGH1fapzf/Ga8PnwMC5c=; b=gLaWu4igBvrzX460LZgrnNX0L1rNc0vfKxJvxZY4QzlGFY9UVo/cfd2Ay4CelxV4eY zgp/wY7fEGcU313M5VyFjELYh/Ikhn4MipLeFXNtz9fARIhlNaZ3geM/rG+KXcbrUT8w 5mVdwVKaNOOEQnCqjv/Q62LSoTjtpqcZ+odHmycFDHIE0D0VgAGYqbeTLR2QXerOIoOP fCWuWKY2hZxP+JDy1OBqHhuzWdHkm6lrP0nBXT9R4Nh9hD7mYo8iRx7Fudz6YNLFm3HB jMtYhZsmTjglra2gP9UuHuaVrl9XH9Fp/ffNolIBGmsKtw8WFC3CyyIfObPwXSPvshVR NIxA== X-Gm-Message-State: AElRT7FrhLOZfh7/TlXNNKWWJ+kyVWS8rWR81YLkmnIFVvecNbwlWURB exu2AYGUWVEW2De7QcDdKM1AgA== X-Google-Smtp-Source: AIpwx4+WKbgV9fJkpJqUCiJatT/jsW72UFxpttHU8MHX+yUc0/uM0YN+lVnEG0TdJHn4ICzSWQw53A== X-Received: by 10.46.65.73 with SMTP id o70mr6799142lja.140.1522361246301; Thu, 29 Mar 2018 15:07:26 -0700 (PDT) Received: from Macroninja.cnexlabs.com (x1-6-a4-08-f5-18-3c-3a.cpe.webspeed.dk. [188.176.29.198]) by smtp.gmail.com with ESMTPSA id i89-v6sm1365508lfk.12.2018.03.29.15.07.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 15:07:25 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, keith.busch@intel.com, javier@cnexlabs.com, =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 26/37] lightnvm: complete geo structure with maxoc* Date: Fri, 30 Mar 2018 00:05:13 +0200 Message-Id: <20180329220524.30363-27-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180329220524.30363-1-mb@lightnvm.io> References: <20180329220524.30363-1-mb@lightnvm.io> 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 From: Javier González 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 Signed-off-by: Matias Bjørling --- 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 f7f7769e7588..41b38ebdb1f3 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->mccap = le32_to_cpu(src->mccap); geo->trdt = le32_to_cpu(src->trdt); @@ -409,6 +416,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->trdt = le32_to_cpu(id->trdt); geo->trdm = le32_to_cpu(id->trdm); @@ -1050,6 +1059,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) { @@ -1147,6 +1160,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); @@ -1163,6 +1178,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 a073c0c76260..870959a58fef 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 */ u32 mccap;