Lines Matching refs:afu
44 struct afu *afu = cmd->parent; in process_cmd_err() local
45 struct cxlflash_cfg *cfg = afu->parent; in process_cmd_err()
156 struct afu *afu = cmd->parent; in cmd_complete() local
157 struct cxlflash_cfg *cfg = afu->parent; in cmd_complete()
159 struct hwq *hwq = get_hwq(afu, cmd->hwq_index); in cmd_complete()
193 struct cxlflash_cfg *cfg = hwq->afu->parent; in flush_pending_cmds()
237 struct cxlflash_cfg *cfg = hwq->afu->parent; in context_reset()
300 static int send_cmd_ioarrin(struct afu *afu, struct afu_cmd *cmd) in send_cmd_ioarrin() argument
302 struct cxlflash_cfg *cfg = afu->parent; in send_cmd_ioarrin()
304 struct hwq *hwq = get_hwq(afu, cmd->hwq_index); in send_cmd_ioarrin()
344 static int send_cmd_sq(struct afu *afu, struct afu_cmd *cmd) in send_cmd_sq() argument
346 struct cxlflash_cfg *cfg = afu->parent; in send_cmd_sq()
348 struct hwq *hwq = get_hwq(afu, cmd->hwq_index); in send_cmd_sq()
389 static int wait_resp(struct afu *afu, struct afu_cmd *cmd) in wait_resp() argument
391 struct cxlflash_cfg *cfg = afu->parent; in wait_resp()
423 struct afu *afu) in cmd_to_target_hwq() argument
428 if (afu->num_hwqs == 1) in cmd_to_target_hwq()
431 switch (afu->hwq_mode) { in cmd_to_target_hwq()
433 hwq = afu->hwq_rr_count++ % afu->num_hwqs; in cmd_to_target_hwq()
440 hwq = smp_processor_id() % afu->num_hwqs; in cmd_to_target_hwq()
461 struct afu *afu = cfg->afu; in send_tmf() local
464 struct hwq *hwq = get_hwq(afu, PRIMARY_HWQ); in send_tmf()
490 cmd->parent = afu; in send_tmf()
503 rc = afu->send_cmd(afu, cmd); in send_tmf()
563 struct afu *afu = cfg->afu; in cxlflash_queuecommand() local
567 int hwq_index = cmd_to_target_hwq(host, scp, afu); in cxlflash_queuecommand()
568 struct hwq *hwq = get_hwq(afu, hwq_index); in cxlflash_queuecommand()
608 atomic_inc(&afu->cmds_active); in cxlflash_queuecommand()
618 cmd->parent = afu; in cxlflash_queuecommand()
633 rc = afu->send_cmd(afu, cmd); in cxlflash_queuecommand()
634 atomic_dec(&afu->cmds_active); in cxlflash_queuecommand()
659 struct afu *afu = cfg->afu; in free_mem() local
661 if (cfg->afu) { in free_mem()
662 free_pages((ulong)afu, get_order(sizeof(struct afu))); in free_mem()
663 cfg->afu = NULL; in free_mem()
692 struct afu *afu = cfg->afu; in stop_afu() local
700 if (likely(afu)) { in stop_afu()
701 while (atomic_read(&afu->cmds_active)) in stop_afu()
704 if (afu_is_irqpoll_enabled(afu)) { in stop_afu()
705 for (i = 0; i < afu->num_hwqs; i++) { in stop_afu()
706 hwq = get_hwq(afu, i); in stop_afu()
712 if (likely(afu->afu_map)) { in stop_afu()
713 cfg->ops->psa_unmap(afu->afu_map); in stop_afu()
714 afu->afu_map = NULL; in stop_afu()
730 struct afu *afu = cfg->afu; in term_intr() local
734 if (!afu) { in term_intr()
739 hwq = get_hwq(afu, index); in term_intr()
776 struct afu *afu = cfg->afu; in term_mc() local
781 if (!afu) { in term_mc()
786 hwq = get_hwq(afu, index); in term_mc()
827 for (k = cfg->afu->num_hwqs - 1; k >= 0; k--) in term_afu()
832 for (k = cfg->afu->num_hwqs - 1; k >= 0; k--) in term_afu()
850 struct afu *afu = cfg->afu; in notify_shutdown() local
861 if (!afu || !afu->afu_map) { in notify_shutdown()
1011 cfg->afu = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, in alloc_mem()
1012 get_order(sizeof(struct afu))); in alloc_mem()
1013 if (unlikely(!cfg->afu)) { in alloc_mem()
1015 __func__, get_order(sizeof(struct afu))); in alloc_mem()
1019 cfg->afu->parent = cfg; in alloc_mem()
1020 cfg->afu->desired_hwqs = CXLFLASH_DEF_HWQS; in alloc_mem()
1021 cfg->afu->afu_map = NULL; in alloc_mem()
1188 static void afu_set_wwpn(struct afu *afu, int port, __be64 __iomem *fc_regs, in afu_set_wwpn() argument
1191 struct cxlflash_cfg *cfg = afu->parent; in afu_set_wwpn()
1224 static void afu_link_reset(struct afu *afu, int port, __be64 __iomem *fc_regs) in afu_link_reset() argument
1226 struct cxlflash_cfg *cfg = afu->parent; in afu_link_reset()
1231 port_sel = readq_be(&afu->afu_map->global.regs.afu_port_sel); in afu_link_reset()
1233 writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel); in afu_link_reset()
1234 cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC); in afu_link_reset()
1250 writeq_be(port_sel, &afu->afu_map->global.regs.afu_port_sel); in afu_link_reset()
1251 cxlflash_afu_sync(afu, 0, 0, AFU_GSYNC); in afu_link_reset()
1260 static void afu_err_intr_init(struct afu *afu) in afu_err_intr_init() argument
1262 struct cxlflash_cfg *cfg = afu->parent; in afu_err_intr_init()
1265 struct hwq *hwq = get_hwq(afu, PRIMARY_HWQ); in afu_err_intr_init()
1276 writeq_be(-1ULL, &afu->afu_map->global.regs.aintr_mask); in afu_err_intr_init()
1280 if (afu->internal_lun) in afu_err_intr_init()
1282 writeq_be(reg, &afu->afu_map->global.regs.afu_ctrl); in afu_err_intr_init()
1284 writeq_be(-1ULL, &afu->afu_map->global.regs.aintr_clear); in afu_err_intr_init()
1287 writeq_be(SISL_ASTATUS_MASK, &afu->afu_map->global.regs.aintr_mask); in afu_err_intr_init()
1290 writeq_be(-1ULL, &afu->afu_map->global.regs.aintr_clear); in afu_err_intr_init()
1296 if (afu->internal_lun) in afu_err_intr_init()
1297 reg |= ((u64)(afu->internal_lun - 1) << SISL_FC_INTERNAL_SHIFT); in afu_err_intr_init()
1314 for (i = 0; i < afu->num_hwqs; i++) { in afu_err_intr_init()
1315 hwq = get_hwq(afu, i); in afu_err_intr_init()
1335 struct cxlflash_cfg *cfg = hwq->afu->parent; in cxlflash_sync_err_irq()
1370 struct afu *afu = hwq->afu; in process_hrrq() local
1390 if (afu_is_sq_cmd_mode(afu)) { in process_hrrq()
1473 struct afu *afu = hwq->afu; in cxlflash_rrq_irq() local
1486 if (afu_is_irqpoll_enabled(afu)) { in cxlflash_rrq_irq()
1541 struct afu *afu = hwq->afu; in cxlflash_async_err_irq() local
1542 struct cxlflash_cfg *cfg = afu->parent; in cxlflash_async_err_irq()
1545 struct sisl_global_map __iomem *global = &afu->afu_map->global; in cxlflash_async_err_irq()
1709 struct afu *afu = cfg->afu; in init_pcr() local
1716 ctrl_map = &afu->afu_map->ctrls[i].ctrl; in init_pcr()
1725 for (i = 0; i < afu->num_hwqs; i++) { in init_pcr()
1726 hwq = get_hwq(afu, i); in init_pcr()
1730 hwq->host_map = &afu->afu_map->hosts[hwq->ctx_hndl].host; in init_pcr()
1731 hwq->ctrl_map = &afu->afu_map->ctrls[hwq->ctx_hndl].ctrl; in init_pcr()
1744 struct afu *afu = cfg->afu; in init_global() local
1763 for (i = 0; i < afu->num_hwqs; i++) { in init_global()
1764 hwq = get_hwq(afu, i); in init_global()
1771 if (afu_is_sq_cmd_mode(afu)) { in init_global()
1778 reg = readq_be(&afu->afu_map->global.regs.afu_config); in init_global()
1784 writeq_be(reg, &afu->afu_map->global.regs.afu_config); in init_global()
1787 if (afu->internal_lun) { in init_global()
1789 writeq_be(PORT0, &afu->afu_map->global.regs.afu_port_sel); in init_global()
1793 &afu->afu_map->global.regs.afu_port_sel); in init_global()
1808 afu_set_wwpn(afu, i, &fc_port_regs[0], wwpn[i]); in init_global()
1815 if (afu_is_ocxl_lisn(afu)) { in init_global()
1817 for (i = 0; i < afu->num_hwqs; i++) { in init_global()
1818 hwq = get_hwq(afu, i); in init_global()
1837 for (i = 0; i < afu->num_hwqs; i++) { in init_global()
1838 hwq = get_hwq(afu, i); in init_global()
1853 hwq = get_hwq(afu, PRIMARY_HWQ); in init_global()
1859 afu->hb = readq_be(&afu->afu_map->global.regs.afu_hb); in init_global()
1870 struct afu *afu = cfg->afu; in start_afu() local
1879 for (i = 0; i < afu->num_hwqs; i++) { in start_afu()
1880 hwq = get_hwq(afu, i); in start_afu()
1896 if (afu_is_sq_cmd_mode(afu)) { in start_afu()
1906 if (afu_is_irqpoll_enabled(afu)) in start_afu()
1907 irq_poll_init(&hwq->irqpoll, afu->irqpoll_weight, in start_afu()
1985 struct hwq *hwq = get_hwq(cfg->afu, index); in init_mc()
1990 hwq->afu = cfg->afu; in init_mc()
2066 struct afu *afu = cfg->afu; in get_num_afu_ports() local
2071 port_mask = readq_be(&afu->afu_map->global.regs.afu_port_sel); in get_num_afu_ports()
2095 struct afu *afu = cfg->afu; in init_afu() local
2102 mutex_init(&afu->sync_active); in init_afu()
2103 afu->num_hwqs = afu->desired_hwqs; in init_afu()
2104 for (i = 0; i < afu->num_hwqs; i++) { in init_afu()
2114 hwq = get_hwq(afu, PRIMARY_HWQ); in init_afu()
2115 afu->afu_map = cfg->ops->psa_map(hwq->ctx_cookie); in init_afu()
2116 if (!afu->afu_map) { in init_afu()
2123 reg = readq(&afu->afu_map->global.regs.afu_version); in init_afu()
2124 memcpy(afu->version, ®, sizeof(reg)); in init_afu()
2125 afu->interface_version = in init_afu()
2126 readq_be(&afu->afu_map->global.regs.interface_version); in init_afu()
2127 if ((afu->interface_version + 1) == 0) { in init_afu()
2129 "interface version %016llx\n", afu->version, in init_afu()
2130 afu->interface_version); in init_afu()
2135 if (afu_is_sq_cmd_mode(afu)) { in init_afu()
2136 afu->send_cmd = send_cmd_sq; in init_afu()
2137 afu->context_reset = context_reset_sq; in init_afu()
2139 afu->send_cmd = send_cmd_ioarrin; in init_afu()
2140 afu->context_reset = context_reset_ioarrin; in init_afu()
2144 afu->version, afu->interface_version); in init_afu()
2154 afu_err_intr_init(cfg->afu); in init_afu()
2155 for (i = 0; i < afu->num_hwqs; i++) { in init_afu()
2156 hwq = get_hwq(afu, i); in init_afu()
2168 for (i = afu->num_hwqs - 1; i >= 0; i--) { in init_afu()
2276 static int send_afu_cmd(struct afu *afu, struct sisl_ioarcb *rcb) in send_afu_cmd() argument
2278 struct cxlflash_cfg *cfg = afu->parent; in send_afu_cmd()
2281 struct hwq *hwq = get_hwq(afu, PRIMARY_HWQ); in send_afu_cmd()
2293 mutex_lock(&afu->sync_active); in send_afu_cmd()
2294 atomic_inc(&afu->cmds_active); in send_afu_cmd()
2309 cmd->parent = afu; in send_afu_cmd()
2314 __func__, afu, cmd, cmd->rcb.cdb[0], nretry); in send_afu_cmd()
2316 rc = afu->send_cmd(afu, cmd); in send_afu_cmd()
2322 rc = wait_resp(afu, cmd); in send_afu_cmd()
2325 rc = afu->context_reset(hwq); in send_afu_cmd()
2347 atomic_dec(&afu->cmds_active); in send_afu_cmd()
2348 mutex_unlock(&afu->sync_active); in send_afu_cmd()
2370 int cxlflash_afu_sync(struct afu *afu, ctx_hndl_t ctx, res_hndl_t res, u8 mode) in cxlflash_afu_sync() argument
2372 struct cxlflash_cfg *cfg = afu->parent; in cxlflash_afu_sync()
2377 __func__, afu, ctx, res, mode); in cxlflash_afu_sync()
2388 return send_afu_cmd(afu, &rcb); in cxlflash_afu_sync()
2408 struct afu *afu = cfg->afu; in cxlflash_eh_abort_handler() local
2409 struct hwq *hwq = get_hwq(afu, cmd->hwq_index); in cxlflash_eh_abort_handler()
2428 rc = afu->context_reset(hwq); in cxlflash_eh_abort_handler()
2666 struct afu *afu = cfg->afu; in lun_mode_show() local
2668 return scnprintf(buf, PAGE_SIZE, "%u\n", afu->internal_lun); in lun_mode_show()
2699 struct afu *afu = cfg->afu; in lun_mode_store() local
2704 if (!rc && (lun_mode < 5) && (lun_mode != afu->internal_lun)) { in lun_mode_store()
2705 afu->internal_lun = lun_mode; in lun_mode_store()
2712 if (afu->internal_lun) in lun_mode_store()
2862 struct afu *afu = cfg->afu; in irqpoll_weight_show() local
2864 return scnprintf(buf, PAGE_SIZE, "%u\n", afu->irqpoll_weight); in irqpoll_weight_show()
2885 struct afu *afu = cfg->afu; in irqpoll_weight_store() local
2900 if (weight == afu->irqpoll_weight) { in irqpoll_weight_store()
2906 if (afu_is_irqpoll_enabled(afu)) { in irqpoll_weight_store()
2907 for (i = 0; i < afu->num_hwqs; i++) { in irqpoll_weight_store()
2908 hwq = get_hwq(afu, i); in irqpoll_weight_store()
2914 afu->irqpoll_weight = weight; in irqpoll_weight_store()
2917 for (i = 0; i < afu->num_hwqs; i++) { in irqpoll_weight_store()
2918 hwq = get_hwq(afu, i); in irqpoll_weight_store()
2940 struct afu *afu = cfg->afu; in num_hwqs_show() local
2942 return scnprintf(buf, PAGE_SIZE, "%u\n", afu->num_hwqs); in num_hwqs_show()
2964 struct afu *afu = cfg->afu; in num_hwqs_store() local
2979 afu->desired_hwqs = min(num_hwqs, CXLFLASH_MAX_HWQS); in num_hwqs_store()
2980 WARN_ON_ONCE(afu->desired_hwqs == 0); in num_hwqs_store()
3025 struct afu *afu = cfg->afu; in hwq_mode_show() local
3027 return scnprintf(buf, PAGE_SIZE, "%s\n", hwq_mode_name[afu->hwq_mode]); in hwq_mode_show()
3051 struct afu *afu = cfg->afu; in hwq_mode_store() local
3067 afu->hwq_mode = mode; in hwq_mode_store()
3200 struct afu *afu = cfg->afu; in cxlflash_worker_thread() local
3224 afu_link_reset(afu, port, fc_port_regs); in cxlflash_worker_thread()
3285 struct afu *afu = cfg->afu; in cxlflash_lun_provision() local
3298 if (!afu_is_lun_provision(afu)) { in cxlflash_lun_provision()
3350 rc = send_afu_cmd(afu, &rcb); in cxlflash_lun_provision()
3379 struct afu *afu = cfg->afu; in cxlflash_afu_debug() local
3391 if (!afu_is_afu_debug(afu)) { in cxlflash_afu_debug()
3439 rc = send_afu_cmd(afu, &rcb); in cxlflash_afu_debug()