diff mbox

[1/3] Allow override of built-in bitmasks for NVDIMM DSMs

Message ID 8d9f517851514711df1012ed03d218931ea12b55.1488844291.git.linda.knippers@hpe.com (mailing list archive)
State Accepted
Commit 095ab4b39f91
Headers show

Commit Message

Linda Knippers March 7, 2017, 12:25 a.m. UTC
As it is today, we can't enable or test new NVDIMM management functions
provided by new firmware and tools without changing the kernel.  We also
can't prevent documented DSM functions from being called in the
case of buggy firmware.  This patch provides a module parameter that
overrides the DSM function mask that is built into the kernel.

If the "disable_vendor_specific" module parameter is also used
we ignore the new parameter. 

Signed-off-by: Linda Knippers <linda.knippers@hpe.com>
---
 drivers/acpi/nfit/core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Johannes Thumshirn March 7, 2017, 8:53 a.m. UTC | #1
On 03/07/2017 01:25 AM, Linda Knippers wrote:
> As it is today, we can't enable or test new NVDIMM management functions
> provided by new firmware and tools without changing the kernel.  We also
> can't prevent documented DSM functions from being called in the
> case of buggy firmware.  This patch provides a module parameter that
> overrides the DSM function mask that is built into the kernel.
> 
> If the "disable_vendor_specific" module parameter is also used
> we ignore the new parameter. 
> 
> Signed-off-by: Linda Knippers <linda.knippers@hpe.com>
> ---

Looks good to me,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
diff mbox

Patch

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 662036b..97d42ff 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -51,6 +51,10 @@ 
 MODULE_PARM_DESC(disable_vendor_specific,
 		"Limit commands to the publicly specified set\n");
 
+static unsigned long override_dsm_mask;
+module_param(override_dsm_mask, ulong, S_IRUGO);
+MODULE_PARM_DESC(override_dsm_mask, "Bitmask of allowed NVDIMM DSM functions");
+
 LIST_HEAD(acpi_descs);
 DEFINE_MUTEX(acpi_desc_lock);
 
@@ -1402,7 +1406,9 @@  static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
 
 	/* limit the supported commands to those that are publicly documented */
 	nfit_mem->family = i;
-	if (nfit_mem->family == NVDIMM_FAMILY_INTEL) {
+	if (override_dsm_mask && !disable_vendor_specific)
+		dsm_mask = override_dsm_mask;
+	else if (nfit_mem->family == NVDIMM_FAMILY_INTEL) {
 		dsm_mask = 0x3fe;
 		if (disable_vendor_specific)
 			dsm_mask &= ~(1 << ND_CMD_VENDOR);