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/hermon/hermon_mr.c
          +++ new/usr/src/uts/common/io/ib/adapters/hermon/hermon_mr.c
↓ open down ↓ 219 lines elided ↑ open up ↑
 220  220           * region (i.e. the Hermon Memory Region handle).  If we fail here, we
 221  221           * must undo the protection domain reference count and the previous
 222  222           * resource allocation.
 223  223           */
 224  224          status = hermon_rsrc_alloc(state, HERMON_MRHDL, 1, sleep, &rsrc);
 225  225          if (status != DDI_SUCCESS) {
 226  226                  status = IBT_INSUFF_RESOURCE;
 227  227                  goto mrshared_fail2;
 228  228          }
 229  229          mr = (hermon_mrhdl_t)rsrc->hr_addr;
 230      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr))
 231  230  
 232  231          /*
 233  232           * Setup and validate the memory region access flags.  This means
 234  233           * translating the IBTF's enable flags into the access flags that
 235  234           * will be used in later operations.
 236  235           */
 237  236          mr->mr_accflag = 0;
 238  237          if (mr_attr->mr_flags & IBT_MR_ENABLE_WINDOW_BIND)
 239  238                  mr->mr_accflag |= IBT_MR_WINDOW_BIND;
 240  239          if (mr_attr->mr_flags & IBT_MR_ENABLE_LOCAL_WRITE)
↓ open down ↓ 72 lines elided ↑ open up ↑
 313  312           * matter here of managing the MTT reference count and grabbing the
 314  313           * address of the MTT table entries (for filling in the shared region's
 315  314           * MPT entry).
 316  315           */
 317  316          mr->mr_mttrsrcp   = mrhdl->mr_mttrsrcp;
 318  317          mr->mr_logmttpgsz = mrhdl->mr_logmttpgsz;
 319  318          mr->mr_bindinfo   = mrhdl->mr_bindinfo;
 320  319          mr->mr_mttrefcntp = mrhdl->mr_mttrefcntp;
 321  320          mutex_exit(&mrhdl->mr_lock);
 322  321          bind = &mr->mr_bindinfo;
 323      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind))
 324  322          mtt = mr->mr_mttrsrcp;
 325  323  
 326  324          /*
 327  325           * Increment the MTT reference count (to reflect the fact that
 328  326           * the MTT is now shared)
 329  327           */
 330  328          (void) hermon_mtt_refcnt_inc(mr->mr_mttrefcntp);
 331  329  
 332  330          /*
 333  331           * Update the new "bind" virtual address.  Do some extra work here
↓ open down ↓ 156 lines elided ↑ open up ↑
 490  488           * region (i.e. the Hermon Memory Region handle).  If we fail here, we
 491  489           * must undo the protection domain reference count and the previous
 492  490           * resource allocation.
 493  491           */
 494  492          status = hermon_rsrc_alloc(state, HERMON_MRHDL, 1, sleep, &rsrc);
 495  493          if (status != DDI_SUCCESS) {
 496  494                  status = IBT_INSUFF_RESOURCE;
 497  495                  goto fmralloc_fail2;
 498  496          }
 499  497          mr = (hermon_mrhdl_t)rsrc->hr_addr;
 500      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr))
 501  498  
 502  499          /*
 503  500           * Setup and validate the memory region access flags.  This means
 504  501           * translating the IBTF's enable flags into the access flags that
 505  502           * will be used in later operations.
 506  503           */
 507  504          mr->mr_accflag = 0;
 508  505          if (fmr_pool->fmr_flags & IBT_MR_ENABLE_LOCAL_WRITE)
 509  506                  mr->mr_accflag |= IBT_MR_LOCAL_WRITE;
 510  507          if (fmr_pool->fmr_flags & IBT_MR_ENABLE_REMOTE_READ)
↓ open down ↓ 106 lines elided ↑ open up ↑
 617  614          mr->mr_lkey        = hermon_mr_key_swap(mr->mr_lkey);
 618  615          mr->mr_rkey        = hermon_mr_key_swap(mr->mr_rkey);
 619  616          mr->mr_mttaddr     = mtt_addr;
 620  617          (void) memcpy(&mr->mr_bindinfo, &bind, sizeof (hermon_bind_info_t));
 621  618  
 622  619          /* initialize hr_addr for use during register/deregister/invalidate */
 623  620          icm_table = &state->hs_icm[HERMON_DMPT];
 624  621          rindx = mpt->hr_indx;
 625  622          hermon_index(index1, index2, rindx, icm_table, i);
 626  623          dma_info = icm_table->icm_dma[index1] + index2;
 627      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mpt))
 628  624          mpt->hr_addr = (void *)((uintptr_t)(dma_info->vaddr + i * mpt->hr_len));
 629  625  
 630  626          *mrhdl = mr;
 631  627  
 632  628          return (DDI_SUCCESS);
 633  629  
 634  630  /*
 635  631   * The following is cleanup for all possible failure cases in this routine
 636  632   */
 637  633  fmralloc_fail4:
↓ open down ↓ 346 lines elided ↑ open up ↑
 984  980   */
 985  981  /* ARGSUSED */
 986  982  int
 987  983  hermon_mr_query(hermon_state_t *state, hermon_mrhdl_t mr,
 988  984      ibt_mr_query_attr_t *attr)
 989  985  {
 990  986          int                     status;
 991  987          hermon_hw_dmpt_t        mpt_entry;
 992  988          uint32_t                lkey;
 993  989  
 994      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*attr))
 995      -
 996  990          mutex_enter(&mr->mr_lock);
 997  991  
 998  992          /*
 999  993           * Check here to see if the memory region has already been partially
1000  994           * deregistered as a result of a hermon_umap_umemlock_cb() callback.
1001  995           * If so, this is an error, return failure.
1002  996           */
1003  997          if ((mr->mr_is_umem) && (mr->mr_umemcookie == NULL)) {
1004  998                  mutex_exit(&mr->mr_lock);
1005  999                  return (IBT_MR_HDL_INVALID);
↓ open down ↓ 264 lines elided ↑ open up ↑
1270 1264           * of the same properties are needed, only a single structure is
1271 1265           * necessary.  If we fail here, we must undo the protection domain
1272 1266           * reference count and the previous resource allocation.
1273 1267           */
1274 1268          status = hermon_rsrc_alloc(state, HERMON_MRHDL, 1, sleep, &rsrc);
1275 1269          if (status != DDI_SUCCESS) {
1276 1270                  status = IBT_INSUFF_RESOURCE;
1277 1271                  goto mwalloc_fail2;
1278 1272          }
1279 1273          mw = (hermon_mwhdl_t)rsrc->hr_addr;
1280      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mw))
1281 1274  
1282 1275          /*
1283 1276           * Calculate an "unbound" RKey from MPT index.  In much the same way
1284 1277           * as we do for memory regions (above), this key is constructed from
1285 1278           * a "constrained" (which depends on the MPT index) and an
1286 1279           * "unconstrained" portion (which may be arbitrarily chosen).
1287 1280           */
1288 1281          mw->mr_rkey = hermon_mr_keycalc(mpt->hr_indx);
1289 1282  
1290 1283          /*
↓ open down ↓ 78 lines elided ↑ open up ↑
1369 1362           * Pull all the necessary information from the Hermon Memory Window
1370 1363           * handle.  This is necessary here because the resource for the
1371 1364           * MW handle is going to be freed up as part of the this operation.
1372 1365           */
1373 1366          mw      = *mwhdl;
1374 1367          mutex_enter(&mw->mr_lock);
1375 1368          mpt     = mw->mr_mptrsrcp;
1376 1369          rsrc    = mw->mr_rsrcp;
1377 1370          pd      = mw->mr_pdhdl;
1378 1371          mutex_exit(&mw->mr_lock);
1379      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mw))
1380 1372  
1381 1373          /*
1382 1374           * Reclaim the MPT entry from hardware.  Note: in general, it is
1383 1375           * unexpected for this operation to return an error.
1384 1376           */
1385 1377          status = hermon_cmn_ownership_cmd_post(state, HW2SW_MPT, NULL,
1386 1378              0, mpt->hr_indx, sleep);
1387 1379          if (status != HERMON_CMD_SUCCESS) {
1388 1380                  cmn_err(CE_CONT, "Hermon: HW2SW_MPT command failed: %08x\n",
1389 1381                      status);
↓ open down ↓ 36 lines elided ↑ open up ↑
1426 1418           * static variable _intentionally_ without any kind of mutex around
1427 1419           * it.  First, single-threading all operations through a single lock
1428 1420           * would be a bad idea (from a performance point-of-view).  Second,
1429 1421           * the upper "unconstrained" bits don't really have to be unique
1430 1422           * because the lower bits are guaranteed to be (although we do make a
1431 1423           * best effort to ensure that they are).  Third, the window for the
1432 1424           * race (where both threads read and update the counter at the same
1433 1425           * time) is incredibly small.
1434 1426           * And, lastly, we'd like to make this into a "random" key
1435 1427           */
1436      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(hermon_memkey_cnt))
1437 1428          tmp_key = (hermon_memkey_cnt++) << HERMON_MEMKEY_SHIFT;
1438 1429          tmp_indx = indx & 0xffffff;
1439 1430          return (tmp_key | tmp_indx);
1440 1431  }
1441 1432  
1442 1433  
1443 1434  /*
1444 1435   * hermon_mr_key_swap()
1445 1436   *    Context: Can be called from interrupt or base context.
1446 1437   *    NOTE:  Produces a key in the form of
↓ open down ↓ 108 lines elided ↑ open up ↑
1555 1546           * the Hermon Memory Region handle).  If we fail here, we must undo
1556 1547           * the protection domain reference count and the previous resource
1557 1548           * allocation.
1558 1549           */
1559 1550          status = hermon_rsrc_alloc(state, HERMON_MRHDL, 1, sleep, &rsrc);
1560 1551          if (status != DDI_SUCCESS) {
1561 1552                  status = IBT_INSUFF_RESOURCE;
1562 1553                  goto mrcommon_fail2;
1563 1554          }
1564 1555          mr = (hermon_mrhdl_t)rsrc->hr_addr;
1565      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr))
1566 1556  
1567 1557          /*
1568 1558           * Setup and validate the memory region access flags.  This means
1569 1559           * translating the IBTF's enable flags into the access flags that
1570 1560           * will be used in later operations.
1571 1561           */
1572 1562          mr->mr_accflag = 0;
1573 1563          if (flags & IBT_MR_ENABLE_WINDOW_BIND)
1574 1564                  mr->mr_accflag |= IBT_MR_WINDOW_BIND;
1575 1565          if (flags & IBT_MR_ENABLE_LOCAL_WRITE)
↓ open down ↓ 33 lines elided ↑ open up ↑
1609 1599                  umem_addr  = (caddr_t)((uintptr_t)bind->bi_addr & ~PAGEOFFSET);
1610 1600                  umem_flags = (DDI_UMEMLOCK_WRITE | DDI_UMEMLOCK_READ |
1611 1601                      DDI_UMEMLOCK_LONGTERM);
1612 1602                  status = umem_lockmemory(umem_addr, umem_len, umem_flags,
1613 1603                      &umem_cookie, &hermon_umem_cbops, NULL);
1614 1604                  if (status != 0) {
1615 1605                          status = IBT_INSUFF_RESOURCE;
1616 1606                          goto mrcommon_fail3;
1617 1607                  }
1618 1608  
1619      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind))
1620      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind->bi_buf))
1621      -
1622 1609                  bind->bi_buf = ddi_umem_iosetup(umem_cookie, 0, umem_len,
1623 1610                      B_WRITE, 0, 0, NULL, DDI_UMEM_SLEEP);
1624 1611                  if (bind->bi_buf == NULL) {
1625 1612                          status = IBT_INSUFF_RESOURCE;
1626 1613                          goto mrcommon_fail3;
1627 1614                  }
1628 1615                  bind->bi_type = HERMON_BINDHDL_UBUF;
1629 1616                  bind->bi_buf->b_flags |= B_READ;
1630 1617  
1631      -                _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*bind->bi_buf))
1632      -                _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*bind))
1633      -
1634 1618                  umapdb = hermon_umap_db_alloc(state->hs_instance,
1635 1619                      (uint64_t)(uintptr_t)umem_cookie, MLNX_UMAP_MRMEM_RSRC,
1636 1620                      (uint64_t)(uintptr_t)rsrc);
1637 1621                  if (umapdb == NULL) {
1638 1622                          status = IBT_INSUFF_RESOURCE;
1639 1623                          goto mrcommon_fail4;
1640 1624                  }
1641 1625          }
1642 1626  
1643 1627          /*
1644 1628           * Setup the bindinfo for the mtt bind call
1645 1629           */
1646 1630          bh = &mr->mr_bindinfo;
1647      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bh))
1648 1631          bcopy(bind, bh, sizeof (hermon_bind_info_t));
1649 1632          bh->bi_bypass = bind_type;
1650 1633          status = hermon_mr_mtt_bind(state, bh, bind_dmahdl, &mtt,
1651 1634              &mtt_pgsize_bits, mpt != NULL);
1652 1635          if (status != DDI_SUCCESS) {
1653 1636                  /*
1654 1637                   * When mtt_bind fails, freerbuf has already been done,
1655 1638                   * so make sure not to call it again.
1656 1639                   */
1657 1640                  bind->bi_type = bh->bi_type;
↓ open down ↓ 9 lines elided ↑ open up ↑
1667 1650           * here, we do pretty much the same as above to clean up.
1668 1651           */
1669 1652          status = hermon_rsrc_alloc(state, HERMON_REFCNT, 1, sleep,
1670 1653              &mtt_refcnt);
1671 1654          if (status != DDI_SUCCESS) {
1672 1655                  status = IBT_INSUFF_RESOURCE;
1673 1656                  goto mrcommon_fail6;
1674 1657          }
1675 1658          mr->mr_mttrefcntp = mtt_refcnt;
1676 1659          swrc_tmp = (hermon_sw_refcnt_t *)mtt_refcnt->hr_addr;
1677      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*swrc_tmp))
1678 1660          HERMON_MTT_REFCNT_INIT(swrc_tmp);
1679 1661  
1680 1662          mtt_addr = (mtt->hr_indx << HERMON_MTT_SIZE_SHIFT);
1681 1663  
1682 1664          /*
1683 1665           * Fill in the MPT entry.  This is the final step before passing
1684 1666           * ownership of the MPT entry to the Hermon hardware.  We use all of
1685 1667           * the information collected/calculated above to fill in the
1686 1668           * requisite portions of the MPT.  Do this ONLY for DMPTs.
1687 1669           */
↓ open down ↓ 110 lines elided ↑ open up ↑
1798 1780                  hermon_umap_db_free(umapdb);
1799 1781          }
1800 1782  mrcommon_fail4:
1801 1783          if (mr_is_umem) {
1802 1784                  /*
1803 1785                   * Free up the memory ddi_umem_iosetup() allocates
1804 1786                   * internally.
1805 1787                   */
1806 1788                  if (bind->bi_type == HERMON_BINDHDL_UBUF) {
1807 1789                          freerbuf(bind->bi_buf);
1808      -                        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind))
1809 1790                          bind->bi_type = HERMON_BINDHDL_NONE;
1810      -                        _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*bind))
1811 1791                  }
1812 1792                  ddi_umem_unlock(umem_cookie);
1813 1793          }
1814 1794  mrcommon_fail3:
1815 1795          hermon_rsrc_free(state, &rsrc);
1816 1796  mrcommon_fail2:
1817 1797          if (mpt != NULL)
1818 1798                  hermon_rsrc_free(state, &mpt);
1819 1799  mrcommon_fail1:
1820 1800          hermon_pd_refcnt_dec(pd);
↓ open down ↓ 52 lines elided ↑ open up ↑
1873 1853           * the Hermon Memory Region handle).  If we fail here, we must undo
1874 1854           * the protection domain reference count and the previous resource
1875 1855           * allocation.
1876 1856           */
1877 1857          status = hermon_rsrc_alloc(state, HERMON_MRHDL, 1, sleep, &rsrc);
1878 1858          if (status != DDI_SUCCESS) {
1879 1859                  status = IBT_INSUFF_RESOURCE;
1880 1860                  goto mrcommon_fail2;
1881 1861          }
1882 1862          mr = (hermon_mrhdl_t)rsrc->hr_addr;
1883      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr))
1884 1863          bzero(mr, sizeof (*mr));
1885 1864  
1886 1865          /*
1887 1866           * Setup and validate the memory region access flags.  This means
1888 1867           * translating the IBTF's enable flags into the access flags that
1889 1868           * will be used in later operations.
1890 1869           */
1891 1870          mr->mr_accflag = 0;
1892 1871          if (flags & IBT_MR_ENABLE_WINDOW_BIND)
1893 1872                  mr->mr_accflag |= IBT_MR_WINDOW_BIND;
↓ open down ↓ 158 lines elided ↑ open up ↑
2052 2031           * the Hermon Memory Region handle).  If we fail here, we must undo
2053 2032           * the protection domain reference count and the previous resource
2054 2033           * allocation.
2055 2034           */
2056 2035          status = hermon_rsrc_alloc(state, HERMON_MRHDL, 1, sleep, &rsrc);
2057 2036          if (status != DDI_SUCCESS) {
2058 2037                  status = IBT_INSUFF_RESOURCE;
2059 2038                  goto alloclkey_fail2;
2060 2039          }
2061 2040          mr = (hermon_mrhdl_t)rsrc->hr_addr;
2062      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr))
2063 2041          bzero(mr, sizeof (*mr));
2064 2042          mr->mr_bindinfo.bi_type = HERMON_BINDHDL_LKEY;
2065 2043  
2066 2044          mr->mr_lkey = hermon_mr_keycalc(mpt->hr_indx);
2067 2045  
2068 2046          status = hermon_rsrc_alloc(state, HERMON_MTT, nummtt, sleep, &mtt);
2069 2047          if (status != DDI_SUCCESS) {
2070 2048                  status = IBT_INSUFF_RESOURCE;
2071 2049                  goto alloclkey_fail3;
2072 2050          }
↓ open down ↓ 7 lines elided ↑ open up ↑
2080 2058           * here, we do pretty much the same as above to clean up.
2081 2059           */
2082 2060          status = hermon_rsrc_alloc(state, HERMON_REFCNT, 1, sleep,
2083 2061              &mtt_refcnt);
2084 2062          if (status != DDI_SUCCESS) {
2085 2063                  status = IBT_INSUFF_RESOURCE;
2086 2064                  goto alloclkey_fail4;
2087 2065          }
2088 2066          mr->mr_mttrefcntp = mtt_refcnt;
2089 2067          swrc_tmp = (hermon_sw_refcnt_t *)mtt_refcnt->hr_addr;
2090      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*swrc_tmp))
2091 2068          HERMON_MTT_REFCNT_INIT(swrc_tmp);
2092 2069  
2093 2070          mtt_addr = (mtt->hr_indx << HERMON_MTT_SIZE_SHIFT);
2094 2071  
2095 2072          bzero(&mpt_entry, sizeof (hermon_hw_dmpt_t));
2096 2073          mpt_entry.status = HERMON_MPT_FREE;
2097 2074          mpt_entry.lw = 1;
2098 2075          mpt_entry.lr = 1;
2099 2076          mpt_entry.reg_win = HERMON_MPT_IS_REGION;
2100 2077          mpt_entry.entity_sz = mr->mr_logmttpgsz;
↓ open down ↓ 280 lines elided ↑ open up ↑
2381 2358  {
2382 2359          hermon_rsrc_t           *mpt;
2383 2360          ibt_mr_attr_flags_t     acc_flags_to_use;
2384 2361          ibt_mr_flags_t          flags;
2385 2362          hermon_pdhdl_t          pd_to_use;
2386 2363          hermon_hw_dmpt_t        mpt_entry;
2387 2364          uint64_t                mtt_addr_to_use, vaddr_to_use, len_to_use;
2388 2365          uint_t                  sleep, dereg_level;
2389 2366          int                     status;
2390 2367  
2391      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind))
2392      -
2393 2368          /*
2394 2369           * Check here to see if the memory region corresponds to a userland
2395 2370           * mapping.  Reregistration of userland memory regions is not
2396 2371           * currently supported.  Return failure.
2397 2372           */
2398 2373          if (mr->mr_is_umem) {
2399 2374                  status = IBT_MR_HDL_INVALID;
2400 2375                  goto mrrereg_fail;
2401 2376          }
2402 2377  
↓ open down ↓ 579 lines elided ↑ open up ↑
2982 2957                                   */
2983 2958                                  hermon_mr_mem_unbind(state, bind);
2984 2959                                  hermon_rsrc_free(state, &mtt);
2985 2960                                  *dereg_level =
2986 2961                                      HERMON_MR_DEREG_NO_HW2SW_MPT_OR_UNBIND;
2987 2962  
2988 2963                                  status = IBT_INSUFF_RESOURCE;
2989 2964                                  goto mrrereghelp_fail;
2990 2965                          }
2991 2966                          swrc_new = (hermon_sw_refcnt_t *)mtt_refcnt->hr_addr;
2992      -                        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*swrc_new))
2993 2967                          HERMON_MTT_REFCNT_INIT(swrc_new);
2994 2968                  } else {
2995 2969                          mtt_refcnt = mr->mr_mttrefcntp;
2996 2970                  }
2997 2971  
2998 2972                  /*
2999 2973                   * Using the new mapping and the new MTT resources, write the
3000 2974                   * updated entries to MTT
3001 2975                   */
3002 2976                  status = hermon_mr_fast_mtt_write(state, mtt, bind,
↓ open down ↓ 95 lines elided ↑ open up ↑
3098 3072  {
3099 3073          ddi_dma_attr_t  dma_attr;
3100 3074          int             (*callback)(caddr_t);
3101 3075          int             status;
3102 3076  
3103 3077          /* bi_type must be set to a meaningful value to get a bind handle */
3104 3078          ASSERT(bind->bi_type == HERMON_BINDHDL_VADDR ||
3105 3079              bind->bi_type == HERMON_BINDHDL_BUF ||
3106 3080              bind->bi_type == HERMON_BINDHDL_UBUF);
3107 3081  
3108      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind))
3109      -
3110 3082          /* Set the callback flag appropriately */
3111 3083          callback = (sleep == HERMON_SLEEP) ? DDI_DMA_SLEEP : DDI_DMA_DONTWAIT;
3112 3084  
3113 3085          /*
3114 3086           * Initialize many of the default DMA attributes.  Then, if we're
3115 3087           * bypassing the IOMMU, set the DDI_DMA_FORCE_PHYSICAL flag.
3116 3088           */
3117 3089          if (dmahdl == NULL) {
3118 3090                  hermon_dma_attr_init(state, &dma_attr);
3119 3091  #ifdef  __sparc
↓ open down ↓ 65 lines elided ↑ open up ↑
3185 3157  
3186 3158  /*
3187 3159   * hermon_mr_mem_unbind()
3188 3160   *    Context: Can be called from interrupt or base context.
3189 3161   */
3190 3162  static void
3191 3163  hermon_mr_mem_unbind(hermon_state_t *state, hermon_bind_info_t *bind)
3192 3164  {
3193 3165          int     status;
3194 3166  
3195      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind))
3196 3167          /* there is nothing to unbind for alloc_lkey */
3197 3168          if (bind->bi_type == HERMON_BINDHDL_LKEY)
3198 3169                  return;
3199 3170  
3200 3171          /*
3201 3172           * In case of HERMON_BINDHDL_UBUF, the memory bi_buf points to
3202 3173           * is actually allocated by ddi_umem_iosetup() internally, then
3203 3174           * it's required to free it here. Reset bi_type to HERMON_BINDHDL_NONE
3204 3175           * not to free it again later.
3205 3176           */
3206      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*bind))
3207 3177          if (bind->bi_type == HERMON_BINDHDL_UBUF) {
3208 3178                  freerbuf(bind->bi_buf);
3209 3179                  bind->bi_type = HERMON_BINDHDL_NONE;
3210 3180          }
3211      -        _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*bind))
3212 3181  
3213 3182          /*
3214 3183           * Unbind the DMA memory for the region
3215 3184           *
3216 3185           * Note: The only way ddi_dma_unbind_handle() currently
3217 3186           * can return an error is if the handle passed in is invalid.
3218 3187           * Since this should never happen, we choose to return void
3219 3188           * from this function!  If this does return an error, however,
3220 3189           * then we print a warning message to the console.
3221 3190           */
↓ open down ↓ 94 lines elided ↑ open up ↑
3316 3285                                      (uint64_t *)(uintptr_t)dma_info->vaddr;
3317 3286  
3318 3287                                  sync_needed = 0;
3319 3288                          } else {
3320 3289                                  sync_needed = 1;
3321 3290                          }
3322 3291  
3323 3292                          addr += pagesize;
3324 3293                          if (addr == 0) {
3325 3294                                  static int do_once = 1;
3326      -                                _NOTE(SCHEME_PROTECTS_DATA("safe sharing",
3327      -                                    do_once))
3328 3295                                  if (do_once) {
3329 3296                                          do_once = 0;
3330 3297                                          cmn_err(CE_NOTE, "probable error in "
3331 3298                                              "dma_cookie address from caller\n");
3332 3299                                  }
3333 3300                                  break;
3334 3301                          }
3335 3302                  }
3336 3303  
3337 3304                  /*
↓ open down ↓ 85 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX