Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-19 Thread Javier González

>>> This breaks user-space. The intention is for user-space to decide
>>> based on version id. Then it can either retrieve the 1.2 or 2.0
>>> attributes. The 2.0 attributes should not be available when a device
>>> is 1.2.
>>> 
>> Why does it break it? I'm only adding new entries.
>> The objective is to expose the genneric geometry, since this is the
>> structure that is passed on to the targets. Since some of the values are
>> calculated, there is value on exposing this information, I believe.
>> Another way of doing it, is adding the generic geometry at the target
>> level, showing what base values it is getting, including the real number
>> of channels/groups and luns/pus.
>> Would this be better in your opinion?
> 
> No. It should be one set of attributes for 1.2 (keep the way it is today), 
> and then separate 2.0 attributes. User-space should then identify either by 
> either 1 or 2 in the version attribute.
> 
 ...

>>> csecs and sos are derived from the the generic block device data structures.
>> As mentioned above, it is to represent the generic geometry.
> 
> They are not part of the 2.0 spec. The fields can be derived from elsewhere.
>>> 

Ok. Thanks for looking into it. 

Javier. 

Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-19 Thread Javier González

>>> This breaks user-space. The intention is for user-space to decide
>>> based on version id. Then it can either retrieve the 1.2 or 2.0
>>> attributes. The 2.0 attributes should not be available when a device
>>> is 1.2.
>>> 
>> Why does it break it? I'm only adding new entries.
>> The objective is to expose the genneric geometry, since this is the
>> structure that is passed on to the targets. Since some of the values are
>> calculated, there is value on exposing this information, I believe.
>> Another way of doing it, is adding the generic geometry at the target
>> level, showing what base values it is getting, including the real number
>> of channels/groups and luns/pus.
>> Would this be better in your opinion?
> 
> No. It should be one set of attributes for 1.2 (keep the way it is today), 
> and then separate 2.0 attributes. User-space should then identify either by 
> either 1 or 2 in the version attribute.
> 
 ...

>>> csecs and sos are derived from the the generic block device data structures.
>> As mentioned above, it is to represent the generic geometry.
> 
> They are not part of the 2.0 spec. The fields can be derived from elsewhere.
>>> 

Ok. Thanks for looking into it. 

Javier. 

Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-18 Thread Matias Bjørling

On 02/16/2018 07:35 AM, Javier Gonzalez wrote:



On 15 Feb 2018, at 02.20, Matias Bjørling  wrote:

On 02/13/2018 03:06 PM, Javier González wrote:

From: Javier González 
Apart from showing the geometry returned by the different identify
commands, provide the generic geometry too, as this is the geometry that
targets will use to describe the device.
Signed-off-by: Javier González 
---
  drivers/nvme/host/lightnvm.c | 146 ---
  1 file changed, 97 insertions(+), 49 deletions(-)
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 97739e668602..7bc75182c723 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u.%u\n",
dev_geo->major_ver_id,
dev_geo->minor_ver_id);
-   } else if (strcmp(attr->name, "capabilities") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
+   } else if (strcmp(attr->name, "clba") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
+   } else if (strcmp(attr->name, "csecs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
+   } else if (strcmp(attr->name, "sos") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
+   } else if (strcmp(attr->name, "ws_min") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
+   } else if (strcmp(attr->name, "ws_opt") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
+   } else if (strcmp(attr->name, "maxoc") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
+   } else if (strcmp(attr->name, "maxocpu") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
+   } else if (strcmp(attr->name, "mw_cunits") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
+   } else if (strcmp(attr->name, "media_capabilities") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
+   } else if (strcmp(attr->name, "max_phys_secs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n",
+   ndev->ops->max_phys_sect);
} else if (strcmp(attr->name, "read_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
} else if (strcmp(attr->name, "read_max") == 0) {
@@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
attr = >attr;
  - if (strcmp(attr->name, "vendor_opcode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
-   } else if (strcmp(attr->name, "device_mode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
-   /* kept for compatibility */
-   } else if (strcmp(attr->name, "media_manager") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
-   } else if (strcmp(attr->name, "ppa_format") == 0) {
+   if (strcmp(attr->name, "ppa_format") == 0) {
return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
-   } else if (strcmp(attr->name, "media_type") == 0) {/* u8 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
-   } else if (strcmp(attr->name, "flash_media_type") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
} else if (strcmp(attr->name, "num_channels") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
} else if (strcmp(attr->name, "num_luns") == 0) {
@@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
} else if (strcmp(attr->name, "hw_sector_size") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
-   } else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
} else if (strcmp(attr->name, "prog_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
} else if (strcmp(attr->name, "prog_max") == 0) {
@@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
} else if (strcmp(attr->name, "erase_max") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
+   } else if (strcmp(attr->name, "vendor_opcode") == 0) {
+   return 

Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-18 Thread Matias Bjørling

On 02/16/2018 07:35 AM, Javier Gonzalez wrote:



On 15 Feb 2018, at 02.20, Matias Bjørling  wrote:

On 02/13/2018 03:06 PM, Javier González wrote:

From: Javier González 
Apart from showing the geometry returned by the different identify
commands, provide the generic geometry too, as this is the geometry that
targets will use to describe the device.
Signed-off-by: Javier González 
---
  drivers/nvme/host/lightnvm.c | 146 ---
  1 file changed, 97 insertions(+), 49 deletions(-)
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 97739e668602..7bc75182c723 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u.%u\n",
dev_geo->major_ver_id,
dev_geo->minor_ver_id);
-   } else if (strcmp(attr->name, "capabilities") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
+   } else if (strcmp(attr->name, "clba") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
+   } else if (strcmp(attr->name, "csecs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
+   } else if (strcmp(attr->name, "sos") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
+   } else if (strcmp(attr->name, "ws_min") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
+   } else if (strcmp(attr->name, "ws_opt") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
+   } else if (strcmp(attr->name, "maxoc") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
+   } else if (strcmp(attr->name, "maxocpu") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
+   } else if (strcmp(attr->name, "mw_cunits") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
+   } else if (strcmp(attr->name, "media_capabilities") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
+   } else if (strcmp(attr->name, "max_phys_secs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n",
+   ndev->ops->max_phys_sect);
} else if (strcmp(attr->name, "read_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
} else if (strcmp(attr->name, "read_max") == 0) {
@@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
attr = >attr;
  - if (strcmp(attr->name, "vendor_opcode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
-   } else if (strcmp(attr->name, "device_mode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
-   /* kept for compatibility */
-   } else if (strcmp(attr->name, "media_manager") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
-   } else if (strcmp(attr->name, "ppa_format") == 0) {
+   if (strcmp(attr->name, "ppa_format") == 0) {
return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
-   } else if (strcmp(attr->name, "media_type") == 0) {/* u8 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
-   } else if (strcmp(attr->name, "flash_media_type") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
} else if (strcmp(attr->name, "num_channels") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
} else if (strcmp(attr->name, "num_luns") == 0) {
@@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
} else if (strcmp(attr->name, "hw_sector_size") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
-   } else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
} else if (strcmp(attr->name, "prog_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
} else if (strcmp(attr->name, "prog_max") == 0) {
@@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
} else if (strcmp(attr->name, "erase_max") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
+   } else if (strcmp(attr->name, "vendor_opcode") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
+   

Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-15 Thread Javier Gonzalez

> On 15 Feb 2018, at 02.20, Matias Bjørling  wrote:
> 
> On 02/13/2018 03:06 PM, Javier González wrote:
>> From: Javier González 
>> Apart from showing the geometry returned by the different identify
>> commands, provide the generic geometry too, as this is the geometry that
>> targets will use to describe the device.
>> Signed-off-by: Javier González 
>> ---
>>  drivers/nvme/host/lightnvm.c | 146 
>> ---
>>  1 file changed, 97 insertions(+), 49 deletions(-)
>> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
>> index 97739e668602..7bc75182c723 100644
>> --- a/drivers/nvme/host/lightnvm.c
>> +++ b/drivers/nvme/host/lightnvm.c
>> @@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
>>  return scnprintf(page, PAGE_SIZE, "%u.%u\n",
>>  dev_geo->major_ver_id,
>>  dev_geo->minor_ver_id);
>> -} else if (strcmp(attr->name, "capabilities") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
>> +} else if (strcmp(attr->name, "clba") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
>> +} else if (strcmp(attr->name, "csecs") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
>> +} else if (strcmp(attr->name, "sos") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
>> +} else if (strcmp(attr->name, "ws_min") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
>> +} else if (strcmp(attr->name, "ws_opt") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
>> +} else if (strcmp(attr->name, "maxoc") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
>> +} else if (strcmp(attr->name, "maxocpu") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
>> +} else if (strcmp(attr->name, "mw_cunits") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
>> +} else if (strcmp(attr->name, "media_capabilities") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
>> +} else if (strcmp(attr->name, "max_phys_secs") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n",
>> +ndev->ops->max_phys_sect);
>>  } else if (strcmp(attr->name, "read_typ") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
>>  } else if (strcmp(attr->name, "read_max") == 0) {
>> @@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
>>  attr = >attr;
>>  -   if (strcmp(attr->name, "vendor_opcode") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
>> -} else if (strcmp(attr->name, "device_mode") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
>> -/* kept for compatibility */
>> -} else if (strcmp(attr->name, "media_manager") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
>> -} else if (strcmp(attr->name, "ppa_format") == 0) {
>> +if (strcmp(attr->name, "ppa_format") == 0) {
>>  return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
>> -} else if (strcmp(attr->name, "media_type") == 0) { /* u8 */
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
>> -} else if (strcmp(attr->name, "flash_media_type") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
>>  } else if (strcmp(attr->name, "num_channels") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
>>  } else if (strcmp(attr->name, "num_luns") == 0) {
>> @@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
>>  } else if (strcmp(attr->name, "hw_sector_size") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
>> -} else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
>>  } else if (strcmp(attr->name, "prog_typ") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
>>  } else if (strcmp(attr->name, "prog_max") == 0) {
>> @@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device 
>> *dev,
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
>>  } else if (strcmp(attr->name, "erase_max") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
>> +} else if (strcmp(attr->name, "vendor_opcode") == 0) {
>> +

Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-15 Thread Javier Gonzalez

> On 15 Feb 2018, at 02.20, Matias Bjørling  wrote:
> 
> On 02/13/2018 03:06 PM, Javier González wrote:
>> From: Javier González 
>> Apart from showing the geometry returned by the different identify
>> commands, provide the generic geometry too, as this is the geometry that
>> targets will use to describe the device.
>> Signed-off-by: Javier González 
>> ---
>>  drivers/nvme/host/lightnvm.c | 146 
>> ---
>>  1 file changed, 97 insertions(+), 49 deletions(-)
>> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
>> index 97739e668602..7bc75182c723 100644
>> --- a/drivers/nvme/host/lightnvm.c
>> +++ b/drivers/nvme/host/lightnvm.c
>> @@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
>>  return scnprintf(page, PAGE_SIZE, "%u.%u\n",
>>  dev_geo->major_ver_id,
>>  dev_geo->minor_ver_id);
>> -} else if (strcmp(attr->name, "capabilities") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
>> +} else if (strcmp(attr->name, "clba") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
>> +} else if (strcmp(attr->name, "csecs") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
>> +} else if (strcmp(attr->name, "sos") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
>> +} else if (strcmp(attr->name, "ws_min") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
>> +} else if (strcmp(attr->name, "ws_opt") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
>> +} else if (strcmp(attr->name, "maxoc") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
>> +} else if (strcmp(attr->name, "maxocpu") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
>> +} else if (strcmp(attr->name, "mw_cunits") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
>> +} else if (strcmp(attr->name, "media_capabilities") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
>> +} else if (strcmp(attr->name, "max_phys_secs") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n",
>> +ndev->ops->max_phys_sect);
>>  } else if (strcmp(attr->name, "read_typ") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
>>  } else if (strcmp(attr->name, "read_max") == 0) {
>> @@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
>>  attr = >attr;
>>  -   if (strcmp(attr->name, "vendor_opcode") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
>> -} else if (strcmp(attr->name, "device_mode") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
>> -/* kept for compatibility */
>> -} else if (strcmp(attr->name, "media_manager") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
>> -} else if (strcmp(attr->name, "ppa_format") == 0) {
>> +if (strcmp(attr->name, "ppa_format") == 0) {
>>  return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
>> -} else if (strcmp(attr->name, "media_type") == 0) { /* u8 */
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
>> -} else if (strcmp(attr->name, "flash_media_type") == 0) {
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
>>  } else if (strcmp(attr->name, "num_channels") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
>>  } else if (strcmp(attr->name, "num_luns") == 0) {
>> @@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
>>  } else if (strcmp(attr->name, "hw_sector_size") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
>> -} else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
>> -return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
>>  } else if (strcmp(attr->name, "prog_typ") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
>>  } else if (strcmp(attr->name, "prog_max") == 0) {
>> @@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device 
>> *dev,
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
>>  } else if (strcmp(attr->name, "erase_max") == 0) {
>>  return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
>> +} else if (strcmp(attr->name, "vendor_opcode") == 0) {
>> +return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);

Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-15 Thread Matias Bjørling

On 02/13/2018 03:06 PM, Javier González wrote:

From: Javier González 

Apart from showing the geometry returned by the different identify
commands, provide the generic geometry too, as this is the geometry that
targets will use to describe the device.

Signed-off-by: Javier González 
---
  drivers/nvme/host/lightnvm.c | 146 ---
  1 file changed, 97 insertions(+), 49 deletions(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 97739e668602..7bc75182c723 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u.%u\n",
dev_geo->major_ver_id,
dev_geo->minor_ver_id);
-   } else if (strcmp(attr->name, "capabilities") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
+   } else if (strcmp(attr->name, "clba") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
+   } else if (strcmp(attr->name, "csecs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
+   } else if (strcmp(attr->name, "sos") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
+   } else if (strcmp(attr->name, "ws_min") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
+   } else if (strcmp(attr->name, "ws_opt") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
+   } else if (strcmp(attr->name, "maxoc") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
+   } else if (strcmp(attr->name, "maxocpu") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
+   } else if (strcmp(attr->name, "mw_cunits") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
+   } else if (strcmp(attr->name, "media_capabilities") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
+   } else if (strcmp(attr->name, "max_phys_secs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n",
+   ndev->ops->max_phys_sect);
} else if (strcmp(attr->name, "read_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
} else if (strcmp(attr->name, "read_max") == 0) {
@@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
  
  	attr = >attr;
  
-	if (strcmp(attr->name, "vendor_opcode") == 0) {

-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
-   } else if (strcmp(attr->name, "device_mode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
-   /* kept for compatibility */
-   } else if (strcmp(attr->name, "media_manager") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
-   } else if (strcmp(attr->name, "ppa_format") == 0) {
+   if (strcmp(attr->name, "ppa_format") == 0) {
return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
-   } else if (strcmp(attr->name, "media_type") == 0) {/* u8 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
-   } else if (strcmp(attr->name, "flash_media_type") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
} else if (strcmp(attr->name, "num_channels") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
} else if (strcmp(attr->name, "num_luns") == 0) {
@@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
} else if (strcmp(attr->name, "hw_sector_size") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
-   } else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
} else if (strcmp(attr->name, "prog_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
} else if (strcmp(attr->name, "prog_max") == 0) {
@@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
} else if (strcmp(attr->name, "erase_max") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
+   } else if (strcmp(attr->name, "vendor_opcode") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
+   } else if (strcmp(attr->name, "device_mode") == 0) {
+   

Re: [PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-15 Thread Matias Bjørling

On 02/13/2018 03:06 PM, Javier González wrote:

From: Javier González 

Apart from showing the geometry returned by the different identify
commands, provide the generic geometry too, as this is the geometry that
targets will use to describe the device.

Signed-off-by: Javier González 
---
  drivers/nvme/host/lightnvm.c | 146 ---
  1 file changed, 97 insertions(+), 49 deletions(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 97739e668602..7bc75182c723 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u.%u\n",
dev_geo->major_ver_id,
dev_geo->minor_ver_id);
-   } else if (strcmp(attr->name, "capabilities") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
+   } else if (strcmp(attr->name, "clba") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
+   } else if (strcmp(attr->name, "csecs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
+   } else if (strcmp(attr->name, "sos") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
+   } else if (strcmp(attr->name, "ws_min") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
+   } else if (strcmp(attr->name, "ws_opt") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
+   } else if (strcmp(attr->name, "maxoc") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
+   } else if (strcmp(attr->name, "maxocpu") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
+   } else if (strcmp(attr->name, "mw_cunits") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
+   } else if (strcmp(attr->name, "media_capabilities") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
+   } else if (strcmp(attr->name, "max_phys_secs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n",
+   ndev->ops->max_phys_sect);
} else if (strcmp(attr->name, "read_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
} else if (strcmp(attr->name, "read_max") == 0) {
@@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
  
  	attr = >attr;
  
-	if (strcmp(attr->name, "vendor_opcode") == 0) {

-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
-   } else if (strcmp(attr->name, "device_mode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
-   /* kept for compatibility */
-   } else if (strcmp(attr->name, "media_manager") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
-   } else if (strcmp(attr->name, "ppa_format") == 0) {
+   if (strcmp(attr->name, "ppa_format") == 0) {
return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
-   } else if (strcmp(attr->name, "media_type") == 0) {/* u8 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
-   } else if (strcmp(attr->name, "flash_media_type") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
} else if (strcmp(attr->name, "num_channels") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
} else if (strcmp(attr->name, "num_luns") == 0) {
@@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
} else if (strcmp(attr->name, "hw_sector_size") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
-   } else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
} else if (strcmp(attr->name, "prog_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
} else if (strcmp(attr->name, "prog_max") == 0) {
@@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
} else if (strcmp(attr->name, "erase_max") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
+   } else if (strcmp(attr->name, "vendor_opcode") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
+   } else if (strcmp(attr->name, "device_mode") == 0) {
+   return scnprintf(page, 

[PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-13 Thread Javier González
From: Javier González 

Apart from showing the geometry returned by the different identify
commands, provide the generic geometry too, as this is the geometry that
targets will use to describe the device.

Signed-off-by: Javier González 
---
 drivers/nvme/host/lightnvm.c | 146 ---
 1 file changed, 97 insertions(+), 49 deletions(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 97739e668602..7bc75182c723 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u.%u\n",
dev_geo->major_ver_id,
dev_geo->minor_ver_id);
-   } else if (strcmp(attr->name, "capabilities") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
+   } else if (strcmp(attr->name, "clba") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
+   } else if (strcmp(attr->name, "csecs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
+   } else if (strcmp(attr->name, "sos") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
+   } else if (strcmp(attr->name, "ws_min") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
+   } else if (strcmp(attr->name, "ws_opt") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
+   } else if (strcmp(attr->name, "maxoc") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
+   } else if (strcmp(attr->name, "maxocpu") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
+   } else if (strcmp(attr->name, "mw_cunits") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
+   } else if (strcmp(attr->name, "media_capabilities") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
+   } else if (strcmp(attr->name, "max_phys_secs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n",
+   ndev->ops->max_phys_sect);
} else if (strcmp(attr->name, "read_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
} else if (strcmp(attr->name, "read_max") == 0) {
@@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
 
attr = >attr;
 
-   if (strcmp(attr->name, "vendor_opcode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
-   } else if (strcmp(attr->name, "device_mode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
-   /* kept for compatibility */
-   } else if (strcmp(attr->name, "media_manager") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
-   } else if (strcmp(attr->name, "ppa_format") == 0) {
+   if (strcmp(attr->name, "ppa_format") == 0) {
return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
-   } else if (strcmp(attr->name, "media_type") == 0) { /* u8 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
-   } else if (strcmp(attr->name, "flash_media_type") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
} else if (strcmp(attr->name, "num_channels") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
} else if (strcmp(attr->name, "num_luns") == 0) {
@@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
} else if (strcmp(attr->name, "hw_sector_size") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
-   } else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
} else if (strcmp(attr->name, "prog_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
} else if (strcmp(attr->name, "prog_max") == 0) {
@@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
} else if (strcmp(attr->name, "erase_max") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
+   } else if (strcmp(attr->name, "vendor_opcode") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
+   } else if (strcmp(attr->name, "device_mode") == 0) {
+   return scnprintf(page, PAGE_SIZE, 

[PATCH 2/8] lightnvm: show generic geometry in sysfs

2018-02-13 Thread Javier González
From: Javier González 

Apart from showing the geometry returned by the different identify
commands, provide the generic geometry too, as this is the geometry that
targets will use to describe the device.

Signed-off-by: Javier González 
---
 drivers/nvme/host/lightnvm.c | 146 ---
 1 file changed, 97 insertions(+), 49 deletions(-)

diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index 97739e668602..7bc75182c723 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -944,8 +944,27 @@ static ssize_t nvm_dev_attr_show(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u.%u\n",
dev_geo->major_ver_id,
dev_geo->minor_ver_id);
-   } else if (strcmp(attr->name, "capabilities") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.cap);
+   } else if (strcmp(attr->name, "clba") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.clba);
+   } else if (strcmp(attr->name, "csecs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
+   } else if (strcmp(attr->name, "sos") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
+   } else if (strcmp(attr->name, "ws_min") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_min);
+   } else if (strcmp(attr->name, "ws_opt") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.ws_opt);
+   } else if (strcmp(attr->name, "maxoc") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxoc);
+   } else if (strcmp(attr->name, "maxocpu") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.maxocpu);
+   } else if (strcmp(attr->name, "mw_cunits") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mw_cunits);
+   } else if (strcmp(attr->name, "media_capabilities") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mccap);
+   } else if (strcmp(attr->name, "max_phys_secs") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n",
+   ndev->ops->max_phys_sect);
} else if (strcmp(attr->name, "read_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.trdt);
} else if (strcmp(attr->name, "read_max") == 0) {
@@ -984,19 +1003,8 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
 
attr = >attr;
 
-   if (strcmp(attr->name, "vendor_opcode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
-   } else if (strcmp(attr->name, "device_mode") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
-   /* kept for compatibility */
-   } else if (strcmp(attr->name, "media_manager") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%s\n", "gennvm");
-   } else if (strcmp(attr->name, "ppa_format") == 0) {
+   if (strcmp(attr->name, "ppa_format") == 0) {
return nvm_dev_attr_show_ppaf((void *)_geo->c.addrf, page);
-   } else if (strcmp(attr->name, "media_type") == 0) { /* u8 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.mtype);
-   } else if (strcmp(attr->name, "flash_media_type") == 0) {
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fmtype);
} else if (strcmp(attr->name, "num_channels") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->num_ch);
} else if (strcmp(attr->name, "num_luns") == 0) {
@@ -1011,8 +1019,6 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.fpg_sz);
} else if (strcmp(attr->name, "hw_sector_size") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.csecs);
-   } else if (strcmp(attr->name, "oob_sector_size") == 0) {/* u32 */
-   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.sos);
} else if (strcmp(attr->name, "prog_typ") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tprt);
} else if (strcmp(attr->name, "prog_max") == 0) {
@@ -1021,13 +1027,21 @@ static ssize_t nvm_dev_attr_show_12(struct device *dev,
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbet);
} else if (strcmp(attr->name, "erase_max") == 0) {
return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.tbem);
+   } else if (strcmp(attr->name, "vendor_opcode") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.vmnt);
+   } else if (strcmp(attr->name, "device_mode") == 0) {
+   return scnprintf(page, PAGE_SIZE, "%u\n", dev_geo->c.dom);
+   /* kept for