Skip to contentSkip to conversation

ndctl: New structure definitions.

PATCH In review Jerry Hoemann 3 participants 10 messages Aug 10, 2017 – Aug 11, 2017 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ndctl: New structure definitions.

Add structure definitions newly published/modified in v0.85:

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

---
 ndctl/lib/ndctl-hpe1.h | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)
ndctl/lib/ndctl-hpe1.h +49 -1
index b050831..ba071fd 100644
@@ -30,6 +30,10 @@ enum {
 	NDN_HPE1_CMD_ERRINJ_QUERY = 18,
 	NDN_HPE1_CMD_ERRINJ_INJECT = 19,
 	NDN_HPE1_CMD_ERRINJ_STATUS = 20,
+	NDN_HPE1_CMD_I2C_READ      = 21,
+	NDN_HPE1_CMD_I2C_WRITE     = 22,
+	NDN_HPE1_CMD_I2C_BLK_READ  = 23,
+	NDN_HPE1_CMD_I2C_BLK_WRITE = 24,
 };
 
 /* NDN_HPE1_CMD_SMART */
@@ -103,7 +107,11 @@ struct ndn_hpe1_smart_data {
 	__u8	res2;
 	__u16	energy_src_total_runtime;
 	__u16	vndr_spec_data_size;
-	__u8	vnd_spec_data[60];
+	__u8	vnd_spec_data[28];
+	__u64	failed_save_cnt;
+	__u64	failed_restore_cnt;
+	__u64	failed_arm_cnt;
+	__u64	failed_flush_cnt;
 } __attribute__((packed));
 
 struct ndn_hpe1_smart {
@@ -312,6 +320,42 @@ struct ndn_hpe1_get_inj_err_status {
 	__u8	err_inj_opt;
 } __attribute__((packed));
 
+/* NDN_HPE1_CMD_I2C_READ */
+struct ndn_hpe1_i2c_read {
+	__u8	in_page;
+	__u8	in_offset;
+	__u32	status;
+	__u8	reg_value;
+} __attribute__((packed));
+
+/* NDN_HPE1_CMD_I2C_WRITE */
+struct ndn_hpe1_i2c_write {
+	__u8	in_page;
+	__u8	in_offset;
+	__u8	in_value;
+	__u32	status;
+} __attribute__((packed));
+
+
+/* NDN_HPE1_CMD_I2C_BLK_READ */
+struct ndn_hpe1_i2c_blk_read {
+	__u8	in_type;
+	__u16	in_reg_id;
+	__u8	in_blk_id;
+	__u32	status;
+	__u8	data[32];
+} __attribute__((packed));
+
+/* NDN_HPE1_CMD_I2C_BLK_WRITE */
+struct ndn_hpe1_i2c_blk_write {
+	__u8	in_type;
+	__u16	in_reg_id;
+	__u8	in_blk_id;
+	__u8	in_data[32];
+	__u32	status;
+} __attribute__((packed));
+
+
 union ndn_hpe1_cmd {
 	__u64					query;
 	struct ndn_hpe1_smart			smart;
@@ -326,6 +370,10 @@ union ndn_hpe1_cmd {
 	struct ndn_hpe1_query_err_inj_cap	err_cap;
 	struct ndn_hpe1_inj_err			inj_err;
 	struct ndn_hpe1_get_inj_err_status	inj_err_stat;
+	struct ndn_hpe1_i2c_read		i2c_read;
+	struct ndn_hpe1_i2c_write		i2c_write;
+	struct ndn_hpe1_i2c_blk_read		i2c_blk_read;
+	struct ndn_hpe1_i2c_blk_write		i2c_blk_write;
 
 	unsigned char				buf[128];
 };
Signature · 6 lines
2.9.4

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#1 lore raw
Quoted 3 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#2 lore raw
Quoted 8 lines · Dan Williams
Quoted 3 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

There are multiple projects both inside and outside of HPE that need to make DSM calls.

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this use need not result in patches sent back to the ndctl project.

Signature · 7 lines
-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#3 lore raw
Quoted 10 lines · Jerry Hoemann
Quoted 8 lines · Dan Williams
Quoted 3 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

Quoted 6 lines

There are multiple projects both inside and outside of HPE that need to make DSM calls.

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this use need not result in patches sent back to the ndctl project.

My hope was that the existing extra definitions in ndctl-hpe1.h would gain some users at some point in the future, but there's otherwise no need to add dead code to ndctl-hpe1.h. That header is only used at compile time it's not shipped so it doesn't provide any benefit to those third party applications that you mention.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#4 lore raw
Quoted 18 lines · Dan Williams
Quoted 10 lines · Jerry Hoemann
Quoted 8 lines · Dan Williams
Quoted 3 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

Quoted 6 lines

There are multiple projects both inside and outside of HPE that need to make DSM calls.

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this use need not result in patches sent back to the ndctl project.

Quoted 5 lines

My hope was that the existing extra definitions in ndctl-hpe1.h would gain some users at some point in the future, but there's otherwise no need to add dead code to ndctl-hpe1.h. That header is only used at compile time it's not shipped so it doesn't provide any benefit to those third party applications that you mention.

AFAIK ndctl-hpe1.h is the only "upstream" place where the definition of the HPE1 non-root function structures reside.

Having the definitions in the kernel supplied header ndctl.h would be much better, but you pushed back on that two years ago.

Have you changed your mind? Do you want me to add the HPE nvdimm-n non root structure definitions to ndctl.h like the Intel non-root definitions?

Signature · 7 lines
-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#5 lore raw
Quoted 19 lines · Jerry Hoemann
Quoted 18 lines · Dan Williams
Quoted 16 lines · Jerry Hoemann
Quoted 8 lines · Dan Williams
Quoted 3 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

There are multiple projects both inside and outside of HPE that need to make DSM calls.

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this use need not result in patches sent back to the ndctl project.

Quoted 8 lines
Quoted 5 lines

My hope was that the existing extra definitions in ndctl-hpe1.h would gain some users at some point in the future, but there's otherwise no need to add dead code to ndctl-hpe1.h. That header is only used at compile time it's not shipped so it doesn't provide any benefit to those third party applications that you mention.

AFAIK ndctl-hpe1.h is the only "upstream" place where the definition of the HPE1 non-root function structures reside.

For a third-party utility I don't see how ndctl is its upstream.

Quoted 7 lines

Having the definitions in the kernel supplied header ndctl.h would be much better, but you pushed back on that two years ago.

Have you changed your mind? Do you want me to add the HPE nvdimm-n non root structure definitions to ndctl.h like the Intel non-root definitions?

No, they don't do the kernel any good either. ND_CMD_CALL is meant to be the last of the ioctl payload definitions we need to add to ndctl.h.

For these to be useful to the ndctl utilty they need libndctl.h wrappers similar to what we've done for handling SMART payloads across vendors. I.e. hide the vendor-specific aspect and make a generic interface. For example, these commands seem to have several similarities with the Microsoft format. I'm planning to do the same with new additions to the Intel DSM command set.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#6 lore raw
In reply to Dan Williams
Quoted 14 lines · Dan Williams
Quoted 13 lines · Jerry Hoemann
Quoted 8 lines · Dan Williams
Quoted 3 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

There are multiple projects both inside and outside of HPE that need to make DSM calls.

Quoted 6 lines
Quoted 3 lines

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this use need not result in patches sent back to the ndctl project.

My hope was that the existing extra definitions in ndctl-hpe1.h would gain some users at some point in the future,

It hasn't been easy to add things to ndctl but we would like to add more. Otherwise we'll have to create yet another tool.

Quoted 4 lines

but there's otherwise no
need to add dead code to ndctl-hpe1.h. That header is only used at compile time it's not shipped so it doesn't provide any benefit to those third party applications that you mention.

We've thought about shipping this include file. I think there's a library or developer package for ndctl?

-- ljk

Quoted 5 lines

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#7 lore raw
Quoted 31 lines · Linda Knippers
Quoted 28 lines · Dan Williams
Quoted 23 lines · Jerry Hoemann
Quoted 7 lines · Dan Williams
Quoted 4 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

Quoted 6 lines
Quoted 1 line

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

There are multiple projects both inside and outside of HPE that need to make DSM calls.

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this use need not result in patches sent back to the ndctl project.

Quoted 6 lines
Quoted 2 lines

My hope was that the existing extra definitions in ndctl-hpe1.h would gain some users at some point in the future,

It hasn't been easy to add things to ndctl but we would like to add more. Otherwise we'll have to create yet another tool.

Understood. The goal I've had with ndctl is to be vendor agnostic out of the gate. The trajectory of vendor tools is that each vendor releases their own special sauce and sometime later someone who is tired of dealing with that differentiation writes a library to undo it, like system-storage-manager or smartmontools, and provide a unified interface. If you need to do truly vendor specific things that probably needs a new tool, but if there's any commonality for a feature across vendors then I think we should look to add a common ndctl front-end for it. For example, I'm looking to add a firmware update mechanism that provides a framework to hide all the "if (vendor == X)" details behind the libndctl api.

Quoted 8 lines
Quoted 4 lines

but there's otherwise no
need to add dead code to ndctl-hpe1.h. That header is only used at compile time it's not shipped so it doesn't provide any benefit to those third party applications that you mention.

We've thought about shipping this include file. I think there's a library or developer package for ndctl?

It does have a devel package for users to write against the libndctl.h api. There's also general if 'platform == NFIT' vs 'platform == e820' differentiation. What it doesn't have is any api that externally presents a vendor specific interface.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#8 lore raw
Quoted 57 lines · Dan Williams
Quoted 31 lines · Linda Knippers
Quoted 28 lines · Dan Williams
Quoted 23 lines · Jerry Hoemann
Quoted 7 lines · Dan Williams
Quoted 4 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

Quoted 6 lines
Quoted 1 line

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

There are multiple projects both inside and outside of HPE that need to make DSM calls.

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this use need not result in patches sent back to the ndctl project.

Quoted 6 lines
Quoted 2 lines

My hope was that the existing extra definitions in ndctl-hpe1.h would gain some users at some point in the future,

It hasn't been easy to add things to ndctl but we would like to add more. Otherwise we'll have to create yet another tool.

Understood. The goal I've had with ndctl is to be vendor agnostic out of the gate. The trajectory of vendor tools is that each vendor releases their own special sauce and sometime later someone who is tired of dealing with that differentiation writes a library to undo it, like system-storage-manager or smartmontools, and provide a unified interface. If you need to do truly vendor specific things that probably needs a new tool, but if there's any commonality for a feature across vendors then I think we should look to add a common ndctl front-end for it. For example, I'm looking to add a firmware update mechanism that provides a framework to hide all the "if (vendor == X)" details behind the libndctl api.

Quoted 6 lines
Quoted 4 lines

but there's otherwise no
need to add dead code to ndctl-hpe1.h. That header is only used at compile time it's not shipped so it doesn't provide any benefit to those third party applications that you mention.

Quoted 7 lines
Quoted 2 lines

We've thought about shipping this include file. I think there's a library or developer package for ndctl?

It does have a devel package for users to write against the libndctl.h api. There's also general if 'platform == NFIT' vs 'platform == e820' differentiation. What it doesn't have is any api that externally presents a vendor specific interface.

I don't think we actually need a vendor-specific interface. We just need an easy/common way to pass through the commands. That's why it seemed natural to add the new DSM structure definitions to the ones that are already there.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#9 lore raw
Quoted 84 lines · Linda Knippers
Quoted 72 lines · Dan Williams
Quoted 41 lines · Linda Knippers
Quoted 37 lines · Dan Williams
Quoted 30 lines · Jerry Hoemann
Quoted 10 lines · Dan Williams
Quoted 6 lines · Jerry Hoemann

Add structure definitions newly published/modified in v0.85:

Quoted 7 lines
Quoted 1 line

https://github.com/HewlettPackard/hpe-nvm/blob/master/Documentation/NFIT_DSM_DDR4_NVDIMM-N_v85.pdf

Are there going to be follow-on patches that make use of these definitions? I would save this update for when those follow-on patches are ready.

There are multiple projects both inside and outside of HPE that need to make DSM calls.

The DSM ioctl is an interface exported to user applications. Customers and vendors can and will use this interface for their own tools and this
use need not result in patches sent back to the ndctl project.

Quoted 7 lines
Quoted 2 lines

My hope was that the existing extra definitions in ndctl-hpe1.h would gain some users at some point in the future,

It hasn't been easy to add things to ndctl but we would like to add more. Otherwise we'll have to create yet another tool.

Understood. The goal I've had with ndctl is to be vendor agnostic out of the gate. The trajectory of vendor tools is that each vendor releases their own special sauce and sometime later someone who is tired of dealing with that differentiation writes a library to undo it, like system-storage-manager or smartmontools, and provide a unified interface. If you need to do truly vendor specific things that probably needs a new tool, but if there's any commonality for a feature across vendors then I think we should look to add a common ndctl front-end for it. For example, I'm looking to add a firmware update mechanism that provides a framework to hide all the "if (vendor == X)" details behind the libndctl api.

Quoted 7 lines
Quoted 4 lines

but there's otherwise no
need to add dead code to ndctl-hpe1.h. That header is only used at compile time it's not shipped so it doesn't provide any benefit to those third party applications that you mention.

Quoted 8 lines
Quoted 2 lines

We've thought about shipping this include file. I think there's a library or developer package for ndctl?

It does have a devel package for users to write against the libndctl.h api. There's also general if 'platform == NFIT' vs 'platform == e820' differentiation. What it doesn't have is any api that externally presents a vendor specific interface.

Quoted 4 lines

I don't think we actually need a vendor-specific interface. We just need an easy/common way to pass through the commands. That's why it seemed natural to add the new DSM structure definitions to the ones that are already there.

That sounds fine to me, just need ndctl_dimm_cmd_new_* wrappers in front of them with an ops structure to redirect to the vendor specific implementation. Just like we have for ndctl_dimm_cmd_new_smart().
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm