* [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test
@ 2017-08-18 4:46 Yasunori Goto
2017-08-18 4:47 ` [PATCH 1/3] acpi nfit: move definitions which nfit_test will use Yasunori Goto
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Yasunori Goto @ 2017-08-18 4:46 UTC (permalink / raw)
To: NVDIMM-ML
This patch set is to emulate translate SPA feature by nfit_test.ko.
Certainly the nfit acpi driver supports translate SPA interface
via ND_CMD_CALL. But nfit_test does not support it yet.
To test translate SPA with nfit_test, this patch set is needed.
---
Change log since v1 [1]:
- Separate patch set of kenel from ndctl patch set.
- Change interface via ND_CMD_CALL.
[1] https://www.mail-archive.com/linux-nvdimm@lists.01.org/msg05287.html
----
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] 9+ messages in thread* [PATCH 1/3] acpi nfit: move definitions which nfit_test will use 2017-08-18 4:46 [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Yasunori Goto @ 2017-08-18 4:47 ` Yasunori Goto 2017-08-26 0:07 ` Dan Williams 2017-08-18 4:49 ` [PATCH 2/3] Enable to show what feature is supported via ND_CMD_CALL for nfit_test Yasunori Goto ` (2 subsequent siblings) 3 siblings, 1 reply; 9+ messages in thread From: Yasunori Goto @ 2017-08-18 4:47 UTC (permalink / raw) To: NVDIMM-ML To use nfit_test.ko can use the definition of NFIT_CMD_TRANSLATE_SPA, the defintion is moved from nfit/core.c to ndctl.h. Probably, other NFIT_CMD_XXX defintions will be used by nfit_test.ko in future. move them to ndctl.h at this time. --- drivers/acpi/nfit/core.c | 11 ----------- include/uapi/linux/ndctl.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 19182d0..00e49c2 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -1621,17 +1621,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) acpi_desc); } -/* - * These constants are private because there are no kernel consumers of - * 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, -}; - static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) { struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h index 6d3c542..a359d19 100644 --- a/include/uapi/linux/ndctl.h +++ b/include/uapi/linux/ndctl.h @@ -204,6 +204,17 @@ enum { ND_CMD_CALL = 10, }; +/* + * Though These constants are mainly used by acpi nfit driver, + * they are defined here for nfit_test.ko to be able to use them. + */ +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, +}; + enum { ND_ARS_VOLATILE = 1, ND_ARS_PERSISTENT = 2, _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] acpi nfit: move definitions which nfit_test will use 2017-08-18 4:47 ` [PATCH 1/3] acpi nfit: move definitions which nfit_test will use Yasunori Goto @ 2017-08-26 0:07 ` Dan Williams 0 siblings, 0 replies; 9+ messages in thread From: Dan Williams @ 2017-08-26 0:07 UTC (permalink / raw) To: Yasunori Goto; +Cc: NVDIMM-ML On Thu, Aug 17, 2017 at 9:47 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote: > > To use nfit_test.ko can use the definition of NFIT_CMD_TRANSLATE_SPA, > the defintion is moved from nfit/core.c to ndctl.h. > > Probably, other NFIT_CMD_XXX defintions will be used by nfit_test.ko in future. > move them to ndctl.h at this time. > > --- > drivers/acpi/nfit/core.c | 11 ----------- > include/uapi/linux/ndctl.h | 11 +++++++++++ > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c > index 19182d0..00e49c2 100644 > --- a/drivers/acpi/nfit/core.c > +++ b/drivers/acpi/nfit/core.c > @@ -1621,17 +1621,6 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc) > acpi_desc); > } > > -/* > - * These constants are private because there are no kernel consumers of > - * 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, > -}; > - > static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) > { > struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; > diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h > index 6d3c542..a359d19 100644 > --- a/include/uapi/linux/ndctl.h > +++ b/include/uapi/linux/ndctl.h > @@ -204,6 +204,17 @@ enum { > ND_CMD_CALL = 10, > }; > > +/* > + * Though These constants are mainly used by acpi nfit driver, > + * they are defined here for nfit_test.ko to be able to use them. > + */ > +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, Like I mentioned in the ndctl patches let's instead move these to a libndctl-nfit.h header. There's no need for the kernel to export these command numbers since it only passes them through to the acpi device. _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] Enable to show what feature is supported via ND_CMD_CALL for nfit_test 2017-08-18 4:46 [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Yasunori Goto 2017-08-18 4:47 ` [PATCH 1/3] acpi nfit: move definitions which nfit_test will use Yasunori Goto @ 2017-08-18 4:49 ` Yasunori Goto 2017-08-18 4:50 ` [PATCH 3/3] acpi nfit: nfit_test supports translate SPA Yasunori Goto 2017-09-21 21:52 ` [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Verma, Vishal L 3 siblings, 0 replies; 9+ messages in thread From: Yasunori Goto @ 2017-08-18 4:49 UTC (permalink / raw) To: NVDIMM-ML Though nfit_test need to show what feature is supported via ND_CMD_CALL on device/nfit/dsm_mask, currently there is no way to tell it. This patch makes to enable it. Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> --- drivers/acpi/nfit/core.c | 1 + drivers/acpi/nfit/nfit.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 00e49c2..8535f21 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -1630,6 +1630,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) int i; nd_desc->cmd_mask = acpi_desc->bus_cmd_force_en; + nd_desc->bus_dsm_mask = acpi_desc->bus_sub_cmd_force_en; adev = to_acpi_dev(acpi_desc); if (!adev) return; diff --git a/drivers/acpi/nfit/nfit.h b/drivers/acpi/nfit/nfit.h index 54292db..5ef95d6 100644 --- a/drivers/acpi/nfit/nfit.h +++ b/drivers/acpi/nfit/nfit.h @@ -167,6 +167,7 @@ struct acpi_nfit_desc { unsigned int init_complete:1; unsigned long dimm_cmd_force_en; unsigned long bus_cmd_force_en; + unsigned long bus_sub_cmd_force_en; int (*blk_do_io)(struct nd_blk_region *ndbr, resource_size_t dpa, void *iobuf, u64 len, int rw); }; _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] acpi nfit: nfit_test supports translate SPA 2017-08-18 4:46 [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Yasunori Goto 2017-08-18 4:47 ` [PATCH 1/3] acpi nfit: move definitions which nfit_test will use Yasunori Goto 2017-08-18 4:49 ` [PATCH 2/3] Enable to show what feature is supported via ND_CMD_CALL for nfit_test Yasunori Goto @ 2017-08-18 4:50 ` Yasunori Goto 2017-08-26 0:12 ` Dan Williams 2017-09-21 21:50 ` Verma, Vishal L 2017-09-21 21:52 ` [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Verma, Vishal L 3 siblings, 2 replies; 9+ messages in thread From: Yasunori Goto @ 2017-08-18 4:50 UTC (permalink / raw) To: NVDIMM-ML nfit_test supports translate SPA To test ndctl list which use interface of Translate SPA, nfit_test needs to emulates it. This test module searches region which includes SPA and returns 1 dimm handle which is last one. Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> --- drivers/nvdimm/region_devs.c | 1 + tools/testing/nvdimm/test/nfit.c | 98 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 98 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..426d1fa 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 = { @@ -449,6 +521,26 @@ static int nfit_test_ctl(struct nvdimm_bus_descriptor *nd_desc, } } else { struct ars_state *ars_state = &t->ars_state; + struct nd_cmd_pkg *call_pkg = buf; + + if (!nd_desc) + return -ENOTTY; + + if (cmd == ND_CMD_CALL) { + func = call_pkg->nd_command; + + buf_len = call_pkg->nd_size_in + call_pkg->nd_size_out; + buf = (void *) call_pkg->nd_payload; + + switch (func) { + case NFIT_CMD_TRANSLATE_SPA: + rc = nfit_test_cmd_translate_spa(acpi_desc->nvdimm_bus, + buf, buf_len); + return rc; + default: + return -ENOTTY; + } + } if (!nd_desc || !test_bit(cmd, &nd_desc->cmd_mask)) return -ENOTTY; @@ -1430,7 +1522,9 @@ 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_CALL, &acpi_desc->bus_cmd_force_en); set_bit(ND_CMD_SMART_THRESHOLD, &acpi_desc->dimm_cmd_force_en); + set_bit(NFIT_CMD_TRANSLATE_SPA, &acpi_desc->bus_sub_cmd_force_en); } static void nfit_test1_setup(struct nfit_test *t) @@ -1616,10 +1710,12 @@ 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_CALL, .module = THIS_MODULE, .provider_name = "ACPI.NFIT", .ndctl = acpi_nfit_ctl, + .bus_dsm_mask = 1UL << NFIT_CMD_TRANSLATE_SPA, }, .dev = &adev->dev, }; _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] acpi nfit: nfit_test supports translate SPA 2017-08-18 4:50 ` [PATCH 3/3] acpi nfit: nfit_test supports translate SPA Yasunori Goto @ 2017-08-26 0:12 ` Dan Williams 2017-08-28 0:47 ` Yasunori Goto 2017-09-21 21:50 ` Verma, Vishal L 1 sibling, 1 reply; 9+ messages in thread From: Dan Williams @ 2017-08-26 0:12 UTC (permalink / raw) To: Yasunori Goto; +Cc: NVDIMM-ML On Thu, Aug 17, 2017 at 9:50 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote: > > nfit_test supports translate SPA > > To test ndctl list which use interface of Translate SPA, > nfit_test needs to emulates it. > This test module searches region which includes SPA and > returns 1 dimm handle which is last one. > > > Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> > > --- > drivers/nvdimm/region_devs.c | 1 + > tools/testing/nvdimm/test/nfit.c | 98 +++++++++++++++++++++++++++++++++++++++- > 2 files changed, 98 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); Only a quick comment here because I need to run, but I'd like to find a way to support this without exporting this internal detail. We should be able to do this by just looking through the data that nfit_test registered with the acpi driver at init time. I'll try to think of a more concrete recommendation, but I do want the end solution to keep is_nd_pmem private to the libnvdimm core if at all possible. _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] acpi nfit: nfit_test supports translate SPA 2017-08-26 0:12 ` Dan Williams @ 2017-08-28 0:47 ` Yasunori Goto 0 siblings, 0 replies; 9+ messages in thread From: Yasunori Goto @ 2017-08-28 0:47 UTC (permalink / raw) To: Dan Williams; +Cc: NVDIMM-ML > On Thu, Aug 17, 2017 at 9:50 PM, Yasunori Goto <y-goto@jp.fujitsu.com> wrote: > > > > nfit_test supports translate SPA > > > > To test ndctl list which use interface of Translate SPA, > > nfit_test needs to emulates it. > > This test module searches region which includes SPA and > > returns 1 dimm handle which is last one. > > > > > > Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> > > > > --- > > drivers/nvdimm/region_devs.c | 1 + > > tools/testing/nvdimm/test/nfit.c | 98 +++++++++++++++++++++++++++++++++++++++- > > 2 files changed, 98 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); > > Only a quick comment here because I need to run, but I'd like to find > a way to support this without exporting this internal detail. We > should be able to do this by just looking through the data that > nfit_test registered with the acpi driver at init time. I'll try to > think of a more concrete recommendation, but I do want the end > solution to keep is_nd_pmem private to the libnvdimm core if at all > possible. > Ok, I'll reconsider it. _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] acpi nfit: nfit_test supports translate SPA 2017-08-18 4:50 ` [PATCH 3/3] acpi nfit: nfit_test supports translate SPA Yasunori Goto 2017-08-26 0:12 ` Dan Williams @ 2017-09-21 21:50 ` Verma, Vishal L 1 sibling, 0 replies; 9+ messages in thread From: Verma, Vishal L @ 2017-09-21 21:50 UTC (permalink / raw) To: y-goto@jp.fujitsu.com, linux-nvdimm@lists.01.org On Fri, 2017-08-18 at 13:50 +0900, Yasunori Goto wrote: > nfit_test supports translate SPA > > To test ndctl list which use interface of Translate SPA, > nfit_test needs to emulates it. > This test module searches region which includes SPA and > returns 1 dimm handle which is last one. > > > Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com> > > --- > drivers/nvdimm/region_devs.c | 1 + > tools/testing/nvdimm/test/nfit.c | 98 > +++++++++++++++++++++++++++++++++++++++- > 2 files changed, 98 insertions(+), 1 deletion(-) A few >80 character lines in this, but other than that, looks good to me. You can run patches through scripts/checkpatch.pl in the kernel tree to catch problems like this. Reviewed-by: Vishal Verma <vishal.l.verma@intel.com> > > 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..426d1fa 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) Over 80 char, you can split the line after 'bus' here. > +{ > + 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); >80 ch > + > + 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, >80 ch > + unsigned int buf_len) By convention, the second line starts after just two tab stops in this file. > +{ > + > + 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 = { > @@ -449,6 +521,26 @@ static int nfit_test_ctl(struct > nvdimm_bus_descriptor *nd_desc, > } > } else { > struct ars_state *ars_state = &t->ars_state; > + struct nd_cmd_pkg *call_pkg = buf; > + > + if (!nd_desc) > + return -ENOTTY; > + > + if (cmd == ND_CMD_CALL) { > + func = call_pkg->nd_command; > + > + buf_len = call_pkg->nd_size_in + call_pkg- > >nd_size_out; > + buf = (void *) call_pkg->nd_payload; > + > + switch (func) { > + case NFIT_CMD_TRANSLATE_SPA: > + rc = > nfit_test_cmd_translate_spa(acpi_desc->nvdimm_bus, > 80 ch > + buf, > buf_len); and a couple extra tab stops here. > + return rc; > + default: > + return -ENOTTY; > + } > + } > > if (!nd_desc || !test_bit(cmd, &nd_desc->cmd_mask)) > return -ENOTTY; > @@ -1430,7 +1522,9 @@ 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_CALL, &acpi_desc->bus_cmd_force_en); > set_bit(ND_CMD_SMART_THRESHOLD, &acpi_desc- > >dimm_cmd_force_en); > + set_bit(NFIT_CMD_TRANSLATE_SPA, &acpi_desc- > >bus_sub_cmd_force_en); > } > > static void nfit_test1_setup(struct nfit_test *t) > @@ -1616,10 +1710,12 @@ 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_CALL, > .module = THIS_MODULE, > .provider_name = "ACPI.NFIT", > .ndctl = acpi_nfit_ctl, > + .bus_dsm_mask = 1UL << > NFIT_CMD_TRANSLATE_SPA, > }, > .dev = &adev->dev, > }; > > > > _______________________________________________ > Linux-nvdimm mailing list > Linux-nvdimm@lists.01.org > https://lists.01.org/mailman/listinfo/linux-nvdimm _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test 2017-08-18 4:46 [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Yasunori Goto ` (2 preceding siblings ...) 2017-08-18 4:50 ` [PATCH 3/3] acpi nfit: nfit_test supports translate SPA Yasunori Goto @ 2017-09-21 21:52 ` Verma, Vishal L 3 siblings, 0 replies; 9+ messages in thread From: Verma, Vishal L @ 2017-09-21 21:52 UTC (permalink / raw) To: y-goto@jp.fujitsu.com, linux-nvdimm@lists.01.org On Fri, 2017-08-18 at 13:46 +0900, Yasunori Goto wrote: > This patch set is to emulate translate SPA feature by nfit_test.ko. > > Certainly the nfit acpi driver supports translate SPA interface > via ND_CMD_CALL. But nfit_test does not support it yet. > > To test translate SPA with nfit_test, this patch set is needed. > > --- > Change log since v1 [1]: > - Separate patch set of kenel from ndctl patch set. > - Change interface via ND_CMD_CALL. Other than the few checkpatch type issues, the series looks good to me. Reviewed-by: Vishal Verma <vishal.l.verma@intel.com> > > > [1] https://www.mail-archive.com/linux-nvdimm@lists.01.org/msg05287.ht > ml > > ---- > > Thanks, > --- > Yasunori Goto > > > > _______________________________________________ > Linux-nvdimm mailing list > Linux-nvdimm@lists.01.org > https://lists.01.org/mailman/listinfo/linux-nvdimm _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-09-21 21:48 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-08-18 4:46 [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Yasunori Goto 2017-08-18 4:47 ` [PATCH 1/3] acpi nfit: move definitions which nfit_test will use Yasunori Goto 2017-08-26 0:07 ` Dan Williams 2017-08-18 4:49 ` [PATCH 2/3] Enable to show what feature is supported via ND_CMD_CALL for nfit_test Yasunori Goto 2017-08-18 4:50 ` [PATCH 3/3] acpi nfit: nfit_test supports translate SPA Yasunori Goto 2017-08-26 0:12 ` Dan Williams 2017-08-28 0:47 ` Yasunori Goto 2017-09-21 21:50 ` Verma, Vishal L 2017-09-21 21:52 ` [PATCH 0/3] acpi nfit: make emulation of translate SPA on nfit_test Verma, Vishal L
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.