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
6868 CXL_CMD(GET_SECURITY_STATE, 0, 0x4, 0),
6969 CXL_CMD(SET_PASSPHRASE, 0x60, 0, 0),
7070 CXL_CMD(DISABLE_PASSPHRASE, 0x40, 0, 0),
71+ CXL_CMD(FREEZE_SECURITY, 0, 0, 0),
7172 };
7273
7374 /*
drivers/cxl/cxlmem.h+1−0
@@ -276,6 +276,7 @@ enum cxl_opcode { · 275 unmodified lines
276276 CXL_MBOX_OP_GET_SECURITY_STATE = 0x4500,
277277 CXL_MBOX_OP_SET_PASSPHRASE = 0x4501,
278278 CXL_MBOX_OP_DISABLE_PASSPHRASE = 0x4502,
279+ CXL_MBOX_OP_FREEZE_SECURITY = 0x4504,
279280 CXL_MBOX_OP_MAX = 0x10000
280281 };
281282
drivers/cxl/security.c+10−0
@@ -87,10 +87,20 @@ static int cxl_pmem_security_disable(struct nvdimm *nvdimm, · 86 unmodified lines
8787 return rc;
8888 }
8989
90+static 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+
9099 static const struct nvdimm_security_ops __cxl_security_ops = {
91100 .get_flags = cxl_pmem_get_security_flags,
92101 .change_key = cxl_pmem_security_change_key,
93102 .disable = cxl_pmem_security_disable,
103+ .freeze = cxl_pmem_security_freeze,
94104 };
95105
96106 const 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
4444 ___C(GET_SECURITY_STATE, "Get Security State"), \
4545 ___C(SET_PASSPHRASE, "Set Passphrase"), \
4646 ___C(DISABLE_PASSPHRASE, "Disable Passphrase"), \
47+ ___C(FREEZE_SECURITY, "Freeze Security"), \
4748 ___C(MAX, "invalid / last command")
4849
4950 #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