All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/Patch 0/5] ndctl list show broken nvdimm info.
@ 2017-08-04  9:02 Yasunori Goto
  2017-08-04  9:06 ` [RFC/Patch 1/5] Remove old enum definition of "Translate Spa" Yasunori Goto
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Yasunori Goto @ 2017-08-04  9:02 UTC (permalink / raw)
  To: NVDIMM-ML


Hello,

I made a patch set to show information of broken NVDIMM.

When a region has a broken block, user need to replace
the NVDIMM which includes the block.
However there is no information to find which DIMM module have the block.
Not only ndctl does not have such information, nvdimm driver can not
find it.


Fortunately, ACPI 6.2 has new specification of _DSM.
It is "translate spa" which can get NVDIMM handle
and DPA(Dimm Physical Address) from SPA(system Physical Addreess).
It helps for ndctl command to find broken NVDIMM.
So, This patch set includes followings.
 - support Translate SPA interface,
 - ndctl ask DIMM by Translate SPA and show it.


To be honest, since I'm still newbie about the internal of NVDIMM driver
and ndctl, I may misunderstand/miss something, and I feel my patch
set has likely quick hack....

Especiall, I'm not sure about the followings.

  - What is the maximum size of input/output argument table for _DSM
    for Translate SPA and ioctl()? It seems to depend on max # of
    ways of mirroring. Since ACPI 6.2 seems not to mention it, 
    it depends on vedor's decision, I think....
    Usually, mirroring is 2 way, but I'm not sure it is the maximum number...

  - Though libndctl has many good API, I'm not sure how new APIs
    should be named.


However, I think progress will be better by getting many others advises
than thinking the aboves alone. So, I hope this post is good start
to make this feature.

Anyway, please check and comment.

Thanks,
---
Yasunori Goto



_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC/Patch 1/5] Remove old enum definition of "Translate Spa"
  2017-08-04  9:02 [RFC/Patch 0/5] ndctl list show broken nvdimm info Yasunori Goto
@ 2017-08-04  9:06 ` Yasunori Goto
  2017-08-04 23:09   ` Dan Williams
  2017-08-04  9:08 ` [RFC/Patch 2/5] Support Translate SPA for NVDIMM Root Device Yasunori Goto
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Yasunori Goto @ 2017-08-04  9:06 UTC (permalink / raw)
  To: NVDIMM-ML


Remove old enum definition of "Translate Spa".

Translate SPA becomes standard specification on ACPI 6.2,
but current definition is likely temporary.
So it is removed.

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>


---
 drivers/acpi/nfit/core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 19182d0..5334755 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1626,7 +1626,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
  * these commands.
  */
 enum nfit_aux_cmds {
-        NFIT_CMD_TRANSLATE_SPA = 5,
         NFIT_CMD_ARS_INJECT_SET = 7,
         NFIT_CMD_ARS_INJECT_CLEAR = 8,
         NFIT_CMD_ARS_INJECT_GET = 9,
@@ -1655,7 +1654,6 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
 		(1 << ND_CMD_ARS_START) |
 		(1 << ND_CMD_ARS_STATUS) |
 		(1 << ND_CMD_CLEAR_ERROR) |
-		(1 << NFIT_CMD_TRANSLATE_SPA) |
 		(1 << NFIT_CMD_ARS_INJECT_SET) |
 		(1 << NFIT_CMD_ARS_INJECT_CLEAR) |
 		(1 << NFIT_CMD_ARS_INJECT_GET);




_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC/Patch 2/5] Support Translate SPA for NVDIMM Root Device.
  2017-08-04  9:02 [RFC/Patch 0/5] ndctl list show broken nvdimm info Yasunori Goto
  2017-08-04  9:06 ` [RFC/Patch 1/5] Remove old enum definition of "Translate Spa" Yasunori Goto
@ 2017-08-04  9:08 ` Yasunori Goto
  2017-08-04 23:30   ` Dan Williams
  2017-08-04  9:10 ` [RFC/Patch 3/5] nfit_test supports Translate SPA Yasunori Goto
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Yasunori Goto @ 2017-08-04  9:08 UTC (permalink / raw)
  To: NVDIMM-ML


Support Translate SPA for NVDIMM Root Device.

ACPI 6.2 has new specification on _DSM of NVDIMM Root Device
It is "Translate SPA" which translate from system physical address(SPA)
to NVDIMM handle and dimm physical address(DPA).

This patch is to support Translate SPA.


Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
---
 drivers/acpi/nfit/core.c   |  7 +++++--
 drivers/nvdimm/bus.c       | 11 ++++++++++-
 include/linux/libnvdimm.h  |  2 +-
 include/uapi/linux/ndctl.h |  4 ++++
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 5334755..e8c67a3 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -173,6 +173,8 @@ static int xlat_bus_status(void *buf, unsigned int cmd, u32 status)
 		if (clear_err->length > clear_err->cleared)
 			return clear_err->cleared;
 		return 0;
+	case ND_CMD_TRANS_SPA:
+		return 0;
 	default:
 		break;
 	}
@@ -352,7 +354,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
 	 * Set fw_status for all the commands with a known format to be
 	 * later interpreted by xlat_status().
 	 */
-	if (i >= 1 && ((cmd >= ND_CMD_ARS_CAP && cmd <= ND_CMD_CLEAR_ERROR)
+	if (i >= 1 && ((cmd >= ND_CMD_ARS_CAP && cmd <= ND_CMD_TRANS_SPA)
 			|| (cmd >= ND_CMD_SMART && cmd <= ND_CMD_VENDOR)))
 		fw_status = *(u32 *) out_obj->buffer.pointer;
 
@@ -1644,7 +1646,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
 	if (!adev)
 		return;
 
-	for (i = ND_CMD_ARS_CAP; i <= ND_CMD_CLEAR_ERROR; i++)
+	for (i = ND_CMD_ARS_CAP; i <= ND_CMD_TRANS_SPA; i++)
 		if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i))
 			set_bit(i, &nd_desc->cmd_mask);
 	set_bit(ND_CMD_CALL, &nd_desc->cmd_mask);
@@ -1654,6 +1656,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
 		(1 << ND_CMD_ARS_START) |
 		(1 << ND_CMD_ARS_STATUS) |
 		(1 << ND_CMD_CLEAR_ERROR) |
+		(1 << ND_CMD_TRANS_SPA) |
 		(1 << NFIT_CMD_ARS_INJECT_SET) |
 		(1 << NFIT_CMD_ARS_INJECT_CLEAR) |
 		(1 << NFIT_CMD_ARS_INJECT_GET);
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 937fafa..ef05fe1 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -727,6 +727,12 @@ static const struct nd_cmd_desc __nd_cmd_bus_descs[] = {
 		.out_num = 3,
 		.out_sizes = { 4, 4, 8, },
 	},
+	[ND_CMD_TRANS_SPA] = {
+		.in_num = 1,
+		.in_sizes = { 8, },
+		.out_num = 7,
+		.out_sizes = { 2, 2, 1, 3, 8, 4, UINT_MAX, },
+	},
 	[ND_CMD_CALL] = {
 		.in_num = 2,
 		.in_sizes = { sizeof(struct nd_cmd_pkg), UINT_MAX, },
@@ -801,7 +807,9 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
 		if (out_field[1] - 8 == remainder)
 			return remainder;
 		return out_field[1] - 4;
-	} else if (cmd == ND_CMD_CALL) {
+	} else if (!nvdimm && cmd == ND_CMD_TRANS_SPA && idx == 6)
+		return out_field[2];
+	else if (cmd == ND_CMD_CALL) {
 		struct nd_cmd_pkg *pkg = (struct nd_cmd_pkg *) in_field;
 
 		return pkg->nd_size_out;
@@ -947,6 +955,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
 		case ND_CMD_SET_CONFIG_DATA:
 		case ND_CMD_ARS_START:
 		case ND_CMD_CLEAR_ERROR:
+		case ND_CMD_TRANS_SPA:
 		case ND_CMD_CALL:
 			dev_dbg(&nvdimm_bus->dev, "'%s' command while read-only.\n",
 					nvdimm ? nvdimm_cmd_name(cmd)
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index f3d3e6a..c179ed0 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -29,7 +29,7 @@ enum {
 
 	/* need to set a limit somewhere, but yes, this is likely overkill */
 	ND_IOCTL_MAX_BUFLEN = SZ_4M,
-	ND_CMD_MAX_ELEM = 5,
+	ND_CMD_MAX_ELEM = 7,
 	ND_CMD_MAX_ENVELOPE = 256,
 	ND_MAX_MAPPINGS = 32,
 
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 6d3c542..91bf129 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -190,6 +190,7 @@ enum {
 	ND_CMD_ARS_START = 2,
 	ND_CMD_ARS_STATUS = 3,
 	ND_CMD_CLEAR_ERROR = 4,
+	ND_CMD_TRANS_SPA = 5,
 
 	/* per-dimm commands */
 	ND_CMD_SMART = 1,
@@ -218,6 +219,7 @@ static inline const char *nvdimm_bus_cmd_name(unsigned cmd)
 		[ND_CMD_ARS_START] = "ars_start",
 		[ND_CMD_ARS_STATUS] = "ars_status",
 		[ND_CMD_CLEAR_ERROR] = "clear_error",
+		[ND_CMD_TRANS_SPA] = "trans_spa",
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
@@ -280,6 +282,8 @@ static inline const char *nvdimm_cmd_name(unsigned cmd)
 
 #define ND_IOCTL_CLEAR_ERROR		_IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR,\
 					struct nd_cmd_clear_error)
+#define ND_IOCTL_TRANS_SPA		_IOWR(ND_IOCTL, ND_CMD_TRANS_SPA,\
+					struct nd_cmd_trans_spa)
 
 #define ND_DEVICE_DIMM 1            /* nd_dimm: container for "config data" */
 #define ND_DEVICE_REGION_PMEM 2     /* nd_region: (parent of PMEM namespaces) */



_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC/Patch 3/5] nfit_test supports Translate SPA
  2017-08-04  9:02 [RFC/Patch 0/5] ndctl list show broken nvdimm info Yasunori Goto
  2017-08-04  9:06 ` [RFC/Patch 1/5] Remove old enum definition of "Translate Spa" Yasunori Goto
  2017-08-04  9:08 ` [RFC/Patch 2/5] Support Translate SPA for NVDIMM Root Device Yasunori Goto
@ 2017-08-04  9:10 ` Yasunori Goto
  2017-08-04  9:12 ` [RFC/Patch 4/5] libndctl Make interfaces to use " Yasunori Goto
  2017-08-04  9:13 ` [RFC/Patch 5/5] ndctl: show dimm's name which has badblock by ndctl list command Yasunori Goto
  4 siblings, 0 replies; 11+ messages in thread
From: Yasunori Goto @ 2017-08-04  9:10 UTC (permalink / raw)
  To: NVDIMM-ML

nfit_test supports Translate SPA

To test interface of Translate SPA, nfit_test must emulate it.
This test module searches region which includes spa and 
returns only 1 dimm handle which is last one currently.



Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

---
 drivers/nvdimm/region_devs.c     |  1 +
 tools/testing/nvdimm/test/nfit.c | 80 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index 5954cfb..3c8cc7f 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -162,6 +162,7 @@ bool is_nd_pmem(struct device *dev)
 {
 	return dev ? dev->type == &nd_pmem_device_type : false;
 }
+EXPORT_SYMBOL_GPL(is_nd_pmem);
 
 bool is_nd_blk(struct device *dev)
 {
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index 4c2fa98..09dcdf5 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -342,6 +342,78 @@ static int nfit_test_cmd_clear_error(struct nd_cmd_clear_error *clear_err,
 	return 0;
 }
 
+struct region_search_spa{
+	u64 addr;
+	struct nd_region *region;
+};
+
+static int nfit_test_search_region_spa(struct device *dev, void *data)
+{
+	struct region_search_spa *ctx = data;
+	struct nd_region *nd_region;
+	resource_size_t ndr_end;
+
+	if (!is_nd_pmem(dev))
+		return 0;
+
+	nd_region = to_nd_region(dev);
+	ndr_end = nd_region->ndr_start + nd_region->ndr_size;
+
+	if (ctx->addr >= nd_region->ndr_start && ctx->addr < ndr_end) {
+		ctx->region = nd_region;
+		return 1;
+	}
+
+	return 0;
+}
+
+static int nfit_test_search_spa(struct nvdimm_bus *bus, struct nd_cmd_trans_spa *spa)
+{
+	int ret;
+	struct nd_region *nd_region = NULL;
+	struct nvdimm *nvdimm = NULL;
+	struct nd_mapping *nd_mapping = NULL;
+	struct region_search_spa ctx = {
+		.addr = spa->spa,
+		.region = NULL,
+	};
+	u64 dpa;
+
+	ret = device_for_each_child(&bus->dev, &ctx, nfit_test_search_region_spa);
+
+	if (!ret)
+		return -ENODEV;
+
+	nd_region = ctx.region;
+
+	dpa = ctx.addr - nd_region->ndr_start;
+
+	/*
+	 * last dimm is selected for test
+	 */
+	nd_mapping = &nd_region->mapping[nd_region->ndr_mappings - 1];
+	nvdimm = nd_mapping->nvdimm;
+
+	spa->devices[0].nfit_device_handle = handle[nvdimm->id];
+	spa->num_nvdimms = 1;
+	spa->devices[0].dpa = dpa;
+
+	return 0;
+}
+
+static int nfit_test_cmd_translate_spa(struct nvdimm_bus *bus, struct nd_cmd_trans_spa *spa,
+				unsigned int buf_len)
+{
+
+	if (buf_len < spa->trans_length)
+		return -EINVAL;
+
+	if (nfit_test_search_spa(bus, spa) < 0|| !spa->num_nvdimms)
+		spa->status = 2;
+
+	return 0;
+}
+
 static int nfit_test_cmd_smart(struct nd_cmd_smart *smart, unsigned int buf_len)
 {
 	static const struct nd_smart_payload smart_data = {
@@ -468,6 +540,9 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc,
 		case ND_CMD_CLEAR_ERROR:
 			rc = nfit_test_cmd_clear_error(buf, buf_len, cmd_rc);
 			break;
+		case ND_CMD_TRANS_SPA:
+			rc = nfit_test_cmd_translate_spa(acpi_desc->nvdimm_bus, buf, buf_len);
+			break;
 		default:
 			return -ENOTTY;
 		}
@@ -1430,6 +1505,7 @@ static void nfit_test0_setup(struct nfit_test *t)
 	set_bit(ND_CMD_ARS_START, &acpi_desc->bus_cmd_force_en);
 	set_bit(ND_CMD_ARS_STATUS, &acpi_desc->bus_cmd_force_en);
 	set_bit(ND_CMD_CLEAR_ERROR, &acpi_desc->bus_cmd_force_en);
+	set_bit(ND_CMD_TRANS_SPA, &acpi_desc->bus_cmd_force_en);
 	set_bit(ND_CMD_SMART_THRESHOLD, &acpi_desc->dimm_cmd_force_en);
 }
 
@@ -1527,6 +1603,7 @@ static void nfit_test1_setup(struct nfit_test *t)
 	set_bit(ND_CMD_ARS_START, &acpi_desc->bus_cmd_force_en);
 	set_bit(ND_CMD_ARS_STATUS, &acpi_desc->bus_cmd_force_en);
 	set_bit(ND_CMD_CLEAR_ERROR, &acpi_desc->bus_cmd_force_en);
+	set_bit(ND_CMD_TRANS_SPA, &acpi_desc->bus_cmd_force_en);
 	set_bit(ND_CMD_GET_CONFIG_SIZE, &acpi_desc->dimm_cmd_force_en);
 	set_bit(ND_CMD_GET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en);
 	set_bit(ND_CMD_SET_CONFIG_DATA, &acpi_desc->dimm_cmd_force_en);
@@ -1616,7 +1693,8 @@ static int nfit_ctl_test(struct device *dev)
 			.cmd_mask = 1UL << ND_CMD_ARS_CAP
 				| 1UL << ND_CMD_ARS_START
 				| 1UL << ND_CMD_ARS_STATUS
-				| 1UL << ND_CMD_CLEAR_ERROR,
+				| 1UL << ND_CMD_CLEAR_ERROR
+			        | 1UL << ND_CMD_TRANS_SPA,
 			.module = THIS_MODULE,
 			.provider_name = "ACPI.NFIT",
 			.ndctl = acpi_nfit_ctl,



_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC/Patch 4/5] libndctl Make interfaces to use Translate SPA
  2017-08-04  9:02 [RFC/Patch 0/5] ndctl list show broken nvdimm info Yasunori Goto
                   ` (2 preceding siblings ...)
  2017-08-04  9:10 ` [RFC/Patch 3/5] nfit_test supports Translate SPA Yasunori Goto
@ 2017-08-04  9:12 ` Yasunori Goto
  2017-08-05  0:03   ` Dan Williams
  2017-08-04  9:13 ` [RFC/Patch 5/5] ndctl: show dimm's name which has badblock by ndctl list command Yasunori Goto
  4 siblings, 1 reply; 11+ messages in thread
From: Yasunori Goto @ 2017-08-04  9:12 UTC (permalink / raw)
  To: NVDIMM-ML

ndctl:libndctl Make interfaces to use Translate SPA.

This patch makes 3 new interfaces :
  - to ask bus has translate SPA feature.
  - to call translate SPA.
  - to find DIMM by SPA address.


Note) I'm not sure how many buffer should be prepared, because
      it depends on max # of mirroring way.
      This patch assume maxmum # is 4 way.


Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

---
 configure.ac                 |  19 ++++++++
 ndctl/lib/libndctl-private.h |   7 +++
 ndctl/lib/libndctl.c         | 103 ++++++++++++++++++++++++++++++++++++++++++-
 ndctl/lib/libndctl.sym       |   3 ++
 ndctl/libndctl.h.in          |  23 ++++++++++
 ndctl/ndctl.h                |   8 ++++
 6 files changed, 162 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 316f5b7..653fde0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -162,6 +162,25 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 )
 AM_CONDITIONAL([ENABLE_CLEAR_ERROR], [test "x$enable_clear_err" = "xyes"])
 
+AC_MSG_CHECKING([for TRANSLATE SPA support])
+AC_LANG(C)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+                       #ifdef HAVE_NDCTL_H
+                       #include <linux/ndctl.h>
+                       #else
+                       #include "ndctl/ndctl.h"
+                       #endif
+                       ]], [[
+                       int x = ND_CMD_TRANS_SPA;
+                       ]]
+               )], [AC_MSG_RESULT([yes])
+                    enable_trans_spa=yes
+                    AC_DEFINE([HAVE_NDCTL_TRANS_SPA], [1],
+                               [Define to 1 if ndctl.h has TRANSLATE SPA support.])
+               ], [AC_MSG_RESULT([no])]
+)
+AM_CONDITIONAL([ENABLE_TRANS_SPA], [test "x$enable_trans_spa" = "xyes"])
+
 AC_MSG_CHECKING([for device DAX support])
 AC_LANG(C)
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
diff --git a/ndctl/lib/libndctl-private.h b/ndctl/lib/libndctl-private.h
index 8f10fbc..a1fcd2f 100644
--- a/ndctl/lib/libndctl-private.h
+++ b/ndctl/lib/libndctl-private.h
@@ -196,6 +196,7 @@ struct ndctl_cmd {
 #ifdef HAVE_NDCTL_CLEAR_ERROR
 		struct nd_cmd_clear_error clear_err[0];
 #endif
+		struct nd_cmd_trans_spa trans_spa[0];
 		struct ndn_pkg_hpe1 hpe1[0];
 		struct ndn_pkg_msft msft[0];
 		struct nd_cmd_smart smart[0];
@@ -250,6 +251,12 @@ static const int nd_cmd_clear_error = ND_CMD_CLEAR_ERROR;
 static const int nd_cmd_clear_error;
 #endif
 
+#ifdef HAVE_NDCTL_TRANS_SPA
+static const int nd_cmd_trans_spa = ND_CMD_TRANS_SPA;
+#else
+static const int nd_cmd_trans_spa;
+#endif
+
 static inline struct ndctl_bus *cmd_to_bus(struct ndctl_cmd *cmd)
 {
 	if (cmd->dimm)
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 68d8064..5ebcc45 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -744,7 +744,9 @@ static int to_dsm_index(const char *name, int dimm)
 		end_cmd = ND_CMD_CALL;
 		cmd_name_fn = nvdimm_cmd_name;
 	} else {
-		end_cmd = nd_cmd_clear_error;
+		end_cmd = nd_cmd_trans_spa;
+		if (!end_cmd)
+			end_cmd = nd_cmd_clear_error;
 		if (!end_cmd)
 			end_cmd = nd_cmd_ars_status;
 		cmd_name_fn = nvdimm_bus_cmd_name;
@@ -1943,6 +1945,102 @@ NDCTL_EXPORT struct badblock *ndctl_region_get_first_badblock(struct ndctl_regio
 	return ndctl_region_get_next_badblock(region);
 }
 
+#ifdef HAVE_NDCTL_TRANS_SPA
+NDCTL_EXPORT int ndctl_bus_has_trans_spa(struct ndctl_bus *bus)
+{
+	if (!bus)
+		return 0;
+
+	return ndctl_bus_is_cmd_supported(bus, ND_CMD_TRANS_SPA);
+}
+
+static struct ndctl_cmd *ndctl_bus_cmd_new_trans_spa(struct ndctl_bus *bus)
+{
+	struct ndctl_cmd *cmd;
+	size_t size, spa_length;
+
+	spa_length = sizeof(struct nd_cmd_trans_spa)
+		+ sizeof(struct nd_nvdimm_device) * ND_MIRROR_MAX_WAY;
+	size = sizeof(*cmd) + spa_length;
+	cmd = calloc(1, size);
+	if (!cmd)
+		return NULL;
+
+	cmd->bus = bus;
+	ndctl_cmd_ref(cmd);
+	cmd->type = ND_CMD_TRANS_SPA;
+	cmd->size = size;
+	cmd->status = 1;
+	cmd->firmware_status = &cmd->trans_spa->status;
+	cmd->trans_spa->trans_length = spa_length;
+
+	return cmd;
+}
+
+static int ndctl_bus_cmd_get_trans_spa(struct ndctl_cmd *cmd,
+					unsigned int *handles, unsigned long long *dpas)
+{
+	int i;
+	int num_nvdimms;
+
+	if (cmd->trans_spa->status == ND_TRANS_SPA_STATUS_INVALID_SPA)
+		return -EINVAL;
+
+	num_nvdimms = cmd->trans_spa->num_nvdimms;
+	for (i = 0; i < num_nvdimms; i++) {
+		handles[i] = cmd->trans_spa->devices[i].nfit_device_handle;
+		dpas[i] = cmd->trans_spa->devices[i].dpa;
+	}
+
+	ndctl_cmd_unref(cmd);
+	return 0;
+}
+
+NDCTL_EXPORT int ndctl_bus_cmd_trans_spa(struct ndctl_bus *bus,
+	unsigned long long addr, unsigned int *handles, unsigned long long *dpas)
+{
+
+	struct ndctl_cmd *cmd;
+	int rc;
+
+	cmd = ndctl_bus_cmd_new_trans_spa(bus);
+	cmd->trans_spa->spa = addr;
+
+	rc = ndctl_cmd_submit(cmd);
+	if (rc) {
+		ndctl_cmd_unref(cmd);
+		return rc;
+	}
+
+	rc = ndctl_bus_cmd_get_trans_spa(cmd, handles, dpas);
+
+	return rc;
+}
+
+NDCTL_EXPORT int ndctl_dimms_get_by_spa(struct ndctl_bus *bus, unsigned long long spa,
+				struct ndctl_dimm **dimms)
+{
+	int i, rc;
+	unsigned int handles[ND_MIRROR_MAX_WAY];
+	unsigned long long dpas[ND_MIRROR_MAX_WAY];
+
+	if (!bus || !spa || !dimms)
+		return -EINVAL;
+
+	memset(handles, 0, sizeof(handles));
+	memset(dpas, 0, sizeof(dpas));
+
+	rc = ndctl_bus_cmd_trans_spa(bus, spa, &handles[0], &dpas[0]);
+	if (rc)
+		return rc;
+
+	for (i = 0; i < ND_MIRROR_MAX_WAY && handles[i]; i++)
+		dimms[i] = ndctl_dimm_get_by_handle(bus, handles[i]);
+
+	return 0;
+}
+#endif /* HAVE_NDCTL_TRANS_SPA */
+
 static struct nd_cmd_vendor_tail *to_vendor_tail(struct ndctl_cmd *cmd)
 {
 	struct nd_cmd_vendor_tail *tail = (struct nd_cmd_vendor_tail *)
@@ -2314,6 +2412,9 @@ static int to_ioctl_cmd(int cmd, int dimm)
 #ifdef HAVE_NDCTL_CLEAR_ERROR
 		case ND_CMD_CLEAR_ERROR:     return ND_IOCTL_CLEAR_ERROR;
 #endif
+#ifdef HAVE_NDCTL_TRANS_SPA
+		case ND_CMD_TRANS_SPA:       return ND_CMD_TRANS_SPA;
+#endif
 		default:
 						       return 0;
 		};
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index 0e59243..6846f20 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -36,6 +36,9 @@ global:
 	ndctl_bus_get_provider;
 	ndctl_bus_get_ctx;
 	ndctl_bus_wait_probe;
+	ndctl_bus_has_trans_spa;
+	ndctl_bus_cmd_trans_spa;
+	ndctl_dimms_get_by_spa;
 	ndctl_dimm_get_first;
 	ndctl_dimm_get_next;
 	ndctl_dimm_get_handle;
diff --git a/ndctl/libndctl.h.in b/ndctl/libndctl.h.in
index 200c5cf..3a6256b 100644
--- a/ndctl/libndctl.h.in
+++ b/ndctl/libndctl.h.in
@@ -347,6 +347,29 @@ static inline unsigned int ndctl_cmd_smart_threshold_get_spares(
 }
 #endif
 
+#if HAVE_NDCTL_TRANS_SPA == 1
+int ndctl_bus_has_trans_spa(struct ndctl_bus *bus);
+int ndctl_bus_cmd_trans_spa(struct ndctl_bus *bus,
+	unsigned long long addr, unsigned int *handles, unsigned long long *dpas);
+int ndctl_dimms_get_by_spa(struct ndctl_bus *bus,
+	unsigned long long spa, struct ndctl_dimm **dimms);
+#else
+static inline int ndctl_bus_has_trans_spa(struct ndctl_bus *bus)
+{
+	return 0;
+}
+static inline int ndctl_bus_cmd_trans_spa(struct ndctl_bus *bus,
+	unsigned long long addr, unsigned int *handles, unsigned long long *dpas)
+{
+	return 0;
+}
+static inline int ndctl_dimms_get_by_spa(struct ndctl_bus *bus,
+	unsigned long long spa, struct ndctl_dimm **dimms)
+{
+	return 0;
+}
+#endif
+
 struct ndctl_cmd *ndctl_dimm_cmd_new_vendor_specific(struct ndctl_dimm *dimm,
 		unsigned int opcode, size_t input_size, size_t output_size);
 ssize_t ndctl_cmd_vendor_set_input(struct ndctl_cmd *cmd, void *buf,
diff --git a/ndctl/ndctl.h b/ndctl/ndctl.h
index d70b97d..add0d58 100644
--- a/ndctl/ndctl.h
+++ b/ndctl/ndctl.h
@@ -35,6 +35,9 @@ struct nd_cmd_smart {
 #define ND_SMART_CRITICAL_HEALTH	(1 << 1)
 #define ND_SMART_FATAL_HEALTH		(1 << 2)
 
+#define ND_MIRROR_MAX_WAY 4 /* XXX: assume max mirroring way */
+#define ND_TRANS_SPA_STATUS_INVALID_SPA  2
+
 struct nd_smart_payload {
 	__u32 flags;
 	__u8 reserved0[4];
@@ -190,6 +193,7 @@ enum {
 	ND_CMD_ARS_START = 2,
 	ND_CMD_ARS_STATUS = 3,
 	ND_CMD_CLEAR_ERROR = 4,
+	ND_CMD_TRANS_SPA = 5,
 
 	/* per-dimm commands */
 	ND_CMD_SMART = 1,
@@ -217,6 +221,7 @@ static __inline__ const char *nvdimm_bus_cmd_name(unsigned cmd)
 		[ND_CMD_ARS_START] = "ars_start",
 		[ND_CMD_ARS_STATUS] = "ars_status",
 		[ND_CMD_CLEAR_ERROR] = "clear_error",
+		[ND_CMD_TRANS_SPA] = "trans_spa",
 		[ND_CMD_CALL] = "cmd_call",
 	};
 
@@ -280,6 +285,9 @@ static __inline__ const char *nvdimm_cmd_name(unsigned cmd)
 #define ND_IOCTL_CLEAR_ERROR		_IOWR(ND_IOCTL, ND_CMD_CLEAR_ERROR,\
 					struct nd_cmd_clear_error)
 
+#define ND_IOCTL_TRANS_SPA 		_IOWR(ND_IOCTL, ND_CMD_TRANS_SPA,\
+					struct nd_cmd_trans_spa)
+
 #define ND_DEVICE_DIMM 1            /* nd_dimm: container for "config data" */
 #define ND_DEVICE_REGION_PMEM 2     /* nd_region: (parent of PMEM namespaces) */
 #define ND_DEVICE_REGION_BLK 3      /* nd_region: (parent of BLK namespaces) */



_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC/Patch 5/5] ndctl: show dimm's name which has badblock by ndctl list command.
  2017-08-04  9:02 [RFC/Patch 0/5] ndctl list show broken nvdimm info Yasunori Goto
                   ` (3 preceding siblings ...)
  2017-08-04  9:12 ` [RFC/Patch 4/5] libndctl Make interfaces to use " Yasunori Goto
@ 2017-08-04  9:13 ` Yasunori Goto
  4 siblings, 0 replies; 11+ messages in thread
From: Yasunori Goto @ 2017-08-04  9:13 UTC (permalink / raw)
  To: NVDIMM-ML

ndctl: show dimm's name which has badblock by ndctl list command.

This patch uses translate SPA interface to get bad dimm info.

Since this patch is likely Proof of Concept,
because libnvdimm functions of this feature will change yet.
So, I don't think this patch can be merged.

However, I hope this patch is good start for discussion....



Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
---
 util/json.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/util/json.c b/util/json.c
index 2b2b5af..b791054 100644
--- a/util/json.c
+++ b/util/json.c
@@ -381,6 +381,22 @@ struct json_object *util_region_badblocks_to_json(struct ndctl_region *region,
 
 	ndctl_region_badblock_foreach(region, bb) {
 		if (flags & UTIL_JSON_MEDIA_ERRORS) {
+			struct ndctl_bus *bus;
+			struct ndctl_dimm *dimms[ND_MIRROR_MAX_WAY];
+			memset(dimms, 0, sizeof(dimms));
+			bus = ndctl_region_get_bus(region);
+			if (ndctl_bus_has_trans_spa(bus)) {
+				int rc;
+				unsigned long long spa;
+				spa = ndctl_region_get_resource(region);
+				if (spa == ULONG_MAX)
+					goto err_array;
+				spa += bb->offset << 9;
+				rc = ndctl_dimms_get_by_spa(bus, spa, dimms);
+				if (rc)
+					goto err_array;
+			}
+
 			jbb = json_object_new_object();
 			if (!jbb)
 				goto err_array;
@@ -395,6 +411,14 @@ struct json_object *util_region_badblocks_to_json(struct ndctl_region *region,
 				goto err;
 			json_object_object_add(jbb, "length", jobj);
 
+			for (int i = 0; i < ND_MIRROR_MAX_WAY; i++) {
+				if (dimms[i]) {
+					jobj = json_object_new_string(ndctl_dimm_get_devname(dimms[i]));
+					if (!jobj)
+						goto err;
+					json_object_object_add(jbb, "dimm", jobj);
+				}
+			}
 			json_object_array_add(jbbs, jbb);
 		}
 
@@ -436,6 +460,8 @@ static struct json_object *dev_badblocks_to_json(struct ndctl_region *region,
 
 	ndctl_region_badblock_foreach(region, bb) {
 		unsigned long long bb_begin, bb_end, begin, end;
+		struct ndctl_bus *bus;
+		struct ndctl_dimm *dimms[ND_MIRROR_MAX_WAY];
 
 		bb_begin = region_begin + (bb->offset << 9);
 		bb_end = bb_begin + (bb->len << 9) - 1;
@@ -453,6 +479,20 @@ static struct json_object *dev_badblocks_to_json(struct ndctl_region *region,
 		else
 			end = bb_end;
 
+		memset(dimms, 0, sizeof(dimms));
+		bus = ndctl_region_get_bus(region);
+		if (ndctl_bus_has_trans_spa(bus)) {
+			int rc;
+			unsigned long long spa;
+			spa = ndctl_region_get_resource(region);
+			if (spa == ULLONG_MAX)
+				goto err_array;
+			spa += bb->offset << 9;
+			rc = ndctl_dimms_get_by_spa(bus, spa, dimms);
+			if (rc)
+				goto err_array;
+		}
+
 		offset = (begin - dev_begin) >> 9;
 		len = (end - begin + 1) >> 9;
 
@@ -472,6 +512,15 @@ static struct json_object *dev_badblocks_to_json(struct ndctl_region *region,
 				goto err;
 			json_object_object_add(jbb, "length", jobj);
 
+			for (int i = 1; i < ND_MIRROR_MAX_WAY; i++) {
+				if (dimms[i]) {
+					jobj = json_object_new_string(ndctl_dimm_get_devname(dimms[i]));
+					if (!jobj)
+						goto err;
+					json_object_object_add(jbb, "dimm", jobj);
+				}
+			}
+
 			json_object_array_add(jbbs, jbb);
 		}
 		bbs += len;



_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [RFC/Patch 1/5] Remove old enum definition of "Translate Spa"
  2017-08-04  9:06 ` [RFC/Patch 1/5] Remove old enum definition of "Translate Spa" Yasunori Goto
@ 2017-08-04 23:09   ` Dan Williams
  2017-08-07  0:03     ` Yasunori Goto
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Williams @ 2017-08-04 23:09 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: NVDIMM-ML

On Fri, Aug 4, 2017 at 2:06 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
> Remove old enum definition of "Translate Spa".
>
> Translate SPA becomes standard specification on ACPI 6.2,
> but current definition is likely temporary.
> So it is removed.
>
> Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
>
>
> ---
>  drivers/acpi/nfit/core.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 19182d0..5334755 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -1626,7 +1626,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
>   * these commands.
>   */
>  enum nfit_aux_cmds {
> -        NFIT_CMD_TRANSLATE_SPA = 5,
>          NFIT_CMD_ARS_INJECT_SET = 7,
>          NFIT_CMD_ARS_INJECT_CLEAR = 8,
>          NFIT_CMD_ARS_INJECT_GET = 9,
> @@ -1655,7 +1654,6 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
>                 (1 << ND_CMD_ARS_START) |
>                 (1 << ND_CMD_ARS_STATUS) |
>                 (1 << ND_CMD_CLEAR_ERROR) |
> -               (1 << NFIT_CMD_TRANSLATE_SPA) |
>                 (1 << NFIT_CMD_ARS_INJECT_SET) |
>                 (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
>                 (1 << NFIT_CMD_ARS_INJECT_GET);

Hmm, those definitions are brand new as of the 4.13 kernel, see commit
7db5bb33add5 "libnvdimm, acpi, nfit: Add bus level dsm mask for pass
thru". What's going on here is that we stopped defining new ND_CMD
numbers for each new DSM that is added to the specification. Instead,
we use the ND_CMD_CALL mechanism to wrap these new command payloads
and pass them through to the BIOS. So, these definitions are needed to
allow that passthrough mechanism to work.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC/Patch 2/5] Support Translate SPA for NVDIMM Root Device.
  2017-08-04  9:08 ` [RFC/Patch 2/5] Support Translate SPA for NVDIMM Root Device Yasunori Goto
@ 2017-08-04 23:30   ` Dan Williams
  0 siblings, 0 replies; 11+ messages in thread
From: Dan Williams @ 2017-08-04 23:30 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: NVDIMM-ML

On Fri, Aug 4, 2017 at 2:08 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
>
> Support Translate SPA for NVDIMM Root Device.
>
> ACPI 6.2 has new specification on _DSM of NVDIMM Root Device
> It is "Translate SPA" which translate from system physical address(SPA)
> to NVDIMM handle and dimm physical address(DPA).
>
> This patch is to support Translate SPA.
>

Ah, yes, this is not needed. The Translate SPA command can be
submitted via ND_CMD_CALL mechanism.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC/Patch 4/5] libndctl Make interfaces to use Translate SPA
  2017-08-04  9:12 ` [RFC/Patch 4/5] libndctl Make interfaces to use " Yasunori Goto
@ 2017-08-05  0:03   ` Dan Williams
  2017-08-07  0:08     ` Yasunori Goto
  0 siblings, 1 reply; 11+ messages in thread
From: Dan Williams @ 2017-08-05  0:03 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: NVDIMM-ML

On Fri, Aug 4, 2017 at 2:12 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> ndctl:libndctl Make interfaces to use Translate SPA.

A process note, please separate kernel patches and ndctl patches into
a different set. The expectation is that all the [PATCH 1/n] to [PATCH
n/n] should apply to the same project.

I have typically been marking my ndctl patches with a prefix like
[ndctl PATCH 1/n], where the kernel patches just say [PATCH].

>
> This patch makes 3 new interfaces :
>   - to ask bus has translate SPA feature.
>   - to call translate SPA.
>   - to find DIMM by SPA address.
>
>
> Note) I'm not sure how many buffer should be prepared, because
>       it depends on max # of mirroring way.
>       This patch assume maxmum # is 4 way.

I think it is ok for now to just reserve space for 1-DIMM. When / if
mirroring support materializes in the kernel you should then be able
to detect how many DIMMs are in the mirror set. Since mirror support
would require changes to the Namespace Label specification I think we
have time to circle back and fix up ndctl for the multiple DIMM per
Translate SPA request case.

Otherwise, the kernel will handle the case where the provided buffer
is too small and return an error.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC/Patch 1/5] Remove old enum definition of "Translate Spa"
  2017-08-04 23:09   ` Dan Williams
@ 2017-08-07  0:03     ` Yasunori Goto
  0 siblings, 0 replies; 11+ messages in thread
From: Yasunori Goto @ 2017-08-07  0:03 UTC (permalink / raw)
  To: Dan Williams; +Cc: NVDIMM-ML

> On Fri, Aug 4, 2017 at 2:06 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> >
> > Remove old enum definition of "Translate Spa".
> >
> > Translate SPA becomes standard specification on ACPI 6.2,
> > but current definition is likely temporary.
> > So it is removed.
> >
> > Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
> >
> >
> > ---
> >  drivers/acpi/nfit/core.c | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> > index 19182d0..5334755 100644
> > --- a/drivers/acpi/nfit/core.c
> > +++ b/drivers/acpi/nfit/core.c
> > @@ -1626,7 +1626,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
> >   * these commands.
> >   */
> >  enum nfit_aux_cmds {
> > -        NFIT_CMD_TRANSLATE_SPA = 5,
> >          NFIT_CMD_ARS_INJECT_SET = 7,
> >          NFIT_CMD_ARS_INJECT_CLEAR = 8,
> >          NFIT_CMD_ARS_INJECT_GET = 9,
> > @@ -1655,7 +1654,6 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
> >                 (1 << ND_CMD_ARS_START) |
> >                 (1 << ND_CMD_ARS_STATUS) |
> >                 (1 << ND_CMD_CLEAR_ERROR) |
> > -               (1 << NFIT_CMD_TRANSLATE_SPA) |
> >                 (1 << NFIT_CMD_ARS_INJECT_SET) |
> >                 (1 << NFIT_CMD_ARS_INJECT_CLEAR) |
> >                 (1 << NFIT_CMD_ARS_INJECT_GET);
> 
> Hmm, those definitions are brand new as of the 4.13 kernel, see commit
> 7db5bb33add5 "libnvdimm, acpi, nfit: Add bus level dsm mask for pass
> thru". What's going on here is that we stopped defining new ND_CMD
> numbers for each new DSM that is added to the specification. Instead,
> we use the ND_CMD_CALL mechanism to wrap these new command payloads
> and pass them through to the BIOS. So, these definitions are needed to
> allow that passthrough mechanism to work.

Ah, Ok.
I'll check it.


Thanks,



_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC/Patch 4/5] libndctl Make interfaces to use Translate SPA
  2017-08-05  0:03   ` Dan Williams
@ 2017-08-07  0:08     ` Yasunori Goto
  0 siblings, 0 replies; 11+ messages in thread
From: Yasunori Goto @ 2017-08-07  0:08 UTC (permalink / raw)
  To: Dan Williams; +Cc: NVDIMM-ML

> On Fri, Aug 4, 2017 at 2:12 AM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote:
> > ndctl:libndctl Make interfaces to use Translate SPA.
> 
> A process note, please separate kernel patches and ndctl patches into
> a different set. The expectation is that all the [PATCH 1/n] to [PATCH
> n/n] should apply to the same project.
> 
> I have typically been marking my ndctl patches with a prefix like
> [ndctl PATCH 1/n], where the kernel patches just say [PATCH].
> 
> >
> > This patch makes 3 new interfaces :
> >   - to ask bus has translate SPA feature.
> >   - to call translate SPA.
> >   - to find DIMM by SPA address.
> >
> >
> > Note) I'm not sure how many buffer should be prepared, because
> >       it depends on max # of mirroring way.
> >       This patch assume maxmum # is 4 way.
> 
> I think it is ok for now to just reserve space for 1-DIMM. When / if
> mirroring support materializes in the kernel you should then be able
> to detect how many DIMMs are in the mirror set. Since mirror support
> would require changes to the Namespace Label specification I think we
> have time to circle back and fix up ndctl for the multiple DIMM per
> Translate SPA request case.


I see. I'll reserve space for 1-DIMM.

> 
> Otherwise, the kernel will handle the case where the provided buffer
> is too small and return an error.
> 




_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-08-07  0:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04  9:02 [RFC/Patch 0/5] ndctl list show broken nvdimm info Yasunori Goto
2017-08-04  9:06 ` [RFC/Patch 1/5] Remove old enum definition of "Translate Spa" Yasunori Goto
2017-08-04 23:09   ` Dan Williams
2017-08-07  0:03     ` Yasunori Goto
2017-08-04  9:08 ` [RFC/Patch 2/5] Support Translate SPA for NVDIMM Root Device Yasunori Goto
2017-08-04 23:30   ` Dan Williams
2017-08-04  9:10 ` [RFC/Patch 3/5] nfit_test supports Translate SPA Yasunori Goto
2017-08-04  9:12 ` [RFC/Patch 4/5] libndctl Make interfaces to use " Yasunori Goto
2017-08-05  0:03   ` Dan Williams
2017-08-07  0:08     ` Yasunori Goto
2017-08-04  9:13 ` [RFC/Patch 5/5] ndctl: show dimm's name which has badblock by ndctl list command Yasunori Goto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.