License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
#ifndef NVM_H
|
|
|
|
#define NVM_H
|
|
|
|
|
2016-07-07 15:54:16 +08:00
|
|
|
#include <linux/blkdev.h>
|
2016-01-14 04:04:11 +08:00
|
|
|
#include <linux/types.h>
|
2016-07-07 15:54:16 +08:00
|
|
|
#include <uapi/linux/lightnvm.h>
|
2016-01-14 04:04:11 +08:00
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
enum {
|
|
|
|
NVM_IO_OK = 0,
|
|
|
|
NVM_IO_REQUEUE = 1,
|
|
|
|
NVM_IO_DONE = 2,
|
|
|
|
NVM_IO_ERR = 3,
|
|
|
|
|
|
|
|
NVM_IOTYPE_NONE = 0,
|
|
|
|
NVM_IOTYPE_GC = 1,
|
|
|
|
};
|
|
|
|
|
2018-03-30 06:05:15 +08:00
|
|
|
/* common format */
|
|
|
|
#define NVM_GEN_CH_BITS (8)
|
|
|
|
#define NVM_GEN_LUN_BITS (8)
|
|
|
|
#define NVM_GEN_BLK_BITS (16)
|
|
|
|
#define NVM_GEN_RESERVED (32)
|
|
|
|
|
|
|
|
/* 1.2 format */
|
|
|
|
#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_SEC_BITS (24)
|
|
|
|
#define NVM_20_RESERVED (8)
|
2016-01-14 04:04:11 +08:00
|
|
|
|
2018-03-30 06:05:12 +08:00
|
|
|
enum {
|
|
|
|
NVM_OCSSD_SPEC_12 = 12,
|
|
|
|
NVM_OCSSD_SPEC_20 = 20,
|
|
|
|
};
|
|
|
|
|
2016-01-14 04:04:11 +08:00
|
|
|
struct ppa_addr {
|
|
|
|
/* Generic structure for all addresses */
|
|
|
|
union {
|
2018-03-30 06:05:15 +08:00
|
|
|
/* generic device format */
|
2016-01-14 04:04:11 +08:00
|
|
|
struct {
|
2018-03-30 06:05:15 +08:00
|
|
|
u64 ch : NVM_GEN_CH_BITS;
|
|
|
|
u64 lun : NVM_GEN_LUN_BITS;
|
|
|
|
u64 blk : NVM_GEN_BLK_BITS;
|
|
|
|
u64 reserved : NVM_GEN_RESERVED;
|
|
|
|
} a;
|
|
|
|
|
|
|
|
/* 1.2 device format */
|
|
|
|
struct {
|
|
|
|
u64 ch : NVM_GEN_CH_BITS;
|
|
|
|
u64 lun : NVM_GEN_LUN_BITS;
|
|
|
|
u64 blk : NVM_GEN_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;
|
2016-01-14 04:04:11 +08:00
|
|
|
} g;
|
|
|
|
|
2018-03-30 06:05:15 +08:00
|
|
|
/* 2.0 device format */
|
|
|
|
struct {
|
|
|
|
u64 grp : NVM_GEN_CH_BITS;
|
|
|
|
u64 pu : NVM_GEN_LUN_BITS;
|
|
|
|
u64 chk : NVM_GEN_BLK_BITS;
|
|
|
|
u64 sec : NVM_20_SEC_BITS;
|
|
|
|
u64 reserved : NVM_20_RESERVED;
|
|
|
|
} m;
|
|
|
|
|
2016-05-07 02:03:19 +08:00
|
|
|
struct {
|
|
|
|
u64 line : 63;
|
|
|
|
u64 is_cached : 1;
|
|
|
|
} c;
|
|
|
|
|
2016-01-14 04:04:11 +08:00
|
|
|
u64 ppa;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nvm_rq;
|
|
|
|
struct nvm_id;
|
|
|
|
struct nvm_dev;
|
lightnvm: eliminate nvm_lun abstraction in mm
In order to naturally support multi-target instances on an Open-Channel
SSD, targets should own the LUNs they get blocks from and manage
provisioning internally. This is done in several steps.
Since targets own the LUNs the are instantiated on top of and manage the
free block list internally, there is no need for a LUN abstraction in
the media manager. LUNs are intrinsically managed as in the physical
layout (ch:0,lun:0, ..., ch:0,lun:n, ch:1,lun:0, ch:1,lun:n, ...,
ch:m,lun:0, ch:m,lun:n) and given to the targets based on the target
creation ioctl. This simplifies LUN management and clears the path for a
partition manager to sit directly underneath LightNVM targets.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2016-11-29 05:39:10 +08:00
|
|
|
struct nvm_tgt_dev;
|
2018-03-30 06:05:17 +08:00
|
|
|
struct nvm_chk_meta;
|
2016-01-14 04:04:11 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
typedef int (nvm_id_fn)(struct nvm_dev *);
|
2016-05-07 02:03:05 +08:00
|
|
|
typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, u8 *);
|
2016-05-07 02:03:09 +08:00
|
|
|
typedef int (nvm_op_set_bb_fn)(struct nvm_dev *, struct ppa_addr *, int, int);
|
2018-03-30 06:05:17 +08:00
|
|
|
typedef int (nvm_get_chk_meta_fn)(struct nvm_dev *, struct nvm_chk_meta *,
|
|
|
|
sector_t, int);
|
2016-01-14 04:04:11 +08:00
|
|
|
typedef int (nvm_submit_io_fn)(struct nvm_dev *, struct nvm_rq *);
|
2017-10-13 20:46:47 +08:00
|
|
|
typedef int (nvm_submit_io_sync_fn)(struct nvm_dev *, struct nvm_rq *);
|
2016-01-14 04:04:11 +08:00
|
|
|
typedef void *(nvm_create_dma_pool_fn)(struct nvm_dev *, char *);
|
|
|
|
typedef void (nvm_destroy_dma_pool_fn)(void *);
|
|
|
|
typedef void *(nvm_dev_dma_alloc_fn)(struct nvm_dev *, void *, gfp_t,
|
|
|
|
dma_addr_t *);
|
|
|
|
typedef void (nvm_dev_dma_free_fn)(void *, void*, dma_addr_t);
|
|
|
|
|
|
|
|
struct nvm_dev_ops {
|
|
|
|
nvm_id_fn *identity;
|
|
|
|
nvm_op_bb_tbl_fn *get_bb_tbl;
|
|
|
|
nvm_op_set_bb_fn *set_bb_tbl;
|
|
|
|
|
2018-03-30 06:05:17 +08:00
|
|
|
nvm_get_chk_meta_fn *get_chk_meta;
|
|
|
|
|
2016-01-14 04:04:11 +08:00
|
|
|
nvm_submit_io_fn *submit_io;
|
2017-10-13 20:46:47 +08:00
|
|
|
nvm_submit_io_sync_fn *submit_io_sync;
|
2016-01-14 04:04:11 +08:00
|
|
|
|
|
|
|
nvm_create_dma_pool_fn *create_dma_pool;
|
|
|
|
nvm_destroy_dma_pool_fn *destroy_dma_pool;
|
|
|
|
nvm_dev_dma_alloc_fn *dev_dma_alloc;
|
|
|
|
nvm_dev_dma_free_fn *dev_dma_free;
|
|
|
|
};
|
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
#ifdef CONFIG_NVM
|
|
|
|
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/file.h>
|
|
|
|
#include <linux/dmapool.h>
|
2016-01-12 14:49:36 +08:00
|
|
|
#include <uapi/linux/lightnvm.h>
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
enum {
|
|
|
|
/* HW Responsibilities */
|
|
|
|
NVM_RSP_L2P = 1 << 0,
|
|
|
|
NVM_RSP_ECC = 1 << 1,
|
|
|
|
|
|
|
|
/* Physical Adressing Mode */
|
|
|
|
NVM_ADDRMODE_LINEAR = 0,
|
|
|
|
NVM_ADDRMODE_CHANNEL = 1,
|
|
|
|
|
|
|
|
/* Plane programming mode for LUN */
|
2016-02-19 20:56:58 +08:00
|
|
|
NVM_PLANE_SINGLE = 1,
|
|
|
|
NVM_PLANE_DOUBLE = 2,
|
|
|
|
NVM_PLANE_QUAD = 4,
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
/* Status codes */
|
|
|
|
NVM_RSP_SUCCESS = 0x0,
|
|
|
|
NVM_RSP_NOT_CHANGEABLE = 0x1,
|
|
|
|
NVM_RSP_ERR_FAILWRITE = 0x40ff,
|
|
|
|
NVM_RSP_ERR_EMPTYPAGE = 0x42ff,
|
2016-11-29 05:38:57 +08:00
|
|
|
NVM_RSP_ERR_FAILECC = 0x4281,
|
2017-01-31 20:17:18 +08:00
|
|
|
NVM_RSP_ERR_FAILCRC = 0x4004,
|
2016-11-29 05:38:57 +08:00
|
|
|
NVM_RSP_WARN_HIGHECC = 0x4700,
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
/* Device opcodes */
|
|
|
|
NVM_OP_PWRITE = 0x91,
|
|
|
|
NVM_OP_PREAD = 0x92,
|
|
|
|
NVM_OP_ERASE = 0x90,
|
|
|
|
|
|
|
|
/* PPA Command Flags */
|
|
|
|
NVM_IO_SNGL_ACCESS = 0x0,
|
|
|
|
NVM_IO_DUAL_ACCESS = 0x1,
|
|
|
|
NVM_IO_QUAD_ACCESS = 0x2,
|
|
|
|
|
2015-12-06 18:25:47 +08:00
|
|
|
/* NAND Access Modes */
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
NVM_IO_SUSPEND = 0x80,
|
|
|
|
NVM_IO_SLC_MODE = 0x100,
|
2017-04-16 02:55:38 +08:00
|
|
|
NVM_IO_SCRAMBLE_ENABLE = 0x200,
|
2015-12-06 18:25:47 +08:00
|
|
|
|
|
|
|
/* Block Types */
|
|
|
|
NVM_BLK_T_FREE = 0x0,
|
|
|
|
NVM_BLK_T_BAD = 0x1,
|
2016-01-12 14:49:32 +08:00
|
|
|
NVM_BLK_T_GRWN_BAD = 0x2,
|
|
|
|
NVM_BLK_T_DEV = 0x4,
|
|
|
|
NVM_BLK_T_HOST = 0x8,
|
2016-01-12 14:49:34 +08:00
|
|
|
|
|
|
|
/* Memory capabilities */
|
|
|
|
NVM_ID_CAP_SLC = 0x1,
|
|
|
|
NVM_ID_CAP_CMD_SUSPEND = 0x2,
|
|
|
|
NVM_ID_CAP_SCRAMBLE = 0x4,
|
|
|
|
NVM_ID_CAP_ENCRYPT = 0x8,
|
2016-01-12 14:49:35 +08:00
|
|
|
|
|
|
|
/* Memory types */
|
|
|
|
NVM_ID_FMTYPE_SLC = 0,
|
|
|
|
NVM_ID_FMTYPE_MLC = 1,
|
2016-02-04 22:13:27 +08:00
|
|
|
|
|
|
|
/* Device capabilities */
|
|
|
|
NVM_ID_DCAP_BBLKMGMT = 0x1,
|
|
|
|
NVM_UD_DCAP_ECC = 0x2,
|
2016-01-12 14:49:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nvm_id_lp_mlc {
|
|
|
|
u16 num_pairs;
|
|
|
|
u8 pairs[886];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nvm_id_lp_tbl {
|
|
|
|
__u8 id[8];
|
|
|
|
struct nvm_id_lp_mlc mlc;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
};
|
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
struct nvm_addrf_12 {
|
2018-03-30 06:05:01 +08:00
|
|
|
u8 ch_len;
|
|
|
|
u8 lun_len;
|
|
|
|
u8 blk_len;
|
|
|
|
u8 pg_len;
|
2018-03-30 06:05:10 +08:00
|
|
|
u8 pln_len;
|
2018-03-30 06:05:14 +08:00
|
|
|
u8 sec_len;
|
2018-03-30 06:05:01 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
u8 ch_offset;
|
|
|
|
u8 lun_offset;
|
|
|
|
u8 blk_offset;
|
|
|
|
u8 pg_offset;
|
|
|
|
u8 pln_offset;
|
2018-03-30 06:05:14 +08:00
|
|
|
u8 sec_offset;
|
2018-01-05 21:16:03 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
u64 ch_mask;
|
|
|
|
u64 lun_mask;
|
|
|
|
u64 blk_mask;
|
|
|
|
u64 pg_mask;
|
|
|
|
u64 pln_mask;
|
|
|
|
u64 sec_mask;
|
|
|
|
};
|
2018-03-30 06:05:02 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
struct nvm_addrf {
|
|
|
|
u8 ch_len;
|
|
|
|
u8 lun_len;
|
|
|
|
u8 chk_len;
|
|
|
|
u8 sec_len;
|
|
|
|
u8 rsv_len[2];
|
2018-03-30 06:05:01 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
u8 ch_offset;
|
|
|
|
u8 lun_offset;
|
|
|
|
u8 chk_offset;
|
|
|
|
u8 sec_offset;
|
|
|
|
u8 rsv_off[2];
|
|
|
|
|
|
|
|
u64 ch_mask;
|
|
|
|
u64 lun_mask;
|
|
|
|
u64 chk_mask;
|
|
|
|
u64 sec_mask;
|
|
|
|
u64 rsv_mask[2];
|
|
|
|
};
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
2018-03-30 06:05:20 +08:00
|
|
|
enum {
|
|
|
|
/* Chunk states */
|
|
|
|
NVM_CHK_ST_FREE = 1 << 0,
|
|
|
|
NVM_CHK_ST_CLOSED = 1 << 1,
|
|
|
|
NVM_CHK_ST_OPEN = 1 << 2,
|
|
|
|
NVM_CHK_ST_OFFLINE = 1 << 3,
|
|
|
|
|
|
|
|
/* Chunk types */
|
|
|
|
NVM_CHK_TP_W_SEQ = 1 << 0,
|
|
|
|
NVM_CHK_TP_W_RAN = 1 << 1,
|
|
|
|
NVM_CHK_TP_SZ_SPEC = 1 << 4,
|
|
|
|
};
|
|
|
|
|
2018-03-30 06:05:17 +08:00
|
|
|
/*
|
|
|
|
* Note: The structure size is linked to nvme_nvm_chk_meta such that the same
|
|
|
|
* buffer can be used when converting from little endian to cpu addressing.
|
|
|
|
*/
|
|
|
|
struct nvm_chk_meta {
|
|
|
|
u8 state;
|
|
|
|
u8 type;
|
|
|
|
u8 wi;
|
|
|
|
u8 rsvd[5];
|
|
|
|
u64 slba;
|
|
|
|
u64 cnlb;
|
|
|
|
u64 wp;
|
|
|
|
};
|
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
struct nvm_target {
|
|
|
|
struct list_head list;
|
2016-11-29 05:39:06 +08:00
|
|
|
struct nvm_tgt_dev *dev;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
struct nvm_tgt_type *type;
|
|
|
|
struct gendisk *disk;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ADDR_EMPTY (~0ULL)
|
|
|
|
|
2018-01-05 21:16:14 +08:00
|
|
|
#define NVM_TARGET_DEFAULT_OP (101)
|
|
|
|
#define NVM_TARGET_MIN_OP (3)
|
|
|
|
#define NVM_TARGET_MAX_OP (80)
|
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
#define NVM_VERSION_MAJOR 1
|
|
|
|
#define NVM_VERSION_MINOR 0
|
|
|
|
#define NVM_VERSION_PATCH 0
|
|
|
|
|
2018-03-30 06:05:04 +08:00
|
|
|
#define NVM_MAX_VLBA (64) /* max logical blocks in a vector command */
|
|
|
|
|
2016-01-12 14:49:21 +08:00
|
|
|
struct nvm_rq;
|
2016-01-12 14:49:29 +08:00
|
|
|
typedef void (nvm_end_io_fn)(struct nvm_rq *);
|
2016-01-12 14:49:21 +08:00
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
struct nvm_rq {
|
lightnvm: eliminate nvm_lun abstraction in mm
In order to naturally support multi-target instances on an Open-Channel
SSD, targets should own the LUNs they get blocks from and manage
provisioning internally. This is done in several steps.
Since targets own the LUNs the are instantiated on top of and manage the
free block list internally, there is no need for a LUN abstraction in
the media manager. LUNs are intrinsically managed as in the physical
layout (ch:0,lun:0, ..., ch:0,lun:n, ch:1,lun:0, ch:1,lun:n, ...,
ch:m,lun:0, ch:m,lun:n) and given to the targets based on the target
creation ioctl. This simplifies LUN management and clears the path for a
partition manager to sit directly underneath LightNVM targets.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2016-11-29 05:39:10 +08:00
|
|
|
struct nvm_tgt_dev *dev;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
struct bio *bio;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct ppa_addr ppa_addr;
|
|
|
|
dma_addr_t dma_ppa_list;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ppa_addr *ppa_list;
|
|
|
|
|
2016-05-07 02:03:12 +08:00
|
|
|
void *meta_list;
|
|
|
|
dma_addr_t dma_meta_list;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
2016-01-12 14:49:21 +08:00
|
|
|
nvm_end_io_fn *end_io;
|
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
uint8_t opcode;
|
2016-05-07 02:03:20 +08:00
|
|
|
uint16_t nr_ppas;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
uint16_t flags;
|
2016-01-12 14:49:29 +08:00
|
|
|
|
2016-03-03 22:06:39 +08:00
|
|
|
u64 ppa_status; /* ppa media status */
|
2016-01-12 14:49:29 +08:00
|
|
|
int error;
|
2017-01-31 20:17:17 +08:00
|
|
|
|
|
|
|
void *private;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct nvm_rq *nvm_rq_from_pdu(void *pdu)
|
|
|
|
{
|
|
|
|
return pdu - sizeof(struct nvm_rq);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *nvm_rq_to_pdu(struct nvm_rq *rqdata)
|
|
|
|
{
|
|
|
|
return rqdata + 1;
|
|
|
|
}
|
|
|
|
|
2016-01-12 14:49:33 +08:00
|
|
|
enum {
|
|
|
|
NVM_BLK_ST_FREE = 0x1, /* Free block */
|
2016-07-07 15:54:14 +08:00
|
|
|
NVM_BLK_ST_TGT = 0x2, /* Block in use by target */
|
2016-01-12 14:49:33 +08:00
|
|
|
NVM_BLK_ST_BAD = 0x8, /* Bad block */
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
};
|
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* Instance geometry */
|
2016-11-29 05:39:06 +08:00
|
|
|
struct nvm_geo {
|
2018-03-30 06:05:10 +08:00
|
|
|
/* device reported version */
|
2018-03-30 06:05:11 +08:00
|
|
|
u8 major_ver_id;
|
|
|
|
u8 minor_ver_id;
|
2018-03-30 06:05:10 +08:00
|
|
|
|
2018-03-30 06:05:12 +08:00
|
|
|
/* kernel short version */
|
|
|
|
u8 version;
|
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* instance specific geometry */
|
2018-03-30 06:05:14 +08:00
|
|
|
int num_ch;
|
|
|
|
int num_lun; /* per channel */
|
2018-01-05 21:16:03 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* calculated values */
|
|
|
|
int all_luns; /* across channels */
|
|
|
|
int all_chunks; /* across channels */
|
|
|
|
|
|
|
|
int op; /* over-provision in instance */
|
|
|
|
|
|
|
|
sector_t total_secs; /* across channels */
|
|
|
|
|
|
|
|
/* chunk geometry */
|
2018-03-30 06:05:14 +08:00
|
|
|
u32 num_chk; /* chunks per lun */
|
2018-03-30 06:05:10 +08:00
|
|
|
u32 clba; /* sectors per chunk */
|
|
|
|
u16 csecs; /* sector size */
|
|
|
|
u16 sos; /* out-of-band area size */
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* device write constrains */
|
|
|
|
u32 ws_min; /* minimum write size */
|
|
|
|
u32 ws_opt; /* optimal write size */
|
|
|
|
u32 mw_cunits; /* distance required for successful read */
|
2018-03-30 06:05:13 +08:00
|
|
|
u32 maxoc; /* maximum open chunks */
|
|
|
|
u32 maxocpu; /* maximum open chunks per parallel unit */
|
2018-01-05 21:16:03 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* device capabilities */
|
|
|
|
u32 mccap;
|
2018-01-05 21:16:03 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* device timings */
|
|
|
|
u32 trdt; /* Avg. Tread (ns) */
|
|
|
|
u32 trdm; /* Max Tread (ns) */
|
|
|
|
u32 tprt; /* Avg. Tprog (ns) */
|
|
|
|
u32 tprm; /* Max Tprog (ns) */
|
|
|
|
u32 tbet; /* Avg. Terase (ns) */
|
|
|
|
u32 tbem; /* Max Terase (ns) */
|
2018-01-05 21:16:14 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* generic address format */
|
|
|
|
struct nvm_addrf addrf;
|
2018-01-05 21:16:03 +08:00
|
|
|
|
2018-03-30 06:05:10 +08:00
|
|
|
/* 1.2 compatibility */
|
|
|
|
u8 vmnt;
|
|
|
|
u32 cap;
|
|
|
|
u32 dom;
|
|
|
|
|
|
|
|
u8 mtype;
|
|
|
|
u8 fmtype;
|
|
|
|
|
|
|
|
u16 cpar;
|
|
|
|
u32 mpos;
|
|
|
|
|
|
|
|
u8 num_pln;
|
2018-03-30 06:05:14 +08:00
|
|
|
u8 pln_mode;
|
2018-03-30 06:05:10 +08:00
|
|
|
u16 num_pg;
|
|
|
|
u16 fpg_sz;
|
2016-11-29 05:39:06 +08:00
|
|
|
};
|
|
|
|
|
2017-01-31 20:17:09 +08:00
|
|
|
/* sub-device structure */
|
2016-11-29 05:39:06 +08:00
|
|
|
struct nvm_tgt_dev {
|
|
|
|
/* Device information */
|
|
|
|
struct nvm_geo geo;
|
|
|
|
|
lightnvm: eliminate nvm_lun abstraction in mm
In order to naturally support multi-target instances on an Open-Channel
SSD, targets should own the LUNs they get blocks from and manage
provisioning internally. This is done in several steps.
Since targets own the LUNs the are instantiated on top of and manage the
free block list internally, there is no need for a LUN abstraction in
the media manager. LUNs are intrinsically managed as in the physical
layout (ch:0,lun:0, ..., ch:0,lun:n, ch:1,lun:0, ch:1,lun:n, ...,
ch:m,lun:0, ch:m,lun:n) and given to the targets based on the target
creation ioctl. This simplifies LUN management and clears the path for a
partition manager to sit directly underneath LightNVM targets.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2016-11-29 05:39:10 +08:00
|
|
|
/* Base ppas for target LUNs */
|
|
|
|
struct ppa_addr *luns;
|
|
|
|
|
2016-11-29 05:39:06 +08:00
|
|
|
struct request_queue *q;
|
|
|
|
|
2016-11-29 05:39:11 +08:00
|
|
|
struct nvm_dev *parent;
|
lightnvm: eliminate nvm_lun abstraction in mm
In order to naturally support multi-target instances on an Open-Channel
SSD, targets should own the LUNs they get blocks from and manage
provisioning internally. This is done in several steps.
Since targets own the LUNs the are instantiated on top of and manage the
free block list internally, there is no need for a LUN abstraction in
the media manager. LUNs are intrinsically managed as in the physical
layout (ch:0,lun:0, ..., ch:0,lun:n, ch:1,lun:0, ch:1,lun:n, ...,
ch:m,lun:0, ch:m,lun:n) and given to the targets based on the target
creation ioctl. This simplifies LUN management and clears the path for a
partition manager to sit directly underneath LightNVM targets.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2016-11-29 05:39:10 +08:00
|
|
|
void *map;
|
2016-11-29 05:39:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct nvm_dev {
|
|
|
|
struct nvm_dev_ops *ops;
|
|
|
|
|
|
|
|
struct list_head devices;
|
|
|
|
|
|
|
|
/* Device information */
|
|
|
|
struct nvm_geo geo;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
2016-03-03 22:06:38 +08:00
|
|
|
unsigned long *lun_map;
|
2016-05-07 02:03:13 +08:00
|
|
|
void *dma_pool;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
/* Backend device */
|
|
|
|
struct request_queue *q;
|
|
|
|
char name[DISK_NAME_LEN];
|
2016-09-16 20:25:08 +08:00
|
|
|
void *private_data;
|
2016-01-12 14:49:36 +08:00
|
|
|
|
lightnvm: eliminate nvm_lun abstraction in mm
In order to naturally support multi-target instances on an Open-Channel
SSD, targets should own the LUNs they get blocks from and manage
provisioning internally. This is done in several steps.
Since targets own the LUNs the are instantiated on top of and manage the
free block list internally, there is no need for a LUN abstraction in
the media manager. LUNs are intrinsically managed as in the physical
layout (ch:0,lun:0, ..., ch:0,lun:n, ch:1,lun:0, ch:1,lun:n, ...,
ch:m,lun:0, ch:m,lun:n) and given to the targets based on the target
creation ioctl. This simplifies LUN management and clears the path for a
partition manager to sit directly underneath LightNVM targets.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2016-11-29 05:39:10 +08:00
|
|
|
void *rmap;
|
|
|
|
|
2016-01-12 14:49:36 +08:00
|
|
|
struct mutex mlock;
|
2016-03-03 22:06:37 +08:00
|
|
|
spinlock_t lock;
|
2017-01-31 20:17:09 +08:00
|
|
|
|
|
|
|
/* target management */
|
|
|
|
struct list_head area_list;
|
|
|
|
struct list_head targets;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
};
|
|
|
|
|
2018-03-30 06:05:16 +08:00
|
|
|
static inline struct ppa_addr generic_to_dev_addr(struct nvm_dev *dev,
|
2017-01-31 20:17:14 +08:00
|
|
|
struct ppa_addr r)
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
{
|
2018-03-30 06:05:16 +08:00
|
|
|
struct nvm_geo *geo = &dev->geo;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
struct ppa_addr l;
|
|
|
|
|
2018-03-30 06:05:15 +08:00
|
|
|
if (geo->version == NVM_OCSSD_SPEC_12) {
|
|
|
|
struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&geo->addrf;
|
|
|
|
|
|
|
|
l.ppa = ((u64)r.g.ch) << ppaf->ch_offset;
|
|
|
|
l.ppa |= ((u64)r.g.lun) << ppaf->lun_offset;
|
|
|
|
l.ppa |= ((u64)r.g.blk) << ppaf->blk_offset;
|
|
|
|
l.ppa |= ((u64)r.g.pg) << ppaf->pg_offset;
|
|
|
|
l.ppa |= ((u64)r.g.pl) << ppaf->pln_offset;
|
|
|
|
l.ppa |= ((u64)r.g.sec) << ppaf->sec_offset;
|
|
|
|
} else {
|
|
|
|
struct nvm_addrf *lbaf = &geo->addrf;
|
|
|
|
|
|
|
|
l.ppa = ((u64)r.m.grp) << lbaf->ch_offset;
|
|
|
|
l.ppa |= ((u64)r.m.pu) << lbaf->lun_offset;
|
|
|
|
l.ppa |= ((u64)r.m.chk) << lbaf->chk_offset;
|
|
|
|
l.ppa |= ((u64)r.m.sec) << lbaf->sec_offset;
|
|
|
|
}
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
2018-03-30 06:05:16 +08:00
|
|
|
static inline struct ppa_addr dev_to_generic_addr(struct nvm_dev *dev,
|
2017-01-31 20:17:14 +08:00
|
|
|
struct ppa_addr r)
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
{
|
2018-03-30 06:05:16 +08:00
|
|
|
struct nvm_geo *geo = &dev->geo;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
struct ppa_addr l;
|
|
|
|
|
2016-07-07 15:54:09 +08:00
|
|
|
l.ppa = 0;
|
2018-03-30 06:05:10 +08:00
|
|
|
|
2018-03-30 06:05:15 +08:00
|
|
|
if (geo->version == NVM_OCSSD_SPEC_12) {
|
|
|
|
struct nvm_addrf_12 *ppaf = (struct nvm_addrf_12 *)&geo->addrf;
|
|
|
|
|
|
|
|
l.g.ch = (r.ppa & ppaf->ch_mask) >> ppaf->ch_offset;
|
|
|
|
l.g.lun = (r.ppa & ppaf->lun_mask) >> ppaf->lun_offset;
|
|
|
|
l.g.blk = (r.ppa & ppaf->blk_mask) >> ppaf->blk_offset;
|
|
|
|
l.g.pg = (r.ppa & ppaf->pg_mask) >> ppaf->pg_offset;
|
|
|
|
l.g.pl = (r.ppa & ppaf->pln_mask) >> ppaf->pln_offset;
|
|
|
|
l.g.sec = (r.ppa & ppaf->sec_mask) >> ppaf->sec_offset;
|
|
|
|
} else {
|
|
|
|
struct nvm_addrf *lbaf = &geo->addrf;
|
|
|
|
|
|
|
|
l.m.grp = (r.ppa & lbaf->ch_mask) >> lbaf->ch_offset;
|
|
|
|
l.m.pu = (r.ppa & lbaf->lun_mask) >> lbaf->lun_offset;
|
|
|
|
l.m.chk = (r.ppa & lbaf->chk_mask) >> lbaf->chk_offset;
|
|
|
|
l.m.sec = (r.ppa & lbaf->sec_mask) >> lbaf->sec_offset;
|
|
|
|
}
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
2015-11-06 01:41:16 +08:00
|
|
|
typedef blk_qc_t (nvm_tgt_make_rq_fn)(struct request_queue *, struct bio *);
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
typedef sector_t (nvm_tgt_capacity_fn)(void *);
|
2017-04-16 02:55:45 +08:00
|
|
|
typedef void *(nvm_tgt_init_fn)(struct nvm_tgt_dev *, struct gendisk *,
|
|
|
|
int flags);
|
2018-06-01 21:04:24 +08:00
|
|
|
typedef void (nvm_tgt_exit_fn)(void *, bool);
|
2017-01-31 20:17:20 +08:00
|
|
|
typedef int (nvm_tgt_sysfs_init_fn)(struct gendisk *);
|
|
|
|
typedef void (nvm_tgt_sysfs_exit_fn)(struct gendisk *);
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
struct nvm_tgt_type {
|
|
|
|
const char *name;
|
|
|
|
unsigned int version[3];
|
|
|
|
|
|
|
|
/* target entry points */
|
|
|
|
nvm_tgt_make_rq_fn *make_rq;
|
|
|
|
nvm_tgt_capacity_fn *capacity;
|
|
|
|
|
|
|
|
/* module-specific init/teardown */
|
|
|
|
nvm_tgt_init_fn *init;
|
|
|
|
nvm_tgt_exit_fn *exit;
|
|
|
|
|
2017-01-31 20:17:20 +08:00
|
|
|
/* sysfs */
|
|
|
|
nvm_tgt_sysfs_init_fn *sysfs_init;
|
|
|
|
nvm_tgt_sysfs_exit_fn *sysfs_exit;
|
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
/* For internal use */
|
|
|
|
struct list_head list;
|
2017-10-13 20:45:50 +08:00
|
|
|
struct module *owner;
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
};
|
|
|
|
|
2016-05-07 02:03:02 +08:00
|
|
|
extern int nvm_register_tgt_type(struct nvm_tgt_type *);
|
|
|
|
extern void nvm_unregister_tgt_type(struct nvm_tgt_type *);
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
|
|
|
extern void *nvm_dev_dma_alloc(struct nvm_dev *, gfp_t, dma_addr_t *);
|
|
|
|
extern void nvm_dev_dma_free(struct nvm_dev *, void *, dma_addr_t);
|
|
|
|
|
2016-09-16 20:25:07 +08:00
|
|
|
extern struct nvm_dev *nvm_alloc_dev(int);
|
|
|
|
extern int nvm_register(struct nvm_dev *);
|
|
|
|
extern void nvm_unregister(struct nvm_dev *);
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
|
2018-03-30 06:05:17 +08:00
|
|
|
|
|
|
|
extern int nvm_get_chunk_meta(struct nvm_tgt_dev *tgt_dev,
|
|
|
|
struct nvm_chk_meta *meta, struct ppa_addr ppa,
|
|
|
|
int nchks);
|
|
|
|
|
2016-11-29 05:39:14 +08:00
|
|
|
extern int nvm_set_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr *,
|
|
|
|
int, int);
|
lightnvm: eliminate nvm_lun abstraction in mm
In order to naturally support multi-target instances on an Open-Channel
SSD, targets should own the LUNs they get blocks from and manage
provisioning internally. This is done in several steps.
Since targets own the LUNs the are instantiated on top of and manage the
free block list internally, there is no need for a LUN abstraction in
the media manager. LUNs are intrinsically managed as in the physical
layout (ch:0,lun:0, ..., ch:0,lun:n, ch:1,lun:0, ch:1,lun:n, ...,
ch:m,lun:0, ch:m,lun:n) and given to the targets based on the target
creation ioctl. This simplifies LUN management and clears the path for a
partition manager to sit directly underneath LightNVM targets.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2016-11-29 05:39:10 +08:00
|
|
|
extern int nvm_submit_io(struct nvm_tgt_dev *, struct nvm_rq *);
|
2017-10-13 20:46:47 +08:00
|
|
|
extern int nvm_submit_io_sync(struct nvm_tgt_dev *, struct nvm_rq *);
|
2017-01-31 20:17:17 +08:00
|
|
|
extern void nvm_end_io(struct nvm_rq *);
|
2016-05-07 02:02:58 +08:00
|
|
|
extern int nvm_bb_tbl_fold(struct nvm_dev *, u8 *, int);
|
2016-11-29 05:39:14 +08:00
|
|
|
extern int nvm_get_tgt_bb_tbl(struct nvm_tgt_dev *, struct ppa_addr, u8 *);
|
2016-01-12 14:49:36 +08:00
|
|
|
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
#else /* CONFIG_NVM */
|
|
|
|
struct nvm_dev_ops;
|
|
|
|
|
2016-09-16 20:25:07 +08:00
|
|
|
static inline struct nvm_dev *nvm_alloc_dev(int node)
|
|
|
|
{
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
}
|
|
|
|
static inline int nvm_register(struct nvm_dev *dev)
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2016-09-16 20:25:07 +08:00
|
|
|
static inline void nvm_unregister(struct nvm_dev *dev) {}
|
lightnvm: Support for Open-Channel SSDs
Open-channel SSDs are devices that share responsibilities with the host
in order to implement and maintain features that typical SSDs keep
strictly in firmware. These include (i) the Flash Translation Layer
(FTL), (ii) bad block management, and (iii) hardware units such as the
flash controller, the interface controller, and large amounts of flash
chips. In this way, Open-channels SSDs exposes direct access to their
physical flash storage, while keeping a subset of the internal features
of SSDs.
LightNVM is a specification that gives support to Open-channel SSDs
LightNVM allows the host to manage data placement, garbage collection,
and parallelism. Device specific responsibilities such as bad block
management, FTL extensions to support atomic IOs, or metadata
persistence are still handled by the device.
The implementation of LightNVM consists of two parts: core and
(multiple) targets. The core implements functionality shared across
targets. This is initialization, teardown and statistics. The targets
implement the interface that exposes physical flash to user-space
applications. Examples of such targets include key-value store,
object-store, as well as traditional block devices, which can be
application-specific.
Contributions in this patch from:
Javier Gonzalez <jg@lightnvm.io>
Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Jesper Madsen <jmad@itu.dk>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
2015-10-29 02:54:55 +08:00
|
|
|
#endif /* CONFIG_NVM */
|
|
|
|
#endif /* LIGHTNVM.H */
|