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_ci.c
          +++ new/usr/src/uts/common/io/ib/adapters/hermon/hermon_ci.c
↓ open down ↓ 644 lines elided ↑ open up ↑
 645  645   */
 646  646  static ibt_status_t
 647  647  hermon_ci_alloc_qp(ibc_hca_hdl_t hca, ibtl_qp_hdl_t ibt_qphdl,
 648  648      ibt_qp_type_t type, ibt_qp_alloc_attr_t *attr_p,
 649  649      ibt_chan_sizes_t *queue_sizes_p, ib_qpn_t *qpn, ibc_qp_hdl_t *qp_p)
 650  650  {
 651  651          hermon_state_t          *state;
 652  652          hermon_qp_info_t        qpinfo;
 653  653          int                     status;
 654  654  
 655      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*attr_p))
 656      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*queue_sizes_p))
 657      -
 658  655          /* Grab the Hermon softstate pointer */
 659  656          state = (hermon_state_t *)hca;
 660  657  
 661  658          /* Allocate the QP */
 662  659          qpinfo.qpi_attrp        = attr_p;
 663  660          qpinfo.qpi_type         = type;
 664  661          qpinfo.qpi_ibt_qphdl    = ibt_qphdl;
 665  662          qpinfo.qpi_queueszp     = queue_sizes_p;
 666  663          qpinfo.qpi_qpn          = qpn;
 667  664          status = hermon_qp_alloc(state, &qpinfo, HERMON_NOSLEEP);
↓ open down ↓ 16 lines elided ↑ open up ↑
 684  681  static ibt_status_t
 685  682  hermon_ci_alloc_special_qp(ibc_hca_hdl_t hca, uint8_t port,
 686  683      ibtl_qp_hdl_t ibt_qphdl, ibt_sqp_type_t type,
 687  684      ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p,
 688  685      ibc_qp_hdl_t *qp_p)
 689  686  {
 690  687          hermon_state_t          *state;
 691  688          hermon_qp_info_t        qpinfo;
 692  689          int                     status;
 693  690  
 694      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*attr_p))
 695      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*queue_sizes_p))
 696      -
 697  691          /* Grab the Hermon softstate pointer */
 698  692          state = (hermon_state_t *)hca;
 699  693  
 700  694          /* Allocate the Special QP */
 701  695          qpinfo.qpi_attrp        = attr_p;
 702  696          qpinfo.qpi_type         = type;
 703  697          qpinfo.qpi_port         = port;
 704  698          qpinfo.qpi_ibt_qphdl    = ibt_qphdl;
 705  699          qpinfo.qpi_queueszp     = queue_sizes_p;
 706  700          status = hermon_special_qp_alloc(state, &qpinfo, HERMON_NOSLEEP);
↓ open down ↓ 16 lines elided ↑ open up ↑
 723  717  hermon_ci_alloc_qp_range(ibc_hca_hdl_t hca, uint_t log2,
 724  718      ibtl_qp_hdl_t *ibtl_qp, ibt_qp_type_t type,
 725  719      ibt_qp_alloc_attr_t *attr_p, ibt_chan_sizes_t *queue_sizes_p,
 726  720      ibc_cq_hdl_t *send_cq, ibc_cq_hdl_t *recv_cq,
 727  721      ib_qpn_t *qpn, ibc_qp_hdl_t *qp_p)
 728  722  {
 729  723          hermon_state_t          *state;
 730  724          hermon_qp_info_t        qpinfo;
 731  725          int                     status;
 732  726  
 733      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*attr_p))
 734      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*queue_sizes_p))
 735      -
 736  727          /* Grab the Hermon softstate pointer */
 737  728          state = (hermon_state_t *)hca;
 738  729  
 739  730          /* Allocate the QP */
 740  731          qpinfo.qpi_attrp        = attr_p;
 741  732          qpinfo.qpi_type         = type;
 742  733          qpinfo.qpi_queueszp     = queue_sizes_p;
 743  734          qpinfo.qpi_qpn          = qpn;
 744  735          status = hermon_qp_alloc_range(state, log2, &qpinfo, ibtl_qp,
 745  736              send_cq, recv_cq, (hermon_qphdl_t *)qp_p, HERMON_NOSLEEP);
↓ open down ↓ 160 lines elided ↑ open up ↑
 906  897          hermon_cqhdl_t  cqhdl;
 907  898  
 908  899          /* Grab the CQ handle */
 909  900          state = (hermon_state_t *)hca;
 910  901          cqhdl = (hermon_cqhdl_t)cq;
 911  902  
 912  903          /* Query the current CQ size */
 913  904          *entries_p = cqhdl->cq_bufsz;
 914  905          *count_p = cqhdl->cq_intmod_count;
 915  906          *usec_p = cqhdl->cq_intmod_usec;
 916      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cqhdl))
 917  907          *hid_p = HERMON_EQNUM_TO_HID(state, cqhdl->cq_eqnum);
 918  908  
 919  909          return (IBT_SUCCESS);
 920  910  }
 921  911  
 922  912  
 923  913  /*
 924  914   * hermon_ci_resize_cq()
 925  915   *    Change the size of a Completion Queue
 926  916   *    Context: Can be called only from user or kernel context.
↓ open down ↓ 81 lines elided ↑ open up ↑
1008  998  hermon_ci_query_cq_handler_id(ibc_hca_hdl_t hca,
1009  999      ibt_cq_handler_id_t hid, ibt_cq_handler_attr_t *attrs)
1010 1000  {
1011 1001          hermon_state_t          *state;
1012 1002  
1013 1003          state = (hermon_state_t *)hca;
1014 1004          if (!HERMON_HID_VALID(state, hid))
1015 1005                  return (IBT_CQ_HID_INVALID);
1016 1006          if (attrs == NULL)
1017 1007                  return (IBT_INVALID_PARAM);
1018      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*attrs))
1019 1008          attrs->cha_ih = state->hs_intrmsi_hdl[hid - 1];
1020 1009          attrs->cha_dip = state->hs_dip;
1021 1010          return (IBT_SUCCESS);
1022 1011  }
1023 1012  
1024 1013  /*
1025 1014   * hermon_ci_alloc_eec()
1026 1015   *    Allocate an End-to-End context
1027 1016   *    Context: Can be called only from user or kernel context.
1028 1017   */
↓ open down ↓ 77 lines elided ↑ open up ↑
1106 1095  hermon_ci_register_mr(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
1107 1096      ibt_mr_attr_t *mr_attr, void *ibtl_reserved, ibc_mr_hdl_t *mr_p,
1108 1097      ibt_mr_desc_t *mr_desc)
1109 1098  {
1110 1099          hermon_mr_options_t     op;
1111 1100          hermon_state_t          *state;
1112 1101          hermon_pdhdl_t          pdhdl;
1113 1102          hermon_mrhdl_t          mrhdl;
1114 1103          int                     status;
1115 1104  
1116      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr_desc))
1117      -
1118 1105          ASSERT(mr_attr != NULL);
1119 1106          ASSERT(mr_p != NULL);
1120 1107          ASSERT(mr_desc != NULL);
1121 1108  
1122 1109          /*
1123 1110           * Validate the access flags.  Both Remote Write and Remote Atomic
1124 1111           * require the Local Write flag to be set
1125 1112           */
1126 1113          if (((mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1127 1114              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_ATOMIC)) &&
↓ open down ↓ 7 lines elided ↑ open up ↑
1135 1122  
1136 1123          /* Register the memory region */
1137 1124          op.mro_bind_type   = state->hs_cfg_profile->cp_iommu_bypass;
1138 1125          op.mro_bind_dmahdl = NULL;
1139 1126          op.mro_bind_override_addr = 0;
1140 1127          status = hermon_mr_register(state, pdhdl, mr_attr, &mrhdl,
1141 1128              &op, HERMON_MPT_DMPT);
1142 1129          if (status != DDI_SUCCESS) {
1143 1130                  return (status);
1144 1131          }
1145      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mrhdl))
1146 1132  
1147 1133          /* Fill in the mr_desc structure */
1148 1134          mr_desc->md_vaddr = mrhdl->mr_bindinfo.bi_addr;
1149 1135          mr_desc->md_lkey  = mrhdl->mr_lkey;
1150 1136          /* Only set RKey if remote access was requested */
1151 1137          if ((mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_ATOMIC) ||
1152 1138              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1153 1139              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_READ)) {
1154 1140                  mr_desc->md_rkey = mrhdl->mr_rkey;
1155 1141          }
↓ open down ↓ 23 lines elided ↑ open up ↑
1179 1165      ibt_smr_attr_t *attrp, struct buf *buf, void *ibtl_reserved,
1180 1166      ibt_mr_hdl_t *mr_p, ibt_mr_desc_t *mr_desc)
1181 1167  {
1182 1168          hermon_mr_options_t     op;
1183 1169          hermon_state_t          *state;
1184 1170          hermon_pdhdl_t          pdhdl;
1185 1171          hermon_mrhdl_t          mrhdl;
1186 1172          int                     status;
1187 1173          ibt_mr_flags_t          flags = attrp->mr_flags;
1188 1174  
1189      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr_desc))
1190      -
1191 1175          ASSERT(mr_p != NULL);
1192 1176          ASSERT(mr_desc != NULL);
1193 1177  
1194 1178          /*
1195 1179           * Validate the access flags.  Both Remote Write and Remote Atomic
1196 1180           * require the Local Write flag to be set
1197 1181           */
1198 1182          if (((flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1199 1183              (flags & IBT_MR_ENABLE_REMOTE_ATOMIC)) &&
1200 1184              !(flags & IBT_MR_ENABLE_LOCAL_WRITE)) {
↓ open down ↓ 6 lines elided ↑ open up ↑
1207 1191  
1208 1192          /* Register the memory region */
1209 1193          op.mro_bind_type   = state->hs_cfg_profile->cp_iommu_bypass;
1210 1194          op.mro_bind_dmahdl = NULL;
1211 1195          op.mro_bind_override_addr = 0;
1212 1196          status = hermon_mr_register_buf(state, pdhdl, attrp, buf,
1213 1197              &mrhdl, &op, HERMON_MPT_DMPT);
1214 1198          if (status != DDI_SUCCESS) {
1215 1199                  return (status);
1216 1200          }
1217      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mrhdl))
1218 1201  
1219 1202          /* Fill in the mr_desc structure */
1220 1203          mr_desc->md_vaddr = mrhdl->mr_bindinfo.bi_addr;
1221 1204          mr_desc->md_lkey  = mrhdl->mr_lkey;
1222 1205          /* Only set RKey if remote access was requested */
1223 1206          if ((flags & IBT_MR_ENABLE_REMOTE_ATOMIC) ||
1224 1207              (flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1225 1208              (flags & IBT_MR_ENABLE_REMOTE_READ)) {
1226 1209                  mr_desc->md_rkey = mrhdl->mr_rkey;
1227 1210          }
↓ open down ↓ 71 lines elided ↑ open up ↑
1299 1282  static ibt_status_t
1300 1283  hermon_ci_register_shared_mr(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr,
1301 1284      ibc_pd_hdl_t pd, ibt_smr_attr_t *mr_attr, void *ibtl_reserved,
1302 1285      ibc_mr_hdl_t *mr_p, ibt_mr_desc_t *mr_desc)
1303 1286  {
1304 1287          hermon_state_t          *state;
1305 1288          hermon_pdhdl_t          pdhdl;
1306 1289          hermon_mrhdl_t          mrhdl, mrhdl_new;
1307 1290          int                     status;
1308 1291  
1309      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr_desc))
1310      -
1311 1292          ASSERT(mr_attr != NULL);
1312 1293          ASSERT(mr_p != NULL);
1313 1294          ASSERT(mr_desc != NULL);
1314 1295  
1315 1296          /*
1316 1297           * Validate the access flags.  Both Remote Write and Remote Atomic
1317 1298           * require the Local Write flag to be set
1318 1299           */
1319 1300          if (((mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1320 1301              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_ATOMIC)) &&
↓ open down ↓ 5 lines elided ↑ open up ↑
1326 1307          state = (hermon_state_t *)hca;
1327 1308          pdhdl = (hermon_pdhdl_t)pd;
1328 1309          mrhdl = (hermon_mrhdl_t)mr;
1329 1310  
1330 1311          /* Register the shared memory region */
1331 1312          status = hermon_mr_register_shared(state, mrhdl, pdhdl, mr_attr,
1332 1313              &mrhdl_new);
1333 1314          if (status != DDI_SUCCESS) {
1334 1315                  return (status);
1335 1316          }
1336      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mrhdl_new))
1337 1317  
1338 1318          /* Fill in the mr_desc structure */
1339 1319          mr_desc->md_vaddr = mrhdl_new->mr_bindinfo.bi_addr;
1340 1320          mr_desc->md_lkey  = mrhdl_new->mr_lkey;
1341 1321          /* Only set RKey if remote access was requested */
1342 1322          if ((mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_ATOMIC) ||
1343 1323              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1344 1324              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_READ)) {
1345 1325                  mr_desc->md_rkey = mrhdl_new->mr_rkey;
1346 1326          }
↓ open down ↓ 22 lines elided ↑ open up ↑
1369 1349  hermon_ci_reregister_mr(ibc_hca_hdl_t hca, ibc_mr_hdl_t mr, ibc_pd_hdl_t pd,
1370 1350      ibt_mr_attr_t *mr_attr, void *ibtl_reserved, ibc_mr_hdl_t *mr_new,
1371 1351      ibt_mr_desc_t *mr_desc)
1372 1352  {
1373 1353          hermon_mr_options_t     op;
1374 1354          hermon_state_t          *state;
1375 1355          hermon_pdhdl_t          pdhdl;
1376 1356          hermon_mrhdl_t          mrhdl, mrhdl_new;
1377 1357          int                     status;
1378 1358  
1379      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr_desc))
1380      -
1381 1359          ASSERT(mr_attr != NULL);
1382 1360          ASSERT(mr_new != NULL);
1383 1361          ASSERT(mr_desc != NULL);
1384 1362  
1385 1363          /* Grab the Hermon softstate pointer, mrhdl, and pdhdl */
1386 1364          state = (hermon_state_t *)hca;
1387 1365          mrhdl = (hermon_mrhdl_t)mr;
1388 1366          pdhdl = (hermon_pdhdl_t)pd;
1389 1367  
1390 1368          /* Reregister the memory region */
1391 1369          op.mro_bind_type = state->hs_cfg_profile->cp_iommu_bypass;
1392 1370          status = hermon_mr_reregister(state, mrhdl, pdhdl, mr_attr,
1393 1371              &mrhdl_new, &op);
1394 1372          if (status != DDI_SUCCESS) {
1395 1373                  return (status);
1396 1374          }
1397      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mrhdl_new))
1398 1375  
1399 1376          /* Fill in the mr_desc structure */
1400 1377          mr_desc->md_vaddr = mrhdl_new->mr_bindinfo.bi_addr;
1401 1378          mr_desc->md_lkey  = mrhdl_new->mr_lkey;
1402 1379          /* Only set RKey if remote access was requested */
1403 1380          if ((mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_ATOMIC) ||
1404 1381              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1405 1382              (mr_attr->mr_flags & IBT_MR_ENABLE_REMOTE_READ)) {
1406 1383                  mr_desc->md_rkey = mrhdl_new->mr_rkey;
1407 1384          }
↓ open down ↓ 23 lines elided ↑ open up ↑
1431 1408      ibt_smr_attr_t *attrp, struct buf *buf, void *ibtl_reserved,
1432 1409      ibc_mr_hdl_t *mr_new, ibt_mr_desc_t *mr_desc)
1433 1410  {
1434 1411          hermon_mr_options_t     op;
1435 1412          hermon_state_t          *state;
1436 1413          hermon_pdhdl_t          pdhdl;
1437 1414          hermon_mrhdl_t          mrhdl, mrhdl_new;
1438 1415          int                     status;
1439 1416          ibt_mr_flags_t          flags = attrp->mr_flags;
1440 1417  
1441      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr_desc))
1442      -
1443 1418          ASSERT(mr_new != NULL);
1444 1419          ASSERT(mr_desc != NULL);
1445 1420  
1446 1421          /* Grab the Hermon softstate pointer, mrhdl, and pdhdl */
1447 1422          state = (hermon_state_t *)hca;
1448 1423          mrhdl = (hermon_mrhdl_t)mr;
1449 1424          pdhdl = (hermon_pdhdl_t)pd;
1450 1425  
1451 1426          /* Reregister the memory region */
1452 1427          op.mro_bind_type = state->hs_cfg_profile->cp_iommu_bypass;
1453 1428          status = hermon_mr_reregister_buf(state, mrhdl, pdhdl, attrp, buf,
1454 1429              &mrhdl_new, &op);
1455 1430          if (status != DDI_SUCCESS) {
1456 1431                  return (status);
1457 1432          }
1458      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mrhdl_new))
1459 1433  
1460 1434          /* Fill in the mr_desc structure */
1461 1435          mr_desc->md_vaddr = mrhdl_new->mr_bindinfo.bi_addr;
1462 1436          mr_desc->md_lkey  = mrhdl_new->mr_lkey;
1463 1437          /* Only set RKey if remote access was requested */
1464 1438          if ((flags & IBT_MR_ENABLE_REMOTE_ATOMIC) ||
1465 1439              (flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1466 1440              (flags & IBT_MR_ENABLE_REMOTE_READ)) {
1467 1441                  mr_desc->md_rkey = mrhdl_new->mr_rkey;
1468 1442          }
↓ open down ↓ 52 lines elided ↑ open up ↑
1521 1495  
1522 1496          /* Grab the Hermon softstate pointer and PD handle */
1523 1497          state = (hermon_state_t *)hca;
1524 1498          pdhdl = (hermon_pdhdl_t)pd;
1525 1499  
1526 1500          /* Allocate the memory window */
1527 1501          status = hermon_mw_alloc(state, pdhdl, flags, &mwhdl);
1528 1502          if (status != DDI_SUCCESS) {
1529 1503                  return (status);
1530 1504          }
1531      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mwhdl))
1532 1505  
1533 1506          /* Return the MW handle and RKey */
1534 1507          *mw_p = (ibc_mw_hdl_t)mwhdl;
1535 1508          *rkey_p = mwhdl->mr_rkey;
1536 1509  
1537 1510          return (IBT_SUCCESS);
1538 1511  }
1539 1512  
1540 1513  
1541 1514  /*
↓ open down ↓ 52 lines elided ↑ open up ↑
1594 1567  static ibt_status_t
1595 1568  hermon_ci_register_dma_mr(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
1596 1569      ibt_dmr_attr_t *mr_attr, void *ibtl_reserved, ibc_mr_hdl_t *mr_p,
1597 1570      ibt_mr_desc_t *mr_desc)
1598 1571  {
1599 1572          hermon_state_t          *state;
1600 1573          hermon_pdhdl_t          pdhdl;
1601 1574          hermon_mrhdl_t          mrhdl;
1602 1575          int                     status;
1603 1576  
1604      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mr_desc))
1605      -
1606 1577          ASSERT(mr_attr != NULL);
1607 1578          ASSERT(mr_p != NULL);
1608 1579          ASSERT(mr_desc != NULL);
1609 1580  
1610 1581          /*
1611 1582           * Validate the access flags.  Both Remote Write and Remote Atomic
1612 1583           * require the Local Write flag to be set
1613 1584           */
1614 1585          if (((mr_attr->dmr_flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1615 1586              (mr_attr->dmr_flags & IBT_MR_ENABLE_REMOTE_ATOMIC)) &&
↓ open down ↓ 2 lines elided ↑ open up ↑
1618 1589          }
1619 1590  
1620 1591          /* Grab the Hermon softstate pointer and PD handle */
1621 1592          state = (hermon_state_t *)hca;
1622 1593          pdhdl = (hermon_pdhdl_t)pd;
1623 1594  
1624 1595          status = hermon_dma_mr_register(state, pdhdl, mr_attr, &mrhdl);
1625 1596          if (status != DDI_SUCCESS) {
1626 1597                  return (status);
1627 1598          }
1628      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mrhdl))
1629 1599  
1630 1600          /* Fill in the mr_desc structure */
1631 1601          mr_desc->md_vaddr = mr_attr->dmr_paddr;
1632 1602          mr_desc->md_lkey  = mrhdl->mr_lkey;
1633 1603          /* Only set RKey if remote access was requested */
1634 1604          if ((mr_attr->dmr_flags & IBT_MR_ENABLE_REMOTE_ATOMIC) ||
1635 1605              (mr_attr->dmr_flags & IBT_MR_ENABLE_REMOTE_WRITE) ||
1636 1606              (mr_attr->dmr_flags & IBT_MR_ENABLE_REMOTE_READ)) {
1637 1607                  mr_desc->md_rkey = mrhdl->mr_rkey;
1638 1608          }
↓ open down ↓ 449 lines elided ↑ open up ↑
2088 2058                  return (IBT_INSUFF_RESOURCE);
2089 2059          }
2090 2060  #ifdef  __sparc
2091 2061          if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS)
2092 2062                  dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL;
2093 2063  
2094 2064          if (hermon_kernel_data_ro == HERMON_RO_ENABLED)
2095 2065                  dma_attr.dma_attr_flags |= DDI_DMA_RELAXED_ORDERING;
2096 2066  #endif
2097 2067  
2098      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ma_hdl))
2099 2068          status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr,
2100 2069              callback, NULL, &ma_hdl->h_ma_dmahdl);
2101 2070          if (status != DDI_SUCCESS) {
2102 2071                  kmem_free(ma_hdl, sizeof (*ma_hdl));
2103 2072                  return (IBT_INSUFF_RESOURCE);
2104 2073          }
2105 2074          status = ddi_dma_buf_bind_handle(ma_hdl->h_ma_dmahdl,
2106 2075              va_attrs->va_buf, DDI_DMA_RDWR | DDI_DMA_CONSISTENT,
2107 2076              callback, NULL, &dmacookie, &cookie_cnt);
2108 2077          if (status != DDI_DMA_MAPPED) {
↓ open down ↓ 20 lines elided ↑ open up ↑
2129 2098                  while (addr <= endaddr) {
2130 2099                          if (i >= list_len) {
2131 2100                                  status = IBT_PBL_TOO_SMALL;
2132 2101                                  goto marea_fail5;
2133 2102                          }
2134 2103                          kaddr[i] = htonll(addr | HERMON_MTT_ENTRY_PRESENT);
2135 2104                          i++;
2136 2105                          addr += pagesize;
2137 2106                          if (addr == 0) {
2138 2107                                  static int do_once = 1;
2139      -                                _NOTE(SCHEME_PROTECTS_DATA("safe sharing",
2140      -                                    do_once))
2141 2108                                  if (do_once) {
2142 2109                                          do_once = 0;
2143 2110                                          cmn_err(CE_NOTE, "probable error in "
2144 2111                                              "dma_cookie address: map_mem_area");
2145 2112                                  }
2146 2113                                  break;
2147 2114                          }
2148 2115                  }
2149 2116                  if (cookie_cnt != 0)
2150 2117                          ddi_dma_nextcookie(ma_hdl->h_ma_dmahdl, &dmacookie);
2151 2118          }
2152 2119  
2153      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*pmr))
2154 2120          pmr->pmr_addr_list = (ibt_phys_addr_t *)(void *)ma_hdl->h_ma_kaddr;
2155 2121          pmr->pmr_iova = va_attrs->va_vaddr;
2156 2122          pmr->pmr_len = len;
2157 2123          pmr->pmr_offset = va_attrs->va_vaddr & PAGEOFFSET;
2158 2124          pmr->pmr_buf_sz = PAGESHIFT;    /* PRM says "Page Sice", but... */
2159 2125          pmr->pmr_num_buf = i;
2160 2126          pmr->pmr_ma = ma_hdl;
2161 2127  
2162 2128          *ma_hdl_p = ma_hdl;
2163 2129          return (IBT_SUCCESS);
↓ open down ↓ 66 lines elided ↑ open up ↑
2230 2196                  callback = DDI_DMA_DONTWAIT;
2231 2197          } else {
2232 2198                  kmflag = KM_SLEEP;
2233 2199                  callback = DDI_DMA_SLEEP;
2234 2200          }
2235 2201  
2236 2202          ma_hdl = kmem_zalloc(sizeof (*ma_hdl), kmflag);
2237 2203          if (ma_hdl == NULL) {
2238 2204                  return (IBT_INSUFF_RESOURCE);
2239 2205          }
2240      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ma_hdl))
2241 2206  
2242 2207          status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr,
2243 2208              callback, NULL, &ma_hdl->h_ma_dmahdl);
2244 2209          if (status != DDI_SUCCESS) {
2245 2210                  ibt_status = IBT_INSUFF_RESOURCE;
2246 2211                  goto marea_fail0;
2247 2212          }
2248 2213          dma_attr.dma_attr_align = 64;   /* as per PRM */
2249 2214          status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr,
2250 2215              callback, NULL, &ma_hdl->h_ma_list_hdl);
↓ open down ↓ 74 lines elided ↑ open up ↑
2325 2290                                          kcookie_paddr = kcookie.dmac_laddress;
2326 2291                                  }
2327 2292                                  kaddr[i+j] = htonll(kcookie_paddr);
2328 2293                                  j++;
2329 2294                          }
2330 2295                          kaddr[i+j] = htonll(addr | HERMON_MTT_ENTRY_PRESENT);
2331 2296                          i++;
2332 2297                          addr += pagesize;
2333 2298                          if (addr == 0) {
2334 2299                                  static int do_once = 1;
2335      -                                _NOTE(SCHEME_PROTECTS_DATA("safe sharing",
2336      -                                    do_once))
2337 2300                                  if (do_once) {
2338 2301                                          do_once = 0;
2339 2302                                          cmn_err(CE_NOTE, "probable error in "
2340 2303                                              "dma_cookie address: map_mem_area");
2341 2304                                  }
2342 2305                                  break;
2343 2306                          }
2344 2307                  }
2345 2308                  if (cookie_cnt != 0)
2346 2309                          ddi_dma_nextcookie(ma_hdl->h_ma_dmahdl, &dmacookie);
2347 2310          }
2348 2311  
2349 2312          pmr = &reg_req->wr;
2350      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*pmr))
2351 2313          pmr->pmr_len = len;
2352 2314          pmr->pmr_offset = va_attrs->va_vaddr & PAGEOFFSET;
2353 2315          pmr->pmr_buf_sz = PAGESHIFT;    /* PRM says "Page Size", but... */
2354 2316          pmr->pmr_num_buf = i;
2355 2317          pmr->pmr_addr_list = &ma_hdl->h_ma_list_cookie;
2356 2318  
2357 2319          *ma_hdl_p = ma_hdl;
2358 2320          return (IBT_SUCCESS);
2359 2321  
2360 2322  marea_fail5:
↓ open down ↓ 46 lines elided ↑ open up ↑
2407 2369                  HERMON_WARNING(state, "failed to unbind DMA mapping");
2408 2370          ddi_dma_free_handle(&ma_hdl->h_ma_dmahdl);
2409 2371          kmem_free(ma_hdl, sizeof (*ma_hdl));
2410 2372          return (IBT_SUCCESS);
2411 2373  }
2412 2374  
2413 2375  struct ibc_mi_s {
2414 2376          int                     imh_len;
2415 2377          ddi_dma_handle_t        imh_dmahandle[1];
2416 2378  };
2417      -_NOTE(SCHEME_PROTECTS_DATA("safe sharing",
2418      -    ibc_mi_s::imh_len
2419      -    ibc_mi_s::imh_dmahandle))
2420 2379  
2421      -
2422 2380  /*
2423 2381   * hermon_ci_map_mem_iov()
2424 2382   * Map the memory
2425 2383   *    Context: Can be called from interrupt or base context.
2426 2384   */
2427 2385  /* ARGSUSED */
2428 2386  static ibt_status_t
2429 2387  hermon_ci_map_mem_iov(ibc_hca_hdl_t hca, ibt_iov_attr_t *iov_attr,
2430 2388      ibt_all_wr_t *wr, ibc_mi_hdl_t *mi_hdl_p)
2431 2389  {
↓ open down ↓ 5 lines elided ↑ open up ↑
2437 2395          ddi_dma_cookie_t        dmacookie;
2438 2396          ddi_dma_attr_t          dma_attr;
2439 2397          uint_t                  cookie_cnt;
2440 2398          ibc_mi_hdl_t            mi_hdl;
2441 2399          ibt_lkey_t              rsvd_lkey;
2442 2400          ibt_wr_ds_t             *sgl;
2443 2401          hermon_state_t          *state;
2444 2402          int                     kmflag;
2445 2403          int                     (*callback)(caddr_t);
2446 2404  
2447      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*wr))
2448      -
2449 2405          state = (hermon_state_t *)hca;
2450 2406          hermon_dma_attr_init(state, &dma_attr);
2451 2407  #ifdef  __sparc
2452 2408          if (state->hs_cfg_profile->cp_iommu_bypass == HERMON_BINDMEM_BYPASS)
2453 2409                  dma_attr.dma_attr_flags = DDI_DMA_FORCE_PHYSICAL;
2454 2410  
2455 2411          if (hermon_kernel_data_ro == HERMON_RO_ENABLED)
2456 2412                  dma_attr.dma_attr_flags |= DDI_DMA_RELAXED_ORDERING;
2457 2413  #endif
2458 2414  
↓ open down ↓ 10 lines elided ↑ open up ↑
2469 2425          } else {
2470 2426                  kmflag = KM_NOSLEEP;
2471 2427                  callback = DDI_DMA_DONTWAIT;
2472 2428          }
2473 2429  
2474 2430          if (iov_attr->iov_flags & IBT_IOV_BUF) {
2475 2431                  mi_hdl = kmem_alloc(sizeof (*mi_hdl), kmflag);
2476 2432                  if (mi_hdl == NULL)
2477 2433                          return (IBT_INSUFF_RESOURCE);
2478 2434                  sgl = wr->send.wr_sgl;
2479      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*sgl))
2480      -
2481 2435                  status = ddi_dma_alloc_handle(state->hs_dip, &dma_attr,
2482 2436                      callback, NULL, &dmahdl);
2483 2437                  if (status != DDI_SUCCESS) {
2484 2438                          kmem_free(mi_hdl, sizeof (*mi_hdl));
2485 2439                          return (IBT_INSUFF_RESOURCE);
2486 2440                  }
2487 2441                  status = ddi_dma_buf_bind_handle(dmahdl, iov_attr->iov_buf,
2488 2442                      DDI_DMA_RDWR | DDI_DMA_CONSISTENT, callback, NULL,
2489 2443                      &dmacookie, &cookie_cnt);
2490 2444                  if (status != DDI_DMA_MAPPED) {
↓ open down ↓ 21 lines elided ↑ open up ↑
2512 2466                  mi_hdl->imh_len = 1;
2513 2467                  mi_hdl->imh_dmahandle[0] = dmahdl;
2514 2468                  *mi_hdl_p = mi_hdl;
2515 2469                  return (IBT_SUCCESS);
2516 2470          }
2517 2471  
2518 2472          if (iov_attr->iov_flags & IBT_IOV_RECV)
2519 2473                  sgl = wr->recv.wr_sgl;
2520 2474          else
2521 2475                  sgl = wr->send.wr_sgl;
2522      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*sgl))
2523 2476  
2524 2477          len = iov_attr->iov_list_len;
2525 2478          for (i = 0, j = 0; j < len; j++) {
2526 2479                  if (iov_attr->iov[j].iov_len == 0)
2527 2480                          continue;
2528 2481                  i++;
2529 2482          }
2530 2483          mi_hdl = kmem_alloc(sizeof (*mi_hdl) +
2531 2484              (i - 1) * sizeof (ddi_dma_handle_t), kmflag);
2532 2485          if (mi_hdl == NULL)
↓ open down ↓ 87 lines elided ↑ open up ↑
2620 2573  static ibt_status_t
2621 2574  hermon_ci_alloc_lkey(ibc_hca_hdl_t hca, ibc_pd_hdl_t pd,
2622 2575      ibt_lkey_flags_t flags, uint_t list_sz, ibc_mr_hdl_t *mr_p,
2623 2576      ibt_pmr_desc_t *mem_desc_p)
2624 2577  {
2625 2578          hermon_state_t          *state;
2626 2579          hermon_pdhdl_t          pdhdl;
2627 2580          hermon_mrhdl_t          mrhdl;
2628 2581          int                     status;
2629 2582  
2630      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mem_desc_p))
2631      -
2632 2583          ASSERT(mr_p != NULL);
2633 2584          ASSERT(mem_desc_p != NULL);
2634 2585  
2635 2586          state = (hermon_state_t *)hca;
2636 2587          pdhdl = (hermon_pdhdl_t)pd;
2637 2588  
2638 2589          if (!(state->hs_ibtfinfo.hca_attr->hca_flags2 & IBT_HCA2_MEM_MGT_EXT))
2639 2590                  return (IBT_NOT_SUPPORTED);
2640 2591  
2641 2592          status = hermon_mr_alloc_lkey(state, pdhdl, flags, list_sz, &mrhdl);
2642 2593          if (status != DDI_SUCCESS) {
2643 2594                  return (status);
2644 2595          }
2645      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mrhdl))
2646 2596  
2647 2597          /* Fill in the mem_desc_p structure */
2648 2598          mem_desc_p->pmd_iova = 0;
2649 2599          mem_desc_p->pmd_phys_buf_list_sz = list_sz;
2650 2600          mem_desc_p->pmd_lkey = mrhdl->mr_lkey;
2651 2601          /* Only set RKey if remote access was requested */
2652 2602          if (flags & IBT_KEY_REMOTE) {
2653 2603                  mem_desc_p->pmd_rkey = mrhdl->mr_rkey;
2654 2604          }
2655 2605          mem_desc_p->pmd_sync_required = B_FALSE;
↓ open down ↓ 140 lines elided ↑ open up ↑
2796 2746          status = hermon_register_physical_fmr(state, fmrpoolhdl, mem_pattr,
2797 2747              &mrhdl, mem_desc_p);
2798 2748          if (status != DDI_SUCCESS) {
2799 2749                  return (status);
2800 2750          }
2801 2751  
2802 2752          /*
2803 2753           * If region is mapped for streaming (i.e. noncoherent), then set
2804 2754           * sync is required
2805 2755           */
2806      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mem_desc_p))
2807 2756          mem_desc_p->pmd_sync_required = (mrhdl->mr_bindinfo.bi_flags &
2808 2757              IBT_MR_NONCOHERENT) ? B_TRUE : B_FALSE;
2809 2758          if (mem_desc_p->pmd_sync_required == B_TRUE) {
2810 2759                  /* Fill in DMA handle for future sync operations */
2811      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(mrhdl->mr_bindinfo))
2812 2760                  mrhdl->mr_bindinfo.bi_dmahdl =
2813 2761                      (ddi_dma_handle_t)mem_pattr->pmr_ma;
2814 2762          }
2815 2763  
2816 2764          /* Return the Hermon MR handle */
2817 2765          *mr_p = (ibc_mr_hdl_t)mrhdl;
2818 2766  
2819 2767          return (IBT_SUCCESS);
2820 2768  }
2821 2769  
↓ open down ↓ 117 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX