Lines Matching +full:poll +full:- +full:retry +full:- +full:count
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2016-17 IBM Corp.
18 #include <asm/ppc-opcode.h>
21 #include "copy-paste.h"
24 #include "vas-trace.h"
28 * ->paste_base_addr and ->paste_win_id_shift we got from device tree.
35 base = window->vinst->paste_base_addr; in vas_win_paste_addr()
36 shift = window->vinst->paste_win_id_shift; in vas_win_paste_addr()
37 winid = window->vas_win.winid; in vas_win_paste_addr()
51 pbaddr = window->vinst->hvwc_bar_start; in get_hvwc_mmio_bar()
52 *start = pbaddr + window->vas_win.winid * VAS_HVWC_SIZE; in get_hvwc_mmio_bar()
61 pbaddr = window->vinst->uwc_bar_start; in get_uwc_mmio_bar()
62 *start = pbaddr + window->vas_win.winid * VAS_UWC_SIZE; in get_uwc_mmio_bar()
69 * be mapped cache-able and is only applicable to send windows.
78 name = kasprintf(GFP_KERNEL, "window-v%d-w%d", txwin->vinst->vas_id, in map_paste_region()
79 txwin->vas_win.winid); in map_paste_region()
83 txwin->paste_addr_name = name; in map_paste_region()
104 return ERR_PTR(-ENOMEM); in map_paste_region()
141 if (window->paste_kaddr) { in unmap_paste_region()
143 unmap_region(window->paste_kaddr, busaddr_start, len); in unmap_paste_region()
144 window->paste_kaddr = NULL; in unmap_paste_region()
145 kfree(window->paste_addr_name); in unmap_paste_region()
146 window->paste_addr_name = NULL; in unmap_paste_region()
155 * a per-instance mutex later if necessary.
166 hvwc_map = window->hvwc_map; in unmap_winctx_mmio_bars()
167 window->hvwc_map = NULL; in unmap_winctx_mmio_bars()
169 uwc_map = window->uwc_map; in unmap_winctx_mmio_bars()
170 window->uwc_map = NULL; in unmap_winctx_mmio_bars()
196 window->hvwc_map = map_mmio_region("HVWCM_Window", start, len); in map_winctx_mmio_bars()
199 window->uwc_map = map_mmio_region("UWCM_Window", start, len); in map_winctx_mmio_bars()
201 if (!window->hvwc_map || !window->uwc_map) { in map_winctx_mmio_bars()
203 return -1; in map_winctx_mmio_bars()
254 /* Skip read-only registers: NX_UTIL and NX_UTIL_SE */ in reset_window_regs()
330 * Initialize Reserved Send Buffer Count for the send window. It involves
334 * Since we can only make a best-effort attempt to fulfill the request,
357 * write the per-chip RX FIFO addresses to the windows during boot-up
358 * as a one-time task? That could work for NX but what about other
359 * receivers? Let the receivers tell us the rx-fifo buffers for now.
370 val = SET_FIELD(VAS_LPID, val, winctx->lpid); in init_winctx_regs()
374 val = SET_FIELD(VAS_PID_ID, val, winctx->pidr); in init_winctx_regs()
377 init_xlate_regs(window, winctx->user_win); in init_winctx_regs()
380 val = SET_FIELD(VAS_FAULT_TX_WIN, val, winctx->fault_win_id); in init_winctx_regs()
387 val = SET_FIELD(VAS_HV_INTR_SRC_RA, val, winctx->irq_port); in init_winctx_regs()
391 val = SET_FIELD(VAS_PSWID_EA_HANDLE, val, winctx->pswid); in init_winctx_regs()
400 * register as is - do NOT shift the address into VAS_LFIFO_BAR in init_winctx_regs()
401 * bit fields! Ok to set the page migration select fields - in init_winctx_regs()
407 val = winctx->rx_fifo; in init_winctx_regs()
412 val = SET_FIELD(VAS_LDATA_STAMP, val, winctx->data_stamp); in init_winctx_regs()
416 val = SET_FIELD(VAS_LDMA_TYPE, val, winctx->dma_type); in init_winctx_regs()
417 val = SET_FIELD(VAS_LDMA_FIFO_DISABLE, val, winctx->fifo_disable); in init_winctx_regs()
425 val = SET_FIELD(VAS_LRX_WCRED, val, winctx->wcreds_max); in init_winctx_regs()
429 val = SET_FIELD(VAS_TX_WCRED, val, winctx->wcreds_max); in init_winctx_regs()
435 fifo_size = winctx->rx_fifo_size / 1024; in init_winctx_regs()
452 val = SET_FIELD(VAS_LRX_WIN_ID, val, winctx->rx_win_id); in init_winctx_regs()
458 val = SET_FIELD(VAS_NOTIFY_DISABLE, val, winctx->notify_disable); in init_winctx_regs()
459 val = SET_FIELD(VAS_INTR_DISABLE, val, winctx->intr_disable); in init_winctx_regs()
460 val = SET_FIELD(VAS_NOTIFY_EARLY, val, winctx->notify_early); in init_winctx_regs()
461 val = SET_FIELD(VAS_NOTIFY_OSU_INTR, val, winctx->notify_os_intr_reg); in init_winctx_regs()
465 val = SET_FIELD(VAS_LNOTIFY_PID, val, winctx->lnotify_pid); in init_winctx_regs()
469 val = SET_FIELD(VAS_LNOTIFY_LPID, val, winctx->lnotify_lpid); in init_winctx_regs()
473 val = SET_FIELD(VAS_LNOTIFY_TID, val, winctx->lnotify_tid); in init_winctx_regs()
477 val = SET_FIELD(VAS_LNOTIFY_MIN_SCOPE, val, winctx->min_scope); in init_winctx_regs()
478 val = SET_FIELD(VAS_LNOTIFY_MAX_SCOPE, val, winctx->max_scope); in init_winctx_regs()
481 /* Skip read-only registers NX_UTIL and NX_UTIL_SE */ in init_winctx_regs()
494 val = SET_FIELD(VAS_WINCTL_REJ_NO_CREDIT, val, winctx->rej_no_credit); in init_winctx_regs()
495 val = SET_FIELD(VAS_WINCTL_PIN, val, winctx->pin_win); in init_winctx_regs()
496 val = SET_FIELD(VAS_WINCTL_TX_WCRED_MODE, val, winctx->tx_wcred_mode); in init_winctx_regs()
497 val = SET_FIELD(VAS_WINCTL_RX_WCRED_MODE, val, winctx->rx_wcred_mode); in init_winctx_regs()
498 val = SET_FIELD(VAS_WINCTL_TX_WORD_MODE, val, winctx->tx_word_mode); in init_winctx_regs()
499 val = SET_FIELD(VAS_WINCTL_RX_WORD_MODE, val, winctx->rx_word_mode); in init_winctx_regs()
500 val = SET_FIELD(VAS_WINCTL_FAULT_WIN, val, winctx->fault_win); in init_winctx_regs()
501 val = SET_FIELD(VAS_WINCTL_NX_WIN, val, winctx->nx_win); in init_winctx_regs()
513 int winid = ida_alloc_max(ida, VAS_WINDOWS_PER_CHIP - 1, GFP_KERNEL); in vas_assign_window_id()
515 if (winid == -ENOSPC) { in vas_assign_window_id()
517 return -EAGAIN; in vas_assign_window_id()
525 struct vas_instance *vinst = window->vinst; in vas_window_free()
526 int winid = window->vas_win.winid; in vas_window_free()
534 vas_release_window_id(&vinst->ida, winid); in vas_window_free()
542 winid = vas_assign_window_id(&vinst->ida); in vas_window_alloc()
550 window->vinst = vinst; in vas_window_alloc()
551 window->vas_win.winid = winid; in vas_window_alloc()
562 vas_release_window_id(&vinst->ida, winid); in vas_window_alloc()
563 return ERR_PTR(-ENOMEM); in vas_window_alloc()
569 WARN_ON_ONCE(rxwin->tx_win); in put_rx_win()
571 atomic_dec(&rxwin->num_txwins); in put_rx_win()
576 * - We must have a valid vasid and it must belong to this instance.
578 * - The window must refer to an OPEN, FTW, RECEIVE window.
580 * NOTE: We access ->windows[] table and assume that vinst->mutex is held.
590 if (vinst->vas_id != vasid) in get_user_rxwin()
591 return ERR_PTR(-EINVAL); in get_user_rxwin()
593 rxwin = vinst->windows[winid]; in get_user_rxwin()
595 if (!rxwin || rxwin->tx_win || rxwin->vas_win.cop != VAS_COP_TYPE_FTW) in get_user_rxwin()
596 return ERR_PTR(-EINVAL); in get_user_rxwin()
612 mutex_lock(&vinst->mutex); in get_vinst_rxwin()
617 rxwin = vinst->rxwin[cop] ?: ERR_PTR(-EINVAL); in get_vinst_rxwin()
620 atomic_inc(&rxwin->num_txwins); in get_vinst_rxwin()
622 mutex_unlock(&vinst->mutex); in get_vinst_rxwin()
629 * ->windows[], contains all the windows in the instance and allows
634 * The second table, ->rxwin[], contains receive windows that are
639 * Here, we save @window in the ->windows[] table. If it is a receive
640 * window, we also save the window in the ->rxwin[] table.
645 int id = window->vas_win.winid; in set_vinst_win()
647 mutex_lock(&vinst->mutex); in set_vinst_win()
653 if (!window->user_win && !window->tx_win) { in set_vinst_win()
654 WARN_ON_ONCE(vinst->rxwin[window->vas_win.cop]); in set_vinst_win()
655 vinst->rxwin[window->vas_win.cop] = window; in set_vinst_win()
658 WARN_ON_ONCE(vinst->windows[id] != NULL); in set_vinst_win()
659 vinst->windows[id] = window; in set_vinst_win()
661 mutex_unlock(&vinst->mutex); in set_vinst_win()
670 int id = window->vas_win.winid; in clear_vinst_win()
671 struct vas_instance *vinst = window->vinst; in clear_vinst_win()
673 mutex_lock(&vinst->mutex); in clear_vinst_win()
675 if (!window->user_win && !window->tx_win) { in clear_vinst_win()
676 WARN_ON_ONCE(!vinst->rxwin[window->vas_win.cop]); in clear_vinst_win()
677 vinst->rxwin[window->vas_win.cop] = NULL; in clear_vinst_win()
680 WARN_ON_ONCE(vinst->windows[id] != window); in clear_vinst_win()
681 vinst->windows[id] = NULL; in clear_vinst_win()
683 mutex_unlock(&vinst->mutex); in clear_vinst_win()
691 * We first zero (memset()) all fields and only set non-zero fields. in init_winctx_for_rxwin()
694 * ->notify_os_intr_reg In powerNV, send intrs to HV in init_winctx_for_rxwin()
695 * ->notify_disable False for NX windows in init_winctx_for_rxwin()
696 * ->intr_disable False for Fault Windows in init_winctx_for_rxwin()
697 * ->xtra_write False for NX windows in init_winctx_for_rxwin()
698 * ->notify_early NA for NX windows in init_winctx_for_rxwin()
699 * ->rsvd_txbuf_count NA for Rx windows in init_winctx_for_rxwin()
700 * ->lpid, ->pid, ->tid NA for Rx windows in init_winctx_for_rxwin()
705 winctx->rx_fifo = rxattr->rx_fifo; in init_winctx_for_rxwin()
706 winctx->rx_fifo_size = rxattr->rx_fifo_size; in init_winctx_for_rxwin()
707 winctx->wcreds_max = rxwin->vas_win.wcreds_max; in init_winctx_for_rxwin()
708 winctx->pin_win = rxattr->pin_win; in init_winctx_for_rxwin()
710 winctx->nx_win = rxattr->nx_win; in init_winctx_for_rxwin()
711 winctx->fault_win = rxattr->fault_win; in init_winctx_for_rxwin()
712 winctx->user_win = rxattr->user_win; in init_winctx_for_rxwin()
713 winctx->rej_no_credit = rxattr->rej_no_credit; in init_winctx_for_rxwin()
714 winctx->rx_word_mode = rxattr->rx_win_ord_mode; in init_winctx_for_rxwin()
715 winctx->tx_word_mode = rxattr->tx_win_ord_mode; in init_winctx_for_rxwin()
716 winctx->rx_wcred_mode = rxattr->rx_wcred_mode; in init_winctx_for_rxwin()
717 winctx->tx_wcred_mode = rxattr->tx_wcred_mode; in init_winctx_for_rxwin()
718 winctx->notify_early = rxattr->notify_early; in init_winctx_for_rxwin()
720 if (winctx->nx_win) { in init_winctx_for_rxwin()
721 winctx->data_stamp = true; in init_winctx_for_rxwin()
722 winctx->intr_disable = true; in init_winctx_for_rxwin()
723 winctx->pin_win = true; in init_winctx_for_rxwin()
725 WARN_ON_ONCE(winctx->fault_win); in init_winctx_for_rxwin()
726 WARN_ON_ONCE(!winctx->rx_word_mode); in init_winctx_for_rxwin()
727 WARN_ON_ONCE(!winctx->tx_word_mode); in init_winctx_for_rxwin()
728 WARN_ON_ONCE(winctx->notify_after_count); in init_winctx_for_rxwin()
729 } else if (winctx->fault_win) { in init_winctx_for_rxwin()
730 winctx->notify_disable = true; in init_winctx_for_rxwin()
731 } else if (winctx->user_win) { in init_winctx_for_rxwin()
733 * Section 1.8.1 Low Latency Core-Core Wake up of in init_winctx_for_rxwin()
736 * - disable credit checks ([tr]x_wcred_mode = false) in init_winctx_for_rxwin()
737 * - disable FIFO writes in init_winctx_for_rxwin()
738 * - enable ASB_Notify, disable interrupt in init_winctx_for_rxwin()
740 winctx->fifo_disable = true; in init_winctx_for_rxwin()
741 winctx->intr_disable = true; in init_winctx_for_rxwin()
742 winctx->rx_fifo = 0; in init_winctx_for_rxwin()
745 winctx->lnotify_lpid = rxattr->lnotify_lpid; in init_winctx_for_rxwin()
746 winctx->lnotify_pid = rxattr->lnotify_pid; in init_winctx_for_rxwin()
747 winctx->lnotify_tid = rxattr->lnotify_tid; in init_winctx_for_rxwin()
748 winctx->pswid = rxattr->pswid; in init_winctx_for_rxwin()
749 winctx->dma_type = VAS_DMA_TYPE_INJECT; in init_winctx_for_rxwin()
750 winctx->tc_mode = rxattr->tc_mode; in init_winctx_for_rxwin()
752 winctx->min_scope = VAS_SCOPE_LOCAL; in init_winctx_for_rxwin()
753 winctx->max_scope = VAS_SCOPE_VECTORED_GROUP; in init_winctx_for_rxwin()
754 if (rxwin->vinst->virq) in init_winctx_for_rxwin()
755 winctx->irq_port = rxwin->vinst->irq_port; in init_winctx_for_rxwin()
762 attr->fault_win, attr->notify_disable, in rx_win_args_valid()
763 attr->intr_disable, attr->notify_early, in rx_win_args_valid()
764 attr->rx_fifo_size); in rx_win_args_valid()
770 attr->rx_fifo_size < VAS_RX_FIFO_SIZE_MIN) in rx_win_args_valid()
773 if (attr->rx_fifo_size > VAS_RX_FIFO_SIZE_MAX) in rx_win_args_valid()
776 if (!attr->wcreds_max) in rx_win_args_valid()
779 if (attr->nx_win) { in rx_win_args_valid()
781 if (attr->fault_win || attr->user_win) in rx_win_args_valid()
787 if (attr->notify_disable || !attr->intr_disable || in rx_win_args_valid()
788 attr->notify_early) in rx_win_args_valid()
790 } else if (attr->fault_win) { in rx_win_args_valid()
792 if (attr->user_win) in rx_win_args_valid()
799 if (!attr->notify_disable || attr->intr_disable) in rx_win_args_valid()
802 } else if (attr->user_win) { in rx_win_args_valid()
804 * User receive windows are only for fast-thread-wakeup in rx_win_args_valid()
807 if (attr->rx_fifo || attr->rx_fifo_size || !attr->intr_disable) in rx_win_args_valid()
823 rxattr->pin_win = true; in vas_init_rx_win_attr()
824 rxattr->nx_win = true; in vas_init_rx_win_attr()
825 rxattr->fault_win = false; in vas_init_rx_win_attr()
826 rxattr->intr_disable = true; in vas_init_rx_win_attr()
827 rxattr->rx_wcred_mode = true; in vas_init_rx_win_attr()
828 rxattr->tx_wcred_mode = true; in vas_init_rx_win_attr()
829 rxattr->rx_win_ord_mode = true; in vas_init_rx_win_attr()
830 rxattr->tx_win_ord_mode = true; in vas_init_rx_win_attr()
832 rxattr->pin_win = true; in vas_init_rx_win_attr()
833 rxattr->fault_win = true; in vas_init_rx_win_attr()
834 rxattr->notify_disable = true; in vas_init_rx_win_attr()
835 rxattr->rx_wcred_mode = true; in vas_init_rx_win_attr()
836 rxattr->rx_win_ord_mode = true; in vas_init_rx_win_attr()
837 rxattr->rej_no_credit = true; in vas_init_rx_win_attr()
838 rxattr->tc_mode = VAS_THRESH_DISABLED; in vas_init_rx_win_attr()
840 rxattr->user_win = true; in vas_init_rx_win_attr()
841 rxattr->intr_disable = true; in vas_init_rx_win_attr()
863 return ERR_PTR(-EINVAL); in vas_rx_win_open()
868 return ERR_PTR(-EINVAL); in vas_rx_win_open()
878 rxwin->tx_win = false; in vas_rx_win_open()
879 rxwin->nx_win = rxattr->nx_win; in vas_rx_win_open()
880 rxwin->user_win = rxattr->user_win; in vas_rx_win_open()
881 rxwin->vas_win.cop = cop; in vas_rx_win_open()
882 rxwin->vas_win.wcreds_max = rxattr->wcreds_max; in vas_rx_win_open()
889 return &rxwin->vas_win; in vas_rx_win_open()
899 txattr->rej_no_credit = false; in vas_init_tx_win_attr()
900 txattr->rx_wcred_mode = true; in vas_init_tx_win_attr()
901 txattr->tx_wcred_mode = true; in vas_init_tx_win_attr()
902 txattr->rx_win_ord_mode = true; in vas_init_tx_win_attr()
903 txattr->tx_win_ord_mode = true; in vas_init_tx_win_attr()
905 txattr->user_win = true; in vas_init_tx_win_attr()
915 * We first zero all fields and only set non-zero ones. Following in init_winctx_for_txwin()
918 * ->notify_os_intr_reg In powernv, send intrs to HV in init_winctx_for_txwin()
919 * ->rsvd_txbuf_count Not supported yet. in init_winctx_for_txwin()
920 * ->notify_disable False for NX windows in init_winctx_for_txwin()
921 * ->xtra_write False for NX windows in init_winctx_for_txwin()
922 * ->notify_early NA for NX windows in init_winctx_for_txwin()
923 * ->lnotify_lpid NA for Tx windows in init_winctx_for_txwin()
924 * ->lnotify_pid NA for Tx windows in init_winctx_for_txwin()
925 * ->lnotify_tid NA for Tx windows in init_winctx_for_txwin()
926 * ->tx_win_cred_mode Ignore for now for NX windows in init_winctx_for_txwin()
927 * ->rx_win_cred_mode Ignore for now for NX windows in init_winctx_for_txwin()
931 winctx->wcreds_max = txwin->vas_win.wcreds_max; in init_winctx_for_txwin()
933 winctx->user_win = txattr->user_win; in init_winctx_for_txwin()
934 winctx->nx_win = txwin->rxwin->nx_win; in init_winctx_for_txwin()
935 winctx->pin_win = txattr->pin_win; in init_winctx_for_txwin()
936 winctx->rej_no_credit = txattr->rej_no_credit; in init_winctx_for_txwin()
937 winctx->rsvd_txbuf_enable = txattr->rsvd_txbuf_enable; in init_winctx_for_txwin()
939 winctx->rx_wcred_mode = txattr->rx_wcred_mode; in init_winctx_for_txwin()
940 winctx->tx_wcred_mode = txattr->tx_wcred_mode; in init_winctx_for_txwin()
941 winctx->rx_word_mode = txattr->rx_win_ord_mode; in init_winctx_for_txwin()
942 winctx->tx_word_mode = txattr->tx_win_ord_mode; in init_winctx_for_txwin()
943 winctx->rsvd_txbuf_count = txattr->rsvd_txbuf_count; in init_winctx_for_txwin()
945 winctx->intr_disable = true; in init_winctx_for_txwin()
946 if (winctx->nx_win) in init_winctx_for_txwin()
947 winctx->data_stamp = true; in init_winctx_for_txwin()
949 winctx->lpid = txattr->lpid; in init_winctx_for_txwin()
950 winctx->pidr = txattr->pidr; in init_winctx_for_txwin()
951 winctx->rx_win_id = txwin->rxwin->vas_win.winid; in init_winctx_for_txwin()
956 if (txwin->vinst->virq) in init_winctx_for_txwin()
957 winctx->fault_win_id = txwin->vinst->fault_win->vas_win.winid; in init_winctx_for_txwin()
959 winctx->dma_type = VAS_DMA_TYPE_INJECT; in init_winctx_for_txwin()
960 winctx->tc_mode = txattr->tc_mode; in init_winctx_for_txwin()
961 winctx->min_scope = VAS_SCOPE_LOCAL; in init_winctx_for_txwin()
962 winctx->max_scope = VAS_SCOPE_VECTORED_GROUP; in init_winctx_for_txwin()
963 if (txwin->vinst->virq) in init_winctx_for_txwin()
964 winctx->irq_port = txwin->vinst->irq_port; in init_winctx_for_txwin()
966 winctx->pswid = txattr->pswid ? txattr->pswid : in init_winctx_for_txwin()
967 encode_pswid(txwin->vinst->vas_id, in init_winctx_for_txwin()
968 txwin->vas_win.winid); in init_winctx_for_txwin()
974 if (attr->tc_mode != VAS_THRESH_DISABLED) in tx_win_args_valid()
980 if (attr->wcreds_max > VAS_TX_WCREDS_MAX) in tx_win_args_valid()
983 if (attr->user_win) { in tx_win_args_valid()
984 if (attr->rsvd_txbuf_count) in tx_win_args_valid()
1007 return ERR_PTR(-EINVAL); in vas_tx_win_open()
1014 if (vasid == -1 && attr->pswid) in vas_tx_win_open()
1015 decode_pswid(attr->pswid, &vasid, NULL); in vas_tx_win_open()
1020 return ERR_PTR(-EINVAL); in vas_tx_win_open()
1023 rxwin = get_vinst_rxwin(vinst, cop, attr->pswid); in vas_tx_win_open()
1035 txwin->vas_win.cop = cop; in vas_tx_win_open()
1036 txwin->tx_win = 1; in vas_tx_win_open()
1037 txwin->rxwin = rxwin; in vas_tx_win_open()
1038 txwin->nx_win = txwin->rxwin->nx_win; in vas_tx_win_open()
1039 txwin->user_win = attr->user_win; in vas_tx_win_open()
1040 txwin->vas_win.wcreds_max = attr->wcreds_max ?: VAS_WCREDS_DEFAULT; in vas_tx_win_open()
1054 if (!txwin->user_win) { in vas_tx_win_open()
1055 txwin->paste_kaddr = map_paste_region(txwin); in vas_tx_win_open()
1056 if (IS_ERR(txwin->paste_kaddr)) { in vas_tx_win_open()
1057 rc = PTR_ERR(txwin->paste_kaddr); in vas_tx_win_open()
1066 if (!vinst->virq) { in vas_tx_win_open()
1067 rc = -ENODEV; in vas_tx_win_open()
1070 rc = get_vas_user_win_ref(&txwin->vas_win.task_ref); in vas_tx_win_open()
1074 vas_user_win_add_mm_context(&txwin->vas_win.task_ref); in vas_tx_win_open()
1079 return &txwin->vas_win; in vas_tx_win_open()
1110 * report-enable flag is set for NX windows. Ensure software in vas_paste_crb()
1113 WARN_ON_ONCE(txwin->nx_win && !re); in vas_paste_crb()
1115 addr = txwin->paste_kaddr; in vas_paste_crb()
1133 rc = -EINVAL; in vas_paste_crb()
1135 pr_debug("Txwin #%d: Msg count %llu\n", txwin->vas_win.winid, in vas_paste_crb()
1143 * If credit checking is enabled for this window, poll for the return
1145 * Since NX-842 waits for the CRBs to be processed before closing the
1148 * TODO: We retry in 10ms intervals now. We could/should probably peek at
1150 * CRBs on the FIFO and compute the delay dynamically on each retry.
1151 * But that is not really needed until we support NX-GZIP access from
1152 * user space. (NX-842 driver waits for CSB and Fast thread-wakeup
1159 int count = 0; in poll_window_credits() local
1162 if (window->tx_win) in poll_window_credits()
1169 retry: in poll_window_credits()
1170 if (window->tx_win) { in poll_window_credits()
1185 if (creds < window->vas_win.wcreds_max) { in poll_window_credits()
1189 count++; in poll_window_credits()
1194 if (!(count % 1000)) in poll_window_credits()
1196 vas_window_pid(&window->vas_win), in poll_window_credits()
1197 window->vas_win.winid, in poll_window_credits()
1198 creds, count); in poll_window_credits()
1200 goto retry; in poll_window_credits()
1205 * Wait for the window to go to "not-busy" state. It should only take a
1213 int count = 0; in poll_window_busy_state() local
1215 retry: in poll_window_busy_state()
1222 count++; in poll_window_busy_state()
1227 if (!(count % 1000)) in poll_window_busy_state()
1229 vas_window_pid(&window->vas_win), in poll_window_busy_state()
1230 window->vas_win.winid, count); in poll_window_busy_state()
1232 goto retry; in poll_window_busy_state()
1243 * - we clear the "Pin Window" bit (so hardware is free to evict)
1245 * - we re-initialize the window context when it is reassigned.
1248 * So, ignoring the cast-out for now. We can add it as needed. If
1275 * - Disable new paste operations (unmap paste address)
1276 * - Poll for the "Window Busy" bit to be cleared
1277 * - Clear the Open/Enable bit for the Window.
1278 * - Poll for return of window Credits (implies FIFO empty for Rx win?)
1279 * - Unpin and cast window context out of cache
1292 if (!window->tx_win && atomic_read(&window->num_txwins) != 0) { in vas_win_close()
1295 return -EBUSY; in vas_win_close()
1311 if (window->tx_win) { in vas_win_close()
1312 if (window->user_win) { in vas_win_close()
1313 mm_context_remove_vas_window(vwin->task_ref.mm); in vas_win_close()
1314 put_vas_user_win_ref(&vwin->task_ref); in vas_win_close()
1316 put_rx_win(window->rxwin); in vas_win_close()
1330 * - The default number of credits available for each send window is
1334 * - One credit is taken when NX request is issued.
1335 * - This credit is returned after NX processed that request.
1336 * - If NX encounters translation error, kernel will return the
1340 * - The total number credits available is FIFO_SIZE/CRB_SIZE.
1343 * - A credit is taken when NX pastes CRB in fault FIFO.
1344 * - The kernel with return credit on fault window after reading entry
1369 return ERR_PTR(-ESRCH); in vas_pswid_to_window()
1375 return ERR_PTR(-ESRCH); in vas_pswid_to_window()
1386 window = vinst->windows[winid]; in vas_pswid_to_window()
1400 if (!window->tx_win || !window->user_win || !window->nx_win || in vas_pswid_to_window()
1401 window->vas_win.cop == VAS_COP_TYPE_FAULT || in vas_pswid_to_window()
1402 window->vas_win.cop == VAS_COP_TYPE_FTW) { in vas_pswid_to_window()
1404 winid, window->tx_win, window->user_win, in vas_pswid_to_window()
1405 window->nx_win, window->vas_win.cop); in vas_pswid_to_window()
1456 * Supporting only nx-gzip coprocessor type now, but this API code