From patchwork Tue Feb 13 14:06:03 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: 10216415 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 8BC0160329 for ; Tue, 13 Feb 2018 14:08:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D3B6283C7 for ; Tue, 13 Feb 2018 14:08:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 704C828D12; Tue, 13 Feb 2018 14:08:17 +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 F274D283C7 for ; Tue, 13 Feb 2018 14:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965037AbeBMOG7 (ORCPT ); Tue, 13 Feb 2018 09:06:59 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:50923 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964917AbeBMOGV (ORCPT ); Tue, 13 Feb 2018 09:06:21 -0500 Received: by mail-wm0-f66.google.com with SMTP id f71so16254910wmf.0 for ; Tue, 13 Feb 2018 06:06:20 -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=G6nSKnMAklrNRz6/ax/fHeNzZ7b+0slnB850lVcTyBM=; b=V3rzNRajpCkUWED3rjO/sCC6dThzhFOJZ+osTQES8/KbQt/AFYQvelXKvHisTPdKgS YEen79eyI4GXYvO3mNClPuvRAoYkmDQpYd1vkRz0S9DOoSgmYPe3PUnAg7nU0x1MgNN3 jTbMzvwtG11SIeJn/op49c2gT/ilj/JpVPDcSzkg++/QVQxpVCV1qSa1CFIBtE6IAd2v qJ7PPoiUoPnFF0kiSv5NMpotCrFdmb8b0k+31lWMS506WLME5j89Zp7GlVeJeRgK5ZMp V6ox5w5e9kVqwbAtN6VMFiU5HlN4VWoSdFMp7bRP6c+WY9iJ6T/6QUAHMViYbU/iWyFb 8HPg== 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=G6nSKnMAklrNRz6/ax/fHeNzZ7b+0slnB850lVcTyBM=; b=fOB3se95aLgjT4WBbUiNMEjXX8NeS/hOWTiVoXccjtC5+wBJ0eJ3wMQSR5xz9qGLo5 N20J2nA08AJ/TC4qgvVLyxDpKIUI7FpM2QDXohK9Zg1T8z2rkRaLhwwQ40+p2Y2wFReU LYs9SMFwpiR3nhIqsZhcnSl3TYo33SzbFhz3aHjwUQOFFrbWV78gZYeEFvfrMQ2Sys3K l/Mvr0CSOLRuV0iF7s/NlFHgjZmzzi2E+xr1cN4QdHHXqqSk1R2T+ztcJCmUUcVY9Olt h1voJ0sNnDjEa4K2r7z0lMFXN54ljuEnaNvnUjceLXnrfF043kA7d7+y1ksqwinKmx11 vIMA== X-Gm-Message-State: APf1xPBQTj284wN9W+Ubuq7h3MmDSBOLUUhyIVzwk82Q0Rai/P/4JZ3G t9OVCfpcbonLDrNyNZbyYHVgmQ== X-Google-Smtp-Source: AH8x225oGm3PY4bsqggjACQVs7tS+r5KOlpsBQoymM/8x+VuCAqQKwgre6pjjH4rRlOM30gAurYT0Q== X-Received: by 10.80.186.5 with SMTP id g5mr2330396edc.12.1518530780100; Tue, 13 Feb 2018 06:06:20 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id k11sm6658850eda.22.2018.02.13.06.06.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Feb 2018 06:06:19 -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 3/8] lightnvm: add support for 2.0 address format Date: Tue, 13 Feb 2018 15:06:03 +0100 Message-Id: <1518530768-20956-4-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518530768-20956-1-git-send-email-javier@cnexlabs.com> References: <1518530768-20956-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 Add support for 2.0 address format. Also, align address bits for 1.2 and 2.0 to align. Signed-off-by: Javier González --- include/linux/lightnvm.h | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index 6a567bd19b73..e035ae4c9acc 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h @@ -16,12 +16,21 @@ enum { NVM_IOTYPE_GC = 1, }; -#define NVM_BLK_BITS (16) -#define NVM_PG_BITS (16) -#define NVM_SEC_BITS (8) -#define NVM_PL_BITS (8) -#define NVM_LUN_BITS (8) -#define NVM_CH_BITS (7) +/* 1.2 format */ +#define NVM_12_CH_BITS (8) +#define NVM_12_LUN_BITS (8) +#define NVM_12_BLK_BITS (16) +#define NVM_12_PG_BITS (16) +#define NVM_12_PL_BITS (4) +#define NVM_12_SEC_BITS (4) +#define NVM_12_RESERVED (8) + +/* 2.0 format */ +#define NVM_20_CH_BITS (8) +#define NVM_20_LUN_BITS (8) +#define NVM_20_CHK_BITS (16) +#define NVM_20_SEC_BITS (24) +#define NVM_20_RESERVED (8) enum { NVM_OCSSD_SPEC_12 = 12, @@ -31,16 +40,26 @@ enum { struct ppa_addr { /* Generic structure for all addresses */ union { + /* 1.2 device format */ struct { - u64 blk : NVM_BLK_BITS; - u64 pg : NVM_PG_BITS; - u64 sec : NVM_SEC_BITS; - u64 pl : NVM_PL_BITS; - u64 lun : NVM_LUN_BITS; - u64 ch : NVM_CH_BITS; - u64 reserved : 1; + u64 ch : NVM_12_CH_BITS; + u64 lun : NVM_12_LUN_BITS; + u64 blk : NVM_12_BLK_BITS; + u64 pg : NVM_12_PG_BITS; + u64 pl : NVM_12_PL_BITS; + u64 sec : NVM_12_SEC_BITS; + u64 reserved : NVM_12_RESERVED; } g; + /* 2.0 device format */ + struct { + u64 ch : NVM_20_CH_BITS; + u64 lun : NVM_20_LUN_BITS; + u64 chk : NVM_20_CHK_BITS; + u64 sec : NVM_20_SEC_BITS; + u64 reserved : NVM_20_RESERVED; + } m; + struct { u64 line : 63; u64 is_cached : 1;