Enable DSM pass thru for root functions
Subsystems (2)
v3 cover Enable DSM pass thru for root functions
The ACPI 6.2 spec added NVDIMM root DSM functions that managibility and test software need to call.
This patch set enables the calling of root functions DSMs via the pass thru mechanism.
Changes v3
----------
1. Fix checkpatch warnings
2. modify bus_dsm_mask_show to display name "dsm_mask" in sysfs.
3. modified submittal comments.
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.
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 in sysfs
libnvdimm: New ACPI 6.2 DSM functions
acpi, nfit: override mask
drivers/acpi/nfit/core.c | 23 +++++++++++++++++++++++ drivers/nvdimm/bus.c | 4 +++- include/linux/libnvdimm.h | 1 + include/uapi/linux/ndctl.h | 41 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 67 insertions(+), 2 deletions(-)
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 1/7 libnvdimm: passthru functions clear to send
Have dsm functions called via the pass thru mechanism also be checked against clear to send.
--- drivers/nvdimm/bus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvdimm/bus.c +3 -1
@@ -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;
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 2/7 acpi, nfit: Enable DSM pass thru for root functions.
In reply to Jerry HoemannSet ND_CMD_CALL in the cmd_mask to enable calling root functions via the pass thru mechanism.
--- drivers/acpi/nfit/core.c | 1 + include/uapi/linux/ndctl.h | 1 + 2 files changed, 2 insertions(+)
drivers/acpi/nfit/core.c +1 -0
@@ -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,
include/uapi/linux/ndctl.h +1 -0
@@ -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])
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 3/7 libnvdimm: Add bus level dsm mask.
In reply to Jerry HoemannAdd a bus level dsm_mask to nvdimm_bus_descriptor to allow the passthru calling mechanism to specify a different mask from the cmd_mask.
--- include/linux/libnvdimm.h | 1 + 1 file changed, 1 insertion(+)
include/linux/libnvdimm.h +1 -0
@@ -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;
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 3/7] libnvdimm: Add bus level dsm mask.
Quoted 21 lines · Jerry Hoemann
Add a bus level
dsm_masktonvdimm_bus_descriptorto allow the passthru calling mechanism to specify a different mask from thecmd_mask.Signed-off-by Jerry Hoemann <[email protected]>--- include/linux/libnvdimm.h | 1 + 1 file changed, 1 insertion(+)include/linux/libnvdimm.h +1
-1@@ -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; --
Quoted 2 lines
1.8.5.6
This patch can be squashed with the next one, it's ok to touch drivers/acpi and drivers/nvdimm in the same patch.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 4/7 acpi, nfit: Use bus_dsm_mask for passthru
In reply to Jerry HoemannPopulate bus_dsm_mask and use it to filter dsm calls that user can make through the pass thru interface.
--- drivers/acpi/nfit/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/acpi/nfit/core.c +5 -0
@@ -253,6 +253,8 @@ 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 +1626,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,
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 4/7] acpi, nfit: Use bus_dsm_mask for passthru
Quoted 22 lines · Jerry Hoemann
Populate
bus_dsm_maskand use it to filter dsm calls that user can make through the pass thru interface.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/acpi/nfit/core.c +2
-0@@ -253,6 +253,8 @@ 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;
drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1632
Quoted 7 lines
drivers/acpi/nfit/core.c +3
-0@@ -1624,6 +1626,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); }
This loop checks for function 6 which is specified as reserved. Lets explicitly test for the known good function numbers with something like this:
/* this should be private in drivers/acpi/nfit/nfit.h */ 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,
};
bus_dsm_mask =
(1 << ND_CMD_ARS_CAP) |
(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);for_each_set_bit(i, &bus_dsm_mask...
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 4/7] acpi, nfit: Use bus_dsm_mask for passthru
Quoted 53 lines · Dan Williams
Quoted 22 lines · Jerry Hoemann
Populate
bus_dsm_maskand use it to filter dsm calls that user can make through the pass thru interface.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/acpi/nfit/core.c +2
-0@@ -253,6 +253,8 @@ 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;drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1632
Quoted 7 lines
drivers/acpi/nfit/core.c +3
-0@@ -1624,6 +1626,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); }This loop checks for function 6 which is specified as reserved. Lets explicitly test for the known good function numbers with something like this:
/* this should be private in
drivers/acpi/nfit/nfit.h*/ enumnfit_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,
};
bus_dsm_mask=(1 << ND_CMD_ARS_CAP) | (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);
Quoted 1 line
for_each_set_bit(i,
&bus_dsm_mask...
I added the for_each_set_bit check in patch 7 of the series.
Signature · 7 lines
----------------------------------------------------------------------------- Jerry Hoemann Software Engineer Hewlett Packard Enterprise ----------------------------------------------------------------------------- _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 4/7] acpi, nfit: Use bus_dsm_mask for passthru
Quoted 54 lines · Jerry Hoemann
Quoted 53 lines · Dan Williams
Quoted 22 lines · Jerry Hoemann
Populate
bus_dsm_maskand use it to filter dsm calls that user can make through the pass thru interface.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/acpi/nfit/core.c +2
-0@@ -253,6 +253,8 @@ 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;drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1632
Quoted 7 lines
drivers/acpi/nfit/core.c +3
-0@@ -1624,6 +1626,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); }This loop checks for function 6 which is specified as reserved. Lets explicitly test for the known good function numbers with something like this:
/* this should be private in
drivers/acpi/nfit/nfit.h*/ enumnfit_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,
};
bus_dsm_mask=(1 << ND_CMD_ARS_CAP) | (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);
Quoted 4 lines
Quoted 1 line
for_each_set_bit(i,
&bus_dsm_mask...I added the
for_each_set_bitcheck in patch 7 of the series.
True, but in a patch series we shouldn't introduce a bug in one patch and fix it later in the same series. Also, if patch7 goes away we would need to fold that enabling in here.
Part of trying to parse what 0x3bf meant lead me to this, and I'm wondering if we should do the same for the other magic vendor dsm_mask constants, but that's a patch for another time.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 4/7] acpi, nfit: Use bus_dsm_mask for passthru
Quoted 55 lines · Dan Williams
Quoted 54 lines · Jerry Hoemann
Quoted 53 lines · Dan Williams
Quoted 22 lines · Jerry Hoemann
Populate
bus_dsm_maskand use it to filter dsm calls that user can make through the pass thru interface.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/acpi/nfit/core.c +2
-0@@ -253,6 +253,8 @@ 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;drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1632
Quoted 7 lines
drivers/acpi/nfit/core.c +3
-0@@ -1624,6 +1626,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); }This loop checks for function 6 which is specified as reserved. Lets explicitly test for the known good function numbers with something like this:
/* this should be private in
drivers/acpi/nfit/nfit.h*/ enumnfit_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,
};
bus_dsm_mask=(1 << ND_CMD_ARS_CAP) | (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);
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
for_each_set_bit(i,
&bus_dsm_mask...I added the
for_each_set_bitcheck in patch 7 of the series.True, but in a patch series we shouldn't introduce a bug in one patch and fix it later in the same series. Also, if patch7 goes away we would need to fold that enabling in here.
A bug? What bad thing happens?
Signature · 7 lines
----------------------------------------------------------------------------- Jerry Hoemann Software Engineer Hewlett Packard Enterprise ----------------------------------------------------------------------------- _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 4/7] acpi, nfit: Use bus_dsm_mask for passthru
Quoted 59 lines · Jerry Hoemann
Quoted 58 lines · Dan Williams
Quoted 57 lines · Jerry Hoemann
Quoted 54 lines · Dan Williams
Quoted 22 lines · Jerry Hoemann
Populate
bus_dsm_maskand use it to filter dsm calls that user can make through the pass thru interface.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/acpi/nfit/core.c +2
-0@@ -253,6 +253,8 @@ 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;drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1632
Quoted 7 lines
drivers/acpi/nfit/core.c +3
-0@@ -1624,6 +1626,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); }This loop checks for function 6 which is specified as reserved. Lets explicitly test for the known good function numbers with something like this:
/* this should be private in
drivers/acpi/nfit/nfit.h*/ enumnfit_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,
};
bus_dsm_mask=(1 << ND_CMD_ARS_CAP) | (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);for_each_set_bit(i,
&bus_dsm_mask...
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
I added the
for_each_set_bitcheck in patch 7 of the series.True, but in a patch series we shouldn't introduce a bug in one patch and fix it later in the same series. Also, if patch7 goes away we would need to fold that enabling in here.
A bug? What bad thing happens?
Ok, yes, not a bug, but in general terms if the review feedback is "patch4 has an issue" the answer (usually) can't be "but I I fix it in patch7". That instead means the fix in patch7 needs to move to patch4. So this is purely a Linux patch-review / process comment.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 5/7 acpi, nfit: Show bus_dsm_mask in sysfs
In reply to Jerry HoemannDisplay bus_dsm_mask in sysfs as /sys/bus/nd/devices/ndbusX/nfit/dsm_mask.
--- drivers/acpi/nfit/core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/nfit/core.c +12 -0
@@ -929,6 +929,17 @@ 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 struct device_attribute dev_attr_bus_dsm_mask = +__ATTR (dsm_mask,0444 , bus_dsm_mask_show,NULL ); +static ssize_t revision_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -1065,6 +1076,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, };
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 6/7 libnvdimm: New ACPI 6.2 DSM functions
In reply to Jerry HoemannACPI 6.2 added new NVDIMM root DSM functions. Define their data structures.
--- include/uapi/linux/ndctl.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
include/uapi/linux/ndctl.h +39 -1
@@ -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 ,
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
PATCH v3 7/7 acpi, nfit: override mask
In reply to Jerry HoemannHave module parameter override_dsm_mask override the dsm_mask for root calls like it does for non-root dsm calls.
--- drivers/acpi/nfit/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/acpi/nfit/core.c +6 -1
@@ -1627,6 +1627,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;
@@ -1638,7 +1639,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); }
Signature · 6 lines
1.8.5.6 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 7/7] acpi, nfit: override mask
Quoted 23 lines · Jerry Hoemann
Have module parameter
override_dsm_maskoverride thedsm_maskfor root calls like it does for non-root dsm calls.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/acpi/nfit/core.c +1
-0@@ -1627,6 +1627,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;@@ -1638,7 +1639,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);
drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1649
Quoted 10 lines
drivers/acpi/nfit/core.c +5
-1set_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); }
I don't think we need this patch. 'override_dsm_mask' is there to make it easier for vendor-specific DSM testing and debug for DIMM-level DSMs. The root bus is not vendor specific and the command set is not evolving at the same rate we are seeing change at DIMM-level DSMs.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 7/7] acpi, nfit: override mask
Quoted 31 lines · Dan Williams
Quoted 30 lines · Jerry Hoemann
Have module parameter
override_dsm_maskoverride thedsm_maskfor root calls like it does for non-root dsm calls.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/acpi/nfit/core.c +6
-1@@ -1627,6 +1627,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;@@ -1638,7 +1639,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 )
Quoted 8 lines
drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1649
Quoted 3 lines
drivers/acpi/nfit/core.c +0
-0if (acpi_check_dsm (adev->handle, uuid,1 ,1ULL << i))set_bit (i, &nd_desc->bus_dsm_mask); }I don't think we need this patch. '
override_dsm_mask' is there to make it easier for vendor-specific DSM testing and debug for DIMM-level DSMs. The root bus is not vendor specific and the command set is not evolving at the same rate we are seeing change at DIMM-level DSMs.
Override_dsm_mask is there to allow using old kernels with new firmware/hardware.
It takes a long time to get even simple changes upstreamed, backported to distros, released, distributed to customers, installed.
In testing, for months we have had to work around the inability to call these functions from linux. A waste of effort.
Signature · 7 lines
----------------------------------------------------------------------------- Jerry Hoemann Software Engineer Hewlett Packard Enterprise ----------------------------------------------------------------------------- _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Re: [PATCH v3 7/7] acpi, nfit: override mask
Quoted 41 lines · Jerry Hoemann
Quoted 31 lines · Dan Williams
Quoted 30 lines · Jerry Hoemann
Have module parameter
override_dsm_maskoverride thedsm_maskfor root calls like it does for non-root dsm calls.Signed-off-by Jerry Hoemann <[email protected]>--- drivers/acpi/nfit/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/acpi/nfit/core.c +6
-1@@ -1627,6 +1627,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;@@ -1638,7 +1639,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 )Quoted 8 lines
drivers/acpi/nfit/core.c static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) · line 1649
Quoted 3 lines
drivers/acpi/nfit/core.c +0
-0if (acpi_check_dsm (adev->handle, uuid,1 ,1ULL << i))set_bit (i, &nd_desc->bus_dsm_mask); }I don't think we need this patch. '
override_dsm_mask' is there to make it easier for vendor-specific DSM testing and debug for DIMM-level DSMs. The root bus is not vendor specific and the command set is not evolving at the same rate we are seeing change at DIMM-level DSMs.
Quoted 8 lines
Override_dsm_maskis there to allow using old kernels with newfirmware/hardware.It takes a long time to get even simple changes upstreamed, backported to distros, released, distributed to customers, installed.
In testing, for months we have had to work around the inability to call these functions from linux. A waste of effort.
I bought this argument for the DIMM level DSMs, but not the bus. Those move much more slowly precisely because they always need to go through the ACPI Speficication Working Group. DIMM level DSMs can change at will and I saw the need for the kernel to be able to keep up with that thrash especially at this early stage. We don't otherwise pre-enable unknown / future-possible ACPI standard interfaces.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm