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_cmd.c
          +++ new/usr/src/uts/common/io/ib/adapters/tavor/tavor_cmd.c
↓ open down ↓ 67 lines elided ↑ open up ↑
  68   68   */
  69   69  int
  70   70  tavor_cmd_post(tavor_state_t *state, tavor_cmd_post_t *cmdpost)
  71   71  {
  72   72          tavor_cmd_t     *cmdptr;
  73   73          int             status;
  74   74          uint16_t        token;
  75   75  
  76   76          TAVOR_TNF_ENTER(tavor_cmd_post);
  77   77  
  78      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cmdpost))
  79      -
  80   78          /* Determine if we are going to spin until completion */
  81   79          if (cmdpost->cp_flags == TAVOR_CMD_NOSLEEP_SPIN) {
  82   80  
  83   81                  TNF_PROBE_0_DEBUG(tavor_cmd_post_spin, TAVOR_TNF_TRACE, "");
  84   82  
  85   83                  /* Write the command to the HCR */
  86   84                  status = tavor_write_hcr(state, cmdpost, 0);
  87   85                  if (status != TAVOR_CMD_SUCCESS) {
  88   86                          TNF_PROBE_0(tavor_cmd_post_fail,
  89   87                              TAVOR_TNF_ERROR, "");
↓ open down ↓ 11 lines elided ↑ open up ↑
 101   99                  ASSERT(TAVOR_SLEEPFLAG_FOR_CONTEXT() != TAVOR_NOSLEEP);
 102  100  
 103  101                  /* NOTE: Expect threads to be waiting in here */
 104  102                  status = tavor_outstanding_cmd_alloc(state, &cmdptr,
 105  103                      cmdpost->cp_flags);
 106  104                  if (status != TAVOR_CMD_SUCCESS) {
 107  105                          TNF_PROBE_0(tavor_cmd_alloc_fail, TAVOR_TNF_ERROR, "");
 108  106                          TAVOR_TNF_EXIT(tavor_cmd_post);
 109  107                          return (status);
 110  108                  }
 111      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cmdptr))
 112  109  
 113  110                  /*
 114  111                   * Set status to "TAVOR_CMD_INVALID_STATUS".  It is
 115  112                   * appropriate to do this here without the "cmd_comp_lock"
 116  113                   * because this register is overloaded.  Later it will be
 117  114                   * used to indicate - through a change from this invalid
 118  115                   * value to some other value - that the condition variable
 119  116                   * has been signaled.  Once it has, status will then contain
 120  117                   * the _real_ completion status
 121  118                   */
↓ open down ↓ 4 lines elided ↑ open up ↑
 126  123                  status = tavor_write_hcr(state, cmdpost, token);
 127  124                  if (status != TAVOR_CMD_SUCCESS) {
 128  125                          tavor_outstanding_cmd_free(state, &cmdptr);
 129  126                          TNF_PROBE_0(tavor_cmd_post_fail, TAVOR_TNF_ERROR, "");
 130  127                          TAVOR_TNF_EXIT(tavor_cmd_post);
 131  128                          return (status);
 132  129                  }
 133  130  
 134  131                  /*
 135  132                   * cv_wait() on the "command_complete" condition variable.
 136      -                 * Note: We have the "__lock_lint" here to workaround warlock.
 137      -                 * Since warlock doesn't know that other parts of the Tavor
 138      -                 * may occasionally call this routine while holding their own
 139      -                 * locks, it complains about this cv_wait.  In reality,
 140      -                 * however, the rest of the driver never calls this routine
 141      -                 * with a lock held unless they pass TAVOR_CMD_NOSLEEP.
 142  133                   */
 143      -                _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*cmdptr))
 144  134                  mutex_enter(&cmdptr->cmd_comp_lock);
 145  135                  while (cmdptr->cmd_status == TAVOR_CMD_INVALID_STATUS) {
 146      -#ifndef __lock_lint
 147      -                        cv_wait(&cmdptr->cmd_comp_cv, &cmdptr->cmd_comp_lock);
 148  136                          /* NOTE: EXPECT SEVERAL THREADS TO BE WAITING HERE */
 149      -#endif
      137 +                        cv_wait(&cmdptr->cmd_comp_cv, &cmdptr->cmd_comp_lock);
 150  138                  }
 151  139                  mutex_exit(&cmdptr->cmd_comp_lock);
 152      -                _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*cmdptr))
 153  140  
 154  141                  /*
 155  142                   * Wake up after command completes (cv_signal).  Read status
 156  143                   * from the command (success, fail, etc.).  It is appropriate
 157  144                   * here (as above) to read the status field without the
 158  145                   * "cmd_comp_lock" because it is no longer being used to
 159  146                   * indicate whether the condition variable has been signaled
 160  147                   * (i.e. at this point we are certain that it already has).
 161  148                   */
 162  149                  status = cmdptr->cmd_status;
↓ open down ↓ 81 lines elided ↑ open up ↑
 244  231                                              &state->ts_in_mblist,
 245  232                                              &mbox_info->mbi_in);
 246  233                                  }
 247  234                                  TAVOR_TNF_EXIT(tavor_mbox_alloc);
 248  235                                  return (status);
 249  236                          }
 250  237                  }
 251  238          }
 252  239  
 253  240          /* Store appropriate context in mbox_info */
 254      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(mbox_info->mbi_sleep_context))
 255  241          mbox_info->mbi_sleep_context = sleep_context;
 256  242  
 257  243          TAVOR_TNF_EXIT(tavor_mbox_alloc);
 258  244          return (TAVOR_CMD_SUCCESS);
 259  245  }
 260  246  
 261  247  
 262  248  /*
 263  249   * tavor_mbox_free()
 264  250   *    Context: Can be called from interrupt or base context.
↓ open down ↓ 2 lines elided ↑ open up ↑
 267  253  tavor_mbox_free(tavor_state_t *state, tavor_mbox_info_t *mbox_info)
 268  254  {
 269  255          TAVOR_TNF_ENTER(tavor_mbox_free);
 270  256  
 271  257          /*
 272  258           * The mailbox has to be freed in the same context from which it was
 273  259           * allocated.  The context is stored in the mbox_info at
 274  260           * tavor_mbox_alloc() time.  We check the stored context against the
 275  261           * current context here.
 276  262           */
 277      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(mbox_info->mbi_sleep_context))
 278  263          ASSERT(mbox_info->mbi_sleep_context == TAVOR_SLEEPFLAG_FOR_CONTEXT());
 279  264  
 280  265          /* Determine correct mboxlist based on calling context */
 281  266          if (mbox_info->mbi_sleep_context == TAVOR_NOSLEEP) {
 282  267                  /* Free the intr "In" mailbox */
 283  268                  if (mbox_info->mbi_alloc_flags & TAVOR_ALLOC_INMBOX) {
 284  269                          tavor_impl_mbox_free(&state->ts_in_intr_mblist,
 285  270                              &mbox_info->mbi_in);
 286  271                  }
 287  272  
↓ open down ↓ 284 lines elided ↑ open up ↑
 572  557                  mblist->mbl_pollers--;
 573  558  
 574  559          /* TAVOR_SLEEP */
 575  560          } else {
 576  561                  /*
 577  562                   * Grab lock here as we prepare to cv_wait if needed.
 578  563                   */
 579  564                  mutex_enter(&mblist->mbl_lock);
 580  565                  while (mblist->mbl_entries_free == 0) {
 581  566                          /*
 582      -                         * Wait (on cv) for a mailbox to become free.  Note:
 583      -                         * Just as we do above in tavor_cmd_post(), we also
 584      -                         * have the "__lock_lint" here to workaround warlock.
 585      -                         * Warlock doesn't know that other parts of the Tavor
 586      -                         * may occasionally call this routine while holding
 587      -                         * their own locks, so it complains about this cv_wait.
 588      -                         * In reality, however, the rest of the driver never
 589      -                         * calls this routine with a lock held unless they pass
 590      -                         * TAVOR_CMD_NOSLEEP.
      567 +                         * Wait (on cv) for a mailbox to become free.
 591  568                           */
 592  569                          mblist->mbl_waiters++;
 593      -#ifndef __lock_lint
 594  570                          cv_wait(&mblist->mbl_cv, &mblist->mbl_lock);
 595      -#endif
 596  571                  }
 597  572          }
 598  573  
 599  574          /* Grab the next available mailbox from list */
 600  575          mbox_ptr = mblist->mbl_mbox;
 601  576          index    = mblist->mbl_head_indx;
 602  577          next     = mbox_ptr[index].mb_next;
 603  578          prev     = mbox_ptr[index].mb_prev;
 604  579  
 605  580          /* Remove it from the mailbox list */
↓ open down ↓ 274 lines elided ↑ open up ↑
 880  855                  /* No free commands */
 881  856                  if (cmd_wait == TAVOR_NOSLEEP) {
 882  857                          mutex_exit(&cmd_list->cml_lock);
 883  858                          TNF_PROBE_0(tavor_outstanding_cmd_alloc_fail,
 884  859                              TAVOR_TNF_ERROR, "");
 885  860                          TAVOR_TNF_EXIT(tavor_outstanding_cmd_alloc);
 886  861                          return (TAVOR_CMD_INSUFF_RSRC);
 887  862                  }
 888  863  
 889  864                  /*
 890      -                 * Wait (on cv) for a command to become free.  Note: Just
 891      -                 * as we do above in tavor_cmd_post(), we also have the
 892      -                 * "__lock_lint" here to workaround warlock.  Warlock doesn't
 893      -                 * know that other parts of the Tavor may occasionally call
 894      -                 * this routine while holding their own locks, so it complains
 895      -                 * about this cv_wait.  In reality, however, the rest of the
 896      -                 * driver never calls this routine with a lock held unless
 897      -                 * they pass TAVOR_CMD_NOSLEEP.
      865 +                 * Wait (on cv) for a command to become free.
 898  866                   */
 899  867                  cmd_list->cml_waiters++;
 900      -#ifndef __lock_lint
 901  868                  cv_wait(&cmd_list->cml_cv, &cmd_list->cml_lock);
 902      -#endif
 903  869          }
 904  870  
 905  871          /* Grab the next available command from the list */
 906  872          head = cmd_list->cml_head_indx;
 907  873          *cmd_ptr = &cmd_list->cml_cmd[head];
 908      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(**cmd_ptr))
 909  874          next = (*cmd_ptr)->cmd_next;
 910  875          prev = (*cmd_ptr)->cmd_prev;
 911  876          (*cmd_ptr)->cmd_status = TAVOR_CMD_INVALID_STATUS;
 912  877  
 913  878          /* Remove it from the command list */
 914  879          cmd_list->cml_cmd[next].cmd_prev = prev;
 915  880          cmd_list->cml_cmd[prev].cmd_next = next;
 916  881          cmd_list->cml_head_indx          = next;
 917  882  
 918  883          /* Update the "free" count and return */
↓ open down ↓ 79 lines elided ↑ open up ↑
 998  963          uint64_t        hcrreg;
 999  964  
1000  965          TAVOR_TNF_ENTER(tavor_write_hcr);
1001  966  
1002  967          /*
1003  968           * Grab the "HCR access" lock if the driver is not in
1004  969           * fastreboot. In fastreboot, this function is called
1005  970           * with the single thread but in high interrupt context
1006  971           * (so that this mutex lock cannot be used).
1007  972           */
1008      -#ifdef __lock_lint
1009      -        mutex_enter(&state->ts_cmd_regs.hcr_lock);
1010      -#else
1011  973          if (!TAVOR_IN_FASTREBOOT(state)) {
1012  974                  mutex_enter(&state->ts_cmd_regs.hcr_lock);
1013  975          }
1014      -#endif
1015  976  
1016  977          hcr = state->ts_cmd_regs.hcr;
1017  978  
1018  979          /*
1019  980           * First, check the "go" bit to see if the previous hcr usage is
1020  981           * complete.  As long as it is set then we must continue to poll.
1021  982           */
1022  983          count    = 0;
1023  984          countmax = state->ts_cfg_profile->cp_cmd_poll_max;
1024  985          for (;;) {
↓ open down ↓ 7 lines elided ↑ open up ↑
1032  993                          break;
1033  994                  }
1034  995                  /* Delay before polling the "go" bit again */
1035  996                  drv_usecwait(state->ts_cfg_profile->cp_cmd_poll_delay);
1036  997  
1037  998                  /*
1038  999                   * If we poll more than the maximum number of times, then
1039 1000                   * return a "timeout" error.
1040 1001                   */
1041 1002                  if (++count > countmax) {
1042      -#ifdef __lock_lint
1043      -                        mutex_exit(&state->ts_cmd_regs.hcr_lock);
1044      -#else
1045 1003                          if (!TAVOR_IN_FASTREBOOT(state)) {
1046 1004                                  mutex_exit(&state->ts_cmd_regs.hcr_lock);
1047 1005                          }
1048      -#endif
1049 1006                          TNF_PROBE_0(tavor_write_hcr_timeout1, TAVOR_TNF_ERROR,
1050 1007                              "");
1051 1008                          TAVOR_TNF_EXIT(tavor_write_hcr);
1052 1009                          return (TAVOR_CMD_TIMEOUT);
1053 1010                  }
1054 1011          }
1055 1012  
1056 1013          /* Write "inparam" as a 64-bit quantity */
1057 1014          ddi_put64(state->ts_reg_cmdhdl, (uint64_t *)&hcr->in_param0,
1058 1015              cmdpost->cp_inparm);
↓ open down ↓ 40 lines elided ↑ open up ↑
1099 1056                                  break;
1100 1057                          }
1101 1058                          /* Delay before polling the "go" bit again */
1102 1059                          drv_usecwait(state->ts_cfg_profile->cp_cmd_poll_delay);
1103 1060  
1104 1061                          /*
1105 1062                           * If we poll more than the maximum number of times,
1106 1063                           * then return a "timeout" error.
1107 1064                           */
1108 1065                          if (++count > countmax) {
1109      -#ifdef __lock_lint
1110      -                                mutex_exit(&state-> ts_cmd_regs.hcr_lock);
1111      -#else
1112 1066                                  if (!TAVOR_IN_FASTREBOOT(state)) {
1113 1067                                          mutex_exit(&state->
1114 1068                                              ts_cmd_regs.hcr_lock);
1115 1069                                  }
1116      -#endif
1117 1070                                  TNF_PROBE_0(tavor_write_hcr_timeout2,
1118 1071                                      TAVOR_TNF_ERROR, "");
1119 1072                                  TAVOR_TNF_EXIT(tavor_write_hcr);
1120 1073                                  return (TAVOR_CMD_TIMEOUT);
1121 1074                          }
1122 1075                  }
1123 1076  
1124 1077                  /* Pull out the "status" bits from the HCR */
1125 1078                  status = (hcrreg >> TAVOR_HCR_CMD_STATUS_SHFT);
1126 1079  
↓ open down ↓ 6 lines elided ↑ open up ↑
1133 1086                  cmdpost->cp_outparm = hcrreg << 32;
1134 1087                  hcrreg = ddi_get32(state->ts_reg_cmdhdl, &hcr->out_param1);
1135 1088                  cmdpost->cp_outparm |= hcrreg;
1136 1089  
1137 1090          /* NOSPIN */
1138 1091          } else {
1139 1092                  status = TAVOR_CMD_SUCCESS;
1140 1093          }
1141 1094  
1142 1095          /* Drop the "HCR access" lock */
1143      -#ifdef __lock_lint
1144      -        mutex_exit(&state->ts_cmd_regs.hcr_lock);
1145      -#else
1146 1096          if (!TAVOR_IN_FASTREBOOT(state)) {
1147 1097                  mutex_exit(&state->ts_cmd_regs.hcr_lock);
1148 1098          }
1149      -#endif
1150 1099  
1151 1100          TAVOR_TNF_EXIT(tavor_write_hcr);
1152 1101          return (status);
1153 1102  }
1154 1103  
1155 1104  
1156 1105  /*
1157 1106   * tavor_outstanding_cmdlist_init()
1158 1107   *    Context: Only called from attach() path context
1159 1108   */
↓ open down ↓ 639 lines elided ↑ open up ↑
1799 1748          /* Sync the mailbox to read the results */
1800 1749          size = sizeof (sm_portinfo_t);
1801 1750          tavor_mbox_sync(mbox_info.mbi_out, TAVOR_CMD_MADDATA_OFFSET,
1802 1751              size, DDI_DMA_SYNC_FORCPU);
1803 1752  
1804 1753          /*
1805 1754           * Copy GetPortInfo response MAD into "portinfo".  Do any endian
1806 1755           * swapping that may be necessary to flip any of the "portinfo"
1807 1756           * fields
1808 1757           */
1809      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*portinfo))
1810 1758          bcopy((void *)((uintptr_t)mbox_info.mbi_out->mb_addr +
1811 1759              TAVOR_CMD_MADDATA_OFFSET), portinfo, size);
1812 1760          TAVOR_GETPORTINFO_SWAP(portinfo);
1813      -        _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*portinfo))
1814 1761  
1815 1762  getportinfo_fail:
1816 1763          /* Free the mailbox */
1817 1764          tavor_mbox_free(state, &mbox_info);
1818 1765  
1819 1766          TAVOR_TNF_EXIT(tavor_getportinfo_cmd_post);
1820 1767          return (status);
1821 1768  }
1822 1769  
1823 1770  
↓ open down ↓ 209 lines elided ↑ open up ↑
2033 1980  
2034 1981          /* Sync the mailbox to read the results */
2035 1982          size = sizeof (sm_guidinfo_t);
2036 1983          tavor_mbox_sync(mbox_info.mbi_out, TAVOR_CMD_MADDATA_OFFSET,
2037 1984              size, DDI_DMA_SYNC_FORCPU);
2038 1985  
2039 1986          /*
2040 1987           * Copy GetGUIDInfo response MAD into "guidinfo".  Do any endian
2041 1988           * swapping that may be necessary to flip the "guidinfo" fields
2042 1989           */
2043      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*guidinfo))
2044 1990          bcopy((void *)((uintptr_t)mbox_info.mbi_out->mb_addr +
2045 1991              TAVOR_CMD_MADDATA_OFFSET), guidinfo, size);
2046 1992          TAVOR_GETGUIDINFO_SWAP(guidinfo);
2047      -        _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*guidinfo))
2048 1993  
2049 1994  getguidinfo_fail:
2050 1995          /* Free the mailbox */
2051 1996          tavor_mbox_free(state, &mbox_info);
2052 1997  
2053 1998          TAVOR_TNF_EXIT(tavor_getguidinfo_cmd_post);
2054 1999          return (status);
2055 2000  }
2056 2001  
2057 2002  
↓ open down ↓ 54 lines elided ↑ open up ↑
2112 2057  
2113 2058          /* Sync the mailbox to read the results */
2114 2059          size = sizeof (sm_pkey_table_t);
2115 2060          tavor_mbox_sync(mbox_info.mbi_out, TAVOR_CMD_MADDATA_OFFSET,
2116 2061              size, DDI_DMA_SYNC_FORCPU);
2117 2062  
2118 2063          /*
2119 2064           * Copy GetPKeyTable response MAD into "pkeytable".  Do any endian
2120 2065           * swapping that may be necessary to flip the "pkeytable" fields
2121 2066           */
2122      -        _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*pkeytable))
2123 2067          bcopy((void *)((uintptr_t)mbox_info.mbi_out->mb_addr +
2124 2068              TAVOR_CMD_MADDATA_OFFSET), pkeytable, size);
2125 2069          TAVOR_GETPKEYTABLE_SWAP(pkeytable);
2126      -        _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*pkeytable))
2127 2070  
2128 2071  getpkeytable_fail:
2129 2072          /* Free the mailbox */
2130 2073          tavor_mbox_free(state, &mbox_info);
2131 2074  
2132 2075          TAVOR_TNF_EXIT(tavor_getpkeytable_cmd_post);
2133 2076          return (status);
2134 2077  }
2135 2078  
2136 2079  
↓ open down ↓ 924 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX