css.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * driver for channel subsystem
  4. *
  5. * Copyright IBM Corp. 2002, 2010
  6. *
  7. * Author(s): Arnd Bergmann (arndb@de.ibm.com)
  8. * Cornelia Huck (cornelia.huck@de.ibm.com)
  9. */
  10. #define KMSG_COMPONENT "cio"
  11. #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  12. #include <linux/export.h>
  13. #include <linux/init.h>
  14. #include <linux/device.h>
  15. #include <linux/slab.h>
  16. #include <linux/errno.h>
  17. #include <linux/list.h>
  18. #include <linux/reboot.h>
  19. #include <linux/suspend.h>
  20. #include <linux/proc_fs.h>
  21. #include <asm/isc.h>
  22. #include <asm/crw.h>
  23. #include "css.h"
  24. #include "cio.h"
  25. #include "blacklist.h"
  26. #include "cio_debug.h"
  27. #include "ioasm.h"
  28. #include "chsc.h"
  29. #include "device.h"
  30. #include "idset.h"
  31. #include "chp.h"
  32. int css_init_done = 0;
  33. int max_ssid;
  34. #define MAX_CSS_IDX 0
  35. struct channel_subsystem *channel_subsystems[MAX_CSS_IDX + 1];
  36. static struct bus_type css_bus_type;
  37. int
  38. for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *data)
  39. {
  40. struct subchannel_id schid;
  41. int ret;
  42. init_subchannel_id(&schid);
  43. do {
  44. do {
  45. ret = fn(schid, data);
  46. if (ret)
  47. break;
  48. } while (schid.sch_no++ < __MAX_SUBCHANNEL);
  49. schid.sch_no = 0;
  50. } while (schid.ssid++ < max_ssid);
  51. return ret;
  52. }
  53. struct cb_data {
  54. void *data;
  55. struct idset *set;
  56. int (*fn_known_sch)(struct subchannel *, void *);
  57. int (*fn_unknown_sch)(struct subchannel_id, void *);
  58. };
  59. static int call_fn_known_sch(struct device *dev, void *data)
  60. {
  61. struct subchannel *sch = to_subchannel(dev);
  62. struct cb_data *cb = data;
  63. int rc = 0;
  64. if (cb->set)
  65. idset_sch_del(cb->set, sch->schid);
  66. if (cb->fn_known_sch)
  67. rc = cb->fn_known_sch(sch, cb->data);
  68. return rc;
  69. }
  70. static int call_fn_unknown_sch(struct subchannel_id schid, void *data)
  71. {
  72. struct cb_data *cb = data;
  73. int rc = 0;
  74. if (idset_sch_contains(cb->set, schid))
  75. rc = cb->fn_unknown_sch(schid, cb->data);
  76. return rc;
  77. }
  78. static int call_fn_all_sch(struct subchannel_id schid, void *data)
  79. {
  80. struct cb_data *cb = data;
  81. struct subchannel *sch;
  82. int rc = 0;
  83. sch = get_subchannel_by_schid(schid);
  84. if (sch) {
  85. if (cb->fn_known_sch)
  86. rc = cb->fn_known_sch(sch, cb->data);
  87. put_device(&sch->dev);
  88. } else {
  89. if (cb->fn_unknown_sch)
  90. rc = cb->fn_unknown_sch(schid, cb->data);
  91. }
  92. return rc;
  93. }
  94. int for_each_subchannel_staged(int (*fn_known)(struct subchannel *, void *),
  95. int (*fn_unknown)(struct subchannel_id,
  96. void *), void *data)
  97. {
  98. struct cb_data cb;
  99. int rc;
  100. cb.data = data;
  101. cb.fn_known_sch = fn_known;
  102. cb.fn_unknown_sch = fn_unknown;
  103. if (fn_known && !fn_unknown) {
  104. /* Skip idset allocation in case of known-only loop. */
  105. cb.set = NULL;
  106. return bus_for_each_dev(&css_bus_type, NULL, &cb,
  107. call_fn_known_sch);
  108. }
  109. cb.set = idset_sch_new();
  110. if (!cb.set)
  111. /* fall back to brute force scanning in case of oom */
  112. return for_each_subchannel(call_fn_all_sch, &cb);
  113. idset_fill(cb.set);
  114. /* Process registered subchannels. */
  115. rc = bus_for_each_dev(&css_bus_type, NULL, &cb, call_fn_known_sch);
  116. if (rc)
  117. goto out;
  118. /* Process unregistered subchannels. */
  119. if (fn_unknown)
  120. rc = for_each_subchannel(call_fn_unknown_sch, &cb);
  121. out:
  122. idset_free(cb.set);
  123. return rc;
  124. }
  125. static void css_sch_todo(struct work_struct *work);
  126. static int css_sch_create_locks(struct subchannel *sch)
  127. {
  128. sch->lock = kmalloc(sizeof(*sch->lock), GFP_KERNEL);
  129. if (!sch->lock)
  130. return -ENOMEM;
  131. spin_lock_init(sch->lock);
  132. mutex_init(&sch->reg_mutex);
  133. return 0;
  134. }
  135. static void css_subchannel_release(struct device *dev)
  136. {
  137. struct subchannel *sch = to_subchannel(dev);
  138. sch->config.intparm = 0;
  139. cio_commit_config(sch);
  140. kfree(sch->lock);
  141. kfree(sch);
  142. }
  143. static int css_validate_subchannel(struct subchannel_id schid,
  144. struct schib *schib)
  145. {
  146. int err;
  147. switch (schib->pmcw.st) {
  148. case SUBCHANNEL_TYPE_IO:
  149. case SUBCHANNEL_TYPE_MSG:
  150. if (!css_sch_is_valid(schib))
  151. err = -ENODEV;
  152. else if (is_blacklisted(schid.ssid, schib->pmcw.dev)) {
  153. CIO_MSG_EVENT(6, "Blacklisted device detected "
  154. "at devno %04X, subchannel set %x\n",
  155. schib->pmcw.dev, schid.ssid);
  156. err = -ENODEV;
  157. } else
  158. err = 0;
  159. break;
  160. default:
  161. err = 0;
  162. }
  163. if (err)
  164. goto out;
  165. CIO_MSG_EVENT(4, "Subchannel 0.%x.%04x reports subchannel type %04X\n",
  166. schid.ssid, schid.sch_no, schib->pmcw.st);
  167. out:
  168. return err;
  169. }
  170. struct subchannel *css_alloc_subchannel(struct subchannel_id schid,
  171. struct schib *schib)
  172. {
  173. struct subchannel *sch;
  174. int ret;
  175. ret = css_validate_subchannel(schid, schib);
  176. if (ret < 0)
  177. return ERR_PTR(ret);
  178. sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA);
  179. if (!sch)
  180. return ERR_PTR(-ENOMEM);
  181. sch->schid = schid;
  182. sch->schib = *schib;
  183. sch->st = schib->pmcw.st;
  184. ret = css_sch_create_locks(sch);
  185. if (ret)
  186. goto err;
  187. INIT_WORK(&sch->todo_work, css_sch_todo);
  188. sch->dev.release = &css_subchannel_release;
  189. device_initialize(&sch->dev);
  190. return sch;
  191. err:
  192. kfree(sch);
  193. return ERR_PTR(ret);
  194. }
  195. static int css_sch_device_register(struct subchannel *sch)
  196. {
  197. int ret;
  198. mutex_lock(&sch->reg_mutex);
  199. dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid,
  200. sch->schid.sch_no);
  201. ret = device_add(&sch->dev);
  202. mutex_unlock(&sch->reg_mutex);
  203. return ret;
  204. }
  205. /**
  206. * css_sch_device_unregister - unregister a subchannel
  207. * @sch: subchannel to be unregistered
  208. */
  209. void css_sch_device_unregister(struct subchannel *sch)
  210. {
  211. mutex_lock(&sch->reg_mutex);
  212. if (device_is_registered(&sch->dev))
  213. device_unregister(&sch->dev);
  214. mutex_unlock(&sch->reg_mutex);
  215. }
  216. EXPORT_SYMBOL_GPL(css_sch_device_unregister);
  217. static void ssd_from_pmcw(struct chsc_ssd_info *ssd, struct pmcw *pmcw)
  218. {
  219. int i;
  220. int mask;
  221. memset(ssd, 0, sizeof(struct chsc_ssd_info));
  222. ssd->path_mask = pmcw->pim;
  223. for (i = 0; i < 8; i++) {
  224. mask = 0x80 >> i;
  225. if (pmcw->pim & mask) {
  226. chp_id_init(&ssd->chpid[i]);
  227. ssd->chpid[i].id = pmcw->chpid[i];
  228. }
  229. }
  230. }
  231. static void ssd_register_chpids(struct chsc_ssd_info *ssd)
  232. {
  233. int i;
  234. int mask;
  235. for (i = 0; i < 8; i++) {
  236. mask = 0x80 >> i;
  237. if (ssd->path_mask & mask)
  238. chp_new(ssd->chpid[i]);
  239. }
  240. }
  241. void css_update_ssd_info(struct subchannel *sch)
  242. {
  243. int ret;
  244. ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info);
  245. if (ret)
  246. ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw);
  247. ssd_register_chpids(&sch->ssd_info);
  248. }
  249. static ssize_t type_show(struct device *dev, struct device_attribute *attr,
  250. char *buf)
  251. {
  252. struct subchannel *sch = to_subchannel(dev);
  253. return sprintf(buf, "%01x\n", sch->st);
  254. }
  255. static DEVICE_ATTR_RO(type);
  256. static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
  257. char *buf)
  258. {
  259. struct subchannel *sch = to_subchannel(dev);
  260. return sprintf(buf, "css:t%01X\n", sch->st);
  261. }
  262. static DEVICE_ATTR_RO(modalias);
  263. static struct attribute *subch_attrs[] = {
  264. &dev_attr_type.attr,
  265. &dev_attr_modalias.attr,
  266. NULL,
  267. };
  268. static struct attribute_group subch_attr_group = {
  269. .attrs = subch_attrs,
  270. };
  271. static const struct attribute_group *default_subch_attr_groups[] = {
  272. &subch_attr_group,
  273. NULL,
  274. };
  275. static ssize_t chpids_show(struct device *dev,
  276. struct device_attribute *attr,
  277. char *buf)
  278. {
  279. struct subchannel *sch = to_subchannel(dev);
  280. struct chsc_ssd_info *ssd = &sch->ssd_info;
  281. ssize_t ret = 0;
  282. int mask;
  283. int chp;
  284. for (chp = 0; chp < 8; chp++) {
  285. mask = 0x80 >> chp;
  286. if (ssd->path_mask & mask)
  287. ret += sprintf(buf + ret, "%02x ", ssd->chpid[chp].id);
  288. else
  289. ret += sprintf(buf + ret, "00 ");
  290. }
  291. ret += sprintf(buf + ret, "\n");
  292. return ret;
  293. }
  294. static DEVICE_ATTR_RO(chpids);
  295. static ssize_t pimpampom_show(struct device *dev,
  296. struct device_attribute *attr,
  297. char *buf)
  298. {
  299. struct subchannel *sch = to_subchannel(dev);
  300. struct pmcw *pmcw = &sch->schib.pmcw;
  301. return sprintf(buf, "%02x %02x %02x\n",
  302. pmcw->pim, pmcw->pam, pmcw->pom);
  303. }
  304. static DEVICE_ATTR_RO(pimpampom);
  305. static struct attribute *io_subchannel_type_attrs[] = {
  306. &dev_attr_chpids.attr,
  307. &dev_attr_pimpampom.attr,
  308. NULL,
  309. };
  310. ATTRIBUTE_GROUPS(io_subchannel_type);
  311. static const struct device_type io_subchannel_type = {
  312. .groups = io_subchannel_type_groups,
  313. };
  314. int css_register_subchannel(struct subchannel *sch)
  315. {
  316. int ret;
  317. /* Initialize the subchannel structure */
  318. sch->dev.parent = &channel_subsystems[0]->device;
  319. sch->dev.bus = &css_bus_type;
  320. sch->dev.groups = default_subch_attr_groups;
  321. if (sch->st == SUBCHANNEL_TYPE_IO)
  322. sch->dev.type = &io_subchannel_type;
  323. /*
  324. * We don't want to generate uevents for I/O subchannels that don't
  325. * have a working ccw device behind them since they will be
  326. * unregistered before they can be used anyway, so we delay the add
  327. * uevent until after device recognition was successful.
  328. * Note that we suppress the uevent for all subchannel types;
  329. * the subchannel driver can decide itself when it wants to inform
  330. * userspace of its existence.
  331. */
  332. dev_set_uevent_suppress(&sch->dev, 1);
  333. css_update_ssd_info(sch);
  334. /* make it known to the system */
  335. ret = css_sch_device_register(sch);
  336. if (ret) {
  337. CIO_MSG_EVENT(0, "Could not register sch 0.%x.%04x: %d\n",
  338. sch->schid.ssid, sch->schid.sch_no, ret);
  339. return ret;
  340. }
  341. if (!sch->driver) {
  342. /*
  343. * No driver matched. Generate the uevent now so that
  344. * a fitting driver module may be loaded based on the
  345. * modalias.
  346. */
  347. dev_set_uevent_suppress(&sch->dev, 0);
  348. kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
  349. }
  350. return ret;
  351. }
  352. static int css_probe_device(struct subchannel_id schid, struct schib *schib)
  353. {
  354. struct subchannel *sch;
  355. int ret;
  356. sch = css_alloc_subchannel(schid, schib);
  357. if (IS_ERR(sch))
  358. return PTR_ERR(sch);
  359. ret = css_register_subchannel(sch);
  360. if (ret)
  361. put_device(&sch->dev);
  362. return ret;
  363. }
  364. static int
  365. check_subchannel(struct device * dev, void * data)
  366. {
  367. struct subchannel *sch;
  368. struct subchannel_id *schid = data;
  369. sch = to_subchannel(dev);
  370. return schid_equal(&sch->schid, schid);
  371. }
  372. struct subchannel *
  373. get_subchannel_by_schid(struct subchannel_id schid)
  374. {
  375. struct device *dev;
  376. dev = bus_find_device(&css_bus_type, NULL,
  377. &schid, check_subchannel);
  378. return dev ? to_subchannel(dev) : NULL;
  379. }
  380. /**
  381. * css_sch_is_valid() - check if a subchannel is valid
  382. * @schib: subchannel information block for the subchannel
  383. */
  384. int css_sch_is_valid(struct schib *schib)
  385. {
  386. if ((schib->pmcw.st == SUBCHANNEL_TYPE_IO) && !schib->pmcw.dnv)
  387. return 0;
  388. if ((schib->pmcw.st == SUBCHANNEL_TYPE_MSG) && !schib->pmcw.w)
  389. return 0;
  390. return 1;
  391. }
  392. EXPORT_SYMBOL_GPL(css_sch_is_valid);
  393. static int css_evaluate_new_subchannel(struct subchannel_id schid, int slow)
  394. {
  395. struct schib schib;
  396. int ccode;
  397. if (!slow) {
  398. /* Will be done on the slow path. */
  399. return -EAGAIN;
  400. }
  401. /*
  402. * The first subchannel that is not-operational (ccode==3)
  403. * indicates that there aren't any more devices available.
  404. * If stsch gets an exception, it means the current subchannel set
  405. * is not valid.
  406. */
  407. ccode = stsch(schid, &schib);
  408. if (ccode)
  409. return (ccode == 3) ? -ENXIO : ccode;
  410. return css_probe_device(schid, &schib);
  411. }
  412. static int css_evaluate_known_subchannel(struct subchannel *sch, int slow)
  413. {
  414. int ret = 0;
  415. if (sch->driver) {
  416. if (sch->driver->sch_event)
  417. ret = sch->driver->sch_event(sch, slow);
  418. else
  419. dev_dbg(&sch->dev,
  420. "Got subchannel machine check but "
  421. "no sch_event handler provided.\n");
  422. }
  423. if (ret != 0 && ret != -EAGAIN) {
  424. CIO_MSG_EVENT(2, "eval: sch 0.%x.%04x, rc=%d\n",
  425. sch->schid.ssid, sch->schid.sch_no, ret);
  426. }
  427. return ret;
  428. }
  429. static void css_evaluate_subchannel(struct subchannel_id schid, int slow)
  430. {
  431. struct subchannel *sch;
  432. int ret;
  433. sch = get_subchannel_by_schid(schid);
  434. if (sch) {
  435. ret = css_evaluate_known_subchannel(sch, slow);
  436. put_device(&sch->dev);
  437. } else
  438. ret = css_evaluate_new_subchannel(schid, slow);
  439. if (ret == -EAGAIN)
  440. css_schedule_eval(schid);
  441. }
  442. /**
  443. * css_sched_sch_todo - schedule a subchannel operation
  444. * @sch: subchannel
  445. * @todo: todo
  446. *
  447. * Schedule the operation identified by @todo to be performed on the slow path
  448. * workqueue. Do nothing if another operation with higher priority is already
  449. * scheduled. Needs to be called with subchannel lock held.
  450. */
  451. void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo)
  452. {
  453. CIO_MSG_EVENT(4, "sch_todo: sched sch=0.%x.%04x todo=%d\n",
  454. sch->schid.ssid, sch->schid.sch_no, todo);
  455. if (sch->todo >= todo)
  456. return;
  457. /* Get workqueue ref. */
  458. if (!get_device(&sch->dev))
  459. return;
  460. sch->todo = todo;
  461. if (!queue_work(cio_work_q, &sch->todo_work)) {
  462. /* Already queued, release workqueue ref. */
  463. put_device(&sch->dev);
  464. }
  465. }
  466. EXPORT_SYMBOL_GPL(css_sched_sch_todo);
  467. static void css_sch_todo(struct work_struct *work)
  468. {
  469. struct subchannel *sch;
  470. enum sch_todo todo;
  471. int ret;
  472. sch = container_of(work, struct subchannel, todo_work);
  473. /* Find out todo. */
  474. spin_lock_irq(sch->lock);
  475. todo = sch->todo;
  476. CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid,
  477. sch->schid.sch_no, todo);
  478. sch->todo = SCH_TODO_NOTHING;
  479. spin_unlock_irq(sch->lock);
  480. /* Perform todo. */
  481. switch (todo) {
  482. case SCH_TODO_NOTHING:
  483. break;
  484. case SCH_TODO_EVAL:
  485. ret = css_evaluate_known_subchannel(sch, 1);
  486. if (ret == -EAGAIN) {
  487. spin_lock_irq(sch->lock);
  488. css_sched_sch_todo(sch, todo);
  489. spin_unlock_irq(sch->lock);
  490. }
  491. break;
  492. case SCH_TODO_UNREG:
  493. css_sch_device_unregister(sch);
  494. break;
  495. }
  496. /* Release workqueue ref. */
  497. put_device(&sch->dev);
  498. }
  499. static struct idset *slow_subchannel_set;
  500. static spinlock_t slow_subchannel_lock;
  501. static wait_queue_head_t css_eval_wq;
  502. static atomic_t css_eval_scheduled;
  503. static int __init slow_subchannel_init(void)
  504. {
  505. spin_lock_init(&slow_subchannel_lock);
  506. atomic_set(&css_eval_scheduled, 0);
  507. init_waitqueue_head(&css_eval_wq);
  508. slow_subchannel_set = idset_sch_new();
  509. if (!slow_subchannel_set) {
  510. CIO_MSG_EVENT(0, "could not allocate slow subchannel set\n");
  511. return -ENOMEM;
  512. }
  513. return 0;
  514. }
  515. static int slow_eval_known_fn(struct subchannel *sch, void *data)
  516. {
  517. int eval;
  518. int rc;
  519. spin_lock_irq(&slow_subchannel_lock);
  520. eval = idset_sch_contains(slow_subchannel_set, sch->schid);
  521. idset_sch_del(slow_subchannel_set, sch->schid);
  522. spin_unlock_irq(&slow_subchannel_lock);
  523. if (eval) {
  524. rc = css_evaluate_known_subchannel(sch, 1);
  525. if (rc == -EAGAIN)
  526. css_schedule_eval(sch->schid);
  527. /*
  528. * The loop might take long time for platforms with lots of
  529. * known devices. Allow scheduling here.
  530. */
  531. cond_resched();
  532. }
  533. return 0;
  534. }
  535. static int slow_eval_unknown_fn(struct subchannel_id schid, void *data)
  536. {
  537. int eval;
  538. int rc = 0;
  539. spin_lock_irq(&slow_subchannel_lock);
  540. eval = idset_sch_contains(slow_subchannel_set, schid);
  541. idset_sch_del(slow_subchannel_set, schid);
  542. spin_unlock_irq(&slow_subchannel_lock);
  543. if (eval) {
  544. rc = css_evaluate_new_subchannel(schid, 1);
  545. switch (rc) {
  546. case -EAGAIN:
  547. css_schedule_eval(schid);
  548. rc = 0;
  549. break;
  550. case -ENXIO:
  551. case -ENOMEM:
  552. case -EIO:
  553. /* These should abort looping */
  554. spin_lock_irq(&slow_subchannel_lock);
  555. idset_sch_del_subseq(slow_subchannel_set, schid);
  556. spin_unlock_irq(&slow_subchannel_lock);
  557. break;
  558. default:
  559. rc = 0;
  560. }
  561. /* Allow scheduling here since the containing loop might
  562. * take a while. */
  563. cond_resched();
  564. }
  565. return rc;
  566. }
  567. static void css_slow_path_func(struct work_struct *unused)
  568. {
  569. unsigned long flags;
  570. CIO_TRACE_EVENT(4, "slowpath");
  571. for_each_subchannel_staged(slow_eval_known_fn, slow_eval_unknown_fn,
  572. NULL);
  573. spin_lock_irqsave(&slow_subchannel_lock, flags);
  574. if (idset_is_empty(slow_subchannel_set)) {
  575. atomic_set(&css_eval_scheduled, 0);
  576. wake_up(&css_eval_wq);
  577. }
  578. spin_unlock_irqrestore(&slow_subchannel_lock, flags);
  579. }
  580. static DECLARE_DELAYED_WORK(slow_path_work, css_slow_path_func);
  581. struct workqueue_struct *cio_work_q;
  582. void css_schedule_eval(struct subchannel_id schid)
  583. {
  584. unsigned long flags;
  585. spin_lock_irqsave(&slow_subchannel_lock, flags);
  586. idset_sch_add(slow_subchannel_set, schid);
  587. atomic_set(&css_eval_scheduled, 1);
  588. queue_delayed_work(cio_work_q, &slow_path_work, 0);
  589. spin_unlock_irqrestore(&slow_subchannel_lock, flags);
  590. }
  591. void css_schedule_eval_all(void)
  592. {
  593. unsigned long flags;
  594. spin_lock_irqsave(&slow_subchannel_lock, flags);
  595. idset_fill(slow_subchannel_set);
  596. atomic_set(&css_eval_scheduled, 1);
  597. queue_delayed_work(cio_work_q, &slow_path_work, 0);
  598. spin_unlock_irqrestore(&slow_subchannel_lock, flags);
  599. }
  600. static int __unset_registered(struct device *dev, void *data)
  601. {
  602. struct idset *set = data;
  603. struct subchannel *sch = to_subchannel(dev);
  604. idset_sch_del(set, sch->schid);
  605. return 0;
  606. }
  607. void css_schedule_eval_all_unreg(unsigned long delay)
  608. {
  609. unsigned long flags;
  610. struct idset *unreg_set;
  611. /* Find unregistered subchannels. */
  612. unreg_set = idset_sch_new();
  613. if (!unreg_set) {
  614. /* Fallback. */
  615. css_schedule_eval_all();
  616. return;
  617. }
  618. idset_fill(unreg_set);
  619. bus_for_each_dev(&css_bus_type, NULL, unreg_set, __unset_registered);
  620. /* Apply to slow_subchannel_set. */
  621. spin_lock_irqsave(&slow_subchannel_lock, flags);
  622. idset_add_set(slow_subchannel_set, unreg_set);
  623. atomic_set(&css_eval_scheduled, 1);
  624. queue_delayed_work(cio_work_q, &slow_path_work, delay);
  625. spin_unlock_irqrestore(&slow_subchannel_lock, flags);
  626. idset_free(unreg_set);
  627. }
  628. void css_wait_for_slow_path(void)
  629. {
  630. flush_workqueue(cio_work_q);
  631. }
  632. /* Schedule reprobing of all unregistered subchannels. */
  633. void css_schedule_reprobe(void)
  634. {
  635. /* Schedule with a delay to allow merging of subsequent calls. */
  636. css_schedule_eval_all_unreg(1 * HZ);
  637. }
  638. EXPORT_SYMBOL_GPL(css_schedule_reprobe);
  639. /*
  640. * Called from the machine check handler for subchannel report words.
  641. */
  642. static void css_process_crw(struct crw *crw0, struct crw *crw1, int overflow)
  643. {
  644. struct subchannel_id mchk_schid;
  645. struct subchannel *sch;
  646. if (overflow) {
  647. css_schedule_eval_all();
  648. return;
  649. }
  650. CIO_CRW_EVENT(2, "CRW0 reports slct=%d, oflw=%d, "
  651. "chn=%d, rsc=%X, anc=%d, erc=%X, rsid=%X\n",
  652. crw0->slct, crw0->oflw, crw0->chn, crw0->rsc, crw0->anc,
  653. crw0->erc, crw0->rsid);
  654. if (crw1)
  655. CIO_CRW_EVENT(2, "CRW1 reports slct=%d, oflw=%d, "
  656. "chn=%d, rsc=%X, anc=%d, erc=%X, rsid=%X\n",
  657. crw1->slct, crw1->oflw, crw1->chn, crw1->rsc,
  658. crw1->anc, crw1->erc, crw1->rsid);
  659. init_subchannel_id(&mchk_schid);
  660. mchk_schid.sch_no = crw0->rsid;
  661. if (crw1)
  662. mchk_schid.ssid = (crw1->rsid >> 4) & 3;
  663. if (crw0->erc == CRW_ERC_PMOD) {
  664. sch = get_subchannel_by_schid(mchk_schid);
  665. if (sch) {
  666. css_update_ssd_info(sch);
  667. put_device(&sch->dev);
  668. }
  669. }
  670. /*
  671. * Since we are always presented with IPI in the CRW, we have to
  672. * use stsch() to find out if the subchannel in question has come
  673. * or gone.
  674. */
  675. css_evaluate_subchannel(mchk_schid, 0);
  676. }
  677. static void __init
  678. css_generate_pgid(struct channel_subsystem *css, u32 tod_high)
  679. {
  680. struct cpuid cpu_id;
  681. if (css_general_characteristics.mcss) {
  682. css->global_pgid.pgid_high.ext_cssid.version = 0x80;
  683. css->global_pgid.pgid_high.ext_cssid.cssid =
  684. (css->cssid < 0) ? 0 : css->cssid;
  685. } else {
  686. css->global_pgid.pgid_high.cpu_addr = stap();
  687. }
  688. get_cpu_id(&cpu_id);
  689. css->global_pgid.cpu_id = cpu_id.ident;
  690. css->global_pgid.cpu_model = cpu_id.machine;
  691. css->global_pgid.tod_high = tod_high;
  692. }
  693. static void channel_subsystem_release(struct device *dev)
  694. {
  695. struct channel_subsystem *css = to_css(dev);
  696. mutex_destroy(&css->mutex);
  697. kfree(css);
  698. }
  699. static ssize_t real_cssid_show(struct device *dev, struct device_attribute *a,
  700. char *buf)
  701. {
  702. struct channel_subsystem *css = to_css(dev);
  703. if (css->cssid < 0)
  704. return -EINVAL;
  705. return sprintf(buf, "%x\n", css->cssid);
  706. }
  707. static DEVICE_ATTR_RO(real_cssid);
  708. static ssize_t cm_enable_show(struct device *dev, struct device_attribute *a,
  709. char *buf)
  710. {
  711. struct channel_subsystem *css = to_css(dev);
  712. int ret;
  713. mutex_lock(&css->mutex);
  714. ret = sprintf(buf, "%x\n", css->cm_enabled);
  715. mutex_unlock(&css->mutex);
  716. return ret;
  717. }
  718. static ssize_t cm_enable_store(struct device *dev, struct device_attribute *a,
  719. const char *buf, size_t count)
  720. {
  721. struct channel_subsystem *css = to_css(dev);
  722. unsigned long val;
  723. int ret;
  724. ret = kstrtoul(buf, 16, &val);
  725. if (ret)
  726. return ret;
  727. mutex_lock(&css->mutex);
  728. switch (val) {
  729. case 0:
  730. ret = css->cm_enabled ? chsc_secm(css, 0) : 0;
  731. break;
  732. case 1:
  733. ret = css->cm_enabled ? 0 : chsc_secm(css, 1);
  734. break;
  735. default:
  736. ret = -EINVAL;
  737. }
  738. mutex_unlock(&css->mutex);
  739. return ret < 0 ? ret : count;
  740. }
  741. static DEVICE_ATTR_RW(cm_enable);
  742. static umode_t cm_enable_mode(struct kobject *kobj, struct attribute *attr,
  743. int index)
  744. {
  745. return css_chsc_characteristics.secm ? attr->mode : 0;
  746. }
  747. static struct attribute *cssdev_attrs[] = {
  748. &dev_attr_real_cssid.attr,
  749. NULL,
  750. };
  751. static struct attribute_group cssdev_attr_group = {
  752. .attrs = cssdev_attrs,
  753. };
  754. static struct attribute *cssdev_cm_attrs[] = {
  755. &dev_attr_cm_enable.attr,
  756. NULL,
  757. };
  758. static struct attribute_group cssdev_cm_attr_group = {
  759. .attrs = cssdev_cm_attrs,
  760. .is_visible = cm_enable_mode,
  761. };
  762. static const struct attribute_group *cssdev_attr_groups[] = {
  763. &cssdev_attr_group,
  764. &cssdev_cm_attr_group,
  765. NULL,
  766. };
  767. static int __init setup_css(int nr)
  768. {
  769. struct channel_subsystem *css;
  770. int ret;
  771. css = kzalloc(sizeof(*css), GFP_KERNEL);
  772. if (!css)
  773. return -ENOMEM;
  774. channel_subsystems[nr] = css;
  775. dev_set_name(&css->device, "css%x", nr);
  776. css->device.groups = cssdev_attr_groups;
  777. css->device.release = channel_subsystem_release;
  778. mutex_init(&css->mutex);
  779. css->cssid = chsc_get_cssid(nr);
  780. css_generate_pgid(css, (u32) (get_tod_clock() >> 32));
  781. ret = device_register(&css->device);
  782. if (ret) {
  783. put_device(&css->device);
  784. goto out_err;
  785. }
  786. css->pseudo_subchannel = kzalloc(sizeof(*css->pseudo_subchannel),
  787. GFP_KERNEL);
  788. if (!css->pseudo_subchannel) {
  789. device_unregister(&css->device);
  790. ret = -ENOMEM;
  791. goto out_err;
  792. }
  793. css->pseudo_subchannel->dev.parent = &css->device;
  794. css->pseudo_subchannel->dev.release = css_subchannel_release;
  795. mutex_init(&css->pseudo_subchannel->reg_mutex);
  796. ret = css_sch_create_locks(css->pseudo_subchannel);
  797. if (ret) {
  798. kfree(css->pseudo_subchannel);
  799. device_unregister(&css->device);
  800. goto out_err;
  801. }
  802. dev_set_name(&css->pseudo_subchannel->dev, "defunct");
  803. ret = device_register(&css->pseudo_subchannel->dev);
  804. if (ret) {
  805. put_device(&css->pseudo_subchannel->dev);
  806. device_unregister(&css->device);
  807. goto out_err;
  808. }
  809. return ret;
  810. out_err:
  811. channel_subsystems[nr] = NULL;
  812. return ret;
  813. }
  814. static int css_reboot_event(struct notifier_block *this,
  815. unsigned long event,
  816. void *ptr)
  817. {
  818. struct channel_subsystem *css;
  819. int ret;
  820. ret = NOTIFY_DONE;
  821. for_each_css(css) {
  822. mutex_lock(&css->mutex);
  823. if (css->cm_enabled)
  824. if (chsc_secm(css, 0))
  825. ret = NOTIFY_BAD;
  826. mutex_unlock(&css->mutex);
  827. }
  828. return ret;
  829. }
  830. static struct notifier_block css_reboot_notifier = {
  831. .notifier_call = css_reboot_event,
  832. };
  833. /*
  834. * Since the css devices are neither on a bus nor have a class
  835. * nor have a special device type, we cannot stop/restart channel
  836. * path measurements via the normal suspend/resume callbacks, but have
  837. * to use notifiers.
  838. */
  839. static int css_power_event(struct notifier_block *this, unsigned long event,
  840. void *ptr)
  841. {
  842. struct channel_subsystem *css;
  843. int ret;
  844. switch (event) {
  845. case PM_HIBERNATION_PREPARE:
  846. case PM_SUSPEND_PREPARE:
  847. ret = NOTIFY_DONE;
  848. for_each_css(css) {
  849. mutex_lock(&css->mutex);
  850. if (!css->cm_enabled) {
  851. mutex_unlock(&css->mutex);
  852. continue;
  853. }
  854. ret = __chsc_do_secm(css, 0);
  855. ret = notifier_from_errno(ret);
  856. mutex_unlock(&css->mutex);
  857. }
  858. break;
  859. case PM_POST_HIBERNATION:
  860. case PM_POST_SUSPEND:
  861. ret = NOTIFY_DONE;
  862. for_each_css(css) {
  863. mutex_lock(&css->mutex);
  864. if (!css->cm_enabled) {
  865. mutex_unlock(&css->mutex);
  866. continue;
  867. }
  868. ret = __chsc_do_secm(css, 1);
  869. ret = notifier_from_errno(ret);
  870. mutex_unlock(&css->mutex);
  871. }
  872. /* search for subchannels, which appeared during hibernation */
  873. css_schedule_reprobe();
  874. break;
  875. default:
  876. ret = NOTIFY_DONE;
  877. }
  878. return ret;
  879. }
  880. static struct notifier_block css_power_notifier = {
  881. .notifier_call = css_power_event,
  882. };
  883. /*
  884. * Now that the driver core is running, we can setup our channel subsystem.
  885. * The struct subchannel's are created during probing.
  886. */
  887. static int __init css_bus_init(void)
  888. {
  889. int ret, i;
  890. ret = chsc_init();
  891. if (ret)
  892. return ret;
  893. chsc_determine_css_characteristics();
  894. /* Try to enable MSS. */
  895. ret = chsc_enable_facility(CHSC_SDA_OC_MSS);
  896. if (ret)
  897. max_ssid = 0;
  898. else /* Success. */
  899. max_ssid = __MAX_SSID;
  900. ret = slow_subchannel_init();
  901. if (ret)
  902. goto out;
  903. ret = crw_register_handler(CRW_RSC_SCH, css_process_crw);
  904. if (ret)
  905. goto out;
  906. if ((ret = bus_register(&css_bus_type)))
  907. goto out;
  908. /* Setup css structure. */
  909. for (i = 0; i <= MAX_CSS_IDX; i++) {
  910. ret = setup_css(i);
  911. if (ret)
  912. goto out_unregister;
  913. }
  914. ret = register_reboot_notifier(&css_reboot_notifier);
  915. if (ret)
  916. goto out_unregister;
  917. ret = register_pm_notifier(&css_power_notifier);
  918. if (ret) {
  919. unregister_reboot_notifier(&css_reboot_notifier);
  920. goto out_unregister;
  921. }
  922. css_init_done = 1;
  923. /* Enable default isc for I/O subchannels. */
  924. isc_register(IO_SCH_ISC);
  925. return 0;
  926. out_unregister:
  927. while (i-- > 0) {
  928. struct channel_subsystem *css = channel_subsystems[i];
  929. device_unregister(&css->pseudo_subchannel->dev);
  930. device_unregister(&css->device);
  931. }
  932. bus_unregister(&css_bus_type);
  933. out:
  934. crw_unregister_handler(CRW_RSC_SCH);
  935. idset_free(slow_subchannel_set);
  936. chsc_init_cleanup();
  937. pr_alert("The CSS device driver initialization failed with "
  938. "errno=%d\n", ret);
  939. return ret;
  940. }
  941. static void __init css_bus_cleanup(void)
  942. {
  943. struct channel_subsystem *css;
  944. for_each_css(css) {
  945. device_unregister(&css->pseudo_subchannel->dev);
  946. device_unregister(&css->device);
  947. }
  948. bus_unregister(&css_bus_type);
  949. crw_unregister_handler(CRW_RSC_SCH);
  950. idset_free(slow_subchannel_set);
  951. chsc_init_cleanup();
  952. isc_unregister(IO_SCH_ISC);
  953. }
  954. static int __init channel_subsystem_init(void)
  955. {
  956. int ret;
  957. ret = css_bus_init();
  958. if (ret)
  959. return ret;
  960. cio_work_q = create_singlethread_workqueue("cio");
  961. if (!cio_work_q) {
  962. ret = -ENOMEM;
  963. goto out_bus;
  964. }
  965. ret = io_subchannel_init();
  966. if (ret)
  967. goto out_wq;
  968. /* Register subchannels which are already in use. */
  969. cio_register_early_subchannels();
  970. /* Start initial subchannel evaluation. */
  971. css_schedule_eval_all();
  972. return ret;
  973. out_wq:
  974. destroy_workqueue(cio_work_q);
  975. out_bus:
  976. css_bus_cleanup();
  977. return ret;
  978. }
  979. subsys_initcall(channel_subsystem_init);
  980. static int css_settle(struct device_driver *drv, void *unused)
  981. {
  982. struct css_driver *cssdrv = to_cssdriver(drv);
  983. if (cssdrv->settle)
  984. return cssdrv->settle();
  985. return 0;
  986. }
  987. int css_complete_work(void)
  988. {
  989. int ret;
  990. /* Wait for the evaluation of subchannels to finish. */
  991. ret = wait_event_interruptible(css_eval_wq,
  992. atomic_read(&css_eval_scheduled) == 0);
  993. if (ret)
  994. return -EINTR;
  995. flush_workqueue(cio_work_q);
  996. /* Wait for the subchannel type specific initialization to finish */
  997. return bus_for_each_drv(&css_bus_type, NULL, NULL, css_settle);
  998. }
  999. /*
  1000. * Wait for the initialization of devices to finish, to make sure we are
  1001. * done with our setup if the search for the root device starts.
  1002. */
  1003. static int __init channel_subsystem_init_sync(void)
  1004. {
  1005. css_complete_work();
  1006. return 0;
  1007. }
  1008. subsys_initcall_sync(channel_subsystem_init_sync);
  1009. void channel_subsystem_reinit(void)
  1010. {
  1011. struct channel_path *chp;
  1012. struct chp_id chpid;
  1013. chsc_enable_facility(CHSC_SDA_OC_MSS);
  1014. chp_id_for_each(&chpid) {
  1015. chp = chpid_to_chp(chpid);
  1016. if (chp)
  1017. chp_update_desc(chp);
  1018. }
  1019. cmf_reactivate();
  1020. }
  1021. #ifdef CONFIG_PROC_FS
  1022. static ssize_t cio_settle_write(struct file *file, const char __user *buf,
  1023. size_t count, loff_t *ppos)
  1024. {
  1025. int ret;
  1026. /* Handle pending CRW's. */
  1027. crw_wait_for_channel_report();
  1028. ret = css_complete_work();
  1029. return ret ? ret : count;
  1030. }
  1031. static const struct file_operations cio_settle_proc_fops = {
  1032. .open = nonseekable_open,
  1033. .write = cio_settle_write,
  1034. .llseek = no_llseek,
  1035. };
  1036. static int __init cio_settle_init(void)
  1037. {
  1038. struct proc_dir_entry *entry;
  1039. entry = proc_create("cio_settle", S_IWUSR, NULL,
  1040. &cio_settle_proc_fops);
  1041. if (!entry)
  1042. return -ENOMEM;
  1043. return 0;
  1044. }
  1045. device_initcall(cio_settle_init);
  1046. #endif /*CONFIG_PROC_FS*/
  1047. int sch_is_pseudo_sch(struct subchannel *sch)
  1048. {
  1049. if (!sch->dev.parent)
  1050. return 0;
  1051. return sch == to_css(sch->dev.parent)->pseudo_subchannel;
  1052. }
  1053. static int css_bus_match(struct device *dev, struct device_driver *drv)
  1054. {
  1055. struct subchannel *sch = to_subchannel(dev);
  1056. struct css_driver *driver = to_cssdriver(drv);
  1057. struct css_device_id *id;
  1058. for (id = driver->subchannel_type; id->match_flags; id++) {
  1059. if (sch->st == id->type)
  1060. return 1;
  1061. }
  1062. return 0;
  1063. }
  1064. static int css_probe(struct device *dev)
  1065. {
  1066. struct subchannel *sch;
  1067. int ret;
  1068. sch = to_subchannel(dev);
  1069. sch->driver = to_cssdriver(dev->driver);
  1070. ret = sch->driver->probe ? sch->driver->probe(sch) : 0;
  1071. if (ret)
  1072. sch->driver = NULL;
  1073. return ret;
  1074. }
  1075. static int css_remove(struct device *dev)
  1076. {
  1077. struct subchannel *sch;
  1078. int ret;
  1079. sch = to_subchannel(dev);
  1080. ret = sch->driver->remove ? sch->driver->remove(sch) : 0;
  1081. sch->driver = NULL;
  1082. return ret;
  1083. }
  1084. static void css_shutdown(struct device *dev)
  1085. {
  1086. struct subchannel *sch;
  1087. sch = to_subchannel(dev);
  1088. if (sch->driver && sch->driver->shutdown)
  1089. sch->driver->shutdown(sch);
  1090. }
  1091. static int css_uevent(struct device *dev, struct kobj_uevent_env *env)
  1092. {
  1093. struct subchannel *sch = to_subchannel(dev);
  1094. int ret;
  1095. ret = add_uevent_var(env, "ST=%01X", sch->st);
  1096. if (ret)
  1097. return ret;
  1098. ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st);
  1099. return ret;
  1100. }
  1101. static int css_pm_prepare(struct device *dev)
  1102. {
  1103. struct subchannel *sch = to_subchannel(dev);
  1104. struct css_driver *drv;
  1105. if (mutex_is_locked(&sch->reg_mutex))
  1106. return -EAGAIN;
  1107. if (!sch->dev.driver)
  1108. return 0;
  1109. drv = to_cssdriver(sch->dev.driver);
  1110. /* Notify drivers that they may not register children. */
  1111. return drv->prepare ? drv->prepare(sch) : 0;
  1112. }
  1113. static void css_pm_complete(struct device *dev)
  1114. {
  1115. struct subchannel *sch = to_subchannel(dev);
  1116. struct css_driver *drv;
  1117. if (!sch->dev.driver)
  1118. return;
  1119. drv = to_cssdriver(sch->dev.driver);
  1120. if (drv->complete)
  1121. drv->complete(sch);
  1122. }
  1123. static int css_pm_freeze(struct device *dev)
  1124. {
  1125. struct subchannel *sch = to_subchannel(dev);
  1126. struct css_driver *drv;
  1127. if (!sch->dev.driver)
  1128. return 0;
  1129. drv = to_cssdriver(sch->dev.driver);
  1130. return drv->freeze ? drv->freeze(sch) : 0;
  1131. }
  1132. static int css_pm_thaw(struct device *dev)
  1133. {
  1134. struct subchannel *sch = to_subchannel(dev);
  1135. struct css_driver *drv;
  1136. if (!sch->dev.driver)
  1137. return 0;
  1138. drv = to_cssdriver(sch->dev.driver);
  1139. return drv->thaw ? drv->thaw(sch) : 0;
  1140. }
  1141. static int css_pm_restore(struct device *dev)
  1142. {
  1143. struct subchannel *sch = to_subchannel(dev);
  1144. struct css_driver *drv;
  1145. css_update_ssd_info(sch);
  1146. if (!sch->dev.driver)
  1147. return 0;
  1148. drv = to_cssdriver(sch->dev.driver);
  1149. return drv->restore ? drv->restore(sch) : 0;
  1150. }
  1151. static const struct dev_pm_ops css_pm_ops = {
  1152. .prepare = css_pm_prepare,
  1153. .complete = css_pm_complete,
  1154. .freeze = css_pm_freeze,
  1155. .thaw = css_pm_thaw,
  1156. .restore = css_pm_restore,
  1157. };
  1158. static struct bus_type css_bus_type = {
  1159. .name = "css",
  1160. .match = css_bus_match,
  1161. .probe = css_probe,
  1162. .remove = css_remove,
  1163. .shutdown = css_shutdown,
  1164. .uevent = css_uevent,
  1165. .pm = &css_pm_ops,
  1166. };
  1167. /**
  1168. * css_driver_register - register a css driver
  1169. * @cdrv: css driver to register
  1170. *
  1171. * This is mainly a wrapper around driver_register that sets name
  1172. * and bus_type in the embedded struct device_driver correctly.
  1173. */
  1174. int css_driver_register(struct css_driver *cdrv)
  1175. {
  1176. cdrv->drv.bus = &css_bus_type;
  1177. return driver_register(&cdrv->drv);
  1178. }
  1179. EXPORT_SYMBOL_GPL(css_driver_register);
  1180. /**
  1181. * css_driver_unregister - unregister a css driver
  1182. * @cdrv: css driver to unregister
  1183. *
  1184. * This is a wrapper around driver_unregister.
  1185. */
  1186. void css_driver_unregister(struct css_driver *cdrv)
  1187. {
  1188. driver_unregister(&cdrv->drv);
  1189. }
  1190. EXPORT_SYMBOL_GPL(css_driver_unregister);