diff options
author | Javier González <javier@cnexlabs.com> | 2018-03-29 18:05:13 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-03-29 19:29:09 -0400 |
commit | 3f48021bad73696421e2725c856b9b3aec7f567c (patch) | |
tree | 440643d2ba86466d7b0d775f972483a65cb91e61 | |
parent | f1d4e8121f3fc25f9be94c6de6b8f5f788ad0265 (diff) |
lightnvm: complete geo structure with maxoc*
Complete the generic geometry structure with the maxoc and maxocpu
felds, present in the 2.0 spec. Also, expose them through sysfs.
Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <mb@lightnvm.io>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/nvme/host/lightnvm.c | 17 | ||||
-rw-r--r-- | include/linux/lightnvm.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index f7f7769e7588..41b38ebdb1f3 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c | |||
@@ -323,6 +323,13 @@ static int nvme_nvm_setup_12(struct nvme_nvm_id12 *id, | |||
323 | geo->ws_opt = sec_per_pg; | 323 | geo->ws_opt = sec_per_pg; |
324 | geo->mw_cunits = geo->ws_opt << 3; /* default to MLC safe values */ | 324 | geo->mw_cunits = geo->ws_opt << 3; /* default to MLC safe values */ |
325 | 325 | ||
326 | /* Do not impose values for maximum number of open blocks as it is | ||
327 | * unspecified in 1.2. Users of 1.2 must be aware of this and eventually | ||
328 | * specify these values through a quirk if restrictions apply. | ||
329 | */ | ||
330 | geo->maxoc = geo->all_luns * geo->nr_chks; | ||
331 | geo->maxocpu = geo->nr_chks; | ||
332 | |||
326 | geo->mccap = le32_to_cpu(src->mccap); | 333 | geo->mccap = le32_to_cpu(src->mccap); |
327 | 334 | ||
328 | geo->trdt = le32_to_cpu(src->trdt); | 335 | geo->trdt = le32_to_cpu(src->trdt); |
@@ -409,6 +416,8 @@ static int nvme_nvm_setup_20(struct nvme_nvm_id20 *id, | |||
409 | geo->ws_min = le32_to_cpu(id->ws_min); | 416 | geo->ws_min = le32_to_cpu(id->ws_min); |
410 | geo->ws_opt = le32_to_cpu(id->ws_opt); | 417 | geo->ws_opt = le32_to_cpu(id->ws_opt); |
411 | geo->mw_cunits = le32_to_cpu(id->mw_cunits); | 418 | geo->mw_cunits = le32_to_cpu(id->mw_cunits); |
419 | geo->maxoc = le32_to_cpu(id->maxoc); | ||
420 | geo->maxocpu = le32_to_cpu(id->maxocpu); | ||
412 | 421 | ||
413 | geo->trdt = le32_to_cpu(id->trdt); | 422 | geo->trdt = le32_to_cpu(id->trdt); |
414 | geo->trdm = le32_to_cpu(id->trdm); | 423 | geo->trdm = le32_to_cpu(id->trdm); |
@@ -1050,6 +1059,10 @@ static ssize_t nvm_dev_attr_show_20(struct device *dev, | |||
1050 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->ws_min); | 1059 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->ws_min); |
1051 | } else if (strcmp(attr->name, "ws_opt") == 0) { | 1060 | } else if (strcmp(attr->name, "ws_opt") == 0) { |
1052 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->ws_opt); | 1061 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->ws_opt); |
1062 | } else if (strcmp(attr->name, "maxoc") == 0) { | ||
1063 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->maxoc); | ||
1064 | } else if (strcmp(attr->name, "maxocpu") == 0) { | ||
1065 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->maxocpu); | ||
1053 | } else if (strcmp(attr->name, "mw_cunits") == 0) { | 1066 | } else if (strcmp(attr->name, "mw_cunits") == 0) { |
1054 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->mw_cunits); | 1067 | return scnprintf(page, PAGE_SIZE, "%u\n", geo->mw_cunits); |
1055 | } else if (strcmp(attr->name, "write_typ") == 0) { | 1068 | } else if (strcmp(attr->name, "write_typ") == 0) { |
@@ -1147,6 +1160,8 @@ static NVM_DEV_ATTR_20_RO(chunks); | |||
1147 | static NVM_DEV_ATTR_20_RO(clba); | 1160 | static NVM_DEV_ATTR_20_RO(clba); |
1148 | static NVM_DEV_ATTR_20_RO(ws_min); | 1161 | static NVM_DEV_ATTR_20_RO(ws_min); |
1149 | static NVM_DEV_ATTR_20_RO(ws_opt); | 1162 | static NVM_DEV_ATTR_20_RO(ws_opt); |
1163 | static NVM_DEV_ATTR_20_RO(maxoc); | ||
1164 | static NVM_DEV_ATTR_20_RO(maxocpu); | ||
1150 | static NVM_DEV_ATTR_20_RO(mw_cunits); | 1165 | static NVM_DEV_ATTR_20_RO(mw_cunits); |
1151 | static NVM_DEV_ATTR_20_RO(write_typ); | 1166 | static NVM_DEV_ATTR_20_RO(write_typ); |
1152 | static NVM_DEV_ATTR_20_RO(write_max); | 1167 | static NVM_DEV_ATTR_20_RO(write_max); |
@@ -1163,6 +1178,8 @@ static struct attribute *nvm_dev_attrs_20[] = { | |||
1163 | &dev_attr_clba.attr, | 1178 | &dev_attr_clba.attr, |
1164 | &dev_attr_ws_min.attr, | 1179 | &dev_attr_ws_min.attr, |
1165 | &dev_attr_ws_opt.attr, | 1180 | &dev_attr_ws_opt.attr, |
1181 | &dev_attr_maxoc.attr, | ||
1182 | &dev_attr_maxocpu.attr, | ||
1166 | &dev_attr_mw_cunits.attr, | 1183 | &dev_attr_mw_cunits.attr, |
1167 | 1184 | ||
1168 | &dev_attr_read_typ.attr, | 1185 | &dev_attr_read_typ.attr, |
diff --git a/include/linux/lightnvm.h b/include/linux/lightnvm.h index a073c0c76260..870959a58fef 100644 --- a/include/linux/lightnvm.h +++ b/include/linux/lightnvm.h | |||
@@ -296,6 +296,8 @@ struct nvm_geo { | |||
296 | u32 ws_min; /* minimum write size */ | 296 | u32 ws_min; /* minimum write size */ |
297 | u32 ws_opt; /* optimal write size */ | 297 | u32 ws_opt; /* optimal write size */ |
298 | u32 mw_cunits; /* distance required for successful read */ | 298 | u32 mw_cunits; /* distance required for successful read */ |
299 | u32 maxoc; /* maximum open chunks */ | ||
300 | u32 maxocpu; /* maximum open chunks per parallel unit */ | ||
299 | 301 | ||
300 | /* device capabilities */ | 302 | /* device capabilities */ |
301 | u32 mccap; | 303 | u32 mccap; |