cxl/pmem: Add "Set Passphrase" security command support
authorDave Jiang <dave.jiang@intel.com>
Wed, 30 Nov 2022 19:21:47 +0000 (12:21 -0700)
committerDan Williams <dan.j.williams@intel.com>
Thu, 1 Dec 2022 20:42:35 +0000 (12:42 -0800)
commit997469407f266250040f20ec73aecc77ad277145
tree33e23e75c0eff11db9d12ea02907bb7e07cff8fa
parent1fa99be35ab3591fbee99b652c10ac8af131d6ee
cxl/pmem: Add "Set Passphrase" security command support

Create callback function to support the nvdimm_security_ops ->change_key()
callback. Translate the operation to send "Set Passphrase" security command
for CXL memory device. The operation supports setting a passphrase for the
CXL persistent memory device. It also supports the changing of the
currently set passphrase. The operation allows manipulation of a user
passphrase or a master passphrase.

See CXL rev3.0 spec section 8.2.9.8.6.2 for reference.

However, the spec leaves a gap WRT master passphrase usages. The spec does
not define any ways to retrieve the status of if the support of master
passphrase is available for the device, nor does the commands that utilize
master passphrase will return a specific error that indicates master
passphrase is not supported. If using a device does not support master
passphrase and a command is issued with a master passphrase, the error
message returned by the device will be ambiguous.

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/166983610751.2734609.4445075071552032091.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/mbox.c
drivers/cxl/cxlmem.h
drivers/cxl/security.c
include/uapi/linux/cxl_mem.h