linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Enable DSM pass thru for root functions
@ 2017-06-20 16:51 Jerry Hoemann
  2017-06-20 16:51 ` [PATCH v2 1/7] libnvdimm: passthru functions clear to send Jerry Hoemann
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

The new ACPI 6.2 spec has added new NVDIMM root DSM functions
that managibility and test software needs to call.

This patch set enables the calling root functions DSM via the
pass thru mechanism.

Changes v2
----------
1. Add bus_dsm_mask to filter root pass thru calls.

2. Add bus_dsm_mask_show to display bus_dsm_mask in sysfs

3. Extend override_dsm_mask to be used for bus_dms_mask also.




Details v1
----------

__nd_ioctl:
Check pass thru functions against nd_cmd_clear_to_send.

acpi_nfit_init_dsms:
Set additional bits in cmd_mask for new functions.

ndctl.h:
Define data structure for the new 6.2 functions.
Add new function names to nvdimm_bus_cmd_name.



Jerry Hoemann (7):
  libnvdimm: passthru functions clear to send
  acpi, nfit: Enable DSM pass thru for root functions.
  libnvdimm: Add bus level dsm mask.
  acpi, nfit: Use bus_dsm_mask for passthru
  acpi, nfit: Show bus_dsm_mask
  libnvdimm: New ACPI 6.2 DSM functions
  acpi, nfit: override mask

 drivers/acpi/nfit/core.c   | 20 ++++++++++++++++++++
 drivers/nvdimm/bus.c       |  4 +++-
 include/linux/libnvdimm.h  |  1 +
 include/uapi/linux/ndctl.h | 41 ++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 64 insertions(+), 2 deletions(-)

-- 
1.8.5.6

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

* [PATCH v2 1/7] libnvdimm: passthru functions clear to send
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
@ 2017-06-20 16:51 ` Jerry Hoemann
  2017-06-20 16:51 ` [PATCH v2 2/7] acpi, nfit: Enable DSM pass thru for root functions Jerry Hoemann
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

Have dsm functions called via the pass thru mechanism also
be checked against clear to send.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 drivers/nvdimm/bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index e9361bf..e16427d 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -907,6 +907,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
 	static char in_env[ND_CMD_MAX_ENVELOPE];
 	const struct nd_cmd_desc *desc = NULL;
 	unsigned int cmd = _IOC_NR(ioctl_cmd);
+	unsigned int func = cmd;
 	void __user *p = (void __user *) arg;
 	struct device *dev = &nvdimm_bus->dev;
 	struct nd_cmd_pkg pkg;
@@ -972,6 +973,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
 	}
 
 	if (cmd == ND_CMD_CALL) {
+		func = pkg.nd_command;
 		dev_dbg(dev, "%s:%s, idx: %llu, in: %zu, out: %zu, len %zu\n",
 				__func__, dimm_name, pkg.nd_command,
 				in_len, out_len, buf_len);
@@ -1020,7 +1022,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
 	}
 
 	nvdimm_bus_lock(&nvdimm_bus->dev);
-	rc = nd_cmd_clear_to_send(nvdimm_bus, nvdimm, cmd, buf);
+	rc = nd_cmd_clear_to_send(nvdimm_bus, nvdimm, func, buf);
 	if (rc)
 		goto out_unlock;
 
-- 
1.8.5.6

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

* [PATCH v2 2/7] acpi, nfit: Enable DSM pass thru for root functions.
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
  2017-06-20 16:51 ` [PATCH v2 1/7] libnvdimm: passthru functions clear to send Jerry Hoemann
@ 2017-06-20 16:51 ` Jerry Hoemann
  2017-06-20 16:51 ` [PATCH v2 3/7] libnvdimm: Add bus level dsm mask Jerry Hoemann
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

Set ND_CMD_CALL in the cmd_mask to enable calling root
functions via the pass trhu mechanism.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 drivers/acpi/nfit/core.c   | 1 +
 include/uapi/linux/ndctl.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 656acb5..b46fca2 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1623,6 +1623,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
 	for (i = ND_CMD_ARS_CAP; i <= ND_CMD_CLEAR_ERROR; i++)
 		if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i))
 			set_bit(i, &nd_desc->cmd_mask);
+	set_bit(ND_CMD_CALL, &nd_desc->cmd_mask);
 }
 
 static ssize_t range_index_show(struct device *dev,
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index 7ad3863..e23c37f 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -179,6 +179,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_CALL] = "cmd_call",
 	};
 
 	if (cmd < ARRAY_SIZE(names) && names[cmd])
-- 
1.8.5.6

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

* [PATCH v2 3/7] libnvdimm: Add bus level dsm mask.
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
  2017-06-20 16:51 ` [PATCH v2 1/7] libnvdimm: passthru functions clear to send Jerry Hoemann
  2017-06-20 16:51 ` [PATCH v2 2/7] acpi, nfit: Enable DSM pass thru for root functions Jerry Hoemann
@ 2017-06-20 16:51 ` Jerry Hoemann
  2017-06-20 16:51 ` [PATCH v2 4/7] acpi, nfit: Use bus_dsm_mask for passthru Jerry Hoemann
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

Add a bus level dsm_mask to nvdimm_bus_descriptor to allow the passthru
calling mechanism to specify a different mask from the cmd_mask.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 include/linux/libnvdimm.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index 6c80701..f8b8f43 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -54,6 +54,7 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc,
 
 struct nvdimm_bus_descriptor {
 	const struct attribute_group **attr_groups;
+	unsigned long bus_dsm_mask;
 	unsigned long cmd_mask;
 	struct module *module;
 	char *provider_name;
-- 
1.8.5.6

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

* [PATCH v2 4/7] acpi, nfit: Use bus_dsm_mask for passthru
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
                   ` (2 preceding siblings ...)
  2017-06-20 16:51 ` [PATCH v2 3/7] libnvdimm: Add bus level dsm mask Jerry Hoemann
@ 2017-06-20 16:51 ` Jerry Hoemann
  2017-06-28 21:09   ` Dan Williams
  2017-06-20 16:51 ` [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask Jerry Hoemann
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

Populate bus_dsm_mask and use it to filter dsm calls that user can
make through the pass thru interface.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 drivers/acpi/nfit/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index b46fca2..9d281a4 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -253,6 +253,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
 		cmd_name = nvdimm_bus_cmd_name(cmd);
 		cmd_mask = nd_desc->cmd_mask;
 		dsm_mask = cmd_mask;
+		if (cmd == ND_CMD_CALL) dsm_mask = nd_desc->bus_dsm_mask;
 		desc = nd_cmd_bus_desc(cmd);
 		uuid = to_nfit_uuid(NFIT_DEV_BUS);
 		handle = adev->handle;
@@ -1624,6 +1625,9 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
 		if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i))
 			set_bit(i, &nd_desc->cmd_mask);
 	set_bit(ND_CMD_CALL, &nd_desc->cmd_mask);
+	for (i = 0; i < ND_CMD_CALL; i++)
+		if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i))
+			set_bit(i, &nd_desc->bus_dsm_mask);
 }
 
 static ssize_t range_index_show(struct device *dev,
-- 
1.8.5.6

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

* [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
                   ` (3 preceding siblings ...)
  2017-06-20 16:51 ` [PATCH v2 4/7] acpi, nfit: Use bus_dsm_mask for passthru Jerry Hoemann
@ 2017-06-20 16:51 ` Jerry Hoemann
  2017-06-28 21:07   ` Dan Williams
  2017-06-20 16:51 ` [PATCH v2 6/7] libnvdimm: New ACPI 6.2 DSM functions Jerry Hoemann
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

Add bus_dsm_mask to sysfs display under /sys/bus/nd/devices/ndbusX/nfit.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 drivers/acpi/nfit/core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 9d281a4..f133b3e 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -928,6 +928,15 @@ static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
 	return 0;
 }
 
+static ssize_t bus_dsm_mask_show(struct device *dev,
+		struct device_attribute *attr, char *buf)
+{
+	struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
+	struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
+	return sprintf(buf, "%#lx\n", nd_desc->bus_dsm_mask);
+}
+static DEVICE_ATTR_RO(bus_dsm_mask);
+
 static ssize_t revision_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
@@ -1064,6 +1073,7 @@ static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
 	&dev_attr_revision.attr,
 	&dev_attr_scrub.attr,
 	&dev_attr_hw_error_scrub.attr,
+	&dev_attr_bus_dsm_mask.attr,
 	NULL,
 };
 
-- 
1.8.5.6

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

* [PATCH v2 6/7] libnvdimm: New ACPI 6.2 DSM functions
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
                   ` (4 preceding siblings ...)
  2017-06-20 16:51 ` [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask Jerry Hoemann
@ 2017-06-20 16:51 ` Jerry Hoemann
  2017-06-28 21:11   ` Dan Williams
  2017-06-20 16:51 ` [PATCH v2 7/7] acpi, nfit: override mask Jerry Hoemann
  2017-06-26 17:37 ` [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
  7 siblings, 1 reply; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

ACPI 6.2 added new NVDIMM root DSM functions.  Define their
data structures.

Update the definition of nd_cmd_ars_cap to match the 6.2 spec.

Add the new 6.2 functions names to nvdimm_bus_cmd_name.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 include/uapi/linux/ndctl.h | 40 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h
index e23c37f..e15768f 100644
--- a/include/uapi/linux/ndctl.h
+++ b/include/uapi/linux/ndctl.h
@@ -105,7 +105,8 @@ struct nd_cmd_ars_cap {
 	__u32 status;
 	__u32 max_ars_out;
 	__u32 clear_err_unit;
-	__u32 reserved;
+	__u16 flags;
+	__u16 reserved;
 } __packed;
 
 struct nd_cmd_ars_start {
@@ -144,6 +145,43 @@ struct nd_cmd_clear_error {
 	__u64 cleared;
 } __packed;
 
+struct nd_cmd_trans_spa {
+	__u64 spa;
+	__u32 status;
+	__u8  flags;
+	__u8  _reserved[3];
+	__u64 trans_length;
+	__u32 num_nvdimms;
+	struct nd_nvdimm_device {
+		__u32 nfit_device_handle;
+		__u32 _reserved;
+		__u64 dpa;
+	} __packed devices[0];
+
+} __packed;
+
+struct nd_cmd_ars_err_inj {
+	__u64 err_inj_spa_range_base;
+	__u64 err_inj_spa_range_length;
+	__u8  err_inj_options;
+	__u32 status;
+} __packed;
+
+struct nd_cmd_ars_err_inj_clr {
+	__u64 err_inj_clr_spa_range_base;
+	__u64 err_inj_clr_spa_range_length;
+	__u32 status;
+} __packed;
+
+struct nd_cmd_ars_err_inj_stat {
+	__u32 status;
+	__u32 inj_err_rec_count;
+	struct nd_error_stat_query_record {
+		__u64 err_inj_stat_spa_range_base;
+		__u64 err_inj_stat_spa_range_length;
+	} __packed record[0];
+} __packed;
+
 enum {
 	ND_CMD_IMPLEMENTED = 0,
 
-- 
1.8.5.6

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

* [PATCH v2 7/7] acpi, nfit: override mask
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
                   ` (5 preceding siblings ...)
  2017-06-20 16:51 ` [PATCH v2 6/7] libnvdimm: New ACPI 6.2 DSM functions Jerry Hoemann
@ 2017-06-20 16:51 ` Jerry Hoemann
  2017-06-26 17:37 ` [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
  7 siblings, 0 replies; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-20 16:51 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel, Jerry Hoemann

Add module parameter override_dsm_mask_root for overriding
the dsm_mask like we do for non-root dsm calls.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 drivers/acpi/nfit/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index f133b3e..456fcc2 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1624,6 +1624,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
 	struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc;
 	const u8 *uuid = to_nfit_uuid(NFIT_DEV_BUS);
 	struct acpi_device *adev;
+	unsigned long dsm_mask;
 	int i;
 
 	nd_desc->cmd_mask = acpi_desc->bus_cmd_force_en;
@@ -1635,7 +1636,11 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
 		if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i))
 			set_bit(i, &nd_desc->cmd_mask);
 	set_bit(ND_CMD_CALL, &nd_desc->cmd_mask);
-	for (i = 0; i < ND_CMD_CALL; i++)
+
+	dsm_mask = 0x3bf;
+	if (override_dsm_mask)
+		dsm_mask = override_dsm_mask;
+	for_each_set_bit(i, &dsm_mask, BITS_PER_LONG)
 		if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i))
 			set_bit(i, &nd_desc->bus_dsm_mask);
 }
-- 
1.8.5.6

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

* Re: [PATCH v2 0/7] Enable DSM pass thru for root functions
  2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
                   ` (6 preceding siblings ...)
  2017-06-20 16:51 ` [PATCH v2 7/7] acpi, nfit: override mask Jerry Hoemann
@ 2017-06-26 17:37 ` Jerry Hoemann
  7 siblings, 0 replies; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-26 17:37 UTC (permalink / raw)
  To: dan.j.williams; +Cc: linux-nvdimm, linux-kernel

On Tue, Jun 20, 2017 at 10:51:19AM -0600, Jerry Hoemann wrote:
> The new ACPI 6.2 spec has added new NVDIMM root DSM functions
> that managibility and test software needs to call.
> 
> This patch set enables the calling root functions DSM via the
> pass thru mechanism.
> 
> Changes v2
> ----------
> 1. Add bus_dsm_mask to filter root pass thru calls.
> 
> 2. Add bus_dsm_mask_show to display bus_dsm_mask in sysfs
> 
> 3. Extend override_dsm_mask to be used for bus_dms_mask also.
> 


  Dan,

  Did you have any feedback?

  Thanks

  Jerry

> 
> 
> 
> Details v1
> ----------
> 
> __nd_ioctl:
> Check pass thru functions against nd_cmd_clear_to_send.
> 
> acpi_nfit_init_dsms:
> Set additional bits in cmd_mask for new functions.
> 
> ndctl.h:
> Define data structure for the new 6.2 functions.
> Add new function names to nvdimm_bus_cmd_name.
> 
> 
> 
> Jerry Hoemann (7):
>   libnvdimm: passthru functions clear to send
>   acpi, nfit: Enable DSM pass thru for root functions.
>   libnvdimm: Add bus level dsm mask.
>   acpi, nfit: Use bus_dsm_mask for passthru
>   acpi, nfit: Show bus_dsm_mask
>   libnvdimm: New ACPI 6.2 DSM functions
>   acpi, nfit: override mask
> 
>  drivers/acpi/nfit/core.c   | 20 ++++++++++++++++++++
>  drivers/nvdimm/bus.c       |  4 +++-
>  include/linux/libnvdimm.h  |  1 +
>  include/uapi/linux/ndctl.h | 41 ++++++++++++++++++++++++++++++++++++++++-
>  4 files changed, 64 insertions(+), 2 deletions(-)
> 
> -- 
> 1.8.5.6

-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------

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

* Re: [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask
  2017-06-20 16:51 ` [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask Jerry Hoemann
@ 2017-06-28 21:07   ` Dan Williams
  2017-06-28 23:15     ` Jerry Hoemann
  0 siblings, 1 reply; 15+ messages in thread
From: Dan Williams @ 2017-06-28 21:07 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: linux-nvdimm, linux-kernel

On Tue, Jun 20, 2017 at 9:51 AM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> Add bus_dsm_mask to sysfs display under /sys/bus/nd/devices/ndbusX/nfit.
>
> Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> ---
>  drivers/acpi/nfit/core.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 9d281a4..f133b3e 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -928,6 +928,15 @@ static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
>         return 0;
>  }
>
> +static ssize_t bus_dsm_mask_show(struct device *dev,
> +               struct device_attribute *attr, char *buf)
> +{
> +       struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
> +       struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
> +       return sprintf(buf, "%#lx\n", nd_desc->bus_dsm_mask);
> +}
> +static DEVICE_ATTR_RO(bus_dsm_mask);
> +
>  static ssize_t revision_show(struct device *dev,
>                 struct device_attribute *attr, char *buf)
>  {
> @@ -1064,6 +1073,7 @@ static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
>         &dev_attr_revision.attr,
>         &dev_attr_scrub.attr,
>         &dev_attr_hw_error_scrub.attr,
> +       &dev_attr_bus_dsm_mask.attr,
>         NULL,
>  };

I think it's redundant to keep 'bus_' in the name of the attribute
since 'bus' is included in the sysfs path. You can use DEVICE_ATTR()
instead of DEVICE_ATTR_RO() to specify the attribute name manually,
and get around the collision with the existing dsm_mash_show()
routine.

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

* Re: [PATCH v2 4/7] acpi, nfit: Use bus_dsm_mask for passthru
  2017-06-20 16:51 ` [PATCH v2 4/7] acpi, nfit: Use bus_dsm_mask for passthru Jerry Hoemann
@ 2017-06-28 21:09   ` Dan Williams
  0 siblings, 0 replies; 15+ messages in thread
From: Dan Williams @ 2017-06-28 21:09 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: linux-nvdimm, linux-kernel

On Tue, Jun 20, 2017 at 9:51 AM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> Populate bus_dsm_mask and use it to filter dsm calls that user can
> make through the pass thru interface.
>
> Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> ---
>  drivers/acpi/nfit/core.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index b46fca2..9d281a4 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -253,6 +253,7 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
>                 cmd_name = nvdimm_bus_cmd_name(cmd);
>                 cmd_mask = nd_desc->cmd_mask;
>                 dsm_mask = cmd_mask;
> +               if (cmd == ND_CMD_CALL) dsm_mask = nd_desc->bus_dsm_mask;

Checkpatch complains about this:

ERROR: trailing statements should be on next line
#118: FILE: drivers/acpi/nfit/core.c:256:
+ if (cmd == ND_CMD_CALL) dsm_mask = nd_desc->bus_dsm_mask;

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

* Re: [PATCH v2 6/7] libnvdimm: New ACPI 6.2 DSM functions
  2017-06-20 16:51 ` [PATCH v2 6/7] libnvdimm: New ACPI 6.2 DSM functions Jerry Hoemann
@ 2017-06-28 21:11   ` Dan Williams
  0 siblings, 0 replies; 15+ messages in thread
From: Dan Williams @ 2017-06-28 21:11 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: linux-nvdimm, linux-kernel

On Tue, Jun 20, 2017 at 9:51 AM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> ACPI 6.2 added new NVDIMM root DSM functions.  Define their
> data structures.
>
> Update the definition of nd_cmd_ars_cap to match the 6.2 spec.
>
> Add the new 6.2 functions names to nvdimm_bus_cmd_name.

This part of the changelog is stale, just trim it when you resend the
series with the other fixups.

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

* Re: [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask
  2017-06-28 21:07   ` Dan Williams
@ 2017-06-28 23:15     ` Jerry Hoemann
  2017-06-28 23:29       ` Dan Williams
  0 siblings, 1 reply; 15+ messages in thread
From: Jerry Hoemann @ 2017-06-28 23:15 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-nvdimm, linux-kernel

On Wed, Jun 28, 2017 at 02:07:20PM -0700, Dan Williams wrote:
> On Tue, Jun 20, 2017 at 9:51 AM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> > Add bus_dsm_mask to sysfs display under /sys/bus/nd/devices/ndbusX/nfit.
> >
> > Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
> > ---
> >  drivers/acpi/nfit/core.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> > index 9d281a4..f133b3e 100644
> > --- a/drivers/acpi/nfit/core.c
> > +++ b/drivers/acpi/nfit/core.c
> > @@ -928,6 +928,15 @@ static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
> >         return 0;
> >  }
> >
> > +static ssize_t bus_dsm_mask_show(struct device *dev,
> > +               struct device_attribute *attr, char *buf)
> > +{
> > +       struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
> > +       struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
> > +       return sprintf(buf, "%#lx\n", nd_desc->bus_dsm_mask);
> > +}
> > +static DEVICE_ATTR_RO(bus_dsm_mask);
> > +
> >  static ssize_t revision_show(struct device *dev,
> >                 struct device_attribute *attr, char *buf)
> >  {
> > @@ -1064,6 +1073,7 @@ static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
> >         &dev_attr_revision.attr,
> >         &dev_attr_scrub.attr,
> >         &dev_attr_hw_error_scrub.attr,
> > +       &dev_attr_bus_dsm_mask.attr,
> >         NULL,
> >  };
> 
> I think it's redundant to keep 'bus_' in the name of the attribute
> since 'bus' is included in the sysfs path. You can use DEVICE_ATTR()
> instead of DEVICE_ATTR_RO() to specify the attribute name manually,
> and get around the collision with the existing dsm_mash_show()
> routine.

DEVICE_ATTR and DEVICE_ATTR_RO uses the same tokenization & stringification
schemes, so that doesn't disambiguate.  They need to be different
case sensitive names if they are to be in same source file.

Do you want me to change name to root_dsm_mask?  or change case: DSM_MASK?



-- 

-----------------------------------------------------------------------------
Jerry Hoemann                  Software Engineer   Hewlett Packard Enterprise
-----------------------------------------------------------------------------

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

* Re: [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask
  2017-06-28 23:15     ` Jerry Hoemann
@ 2017-06-28 23:29       ` Dan Williams
  2017-06-28 23:31         ` Dan Williams
  0 siblings, 1 reply; 15+ messages in thread
From: Dan Williams @ 2017-06-28 23:29 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: linux-nvdimm, linux-kernel

On Wed, Jun 28, 2017 at 4:15 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
> On Wed, Jun 28, 2017 at 02:07:20PM -0700, Dan Williams wrote:
>> On Tue, Jun 20, 2017 at 9:51 AM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>> > Add bus_dsm_mask to sysfs display under /sys/bus/nd/devices/ndbusX/nfit.
>> >
>> > Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
>> > ---
>> >  drivers/acpi/nfit/core.c | 10 ++++++++++
>> >  1 file changed, 10 insertions(+)
>> >
>> > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
>> > index 9d281a4..f133b3e 100644
>> > --- a/drivers/acpi/nfit/core.c
>> > +++ b/drivers/acpi/nfit/core.c
>> > @@ -928,6 +928,15 @@ static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
>> >         return 0;
>> >  }
>> >
>> > +static ssize_t bus_dsm_mask_show(struct device *dev,
>> > +               struct device_attribute *attr, char *buf)
>> > +{
>> > +       struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
>> > +       struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
>> > +       return sprintf(buf, "%#lx\n", nd_desc->bus_dsm_mask);
>> > +}
>> > +static DEVICE_ATTR_RO(bus_dsm_mask);
>> > +
>> >  static ssize_t revision_show(struct device *dev,
>> >                 struct device_attribute *attr, char *buf)
>> >  {
>> > @@ -1064,6 +1073,7 @@ static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
>> >         &dev_attr_revision.attr,
>> >         &dev_attr_scrub.attr,
>> >         &dev_attr_hw_error_scrub.attr,
>> > +       &dev_attr_bus_dsm_mask.attr,
>> >         NULL,
>> >  };
>>
>> I think it's redundant to keep 'bus_' in the name of the attribute
>> since 'bus' is included in the sysfs path. You can use DEVICE_ATTR()
>> instead of DEVICE_ATTR_RO() to specify the attribute name manually,
>> and get around the collision with the existing dsm_mash_show()
>> routine.
>
> DEVICE_ATTR and DEVICE_ATTR_RO uses the same tokenization & stringification
> schemes, so that doesn't disambiguate.  They need to be different
> case sensitive names if they are to be in same source file.
>
> Do you want me to change name to root_dsm_mask?  or change case: DSM_MASK?

I'm saying do something like this:

   DEVICE_ATTR(dsm_mask, 0444, bus_dsm_mask_show, NULL)

...so that the attribute name in sysfs is just 'dsm_mask'.

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

* Re: [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask
  2017-06-28 23:29       ` Dan Williams
@ 2017-06-28 23:31         ` Dan Williams
  0 siblings, 0 replies; 15+ messages in thread
From: Dan Williams @ 2017-06-28 23:31 UTC (permalink / raw)
  To: Jerry Hoemann; +Cc: linux-nvdimm, linux-kernel

On Wed, Jun 28, 2017 at 4:29 PM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Wed, Jun 28, 2017 at 4:15 PM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>> On Wed, Jun 28, 2017 at 02:07:20PM -0700, Dan Williams wrote:
>>> On Tue, Jun 20, 2017 at 9:51 AM, Jerry Hoemann <jerry.hoemann@hpe.com> wrote:
>>> > Add bus_dsm_mask to sysfs display under /sys/bus/nd/devices/ndbusX/nfit.
>>> >
>>> > Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
>>> > ---
>>> >  drivers/acpi/nfit/core.c | 10 ++++++++++
>>> >  1 file changed, 10 insertions(+)
>>> >
>>> > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
>>> > index 9d281a4..f133b3e 100644
>>> > --- a/drivers/acpi/nfit/core.c
>>> > +++ b/drivers/acpi/nfit/core.c
>>> > @@ -928,6 +928,15 @@ static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
>>> >         return 0;
>>> >  }
>>> >
>>> > +static ssize_t bus_dsm_mask_show(struct device *dev,
>>> > +               struct device_attribute *attr, char *buf)
>>> > +{
>>> > +       struct nvdimm_bus *nvdimm_bus = to_nvdimm_bus(dev);
>>> > +       struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
>>> > +       return sprintf(buf, "%#lx\n", nd_desc->bus_dsm_mask);
>>> > +}
>>> > +static DEVICE_ATTR_RO(bus_dsm_mask);
>>> > +
>>> >  static ssize_t revision_show(struct device *dev,
>>> >                 struct device_attribute *attr, char *buf)
>>> >  {
>>> > @@ -1064,6 +1073,7 @@ static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
>>> >         &dev_attr_revision.attr,
>>> >         &dev_attr_scrub.attr,
>>> >         &dev_attr_hw_error_scrub.attr,
>>> > +       &dev_attr_bus_dsm_mask.attr,
>>> >         NULL,
>>> >  };
>>>
>>> I think it's redundant to keep 'bus_' in the name of the attribute
>>> since 'bus' is included in the sysfs path. You can use DEVICE_ATTR()
>>> instead of DEVICE_ATTR_RO() to specify the attribute name manually,
>>> and get around the collision with the existing dsm_mash_show()
>>> routine.
>>
>> DEVICE_ATTR and DEVICE_ATTR_RO uses the same tokenization & stringification
>> schemes, so that doesn't disambiguate.  They need to be different
>> case sensitive names if they are to be in same source file.
>>
>> Do you want me to change name to root_dsm_mask?  or change case: DSM_MASK?
>
> I'm saying do something like this:
>
>    DEVICE_ATTR(dsm_mask, 0444, bus_dsm_mask_show, NULL)
>
> ...so that the attribute name in sysfs is just 'dsm_mask'.

Actually, you'll need to go further and use __ATTR() directly to
initialize a bus_dsm_mask_attr.

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

end of thread, other threads:[~2017-06-28 23:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-20 16:51 [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann
2017-06-20 16:51 ` [PATCH v2 1/7] libnvdimm: passthru functions clear to send Jerry Hoemann
2017-06-20 16:51 ` [PATCH v2 2/7] acpi, nfit: Enable DSM pass thru for root functions Jerry Hoemann
2017-06-20 16:51 ` [PATCH v2 3/7] libnvdimm: Add bus level dsm mask Jerry Hoemann
2017-06-20 16:51 ` [PATCH v2 4/7] acpi, nfit: Use bus_dsm_mask for passthru Jerry Hoemann
2017-06-28 21:09   ` Dan Williams
2017-06-20 16:51 ` [PATCH v2 5/7] acpi, nfit: Show bus_dsm_mask Jerry Hoemann
2017-06-28 21:07   ` Dan Williams
2017-06-28 23:15     ` Jerry Hoemann
2017-06-28 23:29       ` Dan Williams
2017-06-28 23:31         ` Dan Williams
2017-06-20 16:51 ` [PATCH v2 6/7] libnvdimm: New ACPI 6.2 DSM functions Jerry Hoemann
2017-06-28 21:11   ` Dan Williams
2017-06-20 16:51 ` [PATCH v2 7/7] acpi, nfit: override mask Jerry Hoemann
2017-06-26 17:37 ` [PATCH v2 0/7] Enable DSM pass thru for root functions Jerry Hoemann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).