Lines Matching refs:mds
123 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); in cxl_pci_mbox_irq() local
131 mutex_lock(&mds->mbox_mutex); in cxl_pci_mbox_irq()
132 if (mds->security.sanitize_node) in cxl_pci_mbox_irq()
133 mod_delayed_work(system_wq, &mds->security.poll_dwork, 0); in cxl_pci_mbox_irq()
134 mutex_unlock(&mds->mbox_mutex); in cxl_pci_mbox_irq()
137 rcuwait_wake_up(&mds->mbox_wait); in cxl_pci_mbox_irq()
148 struct cxl_memdev_state *mds = in cxl_mbox_sanitize_work() local
149 container_of(work, typeof(*mds), security.poll_dwork.work); in cxl_mbox_sanitize_work()
150 struct cxl_dev_state *cxlds = &mds->cxlds; in cxl_mbox_sanitize_work()
152 mutex_lock(&mds->mbox_mutex); in cxl_mbox_sanitize_work()
154 mds->security.poll_tmo_secs = 0; in cxl_mbox_sanitize_work()
155 if (mds->security.sanitize_node) in cxl_mbox_sanitize_work()
156 sysfs_notify_dirent(mds->security.sanitize_node); in cxl_mbox_sanitize_work()
157 mds->security.sanitize_active = false; in cxl_mbox_sanitize_work()
161 int timeout = mds->security.poll_tmo_secs + 10; in cxl_mbox_sanitize_work()
163 mds->security.poll_tmo_secs = min(15 * 60, timeout); in cxl_mbox_sanitize_work()
164 schedule_delayed_work(&mds->security.poll_dwork, timeout * HZ); in cxl_mbox_sanitize_work()
166 mutex_unlock(&mds->mbox_mutex); in cxl_mbox_sanitize_work()
191 static int __cxl_pci_mbox_send_cmd(struct cxl_memdev_state *mds, in __cxl_pci_mbox_send_cmd() argument
194 struct cxl_dev_state *cxlds = &mds->cxlds; in __cxl_pci_mbox_send_cmd()
201 lockdep_assert_held(&mds->mbox_mutex); in __cxl_pci_mbox_send_cmd()
235 if (mds->security.poll_tmo_secs > 0) { in __cxl_pci_mbox_send_cmd()
296 if (mds->security.sanitize_active) in __cxl_pci_mbox_send_cmd()
301 mds->security.poll_tmo_secs = timeout; in __cxl_pci_mbox_send_cmd()
302 mds->security.sanitize_active = true; in __cxl_pci_mbox_send_cmd()
303 schedule_delayed_work(&mds->security.poll_dwork, in __cxl_pci_mbox_send_cmd()
314 if (rcuwait_wait_event_timeout(&mds->mbox_wait, in __cxl_pci_mbox_send_cmd()
359 n = min3(mbox_cmd->size_out, mds->payload_size, out_len); in __cxl_pci_mbox_send_cmd()
369 static int cxl_pci_mbox_send(struct cxl_memdev_state *mds, in cxl_pci_mbox_send() argument
374 mutex_lock_io(&mds->mbox_mutex); in cxl_pci_mbox_send()
375 rc = __cxl_pci_mbox_send_cmd(mds, cmd); in cxl_pci_mbox_send()
376 mutex_unlock(&mds->mbox_mutex); in cxl_pci_mbox_send()
381 static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds) in cxl_pci_setup_mailbox() argument
383 struct cxl_dev_state *cxlds = &mds->cxlds; in cxl_pci_setup_mailbox()
416 mds->mbox_send = cxl_pci_mbox_send; in cxl_pci_setup_mailbox()
417 mds->payload_size = in cxl_pci_setup_mailbox()
427 mds->payload_size = min_t(size_t, mds->payload_size, SZ_1M); in cxl_pci_setup_mailbox()
428 if (mds->payload_size < 256) { in cxl_pci_setup_mailbox()
430 mds->payload_size); in cxl_pci_setup_mailbox()
434 dev_dbg(dev, "Mailbox payload sized %zu", mds->payload_size); in cxl_pci_setup_mailbox()
436 rcuwait_init(&mds->mbox_wait); in cxl_pci_setup_mailbox()
437 INIT_DELAYED_WORK(&mds->security.poll_dwork, cxl_mbox_sanitize_work); in cxl_pci_setup_mailbox()
575 static int cxl_mem_alloc_event_buf(struct cxl_memdev_state *mds) in cxl_mem_alloc_event_buf() argument
579 buf = kvmalloc(mds->payload_size, GFP_KERNEL); in cxl_mem_alloc_event_buf()
582 mds->event.buf = buf; in cxl_mem_alloc_event_buf()
584 return devm_add_action_or_reset(mds->cxlds.dev, free_event_buf, buf); in cxl_mem_alloc_event_buf()
613 struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds); in cxl_event_thread() local
626 cxl_mem_get_event_records(mds, status); in cxl_event_thread()
649 static int cxl_event_get_int_policy(struct cxl_memdev_state *mds, in cxl_event_get_int_policy() argument
659 rc = cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_event_get_int_policy()
661 dev_err(mds->cxlds.dev, in cxl_event_get_int_policy()
667 static int cxl_event_config_msgnums(struct cxl_memdev_state *mds, in cxl_event_config_msgnums() argument
686 rc = cxl_internal_send_cmd(mds, &mbox_cmd); in cxl_event_config_msgnums()
688 dev_err(mds->cxlds.dev, "Failed to set event interrupt policy : %d", in cxl_event_config_msgnums()
694 return cxl_event_get_int_policy(mds, policy); in cxl_event_config_msgnums()
697 static int cxl_event_irqsetup(struct cxl_memdev_state *mds) in cxl_event_irqsetup() argument
699 struct cxl_dev_state *cxlds = &mds->cxlds; in cxl_event_irqsetup()
703 rc = cxl_event_config_msgnums(mds, &policy); in cxl_event_irqsetup()
742 struct cxl_memdev_state *mds) in cxl_event_config() argument
754 rc = cxl_mem_alloc_event_buf(mds); in cxl_event_config()
758 rc = cxl_event_get_int_policy(mds, &policy); in cxl_event_config()
766 dev_err(mds->cxlds.dev, in cxl_event_config()
771 rc = cxl_event_irqsetup(mds); in cxl_event_config()
775 cxl_mem_get_event_records(mds, CXLDEV_EVENT_STATUS_ALL); in cxl_event_config()
783 struct cxl_memdev_state *mds; in cxl_pci_probe() local
801 mds = cxl_memdev_state_create(&pdev->dev); in cxl_pci_probe()
802 if (IS_ERR(mds)) in cxl_pci_probe()
803 return PTR_ERR(mds); in cxl_pci_probe()
804 cxlds = &mds->cxlds; in cxl_pci_probe()
851 rc = cxl_pci_setup_mailbox(mds); in cxl_pci_probe()
855 rc = cxl_enumerate_cmds(mds); in cxl_pci_probe()
859 rc = cxl_set_timestamp(mds); in cxl_pci_probe()
863 rc = cxl_poison_state_init(mds); in cxl_pci_probe()
867 rc = cxl_dev_state_identify(mds); in cxl_pci_probe()
871 rc = cxl_mem_create_range_info(mds); in cxl_pci_probe()
879 rc = devm_cxl_setup_fw_upload(&pdev->dev, mds); in cxl_pci_probe()
910 rc = cxl_event_config(host_bridge, mds); in cxl_pci_probe()