imr.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. /**
  2. * imr.c
  3. *
  4. * Copyright(c) 2013 Intel Corporation.
  5. * Copyright(c) 2015 Bryan O'Donoghue <pure.logic@nexus-software.ie>
  6. *
  7. * IMR registers define an isolated region of memory that can
  8. * be masked to prohibit certain system agents from accessing memory.
  9. * When a device behind a masked port performs an access - snooped or
  10. * not, an IMR may optionally prevent that transaction from changing
  11. * the state of memory or from getting correct data in response to the
  12. * operation.
  13. *
  14. * Write data will be dropped and reads will return 0xFFFFFFFF, the
  15. * system will reset and system BIOS will print out an error message to
  16. * inform the user that an IMR has been violated.
  17. *
  18. * This code is based on the Linux MTRR code and reference code from
  19. * Intel's Quark BSP EFI, Linux and grub code.
  20. *
  21. * See quark-x1000-datasheet.pdf for register definitions.
  22. * http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/quark-x1000-datasheet.pdf
  23. */
  24. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  25. #include <asm-generic/sections.h>
  26. #include <asm/cpu_device_id.h>
  27. #include <asm/imr.h>
  28. #include <asm/iosf_mbi.h>
  29. #include <linux/debugfs.h>
  30. #include <linux/init.h>
  31. #include <linux/mm.h>
  32. #include <linux/module.h>
  33. #include <linux/types.h>
  34. struct imr_device {
  35. struct dentry *file;
  36. bool init;
  37. struct mutex lock;
  38. int max_imr;
  39. int reg_base;
  40. };
  41. static struct imr_device imr_dev;
  42. /*
  43. * IMR read/write mask control registers.
  44. * See quark-x1000-datasheet.pdf sections 12.7.4.5 and 12.7.4.6 for
  45. * bit definitions.
  46. *
  47. * addr_hi
  48. * 31 Lock bit
  49. * 30:24 Reserved
  50. * 23:2 1 KiB aligned lo address
  51. * 1:0 Reserved
  52. *
  53. * addr_hi
  54. * 31:24 Reserved
  55. * 23:2 1 KiB aligned hi address
  56. * 1:0 Reserved
  57. */
  58. #define IMR_LOCK BIT(31)
  59. struct imr_regs {
  60. u32 addr_lo;
  61. u32 addr_hi;
  62. u32 rmask;
  63. u32 wmask;
  64. };
  65. #define IMR_NUM_REGS (sizeof(struct imr_regs)/sizeof(u32))
  66. #define IMR_SHIFT 8
  67. #define imr_to_phys(x) ((x) << IMR_SHIFT)
  68. #define phys_to_imr(x) ((x) >> IMR_SHIFT)
  69. /**
  70. * imr_is_enabled - true if an IMR is enabled false otherwise.
  71. *
  72. * Determines if an IMR is enabled based on address range and read/write
  73. * mask. An IMR set with an address range set to zero and a read/write
  74. * access mask set to all is considered to be disabled. An IMR in any
  75. * other state - for example set to zero but without read/write access
  76. * all is considered to be enabled. This definition of disabled is how
  77. * firmware switches off an IMR and is maintained in kernel for
  78. * consistency.
  79. *
  80. * @imr: pointer to IMR descriptor.
  81. * @return: true if IMR enabled false if disabled.
  82. */
  83. static inline int imr_is_enabled(struct imr_regs *imr)
  84. {
  85. return !(imr->rmask == IMR_READ_ACCESS_ALL &&
  86. imr->wmask == IMR_WRITE_ACCESS_ALL &&
  87. imr_to_phys(imr->addr_lo) == 0 &&
  88. imr_to_phys(imr->addr_hi) == 0);
  89. }
  90. /**
  91. * imr_read - read an IMR at a given index.
  92. *
  93. * Requires caller to hold imr mutex.
  94. *
  95. * @idev: pointer to imr_device structure.
  96. * @imr_id: IMR entry to read.
  97. * @imr: IMR structure representing address and access masks.
  98. * @return: 0 on success or error code passed from mbi_iosf on failure.
  99. */
  100. static int imr_read(struct imr_device *idev, u32 imr_id, struct imr_regs *imr)
  101. {
  102. u32 reg = imr_id * IMR_NUM_REGS + idev->reg_base;
  103. int ret;
  104. ret = iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->addr_lo);
  105. if (ret)
  106. return ret;
  107. ret = iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->addr_hi);
  108. if (ret)
  109. return ret;
  110. ret = iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->rmask);
  111. if (ret)
  112. return ret;
  113. return iosf_mbi_read(QRK_MBI_UNIT_MM, MBI_REG_READ, reg++, &imr->wmask);
  114. }
  115. /**
  116. * imr_write - write an IMR at a given index.
  117. *
  118. * Requires caller to hold imr mutex.
  119. * Note lock bits need to be written independently of address bits.
  120. *
  121. * @idev: pointer to imr_device structure.
  122. * @imr_id: IMR entry to write.
  123. * @imr: IMR structure representing address and access masks.
  124. * @lock: indicates if the IMR lock bit should be applied.
  125. * @return: 0 on success or error code passed from mbi_iosf on failure.
  126. */
  127. static int imr_write(struct imr_device *idev, u32 imr_id,
  128. struct imr_regs *imr, bool lock)
  129. {
  130. unsigned long flags;
  131. u32 reg = imr_id * IMR_NUM_REGS + idev->reg_base;
  132. int ret;
  133. local_irq_save(flags);
  134. ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->addr_lo);
  135. if (ret)
  136. goto failed;
  137. ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->addr_hi);
  138. if (ret)
  139. goto failed;
  140. ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->rmask);
  141. if (ret)
  142. goto failed;
  143. ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE, reg++, imr->wmask);
  144. if (ret)
  145. goto failed;
  146. /* Lock bit must be set separately to addr_lo address bits. */
  147. if (lock) {
  148. imr->addr_lo |= IMR_LOCK;
  149. ret = iosf_mbi_write(QRK_MBI_UNIT_MM, MBI_REG_WRITE,
  150. reg - IMR_NUM_REGS, imr->addr_lo);
  151. if (ret)
  152. goto failed;
  153. }
  154. local_irq_restore(flags);
  155. return 0;
  156. failed:
  157. /*
  158. * If writing to the IOSF failed then we're in an unknown state,
  159. * likely a very bad state. An IMR in an invalid state will almost
  160. * certainly lead to a memory access violation.
  161. */
  162. local_irq_restore(flags);
  163. WARN(ret, "IOSF-MBI write fail range 0x%08x-0x%08x unreliable\n",
  164. imr_to_phys(imr->addr_lo), imr_to_phys(imr->addr_hi) + IMR_MASK);
  165. return ret;
  166. }
  167. /**
  168. * imr_dbgfs_state_show - print state of IMR registers.
  169. *
  170. * @s: pointer to seq_file for output.
  171. * @unused: unused parameter.
  172. * @return: 0 on success or error code passed from mbi_iosf on failure.
  173. */
  174. static int imr_dbgfs_state_show(struct seq_file *s, void *unused)
  175. {
  176. phys_addr_t base;
  177. phys_addr_t end;
  178. int i;
  179. struct imr_device *idev = s->private;
  180. struct imr_regs imr;
  181. size_t size;
  182. int ret = -ENODEV;
  183. mutex_lock(&idev->lock);
  184. for (i = 0; i < idev->max_imr; i++) {
  185. ret = imr_read(idev, i, &imr);
  186. if (ret)
  187. break;
  188. /*
  189. * Remember to add IMR_ALIGN bytes to size to indicate the
  190. * inherent IMR_ALIGN size bytes contained in the masked away
  191. * lower ten bits.
  192. */
  193. if (imr_is_enabled(&imr)) {
  194. base = imr_to_phys(imr.addr_lo);
  195. end = imr_to_phys(imr.addr_hi) + IMR_MASK;
  196. size = end - base + 1;
  197. } else {
  198. base = 0;
  199. end = 0;
  200. size = 0;
  201. }
  202. seq_printf(s, "imr%02i: base=%pa, end=%pa, size=0x%08zx "
  203. "rmask=0x%08x, wmask=0x%08x, %s, %s\n", i,
  204. &base, &end, size, imr.rmask, imr.wmask,
  205. imr_is_enabled(&imr) ? "enabled " : "disabled",
  206. imr.addr_lo & IMR_LOCK ? "locked" : "unlocked");
  207. }
  208. mutex_unlock(&idev->lock);
  209. return ret;
  210. }
  211. /**
  212. * imr_state_open - debugfs open callback.
  213. *
  214. * @inode: pointer to struct inode.
  215. * @file: pointer to struct file.
  216. * @return: result of single open.
  217. */
  218. static int imr_state_open(struct inode *inode, struct file *file)
  219. {
  220. return single_open(file, imr_dbgfs_state_show, inode->i_private);
  221. }
  222. static const struct file_operations imr_state_ops = {
  223. .open = imr_state_open,
  224. .read = seq_read,
  225. .llseek = seq_lseek,
  226. .release = single_release,
  227. };
  228. /**
  229. * imr_debugfs_register - register debugfs hooks.
  230. *
  231. * @idev: pointer to imr_device structure.
  232. * @return: 0 on success - errno on failure.
  233. */
  234. static int imr_debugfs_register(struct imr_device *idev)
  235. {
  236. idev->file = debugfs_create_file("imr_state", S_IFREG | S_IRUGO, NULL,
  237. idev, &imr_state_ops);
  238. return PTR_ERR_OR_ZERO(idev->file);
  239. }
  240. /**
  241. * imr_debugfs_unregister - unregister debugfs hooks.
  242. *
  243. * @idev: pointer to imr_device structure.
  244. * @return:
  245. */
  246. static void imr_debugfs_unregister(struct imr_device *idev)
  247. {
  248. debugfs_remove(idev->file);
  249. }
  250. /**
  251. * imr_check_params - check passed address range IMR alignment and non-zero size
  252. *
  253. * @base: base address of intended IMR.
  254. * @size: size of intended IMR.
  255. * @return: zero on valid range -EINVAL on unaligned base/size.
  256. */
  257. static int imr_check_params(phys_addr_t base, size_t size)
  258. {
  259. if ((base & IMR_MASK) || (size & IMR_MASK)) {
  260. pr_err("base %pa size 0x%08zx must align to 1KiB\n",
  261. &base, size);
  262. return -EINVAL;
  263. }
  264. if (size == 0)
  265. return -EINVAL;
  266. return 0;
  267. }
  268. /**
  269. * imr_raw_size - account for the IMR_ALIGN bytes that addr_hi appends.
  270. *
  271. * IMR addr_hi has a built in offset of plus IMR_ALIGN (0x400) bytes from the
  272. * value in the register. We need to subtract IMR_ALIGN bytes from input sizes
  273. * as a result.
  274. *
  275. * @size: input size bytes.
  276. * @return: reduced size.
  277. */
  278. static inline size_t imr_raw_size(size_t size)
  279. {
  280. return size - IMR_ALIGN;
  281. }
  282. /**
  283. * imr_address_overlap - detects an address overlap.
  284. *
  285. * @addr: address to check against an existing IMR.
  286. * @imr: imr being checked.
  287. * @return: true for overlap false for no overlap.
  288. */
  289. static inline int imr_address_overlap(phys_addr_t addr, struct imr_regs *imr)
  290. {
  291. return addr >= imr_to_phys(imr->addr_lo) && addr <= imr_to_phys(imr->addr_hi);
  292. }
  293. /**
  294. * imr_add_range - add an Isolated Memory Region.
  295. *
  296. * @base: physical base address of region aligned to 1KiB.
  297. * @size: physical size of region in bytes must be aligned to 1KiB.
  298. * @read_mask: read access mask.
  299. * @write_mask: write access mask.
  300. * @lock: indicates whether or not to permanently lock this region.
  301. * @return: zero on success or negative value indicating error.
  302. */
  303. int imr_add_range(phys_addr_t base, size_t size,
  304. unsigned int rmask, unsigned int wmask, bool lock)
  305. {
  306. phys_addr_t end;
  307. unsigned int i;
  308. struct imr_device *idev = &imr_dev;
  309. struct imr_regs imr;
  310. size_t raw_size;
  311. int reg;
  312. int ret;
  313. if (WARN_ONCE(idev->init == false, "driver not initialized"))
  314. return -ENODEV;
  315. ret = imr_check_params(base, size);
  316. if (ret)
  317. return ret;
  318. /* Tweak the size value. */
  319. raw_size = imr_raw_size(size);
  320. end = base + raw_size;
  321. /*
  322. * Check for reserved IMR value common to firmware, kernel and grub
  323. * indicating a disabled IMR.
  324. */
  325. imr.addr_lo = phys_to_imr(base);
  326. imr.addr_hi = phys_to_imr(end);
  327. imr.rmask = rmask;
  328. imr.wmask = wmask;
  329. if (!imr_is_enabled(&imr))
  330. return -ENOTSUPP;
  331. mutex_lock(&idev->lock);
  332. /*
  333. * Find a free IMR while checking for an existing overlapping range.
  334. * Note there's no restriction in silicon to prevent IMR overlaps.
  335. * For the sake of simplicity and ease in defining/debugging an IMR
  336. * memory map we exclude IMR overlaps.
  337. */
  338. reg = -1;
  339. for (i = 0; i < idev->max_imr; i++) {
  340. ret = imr_read(idev, i, &imr);
  341. if (ret)
  342. goto failed;
  343. /* Find overlap @ base or end of requested range. */
  344. ret = -EINVAL;
  345. if (imr_is_enabled(&imr)) {
  346. if (imr_address_overlap(base, &imr))
  347. goto failed;
  348. if (imr_address_overlap(end, &imr))
  349. goto failed;
  350. } else {
  351. reg = i;
  352. }
  353. }
  354. /* Error out if we have no free IMR entries. */
  355. if (reg == -1) {
  356. ret = -ENOMEM;
  357. goto failed;
  358. }
  359. pr_debug("add %d phys %pa-%pa size %zx mask 0x%08x wmask 0x%08x\n",
  360. reg, &base, &end, raw_size, rmask, wmask);
  361. /* Enable IMR at specified range and access mask. */
  362. imr.addr_lo = phys_to_imr(base);
  363. imr.addr_hi = phys_to_imr(end);
  364. imr.rmask = rmask;
  365. imr.wmask = wmask;
  366. ret = imr_write(idev, reg, &imr, lock);
  367. if (ret < 0) {
  368. /*
  369. * In the highly unlikely event iosf_mbi_write failed
  370. * attempt to rollback the IMR setup skipping the trapping
  371. * of further IOSF write failures.
  372. */
  373. imr.addr_lo = 0;
  374. imr.addr_hi = 0;
  375. imr.rmask = IMR_READ_ACCESS_ALL;
  376. imr.wmask = IMR_WRITE_ACCESS_ALL;
  377. imr_write(idev, reg, &imr, false);
  378. }
  379. failed:
  380. mutex_unlock(&idev->lock);
  381. return ret;
  382. }
  383. EXPORT_SYMBOL_GPL(imr_add_range);
  384. /**
  385. * __imr_remove_range - delete an Isolated Memory Region.
  386. *
  387. * This function allows you to delete an IMR by its index specified by reg or
  388. * by address range specified by base and size respectively. If you specify an
  389. * index on its own the base and size parameters are ignored.
  390. * imr_remove_range(0, base, size); delete IMR at index 0 base/size ignored.
  391. * imr_remove_range(-1, base, size); delete IMR from base to base+size.
  392. *
  393. * @reg: imr index to remove.
  394. * @base: physical base address of region aligned to 1 KiB.
  395. * @size: physical size of region in bytes aligned to 1 KiB.
  396. * @return: -EINVAL on invalid range or out or range id
  397. * -ENODEV if reg is valid but no IMR exists or is locked
  398. * 0 on success.
  399. */
  400. static int __imr_remove_range(int reg, phys_addr_t base, size_t size)
  401. {
  402. phys_addr_t end;
  403. bool found = false;
  404. unsigned int i;
  405. struct imr_device *idev = &imr_dev;
  406. struct imr_regs imr;
  407. size_t raw_size;
  408. int ret = 0;
  409. if (WARN_ONCE(idev->init == false, "driver not initialized"))
  410. return -ENODEV;
  411. /*
  412. * Validate address range if deleting by address, else we are
  413. * deleting by index where base and size will be ignored.
  414. */
  415. if (reg == -1) {
  416. ret = imr_check_params(base, size);
  417. if (ret)
  418. return ret;
  419. }
  420. /* Tweak the size value. */
  421. raw_size = imr_raw_size(size);
  422. end = base + raw_size;
  423. mutex_lock(&idev->lock);
  424. if (reg >= 0) {
  425. /* If a specific IMR is given try to use it. */
  426. ret = imr_read(idev, reg, &imr);
  427. if (ret)
  428. goto failed;
  429. if (!imr_is_enabled(&imr) || imr.addr_lo & IMR_LOCK) {
  430. ret = -ENODEV;
  431. goto failed;
  432. }
  433. found = true;
  434. } else {
  435. /* Search for match based on address range. */
  436. for (i = 0; i < idev->max_imr; i++) {
  437. ret = imr_read(idev, i, &imr);
  438. if (ret)
  439. goto failed;
  440. if (!imr_is_enabled(&imr) || imr.addr_lo & IMR_LOCK)
  441. continue;
  442. if ((imr_to_phys(imr.addr_lo) == base) &&
  443. (imr_to_phys(imr.addr_hi) == end)) {
  444. found = true;
  445. reg = i;
  446. break;
  447. }
  448. }
  449. }
  450. if (!found) {
  451. ret = -ENODEV;
  452. goto failed;
  453. }
  454. pr_debug("remove %d phys %pa-%pa size %zx\n", reg, &base, &end, raw_size);
  455. /* Tear down the IMR. */
  456. imr.addr_lo = 0;
  457. imr.addr_hi = 0;
  458. imr.rmask = IMR_READ_ACCESS_ALL;
  459. imr.wmask = IMR_WRITE_ACCESS_ALL;
  460. ret = imr_write(idev, reg, &imr, false);
  461. failed:
  462. mutex_unlock(&idev->lock);
  463. return ret;
  464. }
  465. /**
  466. * imr_remove_range - delete an Isolated Memory Region by address
  467. *
  468. * This function allows you to delete an IMR by an address range specified
  469. * by base and size respectively.
  470. * imr_remove_range(base, size); delete IMR from base to base+size.
  471. *
  472. * @base: physical base address of region aligned to 1 KiB.
  473. * @size: physical size of region in bytes aligned to 1 KiB.
  474. * @return: -EINVAL on invalid range or out or range id
  475. * -ENODEV if reg is valid but no IMR exists or is locked
  476. * 0 on success.
  477. */
  478. int imr_remove_range(phys_addr_t base, size_t size)
  479. {
  480. return __imr_remove_range(-1, base, size);
  481. }
  482. EXPORT_SYMBOL_GPL(imr_remove_range);
  483. /**
  484. * imr_clear - delete an Isolated Memory Region by index
  485. *
  486. * This function allows you to delete an IMR by an address range specified
  487. * by the index of the IMR. Useful for initial sanitization of the IMR
  488. * address map.
  489. * imr_ge(base, size); delete IMR from base to base+size.
  490. *
  491. * @reg: imr index to remove.
  492. * @return: -EINVAL on invalid range or out or range id
  493. * -ENODEV if reg is valid but no IMR exists or is locked
  494. * 0 on success.
  495. */
  496. static inline int imr_clear(int reg)
  497. {
  498. return __imr_remove_range(reg, 0, 0);
  499. }
  500. /**
  501. * imr_fixup_memmap - Tear down IMRs used during bootup.
  502. *
  503. * BIOS and Grub both setup IMRs around compressed kernel, initrd memory
  504. * that need to be removed before the kernel hands out one of the IMR
  505. * encased addresses to a downstream DMA agent such as the SD or Ethernet.
  506. * IMRs on Galileo are setup to immediately reset the system on violation.
  507. * As a result if you're running a root filesystem from SD - you'll need
  508. * the boot-time IMRs torn down or you'll find seemingly random resets when
  509. * using your filesystem.
  510. *
  511. * @idev: pointer to imr_device structure.
  512. * @return:
  513. */
  514. static void __init imr_fixup_memmap(struct imr_device *idev)
  515. {
  516. phys_addr_t base = virt_to_phys(&_text);
  517. size_t size = virt_to_phys(&__end_rodata) - base;
  518. unsigned long start, end;
  519. int i;
  520. int ret;
  521. /* Tear down all existing unlocked IMRs. */
  522. for (i = 0; i < idev->max_imr; i++)
  523. imr_clear(i);
  524. start = (unsigned long)_text;
  525. end = (unsigned long)__end_rodata - 1;
  526. /*
  527. * Setup a locked IMR around the physical extent of the kernel
  528. * from the beginning of the .text secton to the end of the
  529. * .rodata section as one physically contiguous block.
  530. *
  531. * We don't round up @size since it is already PAGE_SIZE aligned.
  532. * See vmlinux.lds.S for details.
  533. */
  534. ret = imr_add_range(base, size, IMR_CPU, IMR_CPU, true);
  535. if (ret < 0) {
  536. pr_err("unable to setup IMR for kernel: %zu KiB (%lx - %lx)\n",
  537. size / 1024, start, end);
  538. } else {
  539. pr_info("protecting kernel .text - .rodata: %zu KiB (%lx - %lx)\n",
  540. size / 1024, start, end);
  541. }
  542. }
  543. static const struct x86_cpu_id imr_ids[] __initconst = {
  544. { X86_VENDOR_INTEL, 5, 9 }, /* Intel Quark SoC X1000. */
  545. {}
  546. };
  547. MODULE_DEVICE_TABLE(x86cpu, imr_ids);
  548. /**
  549. * imr_init - entry point for IMR driver.
  550. *
  551. * return: -ENODEV for no IMR support 0 if good to go.
  552. */
  553. static int __init imr_init(void)
  554. {
  555. struct imr_device *idev = &imr_dev;
  556. int ret;
  557. if (!x86_match_cpu(imr_ids) || !iosf_mbi_available())
  558. return -ENODEV;
  559. idev->max_imr = QUARK_X1000_IMR_MAX;
  560. idev->reg_base = QUARK_X1000_IMR_REGBASE;
  561. idev->init = true;
  562. mutex_init(&idev->lock);
  563. ret = imr_debugfs_register(idev);
  564. if (ret != 0)
  565. pr_warn("debugfs register failed!\n");
  566. imr_fixup_memmap(idev);
  567. return 0;
  568. }
  569. /**
  570. * imr_exit - exit point for IMR code.
  571. *
  572. * Deregisters debugfs, leave IMR state as-is.
  573. *
  574. * return:
  575. */
  576. static void __exit imr_exit(void)
  577. {
  578. imr_debugfs_unregister(&imr_dev);
  579. }
  580. module_init(imr_init);
  581. module_exit(imr_exit);
  582. MODULE_AUTHOR("Bryan O'Donoghue <pure.logic@nexus-software.ie>");
  583. MODULE_DESCRIPTION("Intel Isolated Memory Region driver");
  584. MODULE_LICENSE("Dual BSD/GPL");