Lines Matching refs:mds
44 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); in firmware_version_show() local
46 if (!mds) in firmware_version_show()
48 return sysfs_emit(buf, "%.16s\n", mds->firmware_version); in firmware_version_show()
57 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); in payload_max_show() local
59 if (!mds) in payload_max_show()
61 return sysfs_emit(buf, "%zu\n", mds->payload_size); in payload_max_show()
70 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); in label_storage_size_show() local
72 if (!mds) in label_storage_size_show()
74 return sysfs_emit(buf, "%zu\n", mds->lsa_size); in label_storage_size_show()
127 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); in security_state_show() local
128 unsigned long state = mds->security.state; in security_state_show()
132 mutex_lock(&mds->mbox_mutex); in security_state_show()
133 if (mds->security.sanitize_active) in security_state_show()
135 mutex_unlock(&mds->mbox_mutex); in security_state_show()
324 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlmd->cxlds); in cxl_inject_poison() local
354 rc = cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_inject_poison()
360 dev_warn_once(mds->cxlds.dev, in cxl_inject_poison()
379 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlmd->cxlds); in cxl_clear_poison() local
418 rc = cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_clear_poison()
424 dev_warn_once(mds->cxlds.dev, in cxl_clear_poison()
495 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlmd->cxlds); in cxl_memdev_security_visible() local
498 !test_bit(CXL_SEC_ENABLED_SANITIZE, mds->security.enabled_cmds)) in cxl_memdev_security_visible()
502 !test_bit(CXL_SEC_ENABLED_SECURE_ERASE, mds->security.enabled_cmds)) in cxl_memdev_security_visible()
544 void set_exclusive_cxl_commands(struct cxl_memdev_state *mds, in set_exclusive_cxl_commands() argument
548 bitmap_or(mds->exclusive_cmds, mds->exclusive_cmds, cmds, in set_exclusive_cxl_commands()
559 void clear_exclusive_cxl_commands(struct cxl_memdev_state *mds, in clear_exclusive_cxl_commands() argument
563 bitmap_andnot(mds->exclusive_cmds, mds->exclusive_cmds, cmds, in clear_exclusive_cxl_commands()
696 static int cxl_mem_get_fw_info(struct cxl_memdev_state *mds) in cxl_mem_get_fw_info() argument
708 rc = cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_mem_get_fw_info()
712 mds->fw.num_slots = info.num_slots; in cxl_mem_get_fw_info()
713 mds->fw.cur_slot = FIELD_GET(CXL_FW_INFO_SLOT_INFO_CUR_MASK, in cxl_mem_get_fw_info()
730 static int cxl_mem_activate_fw(struct cxl_memdev_state *mds, int slot) in cxl_mem_activate_fw() argument
735 if (slot == 0 || slot > mds->fw.num_slots) in cxl_mem_activate_fw()
748 return cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_mem_activate_fw()
761 static int cxl_mem_abort_fw_xfer(struct cxl_memdev_state *mds) in cxl_mem_abort_fw_xfer() argument
782 rc = cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_mem_abort_fw_xfer()
789 struct cxl_memdev_state *mds = fwl->dd_handle; in cxl_fw_cleanup() local
791 mds->fw.next_slot = 0; in cxl_fw_cleanup()
796 struct cxl_memdev_state *mds = fwl->dd_handle; in cxl_fw_do_cancel() local
797 struct cxl_dev_state *cxlds = &mds->cxlds; in cxl_fw_do_cancel()
801 rc = cxl_mem_abort_fw_xfer(mds); in cxl_fw_do_cancel()
811 struct cxl_memdev_state *mds = fwl->dd_handle; in cxl_fw_prepare() local
817 mds->fw.oneshot = struct_size(transfer, data, size) < in cxl_fw_prepare()
818 mds->payload_size; in cxl_fw_prepare()
820 if (cxl_mem_get_fw_info(mds)) in cxl_fw_prepare()
827 if (test_and_clear_bit(CXL_FW_CANCEL, mds->fw.state)) in cxl_fw_prepare()
836 struct cxl_memdev_state *mds = fwl->dd_handle; in cxl_fw_write() local
837 struct cxl_dev_state *cxlds = &mds->cxlds; in cxl_fw_write()
861 cur_size = min_t(size_t, size, mds->payload_size - sizeof(*transfer)); in cxl_fw_write()
866 if (test_and_clear_bit(CXL_FW_CANCEL, mds->fw.state)) in cxl_fw_write()
874 mds->fw.next_slot = (mds->fw.cur_slot % mds->fw.num_slots) + 1; in cxl_fw_write()
883 if (mds->fw.oneshot) { in cxl_fw_write()
885 transfer->slot = mds->fw.next_slot; in cxl_fw_write()
891 transfer->slot = mds->fw.next_slot; in cxl_fw_write()
905 rc = cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_fw_write()
914 if (mds->fw.oneshot || remaining == 0) { in cxl_fw_write()
916 mds->fw.next_slot); in cxl_fw_write()
917 rc = cxl_mem_activate_fw(mds, mds->fw.next_slot); in cxl_fw_write()
935 struct cxl_memdev_state *mds = fwl->dd_handle; in cxl_fw_poll_complete() local
943 if (test_and_clear_bit(CXL_FW_CANCEL, mds->fw.state)) in cxl_fw_poll_complete()
951 struct cxl_memdev_state *mds = fwl->dd_handle; in cxl_fw_cancel() local
953 set_bit(CXL_FW_CANCEL, mds->fw.state); in cxl_fw_cancel()
969 int devm_cxl_setup_fw_upload(struct device *host, struct cxl_memdev_state *mds) in devm_cxl_setup_fw_upload() argument
971 struct cxl_dev_state *cxlds = &mds->cxlds; in devm_cxl_setup_fw_upload()
975 if (!test_bit(CXL_MEM_COMMAND_ID_GET_FW_INFO, mds->enabled_cmds)) in devm_cxl_setup_fw_upload()
979 &cxl_memdev_fw_ops, mds); in devm_cxl_setup_fw_upload()
1042 struct cxl_memdev_state *mds = data; in sanitize_teardown_notifier() local
1049 mutex_lock(&mds->mbox_mutex); in sanitize_teardown_notifier()
1050 state = mds->security.sanitize_node; in sanitize_teardown_notifier()
1051 mds->security.sanitize_node = NULL; in sanitize_teardown_notifier()
1052 mutex_unlock(&mds->mbox_mutex); in sanitize_teardown_notifier()
1054 cancel_delayed_work_sync(&mds->security.poll_dwork); in sanitize_teardown_notifier()
1062 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); in devm_cxl_sanitize_setup_notifier() local
1065 if (!test_bit(CXL_SEC_ENABLED_SANITIZE, mds->security.enabled_cmds)) in devm_cxl_sanitize_setup_notifier()
1075 mds->security.sanitize_node = sysfs_get_dirent(sec, "state"); in devm_cxl_sanitize_setup_notifier()
1077 if (!mds->security.sanitize_node) in devm_cxl_sanitize_setup_notifier()
1080 return devm_add_action_or_reset(host, sanitize_teardown_notifier, mds); in devm_cxl_sanitize_setup_notifier()