History

cxl/pmem: Add "Freeze Security State" security command support

Create callback function to support the nvdimm_security_ops() ->freeze() callback. Translate the operation to send "Freeze Security State" security command for CXL memory device. See CXL rev3.0 spec section 8.2.9.8.6.5 for reference.

Dave Jiang committed 3 years ago

Commit a072f7b1 parent abf0c834 files · +13 −0Browse files

Unified · Split

4 files
  1. drivers/cxl/core/mbox.c +1 −0
  2. drivers/cxl/cxlmem.h +1 −0
  3. drivers/cxl/security.c +10 −0
  4. include/uapi/linux/cxl_mem.h +1 −0
drivers/cxl/core/mbox.c+1−0
@@ -68,6 +68,7 @@ static struct cxl_mem_command cxl_mem_commands[CXL_MEM_COMMAND_ID_MAX] = { · 67 unmodified lines
68 CXL_CMD(GET_SECURITY_STATE, 0, 0x4, 0),68 CXL_CMD(GET_SECURITY_STATE, 0, 0x4, 0),
69 CXL_CMD(SET_PASSPHRASE, 0x60, 0, 0),69 CXL_CMD(SET_PASSPHRASE, 0x60, 0, 0),
70 CXL_CMD(DISABLE_PASSPHRASE, 0x40, 0, 0),70 CXL_CMD(DISABLE_PASSPHRASE, 0x40, 0, 0),
71 CXL_CMD(FREEZE_SECURITY, 0, 0, 0),
71};72};
72 73
73/*74/*
drivers/cxl/cxlmem.h+1−0
@@ -276,6 +276,7 @@ enum cxl_opcode { · 275 unmodified lines
276 CXL_MBOX_OP_GET_SECURITY_STATE = 0x4500,276 CXL_MBOX_OP_GET_SECURITY_STATE = 0x4500,
277 CXL_MBOX_OP_SET_PASSPHRASE = 0x4501,277 CXL_MBOX_OP_SET_PASSPHRASE = 0x4501,
278 CXL_MBOX_OP_DISABLE_PASSPHRASE = 0x4502,278 CXL_MBOX_OP_DISABLE_PASSPHRASE = 0x4502,
279 CXL_MBOX_OP_FREEZE_SECURITY = 0x4504,
279 CXL_MBOX_OP_MAX = 0x10000280 CXL_MBOX_OP_MAX = 0x10000
280};281};
281 282
drivers/cxl/security.c+10−0
@@ -87,10 +87,20 @@ static int cxl_pmem_security_disable(struct nvdimm *nvdimm, · 86 unmodified lines
87 return rc;87 return rc;
88}88}
89 89
90static int cxl_pmem_security_freeze(struct nvdimm *nvdimm)
91{
92 struct cxl_nvdimm *cxl_nvd = nvdimm_provider_data(nvdimm);
93 struct cxl_memdev *cxlmd = cxl_nvd->cxlmd;
94 struct cxl_dev_state *cxlds = cxlmd->cxlds;
95
96 return cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_FREEZE_SECURITY, NULL, 0, NULL, 0);
97}
98
90static const struct nvdimm_security_ops __cxl_security_ops = {99static const struct nvdimm_security_ops __cxl_security_ops = {
91 .get_flags = cxl_pmem_get_security_flags,100 .get_flags = cxl_pmem_get_security_flags,
92 .change_key = cxl_pmem_security_change_key,101 .change_key = cxl_pmem_security_change_key,
93 .disable = cxl_pmem_security_disable,102 .disable = cxl_pmem_security_disable,
103 .freeze = cxl_pmem_security_freeze,
94};104};
95 105
96const struct nvdimm_security_ops *cxl_security_ops = &__cxl_security_ops;106const struct nvdimm_security_ops *cxl_security_ops = &__cxl_security_ops;
include/uapi/linux/cxl_mem.h+1−0
@@ -44,6 +44,7 @@ · 43 unmodified lines
44 ___C(GET_SECURITY_STATE, "Get Security State"), \44 ___C(GET_SECURITY_STATE, "Get Security State"), \
45 ___C(SET_PASSPHRASE, "Set Passphrase"), \45 ___C(SET_PASSPHRASE, "Set Passphrase"), \
46 ___C(DISABLE_PASSPHRASE, "Disable Passphrase"), \46 ___C(DISABLE_PASSPHRASE, "Disable Passphrase"), \
47 ___C(FREEZE_SECURITY, "Freeze Security"), \
47 ___C(MAX, "invalid / last command")48 ___C(MAX, "invalid / last command")
48 49
49#define ___C(a, b) CXL_MEM_COMMAND_ID_##a50#define ___C(a, b) CXL_MEM_COMMAND_ID_##a

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t