edac_mc.c 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261
  1. /*
  2. * edac_mc kernel module
  3. * (C) 2005, 2006 Linux Networx (http://lnxi.com)
  4. * This file may be distributed under the terms of the
  5. * GNU General Public License.
  6. *
  7. * Written by Thayne Harbaugh
  8. * Based on work by Dan Hollis <goemon at anime dot net> and others.
  9. * http://www.anime.net/~goemon/linux-ecc/
  10. *
  11. * Modified by Dave Peterson and Doug Thompson
  12. *
  13. */
  14. #include <linux/module.h>
  15. #include <linux/proc_fs.h>
  16. #include <linux/kernel.h>
  17. #include <linux/types.h>
  18. #include <linux/smp.h>
  19. #include <linux/init.h>
  20. #include <linux/sysctl.h>
  21. #include <linux/highmem.h>
  22. #include <linux/timer.h>
  23. #include <linux/slab.h>
  24. #include <linux/jiffies.h>
  25. #include <linux/spinlock.h>
  26. #include <linux/list.h>
  27. #include <linux/ctype.h>
  28. #include <linux/edac.h>
  29. #include <linux/bitops.h>
  30. #include <asm/uaccess.h>
  31. #include <asm/page.h>
  32. #include "edac_core.h"
  33. #include "edac_module.h"
  34. #include <ras/ras_event.h>
  35. #ifdef CONFIG_EDAC_ATOMIC_SCRUB
  36. #include <asm/edac.h>
  37. #else
  38. #define edac_atomic_scrub(va, size) do { } while (0)
  39. #endif
  40. /* lock to memory controller's control array */
  41. static DEFINE_MUTEX(mem_ctls_mutex);
  42. static LIST_HEAD(mc_devices);
  43. /*
  44. * Used to lock EDAC MC to just one module, avoiding two drivers e. g.
  45. * apei/ghes and i7core_edac to be used at the same time.
  46. */
  47. static void const *edac_mc_owner;
  48. static struct bus_type mc_bus[EDAC_MAX_MCS];
  49. unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
  50. unsigned len)
  51. {
  52. struct mem_ctl_info *mci = dimm->mci;
  53. int i, n, count = 0;
  54. char *p = buf;
  55. for (i = 0; i < mci->n_layers; i++) {
  56. n = snprintf(p, len, "%s %d ",
  57. edac_layer_name[mci->layers[i].type],
  58. dimm->location[i]);
  59. p += n;
  60. len -= n;
  61. count += n;
  62. if (!len)
  63. break;
  64. }
  65. return count;
  66. }
  67. #ifdef CONFIG_EDAC_DEBUG
  68. static void edac_mc_dump_channel(struct rank_info *chan)
  69. {
  70. edac_dbg(4, " channel->chan_idx = %d\n", chan->chan_idx);
  71. edac_dbg(4, " channel = %p\n", chan);
  72. edac_dbg(4, " channel->csrow = %p\n", chan->csrow);
  73. edac_dbg(4, " channel->dimm = %p\n", chan->dimm);
  74. }
  75. static void edac_mc_dump_dimm(struct dimm_info *dimm, int number)
  76. {
  77. char location[80];
  78. edac_dimm_info_location(dimm, location, sizeof(location));
  79. edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n",
  80. dimm->mci->csbased ? "rank" : "dimm",
  81. number, location, dimm->csrow, dimm->cschannel);
  82. edac_dbg(4, " dimm = %p\n", dimm);
  83. edac_dbg(4, " dimm->label = '%s'\n", dimm->label);
  84. edac_dbg(4, " dimm->nr_pages = 0x%x\n", dimm->nr_pages);
  85. edac_dbg(4, " dimm->grain = %d\n", dimm->grain);
  86. edac_dbg(4, " dimm->nr_pages = 0x%x\n", dimm->nr_pages);
  87. }
  88. static void edac_mc_dump_csrow(struct csrow_info *csrow)
  89. {
  90. edac_dbg(4, "csrow->csrow_idx = %d\n", csrow->csrow_idx);
  91. edac_dbg(4, " csrow = %p\n", csrow);
  92. edac_dbg(4, " csrow->first_page = 0x%lx\n", csrow->first_page);
  93. edac_dbg(4, " csrow->last_page = 0x%lx\n", csrow->last_page);
  94. edac_dbg(4, " csrow->page_mask = 0x%lx\n", csrow->page_mask);
  95. edac_dbg(4, " csrow->nr_channels = %d\n", csrow->nr_channels);
  96. edac_dbg(4, " csrow->channels = %p\n", csrow->channels);
  97. edac_dbg(4, " csrow->mci = %p\n", csrow->mci);
  98. }
  99. static void edac_mc_dump_mci(struct mem_ctl_info *mci)
  100. {
  101. edac_dbg(3, "\tmci = %p\n", mci);
  102. edac_dbg(3, "\tmci->mtype_cap = %lx\n", mci->mtype_cap);
  103. edac_dbg(3, "\tmci->edac_ctl_cap = %lx\n", mci->edac_ctl_cap);
  104. edac_dbg(3, "\tmci->edac_cap = %lx\n", mci->edac_cap);
  105. edac_dbg(4, "\tmci->edac_check = %p\n", mci->edac_check);
  106. edac_dbg(3, "\tmci->nr_csrows = %d, csrows = %p\n",
  107. mci->nr_csrows, mci->csrows);
  108. edac_dbg(3, "\tmci->nr_dimms = %d, dimms = %p\n",
  109. mci->tot_dimms, mci->dimms);
  110. edac_dbg(3, "\tdev = %p\n", mci->pdev);
  111. edac_dbg(3, "\tmod_name:ctl_name = %s:%s\n",
  112. mci->mod_name, mci->ctl_name);
  113. edac_dbg(3, "\tpvt_info = %p\n\n", mci->pvt_info);
  114. }
  115. #endif /* CONFIG_EDAC_DEBUG */
  116. const char * const edac_mem_types[] = {
  117. [MEM_EMPTY] = "Empty csrow",
  118. [MEM_RESERVED] = "Reserved csrow type",
  119. [MEM_UNKNOWN] = "Unknown csrow type",
  120. [MEM_FPM] = "Fast page mode RAM",
  121. [MEM_EDO] = "Extended data out RAM",
  122. [MEM_BEDO] = "Burst Extended data out RAM",
  123. [MEM_SDR] = "Single data rate SDRAM",
  124. [MEM_RDR] = "Registered single data rate SDRAM",
  125. [MEM_DDR] = "Double data rate SDRAM",
  126. [MEM_RDDR] = "Registered Double data rate SDRAM",
  127. [MEM_RMBS] = "Rambus DRAM",
  128. [MEM_DDR2] = "Unbuffered DDR2 RAM",
  129. [MEM_FB_DDR2] = "Fully buffered DDR2",
  130. [MEM_RDDR2] = "Registered DDR2 RAM",
  131. [MEM_XDR] = "Rambus XDR",
  132. [MEM_DDR3] = "Unbuffered DDR3 RAM",
  133. [MEM_RDDR3] = "Registered DDR3 RAM",
  134. [MEM_LRDDR3] = "Load-Reduced DDR3 RAM",
  135. [MEM_DDR4] = "Unbuffered DDR4 RAM",
  136. [MEM_RDDR4] = "Registered DDR4 RAM",
  137. };
  138. EXPORT_SYMBOL_GPL(edac_mem_types);
  139. /**
  140. * edac_align_ptr - Prepares the pointer offsets for a single-shot allocation
  141. * @p: pointer to a pointer with the memory offset to be used. At
  142. * return, this will be incremented to point to the next offset
  143. * @size: Size of the data structure to be reserved
  144. * @n_elems: Number of elements that should be reserved
  145. *
  146. * If 'size' is a constant, the compiler will optimize this whole function
  147. * down to either a no-op or the addition of a constant to the value of '*p'.
  148. *
  149. * The 'p' pointer is absolutely needed to keep the proper advancing
  150. * further in memory to the proper offsets when allocating the struct along
  151. * with its embedded structs, as edac_device_alloc_ctl_info() does it
  152. * above, for example.
  153. *
  154. * At return, the pointer 'p' will be incremented to be used on a next call
  155. * to this function.
  156. */
  157. void *edac_align_ptr(void **p, unsigned size, int n_elems)
  158. {
  159. unsigned align, r;
  160. void *ptr = *p;
  161. *p += size * n_elems;
  162. /*
  163. * 'p' can possibly be an unaligned item X such that sizeof(X) is
  164. * 'size'. Adjust 'p' so that its alignment is at least as
  165. * stringent as what the compiler would provide for X and return
  166. * the aligned result.
  167. * Here we assume that the alignment of a "long long" is the most
  168. * stringent alignment that the compiler will ever provide by default.
  169. * As far as I know, this is a reasonable assumption.
  170. */
  171. if (size > sizeof(long))
  172. align = sizeof(long long);
  173. else if (size > sizeof(int))
  174. align = sizeof(long);
  175. else if (size > sizeof(short))
  176. align = sizeof(int);
  177. else if (size > sizeof(char))
  178. align = sizeof(short);
  179. else
  180. return (char *)ptr;
  181. r = (unsigned long)p % align;
  182. if (r == 0)
  183. return (char *)ptr;
  184. *p += align - r;
  185. return (void *)(((unsigned long)ptr) + align - r);
  186. }
  187. static void _edac_mc_free(struct mem_ctl_info *mci)
  188. {
  189. int i, chn, row;
  190. struct csrow_info *csr;
  191. const unsigned int tot_dimms = mci->tot_dimms;
  192. const unsigned int tot_channels = mci->num_cschannel;
  193. const unsigned int tot_csrows = mci->nr_csrows;
  194. if (mci->dimms) {
  195. for (i = 0; i < tot_dimms; i++)
  196. kfree(mci->dimms[i]);
  197. kfree(mci->dimms);
  198. }
  199. if (mci->csrows) {
  200. for (row = 0; row < tot_csrows; row++) {
  201. csr = mci->csrows[row];
  202. if (csr) {
  203. if (csr->channels) {
  204. for (chn = 0; chn < tot_channels; chn++)
  205. kfree(csr->channels[chn]);
  206. kfree(csr->channels);
  207. }
  208. kfree(csr);
  209. }
  210. }
  211. kfree(mci->csrows);
  212. }
  213. kfree(mci);
  214. }
  215. /**
  216. * edac_mc_alloc: Allocate and partially fill a struct mem_ctl_info structure
  217. * @mc_num: Memory controller number
  218. * @n_layers: Number of MC hierarchy layers
  219. * layers: Describes each layer as seen by the Memory Controller
  220. * @size_pvt: size of private storage needed
  221. *
  222. *
  223. * Everything is kmalloc'ed as one big chunk - more efficient.
  224. * Only can be used if all structures have the same lifetime - otherwise
  225. * you have to allocate and initialize your own structures.
  226. *
  227. * Use edac_mc_free() to free mc structures allocated by this function.
  228. *
  229. * NOTE: drivers handle multi-rank memories in different ways: in some
  230. * drivers, one multi-rank memory stick is mapped as one entry, while, in
  231. * others, a single multi-rank memory stick would be mapped into several
  232. * entries. Currently, this function will allocate multiple struct dimm_info
  233. * on such scenarios, as grouping the multiple ranks require drivers change.
  234. *
  235. * Returns:
  236. * On failure: NULL
  237. * On success: struct mem_ctl_info pointer
  238. */
  239. struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
  240. unsigned n_layers,
  241. struct edac_mc_layer *layers,
  242. unsigned sz_pvt)
  243. {
  244. struct mem_ctl_info *mci;
  245. struct edac_mc_layer *layer;
  246. struct csrow_info *csr;
  247. struct rank_info *chan;
  248. struct dimm_info *dimm;
  249. u32 *ce_per_layer[EDAC_MAX_LAYERS], *ue_per_layer[EDAC_MAX_LAYERS];
  250. unsigned pos[EDAC_MAX_LAYERS];
  251. unsigned size, tot_dimms = 1, count = 1;
  252. unsigned tot_csrows = 1, tot_channels = 1, tot_errcount = 0;
  253. void *pvt, *p, *ptr = NULL;
  254. int i, j, row, chn, n, len, off;
  255. bool per_rank = false;
  256. BUG_ON(n_layers > EDAC_MAX_LAYERS || n_layers == 0);
  257. /*
  258. * Calculate the total amount of dimms and csrows/cschannels while
  259. * in the old API emulation mode
  260. */
  261. for (i = 0; i < n_layers; i++) {
  262. tot_dimms *= layers[i].size;
  263. if (layers[i].is_virt_csrow)
  264. tot_csrows *= layers[i].size;
  265. else
  266. tot_channels *= layers[i].size;
  267. if (layers[i].type == EDAC_MC_LAYER_CHIP_SELECT)
  268. per_rank = true;
  269. }
  270. /* Figure out the offsets of the various items from the start of an mc
  271. * structure. We want the alignment of each item to be at least as
  272. * stringent as what the compiler would provide if we could simply
  273. * hardcode everything into a single struct.
  274. */
  275. mci = edac_align_ptr(&ptr, sizeof(*mci), 1);
  276. layer = edac_align_ptr(&ptr, sizeof(*layer), n_layers);
  277. for (i = 0; i < n_layers; i++) {
  278. count *= layers[i].size;
  279. edac_dbg(4, "errcount layer %d size %d\n", i, count);
  280. ce_per_layer[i] = edac_align_ptr(&ptr, sizeof(u32), count);
  281. ue_per_layer[i] = edac_align_ptr(&ptr, sizeof(u32), count);
  282. tot_errcount += 2 * count;
  283. }
  284. edac_dbg(4, "allocating %d error counters\n", tot_errcount);
  285. pvt = edac_align_ptr(&ptr, sz_pvt, 1);
  286. size = ((unsigned long)pvt) + sz_pvt;
  287. edac_dbg(1, "allocating %u bytes for mci data (%d %s, %d csrows/channels)\n",
  288. size,
  289. tot_dimms,
  290. per_rank ? "ranks" : "dimms",
  291. tot_csrows * tot_channels);
  292. mci = kzalloc(size, GFP_KERNEL);
  293. if (mci == NULL)
  294. return NULL;
  295. /* Adjust pointers so they point within the memory we just allocated
  296. * rather than an imaginary chunk of memory located at address 0.
  297. */
  298. layer = (struct edac_mc_layer *)(((char *)mci) + ((unsigned long)layer));
  299. for (i = 0; i < n_layers; i++) {
  300. mci->ce_per_layer[i] = (u32 *)((char *)mci + ((unsigned long)ce_per_layer[i]));
  301. mci->ue_per_layer[i] = (u32 *)((char *)mci + ((unsigned long)ue_per_layer[i]));
  302. }
  303. pvt = sz_pvt ? (((char *)mci) + ((unsigned long)pvt)) : NULL;
  304. /* setup index and various internal pointers */
  305. mci->mc_idx = mc_num;
  306. mci->tot_dimms = tot_dimms;
  307. mci->pvt_info = pvt;
  308. mci->n_layers = n_layers;
  309. mci->layers = layer;
  310. memcpy(mci->layers, layers, sizeof(*layer) * n_layers);
  311. mci->nr_csrows = tot_csrows;
  312. mci->num_cschannel = tot_channels;
  313. mci->csbased = per_rank;
  314. /*
  315. * Alocate and fill the csrow/channels structs
  316. */
  317. mci->csrows = kcalloc(tot_csrows, sizeof(*mci->csrows), GFP_KERNEL);
  318. if (!mci->csrows)
  319. goto error;
  320. for (row = 0; row < tot_csrows; row++) {
  321. csr = kzalloc(sizeof(**mci->csrows), GFP_KERNEL);
  322. if (!csr)
  323. goto error;
  324. mci->csrows[row] = csr;
  325. csr->csrow_idx = row;
  326. csr->mci = mci;
  327. csr->nr_channels = tot_channels;
  328. csr->channels = kcalloc(tot_channels, sizeof(*csr->channels),
  329. GFP_KERNEL);
  330. if (!csr->channels)
  331. goto error;
  332. for (chn = 0; chn < tot_channels; chn++) {
  333. chan = kzalloc(sizeof(**csr->channels), GFP_KERNEL);
  334. if (!chan)
  335. goto error;
  336. csr->channels[chn] = chan;
  337. chan->chan_idx = chn;
  338. chan->csrow = csr;
  339. }
  340. }
  341. /*
  342. * Allocate and fill the dimm structs
  343. */
  344. mci->dimms = kcalloc(tot_dimms, sizeof(*mci->dimms), GFP_KERNEL);
  345. if (!mci->dimms)
  346. goto error;
  347. memset(&pos, 0, sizeof(pos));
  348. row = 0;
  349. chn = 0;
  350. for (i = 0; i < tot_dimms; i++) {
  351. chan = mci->csrows[row]->channels[chn];
  352. off = EDAC_DIMM_OFF(layer, n_layers, pos[0], pos[1], pos[2]);
  353. if (off < 0 || off >= tot_dimms) {
  354. edac_mc_printk(mci, KERN_ERR, "EDAC core bug: EDAC_DIMM_OFF is trying to do an illegal data access\n");
  355. goto error;
  356. }
  357. dimm = kzalloc(sizeof(**mci->dimms), GFP_KERNEL);
  358. if (!dimm)
  359. goto error;
  360. mci->dimms[off] = dimm;
  361. dimm->mci = mci;
  362. /*
  363. * Copy DIMM location and initialize it.
  364. */
  365. len = sizeof(dimm->label);
  366. p = dimm->label;
  367. n = snprintf(p, len, "mc#%u", mc_num);
  368. p += n;
  369. len -= n;
  370. for (j = 0; j < n_layers; j++) {
  371. n = snprintf(p, len, "%s#%u",
  372. edac_layer_name[layers[j].type],
  373. pos[j]);
  374. p += n;
  375. len -= n;
  376. dimm->location[j] = pos[j];
  377. if (len <= 0)
  378. break;
  379. }
  380. /* Link it to the csrows old API data */
  381. chan->dimm = dimm;
  382. dimm->csrow = row;
  383. dimm->cschannel = chn;
  384. /* Increment csrow location */
  385. if (layers[0].is_virt_csrow) {
  386. chn++;
  387. if (chn == tot_channels) {
  388. chn = 0;
  389. row++;
  390. }
  391. } else {
  392. row++;
  393. if (row == tot_csrows) {
  394. row = 0;
  395. chn++;
  396. }
  397. }
  398. /* Increment dimm location */
  399. for (j = n_layers - 1; j >= 0; j--) {
  400. pos[j]++;
  401. if (pos[j] < layers[j].size)
  402. break;
  403. pos[j] = 0;
  404. }
  405. }
  406. mci->op_state = OP_ALLOC;
  407. return mci;
  408. error:
  409. _edac_mc_free(mci);
  410. return NULL;
  411. }
  412. EXPORT_SYMBOL_GPL(edac_mc_alloc);
  413. /**
  414. * edac_mc_free
  415. * 'Free' a previously allocated 'mci' structure
  416. * @mci: pointer to a struct mem_ctl_info structure
  417. */
  418. void edac_mc_free(struct mem_ctl_info *mci)
  419. {
  420. edac_dbg(1, "\n");
  421. /* If we're not yet registered with sysfs free only what was allocated
  422. * in edac_mc_alloc().
  423. */
  424. if (!device_is_registered(&mci->dev)) {
  425. _edac_mc_free(mci);
  426. return;
  427. }
  428. /* the mci instance is freed here, when the sysfs object is dropped */
  429. edac_unregister_sysfs(mci);
  430. }
  431. EXPORT_SYMBOL_GPL(edac_mc_free);
  432. /**
  433. * find_mci_by_dev
  434. *
  435. * scan list of controllers looking for the one that manages
  436. * the 'dev' device
  437. * @dev: pointer to a struct device related with the MCI
  438. */
  439. struct mem_ctl_info *find_mci_by_dev(struct device *dev)
  440. {
  441. struct mem_ctl_info *mci;
  442. struct list_head *item;
  443. edac_dbg(3, "\n");
  444. list_for_each(item, &mc_devices) {
  445. mci = list_entry(item, struct mem_ctl_info, link);
  446. if (mci->pdev == dev)
  447. return mci;
  448. }
  449. return NULL;
  450. }
  451. EXPORT_SYMBOL_GPL(find_mci_by_dev);
  452. /*
  453. * handler for EDAC to check if NMI type handler has asserted interrupt
  454. */
  455. static int edac_mc_assert_error_check_and_clear(void)
  456. {
  457. int old_state;
  458. if (edac_op_state == EDAC_OPSTATE_POLL)
  459. return 1;
  460. old_state = edac_err_assert;
  461. edac_err_assert = 0;
  462. return old_state;
  463. }
  464. /*
  465. * edac_mc_workq_function
  466. * performs the operation scheduled by a workq request
  467. */
  468. static void edac_mc_workq_function(struct work_struct *work_req)
  469. {
  470. struct delayed_work *d_work = to_delayed_work(work_req);
  471. struct mem_ctl_info *mci = to_edac_mem_ctl_work(d_work);
  472. mutex_lock(&mem_ctls_mutex);
  473. if (mci->op_state != OP_RUNNING_POLL) {
  474. mutex_unlock(&mem_ctls_mutex);
  475. return;
  476. }
  477. if (edac_mc_assert_error_check_and_clear())
  478. mci->edac_check(mci);
  479. mutex_unlock(&mem_ctls_mutex);
  480. /* Queue ourselves again. */
  481. edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec()));
  482. }
  483. /*
  484. * edac_mc_reset_delay_period(unsigned long value)
  485. *
  486. * user space has updated our poll period value, need to
  487. * reset our workq delays
  488. */
  489. void edac_mc_reset_delay_period(unsigned long value)
  490. {
  491. struct mem_ctl_info *mci;
  492. struct list_head *item;
  493. mutex_lock(&mem_ctls_mutex);
  494. list_for_each(item, &mc_devices) {
  495. mci = list_entry(item, struct mem_ctl_info, link);
  496. if (mci->op_state == OP_RUNNING_POLL)
  497. edac_mod_work(&mci->work, value);
  498. }
  499. mutex_unlock(&mem_ctls_mutex);
  500. }
  501. /* Return 0 on success, 1 on failure.
  502. * Before calling this function, caller must
  503. * assign a unique value to mci->mc_idx.
  504. *
  505. * locking model:
  506. *
  507. * called with the mem_ctls_mutex lock held
  508. */
  509. static int add_mc_to_global_list(struct mem_ctl_info *mci)
  510. {
  511. struct list_head *item, *insert_before;
  512. struct mem_ctl_info *p;
  513. insert_before = &mc_devices;
  514. p = find_mci_by_dev(mci->pdev);
  515. if (unlikely(p != NULL))
  516. goto fail0;
  517. list_for_each(item, &mc_devices) {
  518. p = list_entry(item, struct mem_ctl_info, link);
  519. if (p->mc_idx >= mci->mc_idx) {
  520. if (unlikely(p->mc_idx == mci->mc_idx))
  521. goto fail1;
  522. insert_before = item;
  523. break;
  524. }
  525. }
  526. list_add_tail_rcu(&mci->link, insert_before);
  527. atomic_inc(&edac_handlers);
  528. return 0;
  529. fail0:
  530. edac_printk(KERN_WARNING, EDAC_MC,
  531. "%s (%s) %s %s already assigned %d\n", dev_name(p->pdev),
  532. edac_dev_name(mci), p->mod_name, p->ctl_name, p->mc_idx);
  533. return 1;
  534. fail1:
  535. edac_printk(KERN_WARNING, EDAC_MC,
  536. "bug in low-level driver: attempt to assign\n"
  537. " duplicate mc_idx %d in %s()\n", p->mc_idx, __func__);
  538. return 1;
  539. }
  540. static int del_mc_from_global_list(struct mem_ctl_info *mci)
  541. {
  542. int handlers = atomic_dec_return(&edac_handlers);
  543. list_del_rcu(&mci->link);
  544. /* these are for safe removal of devices from global list while
  545. * NMI handlers may be traversing list
  546. */
  547. synchronize_rcu();
  548. INIT_LIST_HEAD(&mci->link);
  549. return handlers;
  550. }
  551. /**
  552. * edac_mc_find: Search for a mem_ctl_info structure whose index is 'idx'.
  553. *
  554. * If found, return a pointer to the structure.
  555. * Else return NULL.
  556. *
  557. * Caller must hold mem_ctls_mutex.
  558. */
  559. struct mem_ctl_info *edac_mc_find(int idx)
  560. {
  561. struct list_head *item;
  562. struct mem_ctl_info *mci;
  563. list_for_each(item, &mc_devices) {
  564. mci = list_entry(item, struct mem_ctl_info, link);
  565. if (mci->mc_idx >= idx) {
  566. if (mci->mc_idx == idx)
  567. return mci;
  568. break;
  569. }
  570. }
  571. return NULL;
  572. }
  573. EXPORT_SYMBOL(edac_mc_find);
  574. /**
  575. * edac_mc_add_mc_with_groups: Insert the 'mci' structure into the mci
  576. * global list and create sysfs entries associated with mci structure
  577. * @mci: pointer to the mci structure to be added to the list
  578. * @groups: optional attribute groups for the driver-specific sysfs entries
  579. *
  580. * Return:
  581. * 0 Success
  582. * !0 Failure
  583. */
  584. /* FIXME - should a warning be printed if no error detection? correction? */
  585. int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci,
  586. const struct attribute_group **groups)
  587. {
  588. int ret = -EINVAL;
  589. edac_dbg(0, "\n");
  590. if (mci->mc_idx >= EDAC_MAX_MCS) {
  591. pr_warn_once("Too many memory controllers: %d\n", mci->mc_idx);
  592. return -ENODEV;
  593. }
  594. #ifdef CONFIG_EDAC_DEBUG
  595. if (edac_debug_level >= 3)
  596. edac_mc_dump_mci(mci);
  597. if (edac_debug_level >= 4) {
  598. int i;
  599. for (i = 0; i < mci->nr_csrows; i++) {
  600. struct csrow_info *csrow = mci->csrows[i];
  601. u32 nr_pages = 0;
  602. int j;
  603. for (j = 0; j < csrow->nr_channels; j++)
  604. nr_pages += csrow->channels[j]->dimm->nr_pages;
  605. if (!nr_pages)
  606. continue;
  607. edac_mc_dump_csrow(csrow);
  608. for (j = 0; j < csrow->nr_channels; j++)
  609. if (csrow->channels[j]->dimm->nr_pages)
  610. edac_mc_dump_channel(csrow->channels[j]);
  611. }
  612. for (i = 0; i < mci->tot_dimms; i++)
  613. if (mci->dimms[i]->nr_pages)
  614. edac_mc_dump_dimm(mci->dimms[i], i);
  615. }
  616. #endif
  617. mutex_lock(&mem_ctls_mutex);
  618. if (edac_mc_owner && edac_mc_owner != mci->mod_name) {
  619. ret = -EPERM;
  620. goto fail0;
  621. }
  622. if (add_mc_to_global_list(mci))
  623. goto fail0;
  624. /* set load time so that error rate can be tracked */
  625. mci->start_time = jiffies;
  626. mci->bus = &mc_bus[mci->mc_idx];
  627. if (edac_create_sysfs_mci_device(mci, groups)) {
  628. edac_mc_printk(mci, KERN_WARNING,
  629. "failed to create sysfs device\n");
  630. goto fail1;
  631. }
  632. if (mci->edac_check) {
  633. mci->op_state = OP_RUNNING_POLL;
  634. INIT_DELAYED_WORK(&mci->work, edac_mc_workq_function);
  635. edac_queue_work(&mci->work, msecs_to_jiffies(edac_mc_get_poll_msec()));
  636. } else {
  637. mci->op_state = OP_RUNNING_INTERRUPT;
  638. }
  639. /* Report action taken */
  640. edac_mc_printk(mci, KERN_INFO,
  641. "Giving out device to module %s controller %s: DEV %s (%s)\n",
  642. mci->mod_name, mci->ctl_name, mci->dev_name,
  643. edac_op_state_to_string(mci->op_state));
  644. edac_mc_owner = mci->mod_name;
  645. mutex_unlock(&mem_ctls_mutex);
  646. return 0;
  647. fail1:
  648. del_mc_from_global_list(mci);
  649. fail0:
  650. mutex_unlock(&mem_ctls_mutex);
  651. return ret;
  652. }
  653. EXPORT_SYMBOL_GPL(edac_mc_add_mc_with_groups);
  654. /**
  655. * edac_mc_del_mc: Remove sysfs entries for specified mci structure and
  656. * remove mci structure from global list
  657. * @pdev: Pointer to 'struct device' representing mci structure to remove.
  658. *
  659. * Return pointer to removed mci structure, or NULL if device not found.
  660. */
  661. struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
  662. {
  663. struct mem_ctl_info *mci;
  664. edac_dbg(0, "\n");
  665. mutex_lock(&mem_ctls_mutex);
  666. /* find the requested mci struct in the global list */
  667. mci = find_mci_by_dev(dev);
  668. if (mci == NULL) {
  669. mutex_unlock(&mem_ctls_mutex);
  670. return NULL;
  671. }
  672. /* mark MCI offline: */
  673. mci->op_state = OP_OFFLINE;
  674. if (!del_mc_from_global_list(mci))
  675. edac_mc_owner = NULL;
  676. mutex_unlock(&mem_ctls_mutex);
  677. if (mci->edac_check)
  678. edac_stop_work(&mci->work);
  679. /* remove from sysfs */
  680. edac_remove_sysfs_mci_device(mci);
  681. edac_printk(KERN_INFO, EDAC_MC,
  682. "Removed device %d for %s %s: DEV %s\n", mci->mc_idx,
  683. mci->mod_name, mci->ctl_name, edac_dev_name(mci));
  684. return mci;
  685. }
  686. EXPORT_SYMBOL_GPL(edac_mc_del_mc);
  687. static void edac_mc_scrub_block(unsigned long page, unsigned long offset,
  688. u32 size)
  689. {
  690. struct page *pg;
  691. void *virt_addr;
  692. unsigned long flags = 0;
  693. edac_dbg(3, "\n");
  694. /* ECC error page was not in our memory. Ignore it. */
  695. if (!pfn_valid(page))
  696. return;
  697. /* Find the actual page structure then map it and fix */
  698. pg = pfn_to_page(page);
  699. if (PageHighMem(pg))
  700. local_irq_save(flags);
  701. virt_addr = kmap_atomic(pg);
  702. /* Perform architecture specific atomic scrub operation */
  703. edac_atomic_scrub(virt_addr + offset, size);
  704. /* Unmap and complete */
  705. kunmap_atomic(virt_addr);
  706. if (PageHighMem(pg))
  707. local_irq_restore(flags);
  708. }
  709. /* FIXME - should return -1 */
  710. int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, unsigned long page)
  711. {
  712. struct csrow_info **csrows = mci->csrows;
  713. int row, i, j, n;
  714. edac_dbg(1, "MC%d: 0x%lx\n", mci->mc_idx, page);
  715. row = -1;
  716. for (i = 0; i < mci->nr_csrows; i++) {
  717. struct csrow_info *csrow = csrows[i];
  718. n = 0;
  719. for (j = 0; j < csrow->nr_channels; j++) {
  720. struct dimm_info *dimm = csrow->channels[j]->dimm;
  721. n += dimm->nr_pages;
  722. }
  723. if (n == 0)
  724. continue;
  725. edac_dbg(3, "MC%d: first(0x%lx) page(0x%lx) last(0x%lx) mask(0x%lx)\n",
  726. mci->mc_idx,
  727. csrow->first_page, page, csrow->last_page,
  728. csrow->page_mask);
  729. if ((page >= csrow->first_page) &&
  730. (page <= csrow->last_page) &&
  731. ((page & csrow->page_mask) ==
  732. (csrow->first_page & csrow->page_mask))) {
  733. row = i;
  734. break;
  735. }
  736. }
  737. if (row == -1)
  738. edac_mc_printk(mci, KERN_ERR,
  739. "could not look up page error address %lx\n",
  740. (unsigned long)page);
  741. return row;
  742. }
  743. EXPORT_SYMBOL_GPL(edac_mc_find_csrow_by_page);
  744. const char *edac_layer_name[] = {
  745. [EDAC_MC_LAYER_BRANCH] = "branch",
  746. [EDAC_MC_LAYER_CHANNEL] = "channel",
  747. [EDAC_MC_LAYER_SLOT] = "slot",
  748. [EDAC_MC_LAYER_CHIP_SELECT] = "csrow",
  749. [EDAC_MC_LAYER_ALL_MEM] = "memory",
  750. };
  751. EXPORT_SYMBOL_GPL(edac_layer_name);
  752. static void edac_inc_ce_error(struct mem_ctl_info *mci,
  753. bool enable_per_layer_report,
  754. const int pos[EDAC_MAX_LAYERS],
  755. const u16 count)
  756. {
  757. int i, index = 0;
  758. mci->ce_mc += count;
  759. if (!enable_per_layer_report) {
  760. mci->ce_noinfo_count += count;
  761. return;
  762. }
  763. for (i = 0; i < mci->n_layers; i++) {
  764. if (pos[i] < 0)
  765. break;
  766. index += pos[i];
  767. mci->ce_per_layer[i][index] += count;
  768. if (i < mci->n_layers - 1)
  769. index *= mci->layers[i + 1].size;
  770. }
  771. }
  772. static void edac_inc_ue_error(struct mem_ctl_info *mci,
  773. bool enable_per_layer_report,
  774. const int pos[EDAC_MAX_LAYERS],
  775. const u16 count)
  776. {
  777. int i, index = 0;
  778. mci->ue_mc += count;
  779. if (!enable_per_layer_report) {
  780. mci->ue_noinfo_count += count;
  781. return;
  782. }
  783. for (i = 0; i < mci->n_layers; i++) {
  784. if (pos[i] < 0)
  785. break;
  786. index += pos[i];
  787. mci->ue_per_layer[i][index] += count;
  788. if (i < mci->n_layers - 1)
  789. index *= mci->layers[i + 1].size;
  790. }
  791. }
  792. static void edac_ce_error(struct mem_ctl_info *mci,
  793. const u16 error_count,
  794. const int pos[EDAC_MAX_LAYERS],
  795. const char *msg,
  796. const char *location,
  797. const char *label,
  798. const char *detail,
  799. const char *other_detail,
  800. const bool enable_per_layer_report,
  801. const unsigned long page_frame_number,
  802. const unsigned long offset_in_page,
  803. long grain)
  804. {
  805. unsigned long remapped_page;
  806. char *msg_aux = "";
  807. if (*msg)
  808. msg_aux = " ";
  809. if (edac_mc_get_log_ce()) {
  810. if (other_detail && *other_detail)
  811. edac_mc_printk(mci, KERN_WARNING,
  812. "%d CE %s%son %s (%s %s - %s)\n",
  813. error_count, msg, msg_aux, label,
  814. location, detail, other_detail);
  815. else
  816. edac_mc_printk(mci, KERN_WARNING,
  817. "%d CE %s%son %s (%s %s)\n",
  818. error_count, msg, msg_aux, label,
  819. location, detail);
  820. }
  821. edac_inc_ce_error(mci, enable_per_layer_report, pos, error_count);
  822. if (mci->scrub_mode == SCRUB_SW_SRC) {
  823. /*
  824. * Some memory controllers (called MCs below) can remap
  825. * memory so that it is still available at a different
  826. * address when PCI devices map into memory.
  827. * MC's that can't do this, lose the memory where PCI
  828. * devices are mapped. This mapping is MC-dependent
  829. * and so we call back into the MC driver for it to
  830. * map the MC page to a physical (CPU) page which can
  831. * then be mapped to a virtual page - which can then
  832. * be scrubbed.
  833. */
  834. remapped_page = mci->ctl_page_to_phys ?
  835. mci->ctl_page_to_phys(mci, page_frame_number) :
  836. page_frame_number;
  837. edac_mc_scrub_block(remapped_page,
  838. offset_in_page, grain);
  839. }
  840. }
  841. static void edac_ue_error(struct mem_ctl_info *mci,
  842. const u16 error_count,
  843. const int pos[EDAC_MAX_LAYERS],
  844. const char *msg,
  845. const char *location,
  846. const char *label,
  847. const char *detail,
  848. const char *other_detail,
  849. const bool enable_per_layer_report)
  850. {
  851. char *msg_aux = "";
  852. if (*msg)
  853. msg_aux = " ";
  854. if (edac_mc_get_log_ue()) {
  855. if (other_detail && *other_detail)
  856. edac_mc_printk(mci, KERN_WARNING,
  857. "%d UE %s%son %s (%s %s - %s)\n",
  858. error_count, msg, msg_aux, label,
  859. location, detail, other_detail);
  860. else
  861. edac_mc_printk(mci, KERN_WARNING,
  862. "%d UE %s%son %s (%s %s)\n",
  863. error_count, msg, msg_aux, label,
  864. location, detail);
  865. }
  866. if (edac_mc_get_panic_on_ue()) {
  867. if (other_detail && *other_detail)
  868. panic("UE %s%son %s (%s%s - %s)\n",
  869. msg, msg_aux, label, location, detail, other_detail);
  870. else
  871. panic("UE %s%son %s (%s%s)\n",
  872. msg, msg_aux, label, location, detail);
  873. }
  874. edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count);
  875. }
  876. /**
  877. * edac_raw_mc_handle_error - reports a memory event to userspace without doing
  878. * anything to discover the error location
  879. *
  880. * @type: severity of the error (CE/UE/Fatal)
  881. * @mci: a struct mem_ctl_info pointer
  882. * @e: error description
  883. *
  884. * This raw function is used internally by edac_mc_handle_error(). It should
  885. * only be called directly when the hardware error come directly from BIOS,
  886. * like in the case of APEI GHES driver.
  887. */
  888. void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type,
  889. struct mem_ctl_info *mci,
  890. struct edac_raw_error_desc *e)
  891. {
  892. char detail[80];
  893. int pos[EDAC_MAX_LAYERS] = { e->top_layer, e->mid_layer, e->low_layer };
  894. /* Memory type dependent details about the error */
  895. if (type == HW_EVENT_ERR_CORRECTED) {
  896. snprintf(detail, sizeof(detail),
  897. "page:0x%lx offset:0x%lx grain:%ld syndrome:0x%lx",
  898. e->page_frame_number, e->offset_in_page,
  899. e->grain, e->syndrome);
  900. edac_ce_error(mci, e->error_count, pos, e->msg, e->location, e->label,
  901. detail, e->other_detail, e->enable_per_layer_report,
  902. e->page_frame_number, e->offset_in_page, e->grain);
  903. } else {
  904. snprintf(detail, sizeof(detail),
  905. "page:0x%lx offset:0x%lx grain:%ld",
  906. e->page_frame_number, e->offset_in_page, e->grain);
  907. edac_ue_error(mci, e->error_count, pos, e->msg, e->location, e->label,
  908. detail, e->other_detail, e->enable_per_layer_report);
  909. }
  910. }
  911. EXPORT_SYMBOL_GPL(edac_raw_mc_handle_error);
  912. /**
  913. * edac_mc_handle_error - reports a memory event to userspace
  914. *
  915. * @type: severity of the error (CE/UE/Fatal)
  916. * @mci: a struct mem_ctl_info pointer
  917. * @error_count: Number of errors of the same type
  918. * @page_frame_number: mem page where the error occurred
  919. * @offset_in_page: offset of the error inside the page
  920. * @syndrome: ECC syndrome
  921. * @top_layer: Memory layer[0] position
  922. * @mid_layer: Memory layer[1] position
  923. * @low_layer: Memory layer[2] position
  924. * @msg: Message meaningful to the end users that
  925. * explains the event
  926. * @other_detail: Technical details about the event that
  927. * may help hardware manufacturers and
  928. * EDAC developers to analyse the event
  929. */
  930. void edac_mc_handle_error(const enum hw_event_mc_err_type type,
  931. struct mem_ctl_info *mci,
  932. const u16 error_count,
  933. const unsigned long page_frame_number,
  934. const unsigned long offset_in_page,
  935. const unsigned long syndrome,
  936. const int top_layer,
  937. const int mid_layer,
  938. const int low_layer,
  939. const char *msg,
  940. const char *other_detail)
  941. {
  942. char *p;
  943. int row = -1, chan = -1;
  944. int pos[EDAC_MAX_LAYERS] = { top_layer, mid_layer, low_layer };
  945. int i, n_labels = 0;
  946. u8 grain_bits;
  947. struct edac_raw_error_desc *e = &mci->error_desc;
  948. edac_dbg(3, "MC%d\n", mci->mc_idx);
  949. /* Fills the error report buffer */
  950. memset(e, 0, sizeof (*e));
  951. e->error_count = error_count;
  952. e->top_layer = top_layer;
  953. e->mid_layer = mid_layer;
  954. e->low_layer = low_layer;
  955. e->page_frame_number = page_frame_number;
  956. e->offset_in_page = offset_in_page;
  957. e->syndrome = syndrome;
  958. e->msg = msg;
  959. e->other_detail = other_detail;
  960. /*
  961. * Check if the event report is consistent and if the memory
  962. * location is known. If it is known, enable_per_layer_report will be
  963. * true, the DIMM(s) label info will be filled and the per-layer
  964. * error counters will be incremented.
  965. */
  966. for (i = 0; i < mci->n_layers; i++) {
  967. if (pos[i] >= (int)mci->layers[i].size) {
  968. edac_mc_printk(mci, KERN_ERR,
  969. "INTERNAL ERROR: %s value is out of range (%d >= %d)\n",
  970. edac_layer_name[mci->layers[i].type],
  971. pos[i], mci->layers[i].size);
  972. /*
  973. * Instead of just returning it, let's use what's
  974. * known about the error. The increment routines and
  975. * the DIMM filter logic will do the right thing by
  976. * pointing the likely damaged DIMMs.
  977. */
  978. pos[i] = -1;
  979. }
  980. if (pos[i] >= 0)
  981. e->enable_per_layer_report = true;
  982. }
  983. /*
  984. * Get the dimm label/grain that applies to the match criteria.
  985. * As the error algorithm may not be able to point to just one memory
  986. * stick, the logic here will get all possible labels that could
  987. * pottentially be affected by the error.
  988. * On FB-DIMM memory controllers, for uncorrected errors, it is common
  989. * to have only the MC channel and the MC dimm (also called "branch")
  990. * but the channel is not known, as the memory is arranged in pairs,
  991. * where each memory belongs to a separate channel within the same
  992. * branch.
  993. */
  994. p = e->label;
  995. *p = '\0';
  996. for (i = 0; i < mci->tot_dimms; i++) {
  997. struct dimm_info *dimm = mci->dimms[i];
  998. if (top_layer >= 0 && top_layer != dimm->location[0])
  999. continue;
  1000. if (mid_layer >= 0 && mid_layer != dimm->location[1])
  1001. continue;
  1002. if (low_layer >= 0 && low_layer != dimm->location[2])
  1003. continue;
  1004. /* get the max grain, over the error match range */
  1005. if (dimm->grain > e->grain)
  1006. e->grain = dimm->grain;
  1007. /*
  1008. * If the error is memory-controller wide, there's no need to
  1009. * seek for the affected DIMMs because the whole
  1010. * channel/memory controller/... may be affected.
  1011. * Also, don't show errors for empty DIMM slots.
  1012. */
  1013. if (e->enable_per_layer_report && dimm->nr_pages) {
  1014. if (n_labels >= EDAC_MAX_LABELS) {
  1015. e->enable_per_layer_report = false;
  1016. break;
  1017. }
  1018. n_labels++;
  1019. if (p != e->label) {
  1020. strcpy(p, OTHER_LABEL);
  1021. p += strlen(OTHER_LABEL);
  1022. }
  1023. strcpy(p, dimm->label);
  1024. p += strlen(p);
  1025. *p = '\0';
  1026. /*
  1027. * get csrow/channel of the DIMM, in order to allow
  1028. * incrementing the compat API counters
  1029. */
  1030. edac_dbg(4, "%s csrows map: (%d,%d)\n",
  1031. mci->csbased ? "rank" : "dimm",
  1032. dimm->csrow, dimm->cschannel);
  1033. if (row == -1)
  1034. row = dimm->csrow;
  1035. else if (row >= 0 && row != dimm->csrow)
  1036. row = -2;
  1037. if (chan == -1)
  1038. chan = dimm->cschannel;
  1039. else if (chan >= 0 && chan != dimm->cschannel)
  1040. chan = -2;
  1041. }
  1042. }
  1043. if (!e->enable_per_layer_report) {
  1044. strcpy(e->label, "any memory");
  1045. } else {
  1046. edac_dbg(4, "csrow/channel to increment: (%d,%d)\n", row, chan);
  1047. if (p == e->label)
  1048. strcpy(e->label, "unknown memory");
  1049. if (type == HW_EVENT_ERR_CORRECTED) {
  1050. if (row >= 0) {
  1051. mci->csrows[row]->ce_count += error_count;
  1052. if (chan >= 0)
  1053. mci->csrows[row]->channels[chan]->ce_count += error_count;
  1054. }
  1055. } else
  1056. if (row >= 0)
  1057. mci->csrows[row]->ue_count += error_count;
  1058. }
  1059. /* Fill the RAM location data */
  1060. p = e->location;
  1061. for (i = 0; i < mci->n_layers; i++) {
  1062. if (pos[i] < 0)
  1063. continue;
  1064. p += sprintf(p, "%s:%d ",
  1065. edac_layer_name[mci->layers[i].type],
  1066. pos[i]);
  1067. }
  1068. if (p > e->location)
  1069. *(p - 1) = '\0';
  1070. /* Report the error via the trace interface */
  1071. grain_bits = fls_long(e->grain) + 1;
  1072. trace_mc_event(type, e->msg, e->label, e->error_count,
  1073. mci->mc_idx, e->top_layer, e->mid_layer, e->low_layer,
  1074. (e->page_frame_number << PAGE_SHIFT) | e->offset_in_page,
  1075. grain_bits, e->syndrome, e->other_detail);
  1076. edac_raw_mc_handle_error(type, mci, e);
  1077. }
  1078. EXPORT_SYMBOL_GPL(edac_mc_handle_error);