lightnvm: fix missing grown bad block type
PATCH 1/7 lightnvm: fix missing grown bad block type
The get/set bad block interface defines good block, factory bad block, grown bad block, device reserved block, and host reserved block. Unfortunately the grown bad block was missing, leaving the offsets wrong for device and host side reserved blocks.
This patch adds the missing type and corrects the offsets.
--- include/linux/lightnvm.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/linux/lightnvm.h +3 -2
@@ -58,8 +58,9 @@ enum {/* Block Types */ NVM_BLK_T_FREE =0x0 ,NVM_BLK_T_BAD =0x1 , -NVM_BLK_T_DEV =0x2 , - NVM_BLK_T_HOST = 0x4, +NVM_BLK_T_GRWN_BAD =0x2 , +NVM_BLK_T_DEV =0x4 , + NVM_BLK_T_HOST = 0x8, }; struct nvm_id_group {
Signature · 1 line
2.1.4
PATCH 6/7 lightnvm: use system block for mm initialization
Use system block information to register the appropriate media manager. This enables the LightNVM subsystem to instantiate a media manager selected by the user, instead of relying on automatic detection by each media manager loaded in the kernel.
A device must now be initialized before it can proceed to initialize its media manager. Upon initialization, the configured media manager is automatically initialized as well.
--- drivers/lightnvm/core.c | 25 +++++++++++++++++++++++-- include/linux/lightnvm.h | 3 +++ 2 files changed, 26 insertions(+), 2 deletions(-)
drivers/lightnvm/core.c +23 -2
@@ -106,6 +106,9 @@ struct nvmm_type *nvm_init_mgr(struct nvm_dev *dev)lockdep_assert_held (&nvm_lock);list_for_each_entry (mt, &nvm_mgrs, list) { +if (strncmp (dev->sb.mmtype, mt->name,NVM_MMTYPE_LEN )) +continue ; + ret = mt->register_mgr (dev);if (ret <0 ) { pr_err("nvm: media mgr failed to init (%d) on dev %s\n",
@@ -569,9 +572,16 @@ int nvm_register(struct request_queue *q, char *disk_name, } } + ret =nvm_get_sysblock (dev, &dev->sb); +if (!ret) +pr_err ("nvm: device not initialized.\n" ); +else if (ret <0 ) +pr_err ("nvm: err (%d) on device initialization\n" , ret); +/* register device with a supported media manager */ down_write (&nvm_lock); - dev->mt =nvm_init_mgr (dev); +if (ret >0 ) + dev->mt =nvm_init_mgr (dev);list_add (&dev->devices, &nvm_devices);up_write (&nvm_lock);
@@ -1030,6 +1040,7 @@ static long __nvm_ioctl_dev_init(struct nvm_ioctl_dev_init *init) {struct nvm_dev *dev;struct nvm_sb_info info; +int ret;down_write (&nvm_lock); dev =nvm_find_nvm_dev (init->dev);
@@ -1044,7 +1055,17 @@ static long __nvm_ioctl_dev_init(struct nvm_ioctl_dev_init *init)strncpy (info.mmtype, init->mmtype,NVM_MMTYPE_LEN ); info.fs_ppa.ppa =-1 ; -return nvm_init_sysblock (dev, &info); + ret =nvm_init_sysblock (dev, &info); +if (ret) +return ret; + +memcpy (&dev->sb, &info,sizeof (struct nvm_sb_info )); + +down_write (&nvm_lock); + dev->mt =nvm_init_mgr (dev); +up_write (&nvm_lock); + +return 0 ; }static long nvm_ioctl_dev_init (struct file *file,void __user *arg)
include/linux/lightnvm.h +3 -0
@@ -301,6 +301,9 @@ struct nvm_dev {struct nvmm_type *mt;void *mp; +/* System blocks */ +struct nvm_sb_info sb; +/* Device information */ int nr_chnls;int nr_planes;
Signature · 1 line
2.1.4
PATCH 5/7 lightnvm: introduce ioctl to initialize device
In reply to Matias BjørlingBased on the previous patch, we now introduce an ioctl to initialize the device using nvm_init_sysblock and create the necessary system blocks. The user may specify the media manager that they wish to instantiate on top. Default from user-space will be "gennvm".
--- drivers/lightnvm/core.c | 50 +++++++++++++++++++++++++++++++++++++++++++ include/uapi/linux/lightnvm.h | 11 ++++++++++ 2 files changed, 61 insertions(+)
drivers/lightnvm/core.c +50 -0
@@ -1019,6 +1019,54 @@ static long nvm_ioctl_dev_remove(struct file *file, void __user *arg)return __nvm_configure_remove (&remove); } +static void nvm_setup_nvm_sb_info (struct nvm_sb_info *info) +{ + info->seqnr =1 ; + info->erase_cnt =0 ; + info->version =1 ; +} + +static long __nvm_ioctl_dev_init (struct nvm_ioctl_dev_init *init) +{ +struct nvm_dev *dev; +struct nvm_sb_info info; + +down_write (&nvm_lock); + dev =nvm_find_nvm_dev (init->dev); +up_write (&nvm_lock); +if (!dev) { +pr_err ("nvm: device not found\n" ); +return -EINVAL ; + } + +nvm_setup_nvm_sb_info (&info); + +strncpy (info.mmtype, init->mmtype,NVM_MMTYPE_LEN ); + info.fs_ppa.ppa =-1 ; + +return nvm_init_sysblock (dev, &info); +} + +static long nvm_ioctl_dev_init (struct file *file,void __user *arg) +{ +struct nvm_ioctl_dev_init init; + +if (!capable (CAP_SYS_ADMIN )) +return -EPERM ; + +if (copy_from_user (&init, arg,sizeof (struct nvm_ioctl_dev_init ))) +return -EFAULT ; + +if (init.flags !=0 ) { +pr_err ("nvm: no flags supported\n" ); +return -EINVAL ; + } + + init.dev[DISK_NAME_LEN -1 ] ='\0' ; + +return __nvm_ioctl_dev_init (&init); +} +static long nvm_ctl_ioctl (struct file *file,uint cmd,unsigned long arg) {void __user *argp = (void __user *)arg;
@@ -1032,6 +1080,8 @@ static long nvm_ctl_ioctl(struct file *file, uint cmd, unsigned long arg)return nvm_ioctl_dev_create (file, argp);case NVM_DEV_REMOVE :return nvm_ioctl_dev_remove (file, argp); +case NVM_DEV_INIT : +return nvm_ioctl_dev_init (file, argp); }return 0 ; }
include/uapi/linux/lightnvm.h +11 -0
@@ -101,6 +101,12 @@ struct nvm_ioctl_remove {__u32 flags; }; +struct nvm_ioctl_dev_init { +char dev[DISK_NAME_LEN ];/* open-channel SSD device */ +char mmtype[NVM_MMTYPE_LEN ];/* register to media manager */ + +__u32 flags; +};/* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ enum {
@@ -111,6 +117,9 @@ enum {/* device level cmds */ NVM_DEV_CREATE_CMD ,NVM_DEV_REMOVE_CMD , + +/* Init a device to support LightNVM media managers */ + NVM_DEV_INIT_CMD, };#define NVM_IOCTL 'L'/* 0x4c */
@@ -123,6 +132,8 @@ enum { struct nvm_ioctl_create)#define NVM_DEV_REMOVE _IOW(NVM_IOCTL, NVM_DEV_REMOVE_CMD, \ struct nvm_ioctl_remove) +#define NVM_DEV_INIT _IOW(NVM_IOCTL, NVM_DEV_INIT_CMD, \ + struct nvm_ioctl_dev_init)#define NVM_VERSION_MAJOR 1#define NVM_VERSION_MINOR 0
Signature · 1 line
2.1.4
PATCH 7/7 lightnvm: introduce factory reset
In reply to Matias BjørlingNow that a device can be managed using the system blocks, a method to reset the device is necessary as well. This patch introduces logic to reset the device easily to factory state and exposes it through an ioctl.
The ioctl takes the following flags:
NVM_FACTORY_ERASE_ONLY_USER
By default all blocks, except host-reserved blocks are erased upon factory reset. Instead of this, only erase host-reserved blocks.
NVM_FACTORY_RESET_HOST_BLKS
Mark host-reserved blocks to be erased and set their type to free.
NVM_FACTORY_RESET_GRWN_BBLKS
Mark "grown bad blocks" to be erased and set their type to free.
--- drivers/lightnvm/core.c | 34 ++++++++ drivers/lightnvm/sysblk.c | 179 ++++++++++++++++++++++++++++++++++++++++++ include/linux/lightnvm.h | 2 + include/uapi/linux/lightnvm.h | 19 +++++ 4 files changed, 234 insertions(+)
drivers/lightnvm/core.c +34 -0
@@ -1088,6 +1088,38 @@ static long nvm_ioctl_dev_init(struct file *file, void __user *arg)return __nvm_ioctl_dev_init (&init); } +static long nvm_ioctl_dev_factory (struct file *file,void __user *arg) +{ +struct nvm_ioctl_dev_factory fact; +struct nvm_dev *dev; + +if (!capable (CAP_SYS_ADMIN )) +return -EPERM ; + +if (copy_from_user (&fact, arg,sizeof (struct nvm_ioctl_dev_factory ))) +return -EFAULT ; + + fact.dev[DISK_NAME_LEN -1 ] ='\0' ; + +if (fact.flags & ~(NVM_FACTORY_NR_BITS -1 )) +return -EINVAL ; + +down_write (&nvm_lock); + dev =nvm_find_nvm_dev (fact.dev); +up_write (&nvm_lock); +if (!dev) { +pr_err ("nvm: device not found\n" ); +return -EINVAL ; + } + +if (dev->mt) { + dev->mt->unregister_mgr (dev); + dev->mt =NULL ; + } + +return nvm_dev_factory (dev, fact.flags); +} +static long nvm_ctl_ioctl (struct file *file,uint cmd,unsigned long arg) {void __user *argp = (void __user *)arg;
@@ -1103,6 +1135,8 @@ static long nvm_ctl_ioctl(struct file *file, uint cmd, unsigned long arg)return nvm_ioctl_dev_remove (file, argp);case NVM_DEV_INIT :return nvm_ioctl_dev_init (file, argp); +case NVM_DEV_FACTORY : +return nvm_ioctl_dev_factory (file, argp); }return 0 ; }
drivers/lightnvm/sysblk.c +179 -0
182 lines not on this page · raw message
include/linux/lightnvm.h +2 -0
@@ -527,6 +527,8 @@ struct nvm_system_block {extern int nvm_get_sysblock (struct nvm_dev *,struct nvm_sb_info *);extern int nvm_update_sysblock (struct nvm_dev *,struct nvm_sb_info *);extern int nvm_init_sysblock (struct nvm_dev *,struct nvm_sb_info *); + +extern int nvm_dev_factory (struct nvm_dev *,int flags);#else /* CONFIG_NVM */ struct nvm_dev_ops ;
include/uapi/linux/lightnvm.h +19 -0
@@ -108,6 +108,20 @@ struct nvm_ioctl_dev_init {__u32 flags; }; +enum { +NVM_FACTORY_ERASE_ONLY_USER =1 <<0 ,/* erase only blocks used as +* host blks or grown blks */ +NVM_FACTORY_RESET_HOST_BLKS =1 <<1 ,/* remove host blk marks */ +NVM_FACTORY_RESET_GRWN_BBLKS =1 <<2 ,/* remove grown blk marks */ +NVM_FACTORY_NR_BITS =1 <<3 ,/* stops here */ +}; + +struct nvm_ioctl_dev_factory { +char dev[DISK_NAME_LEN ]; + +__u32 flags; +}; +/* The ioctl type, 'L', 0x20 - 0x2F documented in ioctl-number.txt */ enum {/* top level cmds */
@@ -120,6 +134,9 @@ enum {/* Init a device to support LightNVM media managers */ NVM_DEV_INIT_CMD , + +/* Factory reset device */ + NVM_DEV_FACTORY_CMD, };#define NVM_IOCTL 'L'/* 0x4c */
@@ -134,6 +151,8 @@ enum { struct nvm_ioctl_remove)#define NVM_DEV_INIT _IOW(NVM_IOCTL, NVM_DEV_INIT_CMD, \ struct nvm_ioctl_dev_init) +#define NVM_DEV_FACTORY _IOW(NVM_IOCTL, NVM_DEV_FACTORY_CMD, \ + struct nvm_ioctl_dev_factory)#define NVM_VERSION_MAJOR 1#define NVM_VERSION_MINOR 0
Signature · 1 line
2.1.4
PATCH v2 4/7 lightnvm: core on-disk initialization
In reply to Matias BjørlingAn Open-Channel SSD shall be initialized before use. To initialize, we define an on-disk format, that keeps a small set of metadata to bring up the media manager on top of the device.
The initial step is introduced to allow a user to format the disks for a given media manager. During format, a system block is stored on one to three separate luns on the device. Each lun has the system block duplicated. During initialization, the system block can be retrieved and the appropriate media manager can initialized.
The on-disk format currently covers (struct nvm_system_block):
- Magic value "NVMS".
- Monotonic increasing sequence number.
- The physical block erase count.
- Version of the system block format.
- Media manager type.
- Media manager superblock physical address.
The interface provides three functions to manage the system block:
int nvm_init_sysblock(struct nvm_dev *, struct nvm_sb_info *) int nvm_get_sysblock(struct nvm *dev, struct nvm_sb_info *) int nvm_update_sysblock(struct nvm *dev, struct nvm_sb_info *)
Each implement a part of the logic to manage the system block. The initialization creates the first system blocks and mark them on the device. Get retrieves the latest system block by scanning all pages in the associated system blocks. The update sysblock writes new metadata and allocates new block if necessary.
--- drivers/lightnvm/Makefile | 2 +- drivers/lightnvm/core.c | 1 + drivers/lightnvm/sysblk.c | 562 ++++++++++++++++++++++++++++++++++++++++++ include/linux/lightnvm.h | 35 +++ include/uapi/linux/lightnvm.h | 1 + 5 files changed, 600 insertions(+), 1 deletion(-) create mode 100644 drivers/lightnvm/sysblk.c
drivers/lightnvm/Makefile +1 -1
@@ -2,6 +2,6 @@ # Makefile for Open-Channel SSDs. # -obj-$(CONFIG_NVM) := core.o +obj-$(CONFIG_NVM) := core.o sysblk.o obj-$(CONFIG_NVM_GENNVM) += gennvm.o obj-$(CONFIG_NVM_RRPC) += rrpc.o
drivers/lightnvm/core.c +1 -0
@@ -466,6 +466,7 @@ static int nvm_core_init(struct nvm_dev *dev) dev->nr_chnls; dev->total_pages = dev->total_blocks * dev->pgs_per_blk;INIT_LIST_HEAD (&dev->online_targets); +mutex_init (&dev->mlock);return 0 ; }
drivers/lightnvm/sysblk.c new file +562 -0
562 lines not on this page · raw message
include/linux/lightnvm.h +35 -0
@@ -17,6 +17,7 @@ enum {#include <linux/types.h> #include <linux/file.h> #include <linux/dmapool.h> +#include <uapi/linux/lightnvm.h> enum {/* HW Responsibilities */
@@ -281,6 +282,15 @@ struct nvm_block {int state; }; +/* system block cpu representation */ +struct nvm_sb_info { +unsigned long seqnr; +unsigned long erase_cnt; +unsigned int version; +char mmtype[NVM_MMTYPE_LEN ]; +struct ppa_addr fs_ppa; +}; +struct nvm_dev {struct nvm_dev_ops *ops;
@@ -329,6 +339,8 @@ struct nvm_dev {/* Backend device */ struct request_queue *q;char name[DISK_NAME_LEN ]; + +struct mutex mlock; }; static inline struct ppa_addr generic_to_dev_addr(struct nvm_dev *dev,
@@ -394,6 +406,11 @@ static inline struct ppa_addr block_to_ppa(struct nvm_dev *dev,return ppa; } +static inline int ppa_to_slc (struct nvm_dev *dev,int slc_pg) +{ +return dev->lptbl[slc_pg]; +} +typedef blk_qc_t (nvm_tgt_make_rq_fn )(struct request_queue *,struct bio *);typedef sector_t (nvm_tgt_capacity_fn )(void *);typedef void *(nvm_tgt_init_fn )(struct nvm_dev *,struct gendisk *,int ,int );
@@ -489,6 +506,24 @@ extern int nvm_erase_blk(struct nvm_dev *, struct nvm_block *);extern void nvm_end_io (struct nvm_rq *,int );extern int nvm_submit_ppa (struct nvm_dev *,struct ppa_addr *,int ,int ,int ,void *,int ); + +/* sysblk.c */ +#define NVM_SYSBLK_MAGIC 0x4E564D53/* "NVMS" */ + +/* system block on disk representation */ +struct nvm_system_block { +__be32 magic;/* magic signature */ +__be32 seqnr;/* sequence number */ +__be32 erase_cnt;/* erase count */ +__be16 version;/* version number */ +u8 mmtype[NVM_MMTYPE_LEN ];/* media manager name */ +__be64 fs_ppa;/* PPA for media manager +* superblock */ +}; + +extern int nvm_get_sysblock (struct nvm_dev *,struct nvm_sb_info *); +extern int nvm_update_sysblock (struct nvm_dev *,struct nvm_sb_info *); +extern int nvm_init_sysblock (struct nvm_dev *,struct nvm_sb_info *);#else /* CONFIG_NVM */ struct nvm_dev_ops ;
include/uapi/linux/lightnvm.h +1 -0
@@ -33,6 +33,7 @@#define NVM_TTYPE_NAME_MAX 48#define NVM_TTYPE_MAX 63 +#define NVM_MMTYPE_LEN 8#define NVM_CTRL_FILE "/dev/lightnvm/control"
Signature · 1 line
2.1.4
PATCH 3/7 lightnvm: introduce mlc lower page table mappings
In reply to Matias BjørlingNAND MLC memories have both lower and upper pages. When programming, both of these must be written, before data can be read. However, these lower and upper pages might not placed at even and odd flash pages, but can be skipped. Therefore each flash memory has its lower pages defined, which can then be used when programming and to know when padding are necessary.
This patch implements the lower page definition in the specification, and exposes it through a simple lookup table at dev->lptbl.
--- drivers/lightnvm/core.c | 61 +++++++++++++++++++++++++++++++++++++++++++- drivers/nvme/host/lightnvm.c | 22 +++++++++++++++- include/linux/lightnvm.h | 20 +++++++++++++++ 3 files changed, 101 insertions(+), 2 deletions(-)
drivers/lightnvm/core.c +60 -1
@@ -362,6 +362,51 @@ int nvm_submit_ppa(struct nvm_dev *dev, struct ppa_addr *ppa, int nr_ppas, }EXPORT_SYMBOL (nvm_submit_ppa); +static int nvm_init_slc_tbl (struct nvm_dev *dev,struct nvm_id_group *grp) +{ +int i; + + dev->lps_per_blk = dev->pgs_per_blk; + dev->lptbl =kcalloc (dev->lps_per_blk,sizeof (int ),GFP_KERNEL ); +if (!dev->lptbl) +return -ENOMEM ; + +/* Just a linear array */ +for (i =0 ; i < dev->lps_per_blk; i++) + dev->lptbl[i] = i; + +return 0 ; +} + +static int nvm_init_mlc_tbl (struct nvm_dev *dev,struct nvm_id_group *grp) +{ +int i, p; +struct nvm_id_lp_mlc *mlc = &grp->lptbl.mlc; + +if (!mlc->num_pairs) +return 0 ; + + dev->lps_per_blk = mlc->num_pairs; + dev->lptbl =kcalloc (dev->lps_per_blk,sizeof (int ),GFP_KERNEL ); +if (!dev->lptbl) +return -ENOMEM ; + +/* The lower page table encoding consists of a list of bytes, where each +* has a lower and an upper half. The first half byte maintains the +* increment value and every value after is an offset added to the +* previous incrementation value */ + dev->lptbl[0 ] = mlc->pairs[0 ] &0xF ; +for (i =1 ; i < dev->lps_per_blk; i++) { + p = mlc->pairs[i >>1 ]; +if (i &0x1 )/* upper */ + dev->lptbl[i] = dev->lptbl[i -1 ] + ((p &0xF0 ) >>4 ); +else /* lower */ + dev->lptbl[i] = dev->lptbl[i -1 ] + (p &0xF ); + } + +return 0 ; +} +static int nvm_core_init (struct nvm_dev *dev) {struct nvm_id *id = &dev->identity;
@@ -387,11 +432,23 @@ static int nvm_core_init(struct nvm_dev *dev)return -EINVAL ; } -if (grp->fmtype !=0 && grp->fmtype !=1 ) { +switch (grp->fmtype) { +case NVM_ID_FMTYPE_SLC : +if (nvm_init_slc_tbl (dev, grp)) +return -ENOMEM ; +break ; +case NVM_ID_FMTYPE_MLC : +if (nvm_init_mlc_tbl (dev, grp)) +return -ENOMEM ; +break ; +default :pr_err ("nvm: flash type not supported\n" );return -EINVAL ; } +if (!dev->lps_per_blk) +pr_info ("nvm: lower page programming table missing\n" ); +if (grp->mpos &0x020202 ) dev->plane_mode =NVM_PLANE_DOUBLE ;if (grp->mpos &0x040404 )
@@ -420,6 +477,8 @@ static void nvm_free(struct nvm_dev *dev)if (dev->mt) dev->mt->unregister_mgr (dev); + +kfree (dev->lptbl); }static int nvm_init (struct nvm_dev *dev)
drivers/nvme/host/lightnvm.c +21 -1
@@ -146,6 +146,16 @@ struct nvme_nvm_command { }; }; +struct nvme_nvm_lp_mlc { +__u16 num_pairs; +__u8 pairs[886 ]; +}; + +struct nvme_nvm_lp_tbl { +__u8 id[8 ]; +struct nvme_nvm_lp_mlc mlc; +}; +struct nvme_nvm_id_group {__u8 mtype;__u8 fmtype;
@@ -169,7 +179,8 @@ struct nvme_nvm_id_group {__le32 mpos;__le32 mccap;__le16 cpar; -__u8 reserved[906 ]; +__u8 reserved[10 ]; +struct nvme_nvm_lp_tbl lptbl; } __packed;struct nvme_nvm_addr_format {
@@ -266,6 +277,15 @@ static int init_grps(struct nvm_id *nvm_id, struct nvme_nvm_id *nvme_nvm_id) dst->mccap =le32_to_cpu (src->mccap); dst->cpar =le16_to_cpu (src->cpar); + +if (dst->fmtype ==NVM_ID_FMTYPE_MLC ) { +memcpy (dst->lptbl.id, src->lptbl.id,8 ); + dst->lptbl.mlc.num_pairs = +le16_to_cpu (src->lptbl.mlc.num_pairs); +/* 4 bits per pair */ +memcpy (dst->lptbl.mlc.pairs, src->lptbl.mlc.pairs, + dst->lptbl.mlc.num_pairs >>1 ); + } }return 0 ;
include/linux/lightnvm.h +20 -0
@@ -67,6 +67,20 @@ enum {NVM_ID_CAP_CMD_SUSPEND =0x2 ,NVM_ID_CAP_SCRAMBLE =0x4 ,NVM_ID_CAP_ENCRYPT =0x8 , + +/* Memory types */ +NVM_ID_FMTYPE_SLC =0 , + NVM_ID_FMTYPE_MLC = 1, +}; + +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; }; struct nvm_id_group {
@@ -89,6 +103,8 @@ struct nvm_id_group {u32 mpos;u32 mccap;u16 cpar; + +struct nvm_id_lp_tbl lptbl; };struct nvm_addr_format {
@@ -297,6 +313,10 @@ struct nvm_dev {int sec_per_blk;int sec_per_lun; +/* lower page table */ +int lps_per_blk; +int *lptbl; +unsigned long total_pages;unsigned long total_blocks;int nr_luns;
Signature · 1 line
2.1.4
PATCH 2/7 lightnvm: add mccap support
In reply to Matias BjørlingSome flash media has extended capabilities, such as programming SLC pages on MLC/TLC flash, erase/program suspend, scramble and encryption. MCCAP is introduced to detect support for these capabilities in the command set.
--- drivers/lightnvm/core.c | 1 + include/linux/lightnvm.h | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/lightnvm/core.c +1 -0
@@ -376,6 +376,7 @@ static int nvm_core_init(struct nvm_dev *dev) dev->sec_size = grp->csecs; dev->oob_size = grp->sos; dev->sec_per_pg = grp->fpg_sz / grp->csecs; + dev->mccap = grp->mccap;memcpy (&dev->ppaf, &id->ppaf,sizeof (struct nvm_addr_format )); dev->plane_mode =NVM_PLANE_SINGLE ;
include/linux/lightnvm.h +7 -0
@@ -61,6 +61,12 @@ enum {NVM_BLK_T_GRWN_BAD =0x2 ,NVM_BLK_T_DEV =0x4 ,NVM_BLK_T_HOST =0x8 , + +/* Memory capabilities */ +NVM_ID_CAP_SLC =0x1 , +NVM_ID_CAP_CMD_SUSPEND =0x2 , +NVM_ID_CAP_SCRAMBLE =0x4 , + NVM_ID_CAP_ENCRYPT = 0x8, }; struct nvm_id_group {
@@ -278,6 +284,7 @@ struct nvm_dev {int blks_per_lun;int sec_size;int oob_size; +int mccap;struct nvm_addr_format ppaf;/* Calculated/Cached values. These do not reflect the actual usable
Signature · 1 line
2.1.4