Received: by 10.223.185.116 with SMTP id b49csp1615966wrg; Wed, 21 Feb 2018 23:37:37 -0800 (PST) X-Google-Smtp-Source: AH8x225W7slARs3pKsoyRI7Zxwu+t0l6KUv6wwibdz9I74cKx/8uRoxwQLuzlYKfjDVEg8N5ne1L X-Received: by 2002:a17:902:8604:: with SMTP id f4-v6mr4879999plo.380.1519285057025; Wed, 21 Feb 2018 23:37:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519285056; cv=none; d=google.com; s=arc-20160816; b=dqrYCO/HCWiWpWEHGcttibaLpwsKnEvcPwi3k4OcWGABdbctur8GhRxMK0mkOL4j68 ZTON4Ow9wSI0nJiAZpSV6m0wb/H4Y0J2gRjvm6P8MqneBq69fp0xVUcvl2wZqdn19cTG Ldd75CEeY1Q//jD5/9GDVC6NTCLZYHhE3cQDrCW5iYbOrsMD1W30hCJUDt6nKTnpyadi Y2SpNkxz3mRMhmLbchYg9cqMhYKm7P7ENRu5nUCiqXSD0W1xfCHqDteGBbq1Ii3Ie4Oh Z3ZpFLTGSAgU63OJU1c2s7sMvlxtZ/sM4nKLyCd2H3wqjzW5Fx2HRjYDfLY8biUc9Nr1 am0A== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=6TPx4ySlOWdPdLK0i5SYJRVEOjNExw7P2R5go8GckG8=; b=sfq3JsE5r5dtm7R73tn0PB8xZ/WciMvI2PXupF9rpmSbEX5Mf9QyhW7cEFkAYEzHCt ZB2T1SgcSPwxM3WuwObsGg4834JvdwBC5BhzB23jRH/a46NSnDQGuArJ2XqqNIN7rEg2 Je42iOdSVAsB7wuIc/+7kpMTBh55yM0bzcRxgjvY/+dFYvuKBXZ4ws0P2GRYyKlXJ+ho tTkc+u3H0WbZfud4Ge+CJfl0fasPMfZMFAvwaWRlHEx/Y8BkMeR2Z3Lc9PmbB7LatrsQ yRw8Tkznp9nmVCfOJqttam5RJemwYH9p0JnCgBDGYhZZCk9DHVGSUSE0Fv4tuJIVilWm Rgmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=nRFN8lNq; 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 31-v6si894225plz.201.2018.02.21.23.37.22; Wed, 21 Feb 2018 23:37:36 -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=nRFN8lNq; 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 S1752649AbeBVHfC (ORCPT + 99 others); Thu, 22 Feb 2018 02:35:02 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:39540 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751687AbeBVHfA (ORCPT ); Thu, 22 Feb 2018 02:35:00 -0500 Received: by mail-lf0-f66.google.com with SMTP id f75so993625lfg.6 for ; Wed, 21 Feb 2018 23:35:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=6TPx4ySlOWdPdLK0i5SYJRVEOjNExw7P2R5go8GckG8=; b=nRFN8lNqYTH+PdDt8twHJMy/F+DyqzdlF9UxU6fVqrCRVmAEvTCEnCEoK1HJv1+jAj oX3TYq1eIMnCJgKL99rp0yVMWfyePHi+Eo8AlehOY71cOTE17PQhMcTNG4MLyAViCOSi Oppa6qw7VBGyyOr0EQSPxSyndYLWpX7RXk2B9M4GktVLGxfQvWtxz5Gnt86EwZS8T2R0 ACZxhwMy40Uht032glZoqtWVihnTTvLgtAllMidAw1wrCncNKi0B8pVnIXLYShWDrqZv I7dmHF17wNqRgUYvkW1fhb5JnOyKgFCdv7JlylsA0+l2AvDm5FE93Lvcf/ToW5vkrX4k KP8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6TPx4ySlOWdPdLK0i5SYJRVEOjNExw7P2R5go8GckG8=; b=tfuGXBr1EpOr82NTnNOlYpaY50u8Fs6ZqIhoyU1u9Ao54pa8LIy65l4u4gZbeA7kAA mUM4XQ+jJ6su6f/9jiV/2e8onybeYiyQ4w3FJfadAgXGKZ99wLS4i9k14Qa7RzH1ZvMy x2ZQSq1foAlJHMG2RPIiSCKQ/5Ll2Lx2km+2ueFQ3HwywnkqPUrNCQ1ChfwGgp15d4Vn qZpnNE8/JYnoGb1nAWTI4p26DcaRvO1IrEnzmTbKCSOeC+Z0zUHb8aYlIq5BP2AvQZeX Q/1/IsdwSMVxFxR1Qs3EXMSWVJzdqfN/9UUMMCFeF7etznipxQQ+M/0Dh5TMxX9UM+MY +cQA== X-Gm-Message-State: APf1xPBrciToiGgADi2/Sfz7I9vb4I0xUHy8mEbOwG+AmYAblQ/ZqdwF OPBenSQrxiVSmPgK6/xY2xMKyPD6 X-Received: by 10.25.198.23 with SMTP id w23mr4159606lff.40.1519284899199; Wed, 21 Feb 2018 23:34:59 -0800 (PST) Received: from [192.168.0.10] (x1-6-a4-08-f5-18-3c-3a.cpe.webspeed.dk. [188.176.29.198]) by smtp.googlemail.com with ESMTPSA id c63sm3031927lfg.82.2018.02.21.23.34.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 23:34:58 -0800 (PST) Subject: Re: [PATCH 04/20] lightnvm: add minor version to generic geometry To: =?UTF-8?Q?Javier_Gonz=c3=a1lez?= Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, =?UTF-8?Q?Javier_Gonz=c3=a1lez?= References: <1519205218-26994-1-git-send-email-javier@cnexlabs.com> <1519205218-26994-5-git-send-email-javier@cnexlabs.com> From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: Date: Thu, 22 Feb 2018 08:34:57 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1519205218-26994-5-git-send-email-javier@cnexlabs.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/21/2018 10:26 AM, Javier González wrote: > Separate the version between major and minor on the generic geometry. > Also, add a "subversion" entry to sysfs to expose the minor version > without breaking user space. > > Signed-off-by: Javier González > --- > drivers/lightnvm/core.c | 4 ++-- > drivers/nvme/host/lightnvm.c | 25 ++++++++++++++++++++----- > include/linux/lightnvm.h | 3 ++- > 3 files changed, 24 insertions(+), 8 deletions(-) > > diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c > index 42596afdf64c..dc9ec6baff45 100644 > --- a/drivers/lightnvm/core.c > +++ b/drivers/lightnvm/core.c > @@ -897,8 +897,8 @@ static int nvm_init(struct nvm_dev *dev) > goto err; > } > > - pr_debug("nvm: ver:%u nvm_vendor:%x\n", > - dev_geo->ver_id, > + pr_debug("nvm: ver:%u.%u nvm_vendor:%x\n", > + dev_geo->major_ver_id, dev_geo->minor_ver_id, > dev_geo->c.vmnt); > > ret = nvm_core_init(dev); > diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c > index 598abba66f52..71b4ac57a668 100644 > --- a/drivers/nvme/host/lightnvm.c > +++ b/drivers/nvme/host/lightnvm.c > @@ -296,7 +296,8 @@ static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id, > } > > /* 1.2 spec. only reports a single version id - unfold */ > - dev_geo->ver_id = id->ver_id; > + dev_geo->major_ver_id = id->ver_id; > + dev_geo->minor_ver_id = 2; > > dev_geo->nr_chnls = src->num_ch; > dev_geo->nr_luns = src->num_lun; > @@ -377,7 +378,14 @@ static void nvme_nvm_set_addr_20(struct nvm_addr_format *dst, > static int nvme_nvm_setup_20(struct nvme_nvm_id20 *id, > struct nvm_dev_geo *dev_geo) > { > - dev_geo->ver_id = id->mjr; > + dev_geo->major_ver_id = id->mjr; > + dev_geo->minor_ver_id = id->mnr; > + > + if (!(dev_geo->major_ver_id == 2 && dev_geo->minor_ver_id == 0)) { > + pr_err("nvm: OCSSD version not supported (v%d.%d)\n", > + dev_geo->major_ver_id, dev_geo->minor_ver_id); > + return -EINVAL; > + } > > dev_geo->nr_chnls = le16_to_cpu(id->num_grp); > dev_geo->nr_luns = le16_to_cpu(id->num_pu); > @@ -913,7 +921,11 @@ static ssize_t nvm_dev_attr_show(struct device *dev, > attr = &dattr->attr; > > if (strcmp(attr->name, "version") == 0) { > - return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->ver_id); > + return scnprintf(page, PAGE_SIZE, "%u\n", > + dev_geo->major_ver_id); > + } else if (strcmp(attr->name, "subversion") == 0) { > + return scnprintf(page, PAGE_SIZE, "%u\n", > + dev_geo->minor_ver_id); > } else if (strcmp(attr->name, "media_capabilities") == 0) { > return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap); > } else if (strcmp(attr->name, "read_typ") == 0) { > @@ -1055,6 +1067,7 @@ static ssize_t nvm_dev_attr_show_20(struct device *dev, > > /* general attributes */ > static NVM_DEV_ATTR_RO(version); > +static NVM_DEV_ATTR_RO(subversion); > static NVM_DEV_ATTR_RO(media_capabilities); > > static NVM_DEV_ATTR_RO(read_typ); > @@ -1085,6 +1098,7 @@ static NVM_DEV_ATTR_12_RO(max_phys_secs); > > static struct attribute *nvm_dev_attrs_12[] = { > &dev_attr_version.attr, > + &dev_attr_subversion.attr, > &dev_attr_media_capabilities.attr, > > &dev_attr_vendor_opcode.attr, > @@ -1134,6 +1148,7 @@ static NVM_DEV_ATTR_20_RO(reset_max); > > static struct attribute *nvm_dev_attrs_20[] = { > &dev_attr_version.attr, > + &dev_attr_subversion.attr, > &dev_attr_media_capabilities.attr, > > &dev_attr_groups.attr, > @@ -1167,7 +1182,7 @@ int nvme_nvm_register_sysfs(struct nvme_ns *ns) > if (!ndev) > return -EINVAL; > > - switch (dev_geo->ver_id) { > + switch (dev_geo->major_ver_id) { > case 1: > return sysfs_create_group(&disk_to_dev(ns->disk)->kobj, > &nvm_dev_attr_group_12); > @@ -1184,7 +1199,7 @@ void nvme_nvm_unregister_sysfs(struct nvme_ns *ns) > struct nvm_dev *ndev = ns->ndev; > struct nvm_dev_geo *dev_geo = &ndev->dev_geo; > > - switch (dev_geo->ver_id) { > + switch (dev_geo->major_ver_id) { > case 1: > sysfs_remove_group(&disk_to_dev(ns->disk)->kobj, > &nvm_dev_attr_group_12); > diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h > index 18e3751b1632..5af0b8837095 100644 > --- a/include/linux/lightnvm.h > +++ b/include/linux/lightnvm.h > @@ -242,7 +242,8 @@ struct nvm_common_geo { > /* Device identified geometry */ > struct nvm_dev_geo { > /* device reported version */ > - u8 ver_id; > + u8 major_ver_id; > + u8 minor_ver_id; > > /* full device geometry */ > u16 nr_chnls; > Looks fairly good to me. Did you consider putting in the major and minor version id into the version attribute? e.g., keep 1 as 1, and have version 2 be exposed as 2.0?