nouveau_pm.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. /*
  2. * Copyright 2010 Red Hat Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. * Authors: Ben Skeggs
  23. */
  24. #include "drmP.h"
  25. #include "nouveau_drv.h"
  26. #include "nouveau_pm.h"
  27. #ifdef CONFIG_ACPI
  28. #include <linux/acpi.h>
  29. #endif
  30. #include <linux/power_supply.h>
  31. #include <linux/hwmon.h>
  32. #include <linux/hwmon-sysfs.h>
  33. static int
  34. nouveau_pm_clock_set(struct drm_device *dev, struct nouveau_pm_level *perflvl,
  35. u8 id, u32 khz)
  36. {
  37. struct drm_nouveau_private *dev_priv = dev->dev_private;
  38. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  39. void *pre_state;
  40. if (khz == 0)
  41. return 0;
  42. pre_state = pm->clock_pre(dev, perflvl, id, khz);
  43. if (IS_ERR(pre_state))
  44. return PTR_ERR(pre_state);
  45. if (pre_state)
  46. pm->clock_set(dev, pre_state);
  47. return 0;
  48. }
  49. static int
  50. nouveau_pm_perflvl_set(struct drm_device *dev, struct nouveau_pm_level *perflvl)
  51. {
  52. struct drm_nouveau_private *dev_priv = dev->dev_private;
  53. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  54. int ret;
  55. if (perflvl == pm->cur)
  56. return 0;
  57. if (pm->fanspeed_set && perflvl->fanspeed) {
  58. ret = pm->fanspeed_set(dev, perflvl->fanspeed);
  59. if (ret)
  60. NV_ERROR(dev, "set fanspeed failed: %d\n", ret);
  61. }
  62. if (pm->voltage.supported && pm->voltage_set && perflvl->volt_min) {
  63. ret = pm->voltage_set(dev, perflvl->volt_min);
  64. if (ret) {
  65. NV_ERROR(dev, "voltage_set %d failed: %d\n",
  66. perflvl->volt_min, ret);
  67. }
  68. }
  69. if (pm->clocks_pre) {
  70. void *state = pm->clocks_pre(dev, perflvl);
  71. if (IS_ERR(state))
  72. return PTR_ERR(state);
  73. pm->clocks_set(dev, state);
  74. } else
  75. if (pm->clock_set) {
  76. nouveau_pm_clock_set(dev, perflvl, PLL_CORE, perflvl->core);
  77. nouveau_pm_clock_set(dev, perflvl, PLL_SHADER, perflvl->shader);
  78. nouveau_pm_clock_set(dev, perflvl, PLL_MEMORY, perflvl->memory);
  79. nouveau_pm_clock_set(dev, perflvl, PLL_UNK05, perflvl->unk05);
  80. }
  81. pm->cur = perflvl;
  82. return 0;
  83. }
  84. static int
  85. nouveau_pm_profile_set(struct drm_device *dev, const char *profile)
  86. {
  87. struct drm_nouveau_private *dev_priv = dev->dev_private;
  88. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  89. struct nouveau_pm_level *perflvl = NULL;
  90. /* safety precaution, for now */
  91. if (nouveau_perflvl_wr != 7777)
  92. return -EPERM;
  93. if (!strncmp(profile, "boot", 4))
  94. perflvl = &pm->boot;
  95. else {
  96. int pl = simple_strtol(profile, NULL, 10);
  97. int i;
  98. for (i = 0; i < pm->nr_perflvl; i++) {
  99. if (pm->perflvl[i].id == pl) {
  100. perflvl = &pm->perflvl[i];
  101. break;
  102. }
  103. }
  104. if (!perflvl)
  105. return -EINVAL;
  106. }
  107. NV_INFO(dev, "setting performance level: %s\n", profile);
  108. return nouveau_pm_perflvl_set(dev, perflvl);
  109. }
  110. static int
  111. nouveau_pm_perflvl_get(struct drm_device *dev, struct nouveau_pm_level *perflvl)
  112. {
  113. struct drm_nouveau_private *dev_priv = dev->dev_private;
  114. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  115. int ret;
  116. memset(perflvl, 0, sizeof(*perflvl));
  117. if (pm->clocks_get) {
  118. ret = pm->clocks_get(dev, perflvl);
  119. if (ret)
  120. return ret;
  121. } else
  122. if (pm->clock_get) {
  123. ret = pm->clock_get(dev, PLL_CORE);
  124. if (ret > 0)
  125. perflvl->core = ret;
  126. ret = pm->clock_get(dev, PLL_MEMORY);
  127. if (ret > 0)
  128. perflvl->memory = ret;
  129. ret = pm->clock_get(dev, PLL_SHADER);
  130. if (ret > 0)
  131. perflvl->shader = ret;
  132. ret = pm->clock_get(dev, PLL_UNK05);
  133. if (ret > 0)
  134. perflvl->unk05 = ret;
  135. }
  136. if (pm->voltage.supported && pm->voltage_get) {
  137. ret = pm->voltage_get(dev);
  138. if (ret > 0) {
  139. perflvl->volt_min = ret;
  140. perflvl->volt_max = ret;
  141. }
  142. }
  143. if (pm->fanspeed_get) {
  144. ret = pm->fanspeed_get(dev);
  145. if (ret > 0)
  146. perflvl->fanspeed = ret;
  147. }
  148. return 0;
  149. }
  150. static void
  151. nouveau_pm_perflvl_info(struct nouveau_pm_level *perflvl, char *ptr, int len)
  152. {
  153. char c[16], s[16], v[32], f[16], t[16], m[16];
  154. c[0] = '\0';
  155. if (perflvl->core)
  156. snprintf(c, sizeof(c), " core %dMHz", perflvl->core / 1000);
  157. s[0] = '\0';
  158. if (perflvl->shader)
  159. snprintf(s, sizeof(s), " shader %dMHz", perflvl->shader / 1000);
  160. m[0] = '\0';
  161. if (perflvl->memory)
  162. snprintf(m, sizeof(m), " memory %dMHz", perflvl->memory / 1000);
  163. v[0] = '\0';
  164. if (perflvl->volt_min && perflvl->volt_min != perflvl->volt_max) {
  165. snprintf(v, sizeof(v), " voltage %dmV-%dmV",
  166. perflvl->volt_min / 1000, perflvl->volt_max / 1000);
  167. } else
  168. if (perflvl->volt_min) {
  169. snprintf(v, sizeof(v), " voltage %dmV",
  170. perflvl->volt_min / 1000);
  171. }
  172. f[0] = '\0';
  173. if (perflvl->fanspeed)
  174. snprintf(f, sizeof(f), " fanspeed %d%%", perflvl->fanspeed);
  175. t[0] = '\0';
  176. if (perflvl->timing)
  177. snprintf(t, sizeof(t), " timing %d", perflvl->timing->id);
  178. snprintf(ptr, len, "%s%s%s%s%s%s\n", c, s, m, t, v, f);
  179. }
  180. static ssize_t
  181. nouveau_pm_get_perflvl_info(struct device *d,
  182. struct device_attribute *a, char *buf)
  183. {
  184. struct nouveau_pm_level *perflvl = (struct nouveau_pm_level *)a;
  185. char *ptr = buf;
  186. int len = PAGE_SIZE;
  187. snprintf(ptr, len, "%d:", perflvl->id);
  188. ptr += strlen(buf);
  189. len -= strlen(buf);
  190. nouveau_pm_perflvl_info(perflvl, ptr, len);
  191. return strlen(buf);
  192. }
  193. static ssize_t
  194. nouveau_pm_get_perflvl(struct device *d, struct device_attribute *a, char *buf)
  195. {
  196. struct drm_device *dev = pci_get_drvdata(to_pci_dev(d));
  197. struct drm_nouveau_private *dev_priv = dev->dev_private;
  198. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  199. struct nouveau_pm_level cur;
  200. int len = PAGE_SIZE, ret;
  201. char *ptr = buf;
  202. if (!pm->cur)
  203. snprintf(ptr, len, "setting: boot\n");
  204. else if (pm->cur == &pm->boot)
  205. snprintf(ptr, len, "setting: boot\nc:");
  206. else
  207. snprintf(ptr, len, "setting: static %d\nc:", pm->cur->id);
  208. ptr += strlen(buf);
  209. len -= strlen(buf);
  210. ret = nouveau_pm_perflvl_get(dev, &cur);
  211. if (ret == 0)
  212. nouveau_pm_perflvl_info(&cur, ptr, len);
  213. return strlen(buf);
  214. }
  215. static ssize_t
  216. nouveau_pm_set_perflvl(struct device *d, struct device_attribute *a,
  217. const char *buf, size_t count)
  218. {
  219. struct drm_device *dev = pci_get_drvdata(to_pci_dev(d));
  220. int ret;
  221. ret = nouveau_pm_profile_set(dev, buf);
  222. if (ret)
  223. return ret;
  224. return strlen(buf);
  225. }
  226. static DEVICE_ATTR(performance_level, S_IRUGO | S_IWUSR,
  227. nouveau_pm_get_perflvl, nouveau_pm_set_perflvl);
  228. static int
  229. nouveau_sysfs_init(struct drm_device *dev)
  230. {
  231. struct drm_nouveau_private *dev_priv = dev->dev_private;
  232. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  233. struct device *d = &dev->pdev->dev;
  234. int ret, i;
  235. ret = device_create_file(d, &dev_attr_performance_level);
  236. if (ret)
  237. return ret;
  238. for (i = 0; i < pm->nr_perflvl; i++) {
  239. struct nouveau_pm_level *perflvl = &pm->perflvl[i];
  240. perflvl->dev_attr.attr.name = perflvl->name;
  241. perflvl->dev_attr.attr.mode = S_IRUGO;
  242. perflvl->dev_attr.show = nouveau_pm_get_perflvl_info;
  243. perflvl->dev_attr.store = NULL;
  244. sysfs_attr_init(&perflvl->dev_attr.attr);
  245. ret = device_create_file(d, &perflvl->dev_attr);
  246. if (ret) {
  247. NV_ERROR(dev, "failed pervlvl %d sysfs: %d\n",
  248. perflvl->id, i);
  249. perflvl->dev_attr.attr.name = NULL;
  250. nouveau_pm_fini(dev);
  251. return ret;
  252. }
  253. }
  254. return 0;
  255. }
  256. static void
  257. nouveau_sysfs_fini(struct drm_device *dev)
  258. {
  259. struct drm_nouveau_private *dev_priv = dev->dev_private;
  260. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  261. struct device *d = &dev->pdev->dev;
  262. int i;
  263. device_remove_file(d, &dev_attr_performance_level);
  264. for (i = 0; i < pm->nr_perflvl; i++) {
  265. struct nouveau_pm_level *pl = &pm->perflvl[i];
  266. if (!pl->dev_attr.attr.name)
  267. break;
  268. device_remove_file(d, &pl->dev_attr);
  269. }
  270. }
  271. #if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
  272. static ssize_t
  273. nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char *buf)
  274. {
  275. struct drm_device *dev = dev_get_drvdata(d);
  276. struct drm_nouveau_private *dev_priv = dev->dev_private;
  277. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  278. return snprintf(buf, PAGE_SIZE, "%d\n", pm->temp_get(dev)*1000);
  279. }
  280. static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, nouveau_hwmon_show_temp,
  281. NULL, 0);
  282. static ssize_t
  283. nouveau_hwmon_max_temp(struct device *d, struct device_attribute *a, char *buf)
  284. {
  285. struct drm_device *dev = dev_get_drvdata(d);
  286. struct drm_nouveau_private *dev_priv = dev->dev_private;
  287. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  288. struct nouveau_pm_threshold_temp *temp = &pm->threshold_temp;
  289. return snprintf(buf, PAGE_SIZE, "%d\n", temp->down_clock*1000);
  290. }
  291. static ssize_t
  292. nouveau_hwmon_set_max_temp(struct device *d, struct device_attribute *a,
  293. const char *buf, size_t count)
  294. {
  295. struct drm_device *dev = dev_get_drvdata(d);
  296. struct drm_nouveau_private *dev_priv = dev->dev_private;
  297. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  298. struct nouveau_pm_threshold_temp *temp = &pm->threshold_temp;
  299. long value;
  300. if (strict_strtol(buf, 10, &value) == -EINVAL)
  301. return count;
  302. temp->down_clock = value/1000;
  303. nouveau_temp_safety_checks(dev);
  304. return count;
  305. }
  306. static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, nouveau_hwmon_max_temp,
  307. nouveau_hwmon_set_max_temp,
  308. 0);
  309. static ssize_t
  310. nouveau_hwmon_critical_temp(struct device *d, struct device_attribute *a,
  311. char *buf)
  312. {
  313. struct drm_device *dev = dev_get_drvdata(d);
  314. struct drm_nouveau_private *dev_priv = dev->dev_private;
  315. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  316. struct nouveau_pm_threshold_temp *temp = &pm->threshold_temp;
  317. return snprintf(buf, PAGE_SIZE, "%d\n", temp->critical*1000);
  318. }
  319. static ssize_t
  320. nouveau_hwmon_set_critical_temp(struct device *d, struct device_attribute *a,
  321. const char *buf,
  322. size_t count)
  323. {
  324. struct drm_device *dev = dev_get_drvdata(d);
  325. struct drm_nouveau_private *dev_priv = dev->dev_private;
  326. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  327. struct nouveau_pm_threshold_temp *temp = &pm->threshold_temp;
  328. long value;
  329. if (strict_strtol(buf, 10, &value) == -EINVAL)
  330. return count;
  331. temp->critical = value/1000;
  332. nouveau_temp_safety_checks(dev);
  333. return count;
  334. }
  335. static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO | S_IWUSR,
  336. nouveau_hwmon_critical_temp,
  337. nouveau_hwmon_set_critical_temp,
  338. 0);
  339. static ssize_t nouveau_hwmon_show_name(struct device *dev,
  340. struct device_attribute *attr,
  341. char *buf)
  342. {
  343. return sprintf(buf, "nouveau\n");
  344. }
  345. static SENSOR_DEVICE_ATTR(name, S_IRUGO, nouveau_hwmon_show_name, NULL, 0);
  346. static ssize_t nouveau_hwmon_show_update_rate(struct device *dev,
  347. struct device_attribute *attr,
  348. char *buf)
  349. {
  350. return sprintf(buf, "1000\n");
  351. }
  352. static SENSOR_DEVICE_ATTR(update_rate, S_IRUGO,
  353. nouveau_hwmon_show_update_rate,
  354. NULL, 0);
  355. static struct attribute *hwmon_attributes[] = {
  356. &sensor_dev_attr_temp1_input.dev_attr.attr,
  357. &sensor_dev_attr_temp1_max.dev_attr.attr,
  358. &sensor_dev_attr_temp1_crit.dev_attr.attr,
  359. &sensor_dev_attr_name.dev_attr.attr,
  360. &sensor_dev_attr_update_rate.dev_attr.attr,
  361. NULL
  362. };
  363. static const struct attribute_group hwmon_attrgroup = {
  364. .attrs = hwmon_attributes,
  365. };
  366. #endif
  367. static int
  368. nouveau_hwmon_init(struct drm_device *dev)
  369. {
  370. #if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
  371. struct drm_nouveau_private *dev_priv = dev->dev_private;
  372. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  373. struct device *hwmon_dev;
  374. int ret;
  375. if (!pm->temp_get)
  376. return -ENODEV;
  377. hwmon_dev = hwmon_device_register(&dev->pdev->dev);
  378. if (IS_ERR(hwmon_dev)) {
  379. ret = PTR_ERR(hwmon_dev);
  380. NV_ERROR(dev,
  381. "Unable to register hwmon device: %d\n", ret);
  382. return ret;
  383. }
  384. dev_set_drvdata(hwmon_dev, dev);
  385. ret = sysfs_create_group(&dev->pdev->dev.kobj, &hwmon_attrgroup);
  386. if (ret) {
  387. NV_ERROR(dev,
  388. "Unable to create hwmon sysfs file: %d\n", ret);
  389. hwmon_device_unregister(hwmon_dev);
  390. return ret;
  391. }
  392. pm->hwmon = hwmon_dev;
  393. #endif
  394. return 0;
  395. }
  396. static void
  397. nouveau_hwmon_fini(struct drm_device *dev)
  398. {
  399. #if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
  400. struct drm_nouveau_private *dev_priv = dev->dev_private;
  401. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  402. if (pm->hwmon) {
  403. sysfs_remove_group(&dev->pdev->dev.kobj, &hwmon_attrgroup);
  404. hwmon_device_unregister(pm->hwmon);
  405. }
  406. #endif
  407. }
  408. #if defined(CONFIG_ACPI) && defined(CONFIG_POWER_SUPPLY)
  409. static int
  410. nouveau_pm_acpi_event(struct notifier_block *nb, unsigned long val, void *data)
  411. {
  412. struct drm_nouveau_private *dev_priv =
  413. container_of(nb, struct drm_nouveau_private, engine.pm.acpi_nb);
  414. struct drm_device *dev = dev_priv->dev;
  415. struct acpi_bus_event *entry = (struct acpi_bus_event *)data;
  416. if (strcmp(entry->device_class, "ac_adapter") == 0) {
  417. bool ac = power_supply_is_system_supplied();
  418. NV_DEBUG(dev, "power supply changed: %s\n", ac ? "AC" : "DC");
  419. }
  420. return NOTIFY_OK;
  421. }
  422. #endif
  423. int
  424. nouveau_pm_init(struct drm_device *dev)
  425. {
  426. struct drm_nouveau_private *dev_priv = dev->dev_private;
  427. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  428. char info[256];
  429. int ret, i;
  430. nouveau_mem_timing_init(dev);
  431. nouveau_volt_init(dev);
  432. nouveau_perf_init(dev);
  433. nouveau_temp_init(dev);
  434. NV_INFO(dev, "%d available performance level(s)\n", pm->nr_perflvl);
  435. for (i = 0; i < pm->nr_perflvl; i++) {
  436. nouveau_pm_perflvl_info(&pm->perflvl[i], info, sizeof(info));
  437. NV_INFO(dev, "%d:%s", pm->perflvl[i].id, info);
  438. }
  439. /* determine current ("boot") performance level */
  440. ret = nouveau_pm_perflvl_get(dev, &pm->boot);
  441. if (ret == 0) {
  442. strncpy(pm->boot.name, "boot", 4);
  443. pm->cur = &pm->boot;
  444. nouveau_pm_perflvl_info(&pm->boot, info, sizeof(info));
  445. NV_INFO(dev, "c:%s", info);
  446. }
  447. /* switch performance levels now if requested */
  448. if (nouveau_perflvl != NULL) {
  449. ret = nouveau_pm_profile_set(dev, nouveau_perflvl);
  450. if (ret) {
  451. NV_ERROR(dev, "error setting perflvl \"%s\": %d\n",
  452. nouveau_perflvl, ret);
  453. }
  454. }
  455. nouveau_sysfs_init(dev);
  456. nouveau_hwmon_init(dev);
  457. #if defined(CONFIG_ACPI) && defined(CONFIG_POWER_SUPPLY)
  458. pm->acpi_nb.notifier_call = nouveau_pm_acpi_event;
  459. register_acpi_notifier(&pm->acpi_nb);
  460. #endif
  461. return 0;
  462. }
  463. void
  464. nouveau_pm_fini(struct drm_device *dev)
  465. {
  466. struct drm_nouveau_private *dev_priv = dev->dev_private;
  467. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  468. if (pm->cur != &pm->boot)
  469. nouveau_pm_perflvl_set(dev, &pm->boot);
  470. nouveau_temp_fini(dev);
  471. nouveau_perf_fini(dev);
  472. nouveau_volt_fini(dev);
  473. nouveau_mem_timing_fini(dev);
  474. #if defined(CONFIG_ACPI) && defined(CONFIG_POWER_SUPPLY)
  475. unregister_acpi_notifier(&pm->acpi_nb);
  476. #endif
  477. nouveau_hwmon_fini(dev);
  478. nouveau_sysfs_fini(dev);
  479. }
  480. void
  481. nouveau_pm_resume(struct drm_device *dev)
  482. {
  483. struct drm_nouveau_private *dev_priv = dev->dev_private;
  484. struct nouveau_pm_engine *pm = &dev_priv->engine.pm;
  485. struct nouveau_pm_level *perflvl;
  486. if (!pm->cur || pm->cur == &pm->boot)
  487. return;
  488. perflvl = pm->cur;
  489. pm->cur = &pm->boot;
  490. nouveau_pm_perflvl_set(dev, perflvl);
  491. }