Print this page
8368 remove warlock leftovers from usr/src/uts

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/ib/adapters/tavor/tavor_cq.c
          +++ new/usr/src/uts/common/io/ib/adapters/tavor/tavor_cq.c
↓ open down ↓ 73 lines elided ↑ open up ↑
  74   74          tavor_mrhdl_t           mr;
  75   75          tavor_hw_cqe_t          *buf;
  76   76          uint64_t                addr, value;
  77   77          uint32_t                log_cq_size, lkey, uarpg;
  78   78          uint_t                  dma_xfer_mode, cq_sync, cq_is_umap;
  79   79          int                     status, i, flag;
  80   80          char                    *errormsg;
  81   81  
  82   82          TAVOR_TNF_ENTER(tavor_cq_alloc);
  83   83  
  84      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cq_attr))
  85      -
  86   84          /*
  87   85           * Determine whether CQ is being allocated for userland access or
  88   86           * whether it is being allocated for kernel access.  If the CQ is
  89   87           * being allocated for userland access, then lookup the UAR doorbell
  90   88           * page number for the current process.  Note:  If this is not found
  91   89           * (e.g. if the process has not previously open()'d the Tavor driver),
  92   90           * then an error is returned.
  93   91           */
  94   92          cq_is_umap = (cq_attr->cq_flags & IBT_CQ_USER_MAP) ? 1 : 0;
  95   93          if (cq_is_umap) {
↓ open down ↓ 33 lines elided ↑ open up ↑
 129  127           * undo the protection domain reference count and the previous
 130  128           * resource allocation.
 131  129           */
 132  130          status = tavor_rsrc_alloc(state, TAVOR_CQHDL, 1, sleepflag, &rsrc);
 133  131          if (status != DDI_SUCCESS) {
 134  132                  /* Set "status" and "errormsg" and goto failure */
 135  133                  TAVOR_TNF_FAIL(IBT_INSUFF_RESOURCE, "failed CQ handle");
 136  134                  goto cqalloc_fail2;
 137  135          }
 138  136          cq = (tavor_cqhdl_t)rsrc->tr_addr;
 139      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cq))
 140  137          cq->cq_is_umap = cq_is_umap;
 141  138  
 142  139          /* Use the index as CQ number */
 143  140          cq->cq_cqnum = cqc->tr_indx;
 144  141  
 145  142          /*
 146  143           * If this will be a user-mappable CQ, then allocate an entry for
 147  144           * the "userland resources database".  This will later be added to
 148  145           * the database (after all further CQ operations are successful).
 149  146           * If we fail here, we must undo the reference counts and the
↓ open down ↓ 51 lines elided ↑ open up ↑
 201  198          } else {
 202  199                  cq->cq_cqinfo.qa_location = TAVOR_QUEUE_LOCATION_NORMAL;
 203  200          }
 204  201          status = tavor_queue_alloc(state, &cq->cq_cqinfo, sleepflag);
 205  202          if (status != DDI_SUCCESS) {
 206  203                  /* Set "status" and "errormsg" and goto failure */
 207  204                  TAVOR_TNF_FAIL(IBT_INSUFF_RESOURCE, "failed completion queue");
 208  205                  goto cqalloc_fail4;
 209  206          }
 210  207          buf = (tavor_hw_cqe_t *)cq->cq_cqinfo.qa_buf_aligned;
 211      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*buf))
 212  208  
 213  209          /*
 214  210           * Initialize each of the Completion Queue Entries (CQE) by setting
 215  211           * their ownership to hardware ("owner" bit set to HW).  This is in
 216  212           * preparation for the final transfer of ownership (below) of the
 217  213           * CQ context itself.
 218  214           */
 219  215          for (i = 0; i < (1 << log_cq_size); i++) {
 220  216                  TAVOR_CQE_OWNER_SET_HW(cq, &buf[i]);
 221  217          }
↓ open down ↓ 19 lines elided ↑ open up ↑
 241  237          }
 242  238          op.mro_bind_type   = state->ts_cfg_profile->cp_iommu_bypass;
 243  239          op.mro_bind_dmahdl = cq->cq_cqinfo.qa_dmahdl;
 244  240          op.mro_bind_override_addr = 0;
 245  241          status = tavor_mr_register(state, pd, &mr_attr, &mr, &op);
 246  242          if (status != DDI_SUCCESS) {
 247  243                  /* Set "status" and "errormsg" and goto failure */
 248  244                  TAVOR_TNF_FAIL(IBT_INSUFF_RESOURCE, "failed register mr");
 249  245                  goto cqalloc_fail5;
 250  246          }
 251      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr))
 252  247          addr = mr->mr_bindinfo.bi_addr;
 253  248          lkey = mr->mr_lkey;
 254  249  
 255  250          /* Determine if later ddi_dma_sync will be necessary */
 256  251          cq_sync = TAVOR_CQ_IS_SYNC_REQ(state, cq->cq_cqinfo);
 257  252  
 258  253          /* Sync entire CQ for use by the hardware (if necessary). */
 259  254          if (cq_sync) {
 260  255                  (void) ddi_dma_sync(mr->mr_bindinfo.bi_dmahdl, 0,
 261  256                      cq->cq_cqinfo.qa_size, DDI_DMA_SYNC_FORDEV);
↓ open down ↓ 215 lines elided ↑ open up ↑
 477  472  
 478  473          /*
 479  474           * While we hold the CQ lock, do a "forced reap" of the workQ WRID
 480  475           * list.  This cleans up all the structures associated with the WRID
 481  476           * processing for this CQ.  Once we complete, drop the lock and finish
 482  477           * the deallocation of the CQ.
 483  478           */
 484  479          tavor_wrid_cq_force_reap(cq);
 485  480  
 486  481          mutex_exit(&cq->cq_lock);
 487      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cq))
 488  482  
 489  483          /*
 490  484           * Reclaim CQC entry from hardware (using the Tavor HW2SW_CQ
 491  485           * firmware command).  If the ownership transfer fails for any reason,
 492  486           * then it is an indication that something (either in HW or SW) has
 493  487           * gone seriously wrong.
 494  488           */
 495  489          status = tavor_cmn_ownership_cmd_post(state, HW2SW_CQ, &cqc_entry,
 496  490              sizeof (tavor_hw_cqc_t), cqnum, sleepflag);
 497  491          if (status != TAVOR_CMD_SUCCESS) {
↓ open down ↓ 109 lines elided ↑ open up ↑
 607  601          } else {
 608  602                  new_cqinfo.qa_location = TAVOR_QUEUE_LOCATION_NORMAL;
 609  603          }
 610  604          status = tavor_queue_alloc(state, &new_cqinfo, sleepflag);
 611  605          if (status != DDI_SUCCESS) {
 612  606                  /* Set "status" and "errormsg" and goto failure */
 613  607                  TAVOR_TNF_FAIL(IBT_INSUFF_RESOURCE, "failed completion queue");
 614  608                  goto cqresize_fail;
 615  609          }
 616  610          buf = (tavor_hw_cqe_t *)new_cqinfo.qa_buf_aligned;
 617      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*buf))
 618  611  
 619  612          /*
 620  613           * Initialize each of the Completion Queue Entries (CQE) by setting
 621  614           * their ownership to hardware ("owner" bit set to HW).  This is in
 622  615           * preparation for the final resize operation (below).
 623  616           */
 624  617          for (i = 0; i < (1 << log_cq_size); i++) {
 625  618                  TAVOR_CQE_OWNER_SET_HW(cq, &buf[i]);
 626  619          }
 627  620  
↓ open down ↓ 18 lines elided ↑ open up ↑
 646  639          op.mro_bind_type = state->ts_cfg_profile->cp_iommu_bypass;
 647  640          op.mro_bind_dmahdl = new_cqinfo.qa_dmahdl;
 648  641          op.mro_bind_override_addr = 0;
 649  642          status = tavor_mr_register(state, pd, &mr_attr, &mr, &op);
 650  643          if (status != DDI_SUCCESS) {
 651  644                  tavor_queue_free(state, &new_cqinfo);
 652  645                  /* Set "status" and "errormsg" and goto failure */
 653  646                  TAVOR_TNF_FAIL(IBT_INSUFF_RESOURCE, "failed register mr");
 654  647                  goto cqresize_fail;
 655  648          }
 656      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr))
 657  649  
 658  650          /* Determine if later ddi_dma_sync will be necessary */
 659  651          cq_sync = TAVOR_CQ_IS_SYNC_REQ(state, new_cqinfo);
 660  652  
 661  653          /* Sync entire "new" CQ for use by hardware (if necessary) */
 662  654          if (cq_sync) {
 663  655                  (void) ddi_dma_sync(mr->mr_bindinfo.bi_dmahdl, 0,
 664  656                      new_cqinfo.qa_size, DDI_DMA_SYNC_FORDEV);
 665  657          }
 666  658  
↓ open down ↓ 1235 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX