mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
cxl: add dimm_id support for __nvdimm_create()
Set the cxlds->serial as the dimm_id to be fed to __nvdimm_create(). The security code uses that as the key description for the security key of the memory device. The nvdimm unlock code cannot find the respective key without the dimm_id. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/166863357043.80269.4337575149671383294.stgit@djiang5-desk3.ch.intel.com Link: https://lore.kernel.org/r/166983620459.2734609.10175456773200251184.stgit@djiang5-desk3.ch.intel.com Link: https://lore.kernel.org/r/166993219918.1995348.10786511454826454601.stgit@dwillia2-xfh.jf.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
15a8348707
commit
b5807c80b5
|
|
@ -238,6 +238,13 @@ static struct cxl_nvdimm *cxl_nvdimm_alloc(struct cxl_memdev *cxlmd)
|
||||||
dev->parent = &cxlmd->dev;
|
dev->parent = &cxlmd->dev;
|
||||||
dev->bus = &cxl_bus_type;
|
dev->bus = &cxl_bus_type;
|
||||||
dev->type = &cxl_nvdimm_type;
|
dev->type = &cxl_nvdimm_type;
|
||||||
|
/*
|
||||||
|
* A "%llx" string is 17-bytes vs dimm_id that is max
|
||||||
|
* NVDIMM_KEY_DESC_LEN
|
||||||
|
*/
|
||||||
|
BUILD_BUG_ON(sizeof(cxl_nvd->dev_id) < 17 ||
|
||||||
|
sizeof(cxl_nvd->dev_id) > NVDIMM_KEY_DESC_LEN);
|
||||||
|
sprintf(cxl_nvd->dev_id, "%llx", cxlmd->cxlds->serial);
|
||||||
|
|
||||||
return cxl_nvd;
|
return cxl_nvd;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -420,11 +420,14 @@ struct cxl_nvdimm_bridge {
|
||||||
enum cxl_nvdimm_brige_state state;
|
enum cxl_nvdimm_brige_state state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CXL_DEV_ID_LEN 19
|
||||||
|
|
||||||
struct cxl_nvdimm {
|
struct cxl_nvdimm {
|
||||||
struct device dev;
|
struct device dev;
|
||||||
struct cxl_memdev *cxlmd;
|
struct cxl_memdev *cxlmd;
|
||||||
struct cxl_nvdimm_bridge *bridge;
|
struct cxl_nvdimm_bridge *bridge;
|
||||||
struct xarray pmem_regions;
|
struct xarray pmem_regions;
|
||||||
|
u8 dev_id[CXL_DEV_ID_LEN]; /* for nvdimm, string of 'serial' */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cxl_pmem_region_mapping {
|
struct cxl_pmem_region_mapping {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,8 @@ static int cxl_nvdimm_probe(struct device *dev)
|
||||||
set_bit(ND_CMD_SET_CONFIG_DATA, &cmd_mask);
|
set_bit(ND_CMD_SET_CONFIG_DATA, &cmd_mask);
|
||||||
nvdimm = __nvdimm_create(cxl_nvb->nvdimm_bus, cxl_nvd,
|
nvdimm = __nvdimm_create(cxl_nvb->nvdimm_bus, cxl_nvd,
|
||||||
cxl_dimm_attribute_groups, flags,
|
cxl_dimm_attribute_groups, flags,
|
||||||
cmd_mask, 0, NULL, NULL, cxl_security_ops, NULL);
|
cmd_mask, 0, NULL, cxl_nvd->dev_id,
|
||||||
|
cxl_security_ops, NULL);
|
||||||
if (!nvdimm) {
|
if (!nvdimm) {
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user