summaryrefslogtreecommitdiff
path: root/drivers/cxl/security.c
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2023-06-12 11:10:33 -0700
committerDan Williams <dan.j.williams@intel.com>2023-06-25 14:54:51 -0700
commit9968c9dd568e83f57fdc1f6127f8b369a0594991 (patch)
treef36542a860c24868caeeffa6995f70ad113476d1 /drivers/cxl/security.c
parent8ea9c33d48f20479e87b5fc3a97cd25e656d30dc (diff)
cxl/mem: Introduce security state sysfs file
Add a read-only sysfs file to display the security state of a device (currently only pmem): /sys/bus/cxl/devices/memX/security/state This introduces a cxl_security_state structure that is to be the placeholder for common CXL security features. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Fan Ni <fan.ni@samsung.com> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20230612181038.14421-3-dave@stgolabs.net Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl/security.c')
-rw-r--r--drivers/cxl/security.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/cxl/security.c b/drivers/cxl/security.c
index 4ad4bda2d18e..9da6785dfd31 100644
--- a/drivers/cxl/security.c
+++ b/drivers/cxl/security.c
@@ -34,6 +34,9 @@ static unsigned long cxl_pmem_get_security_flags(struct nvdimm *nvdimm,
return 0;
sec_out = le32_to_cpu(out.flags);
+ /* cache security state */
+ cxlds->security.state = sec_out;
+
if (ptype == NVDIMM_MASTER) {
if (sec_out & CXL_PMEM_SEC_STATE_MASTER_PASS_SET)
set_bit(NVDIMM_SECURITY_UNLOCKED, &security_flags);