Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libnvdimm, acpi, nfit: Add bus level dsm mask for pass thru.

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.

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>
[djbw: use command number constants instead of a magic mask value]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>

authored by

Jerry Hoemann and committed by
Dan Williams
7db5bb33 37d74841

+28
+27
drivers/acpi/nfit/core.c
··· 253 253 cmd_name = nvdimm_bus_cmd_name(cmd); 254 254 cmd_mask = nd_desc->cmd_mask; 255 255 dsm_mask = cmd_mask; 256 + if (cmd == ND_CMD_CALL) 257 + dsm_mask = nd_desc->bus_dsm_mask; 256 258 desc = nd_cmd_bus_desc(cmd); 257 259 guid = to_nfit_uuid(NFIT_DEV_BUS); 258 260 handle = adev->handle; ··· 1610 1608 acpi_desc); 1611 1609 } 1612 1610 1611 + /* 1612 + * These constants are private because there are no kernel consumers of 1613 + * these commands. 1614 + */ 1615 + enum nfit_aux_cmds { 1616 + NFIT_CMD_TRANSLATE_SPA = 5, 1617 + NFIT_CMD_ARS_INJECT_SET = 7, 1618 + NFIT_CMD_ARS_INJECT_CLEAR = 8, 1619 + NFIT_CMD_ARS_INJECT_GET = 9, 1620 + }; 1621 + 1613 1622 static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) 1614 1623 { 1615 1624 struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; 1616 1625 const guid_t *guid = to_nfit_uuid(NFIT_DEV_BUS); 1617 1626 struct acpi_device *adev; 1627 + unsigned long dsm_mask; 1618 1628 int i; 1619 1629 1620 1630 nd_desc->cmd_mask = acpi_desc->bus_cmd_force_en; ··· 1638 1624 if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i)) 1639 1625 set_bit(i, &nd_desc->cmd_mask); 1640 1626 set_bit(ND_CMD_CALL, &nd_desc->cmd_mask); 1627 + 1628 + dsm_mask = 1629 + (1 << ND_CMD_ARS_CAP) | 1630 + (1 << ND_CMD_ARS_START) | 1631 + (1 << ND_CMD_ARS_STATUS) | 1632 + (1 << ND_CMD_CLEAR_ERROR) | 1633 + (1 << NFIT_CMD_TRANSLATE_SPA) | 1634 + (1 << NFIT_CMD_ARS_INJECT_SET) | 1635 + (1 << NFIT_CMD_ARS_INJECT_CLEAR) | 1636 + (1 << NFIT_CMD_ARS_INJECT_GET); 1637 + for_each_set_bit(i, &dsm_mask, BITS_PER_LONG) 1638 + if (acpi_check_dsm(adev->handle, guid, 1, 1ULL << i)) 1639 + set_bit(i, &nd_desc->bus_dsm_mask); 1641 1640 } 1642 1641 1643 1642 static ssize_t range_index_show(struct device *dev,
+1
include/linux/libnvdimm.h
··· 55 55 56 56 struct nvdimm_bus_descriptor { 57 57 const struct attribute_group **attr_groups; 58 + unsigned long bus_dsm_mask; 58 59 unsigned long cmd_mask; 59 60 struct module *module; 60 61 char *provider_name;