Received: by 10.223.185.116 with SMTP id b49csp7261043wrg; Thu, 1 Mar 2018 02:35:54 -0800 (PST) X-Google-Smtp-Source: AG47ELvejstN0qA2ENI8jBOMg8rgEdva852eGip3U6iJ2kmdtOK6WGuif5puG7Qfv+aY9etwv2WV X-Received: by 10.99.54.196 with SMTP id d187mr135017pga.154.1519900554210; Thu, 01 Mar 2018 02:35:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519900554; cv=none; d=google.com; s=arc-20160816; b=pVpxRPNnRDhPrr9Cy2UUvPe//+x/cOFl0jbW5UIlmm1PjJ9K1Bz/2zuz+V5w747588 wOmuK4g4qBBEQsk/qzpSHPOY92LDwoJ1fDqG2Aa7c8bAOdtzIEKpfJXX7ZjB5gPfOoqR pgDslD5u/6wzU7PCSqZB7yft4zI8KopMtWZA4ZF9xBTeG5zVYKfA8bXt/PYQA3RsQbn4 oqq1JAklZwdPJ0tTcbUbWFfj5AgZx4C4sDL+JOoeQU2Jjm4yNbBea1EcRZ5x8l35Ozr9 CpHZK0halof0SFY+svt9MWnSHiPK3Sq5ixJI789O/NZQO6b+1CTwHyLM7P6mHYKcLlcf jX0g== 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=c1zd5+9Hz5iwenLGdar0+xlRpjLeIrSlzqGkZuJvhfE=; b=E6IS8eACN/8nOT1pvY5D9GomSUHtuyi7e1tHjICGoQbY2xRlQb9r0lJF+6ztIHpo4Y JIQSm6XQ1HKEakHCGaE0zVBE84ZRmsVQQSS7qnt2LGkhHzI1jqiYX/1V6vbf4FnFHn0d ZEDWxho+a1z282bTdbGLWCiVd5u0sbFEorsYgaF0hRN65AA2WSqhsdLiL+B666x06pgR ocsvtEHnfKRwg35jhr+XPocaie6vIMMHreU+AjU7phEnaRIGEunT2Tipi+KZ00l7T8xS w33UsuV/rlwIPTs9+d287652Y9fMkp4T87D7NQlb6Q1tPCafA0/Qjx1TNUHqIPUm2Uoj aksA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lightnvm-io.20150623.gappssmtp.com header.s=20150623 header.b=VK6hfohv; 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 v10-v6si2883388plo.61.2018.03.01.02.35.39; Thu, 01 Mar 2018 02:35:54 -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=VK6hfohv; 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 S967452AbeCAKdN (ORCPT + 99 others); Thu, 1 Mar 2018 05:33:13 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:40843 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966117AbeCAKdJ (ORCPT ); Thu, 1 Mar 2018 05:33:09 -0500 Received: by mail-lf0-f68.google.com with SMTP id 37so8055155lfs.7 for ; Thu, 01 Mar 2018 02:33:08 -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=c1zd5+9Hz5iwenLGdar0+xlRpjLeIrSlzqGkZuJvhfE=; b=VK6hfohvWrP08x3rmLik3b4vmaC0e96KYW5mRTA0+ZB0kgYZbj82dzMg4OVEW2Q+cQ 6tI56uCja2Dak78mo2XQ/D/BMdIAQVvZ24cAzLWM6WFMeZutJd5m5pYhad7df8ejUlTu UENyNPDnkP9liMgBpoTOTIMZq2xC7+yH8fS1fQFEPOu33vWJAc+IUmSqkcgy9+qtKVH9 YpxeEMFT0VqUrXpm2K83opdZHTfYqzxX834xyY7GJzhfhIUhvFb7b1t7C3DI0oE+2big 1ts2MFRuhPuiw3bhUta34REb0iqykNLaYZuERTDNDx+FFjotSq6/Lf2A3dk26KBY90KK XODQ== 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=c1zd5+9Hz5iwenLGdar0+xlRpjLeIrSlzqGkZuJvhfE=; b=mUntuFCekGTIMQJEc78HZuzQqHhIWY29APkRoeXosvIl/oqwJytrmcQpOiJz1TN6rf 4EOk698ehaKl47xq8MjqXZEEa/+oHgXRmRIHgBwcTA4e/JxrvF/gtEmHSTZslJRHUaan MIIVASlUc956qNWIl80U21odqqZzOSRI45nVEwWfq+zGj++Ut9K3tKm3c8B+kUs2iCNg s13CGMa/5m0qZOBbUbqK02Dnp5nMAiJfX3t/B2vD82ZSrEGMDBgTOW6cJOc8aBmO+ThX MZ4htob4tdpbbEAKW+h1rKpgdKm87Dys6hghyfaqJ2DLtWSkp1L8IpSt5NF1DqMSqS4+ RUAw== X-Gm-Message-State: AElRT7H0/lbBNWM/yymQwq7HjQZbIRDxWSXHjkZbiVVwhmG5cEE9xzyZ vTcMU5Z/fU2Ijwo0z4UbANNHxg== X-Received: by 10.25.217.69 with SMTP id q66mr1109765lfg.62.1519900387705; Thu, 01 Mar 2018 02:33:07 -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 11sm800055ljr.27.2018.03.01.02.33.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 02:33:06 -0800 (PST) Subject: Re: [PATCH 02/15] lightnvm: add controller capabilities to 2.0 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: <1519832975-25432-1-git-send-email-javier@cnexlabs.com> <1519832975-25432-3-git-send-email-javier@cnexlabs.com> From: =?UTF-8?Q?Matias_Bj=c3=b8rling?= Message-ID: Date: Thu, 1 Mar 2018 11:33:06 +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: <1519832975-25432-3-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/28/2018 04:49 PM, Javier González wrote: > Assign missing mccap value on 2.0 path > > Signed-off-by: Javier González > --- > drivers/nvme/host/lightnvm.c | 4 +++- > include/linux/lightnvm.h | 8 +++++--- > 2 files changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c > index e276ace28c64..5b2024ebac76 100644 > --- a/drivers/nvme/host/lightnvm.c > +++ b/drivers/nvme/host/lightnvm.c > @@ -318,7 +318,7 @@ 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 */ > > - geo->mccap = le32_to_cpu(src->mccap); > + geo->cap = le32_to_cpu(src->mccap); > > geo->trdt = le32_to_cpu(src->trdt); > geo->trdm = le32_to_cpu(src->trdm); > @@ -396,6 +396,8 @@ static int nvme_nvm_setup_20(struct nvme_nvm_id20 *id, > geo->ws_opt = le32_to_cpu(id->ws_opt); > geo->mw_cunits = le32_to_cpu(id->mw_cunits); > > + geo->cap = le32_to_cpu(id->mccap); > + > geo->trdt = le32_to_cpu(id->trdt); > geo->trdm = le32_to_cpu(id->trdm); > geo->tprt = le32_to_cpu(id->twrt); > diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h > index 16255fcd5250..b9f0d2070de9 100644 > --- a/include/linux/lightnvm.h > +++ b/include/linux/lightnvm.h > @@ -288,8 +288,10 @@ struct nvm_geo { > u32 ws_opt; /* optimal write size */ > u32 mw_cunits; /* distance required for successful read */ > > - /* device capabilities */ > - u32 mccap; > + /* device capabilities. Note that this represents capabilities in 1.2 > + * and media and controller capabilities in 2.0 > + */ > + u32 cap; Here is a list of capabilities: 1.2 Bad block mgmt Hybrid command support 2.0 Vector copy Double reset The way I was thinking it would be implemented is to split the upper cap bits to 2.0, and let the lower bits be reserved for 1.2. Such that one would define the following: enum { NVM_CAP_BBM 1 << 0; NVM_CAP_HCS 1 << 1; NVM_CAP_VCPY 1 << 16; NVM_CAP_DRST 1 << 17; }; That way, the assignment from 2.0 can easily be done with cap = le32_to_cpu(id->mccap) << 16; and targets and other don't need to understand the difference between 1.2 and 2.0 format. > > /* device timings */ > u32 trdt; /* Avg. Tread (ns) */ > @@ -304,7 +306,7 @@ struct nvm_geo { > > /* 1.2 compatibility */ > u8 vmnt; > - u32 cap; > + u32 mccap; > u32 dom; > > u8 mtype; >