iommu.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. /*
  2. * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
  3. *
  4. * Rewrite, cleanup:
  5. *
  6. * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
  7. * Copyright (C) 2006 Olof Johansson <olof@lixom.net>
  8. *
  9. * Dynamic DMA mapping support, pSeries-specific parts, both SMP and LPAR.
  10. *
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. */
  26. #include <linux/init.h>
  27. #include <linux/types.h>
  28. #include <linux/slab.h>
  29. #include <linux/mm.h>
  30. #include <linux/spinlock.h>
  31. #include <linux/string.h>
  32. #include <linux/pci.h>
  33. #include <linux/dma-mapping.h>
  34. #include <asm/io.h>
  35. #include <asm/prom.h>
  36. #include <asm/rtas.h>
  37. #include <asm/iommu.h>
  38. #include <asm/pci-bridge.h>
  39. #include <asm/machdep.h>
  40. #include <asm/abs_addr.h>
  41. #include <asm/pSeries_reconfig.h>
  42. #include <asm/firmware.h>
  43. #include <asm/tce.h>
  44. #include <asm/ppc-pci.h>
  45. #include <asm/udbg.h>
  46. #include "plpar_wrappers.h"
  47. #define DBG(fmt...)
  48. static void tce_build_pSeries(struct iommu_table *tbl, long index,
  49. long npages, unsigned long uaddr,
  50. enum dma_data_direction direction)
  51. {
  52. u64 proto_tce;
  53. u64 *tcep;
  54. u64 rpn;
  55. proto_tce = TCE_PCI_READ; // Read allowed
  56. if (direction != DMA_TO_DEVICE)
  57. proto_tce |= TCE_PCI_WRITE;
  58. tcep = ((u64 *)tbl->it_base) + index;
  59. while (npages--) {
  60. /* can't move this out since we might cross LMB boundary */
  61. rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
  62. *tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
  63. uaddr += TCE_PAGE_SIZE;
  64. tcep++;
  65. }
  66. }
  67. static void tce_free_pSeries(struct iommu_table *tbl, long index, long npages)
  68. {
  69. u64 *tcep;
  70. tcep = ((u64 *)tbl->it_base) + index;
  71. while (npages--)
  72. *(tcep++) = 0;
  73. }
  74. static unsigned long tce_get_pseries(struct iommu_table *tbl, long index)
  75. {
  76. u64 *tcep;
  77. tcep = ((u64 *)tbl->it_base) + index;
  78. return *tcep;
  79. }
  80. static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
  81. long npages, unsigned long uaddr,
  82. enum dma_data_direction direction)
  83. {
  84. u64 rc;
  85. u64 proto_tce, tce;
  86. u64 rpn;
  87. rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
  88. proto_tce = TCE_PCI_READ;
  89. if (direction != DMA_TO_DEVICE)
  90. proto_tce |= TCE_PCI_WRITE;
  91. while (npages--) {
  92. tce = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
  93. rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, tce);
  94. if (rc && printk_ratelimit()) {
  95. printk("tce_build_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
  96. printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
  97. printk("\ttcenum = 0x%lx\n", (u64)tcenum);
  98. printk("\ttce val = 0x%lx\n", tce );
  99. show_stack(current, (unsigned long *)__get_SP());
  100. }
  101. tcenum++;
  102. rpn++;
  103. }
  104. }
  105. static DEFINE_PER_CPU(u64 *, tce_page) = NULL;
  106. static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
  107. long npages, unsigned long uaddr,
  108. enum dma_data_direction direction)
  109. {
  110. u64 rc;
  111. u64 proto_tce;
  112. u64 *tcep;
  113. u64 rpn;
  114. long l, limit;
  115. if (npages == 1)
  116. return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
  117. direction);
  118. tcep = __get_cpu_var(tce_page);
  119. /* This is safe to do since interrupts are off when we're called
  120. * from iommu_alloc{,_sg}()
  121. */
  122. if (!tcep) {
  123. tcep = (u64 *)__get_free_page(GFP_ATOMIC);
  124. /* If allocation fails, fall back to the loop implementation */
  125. if (!tcep)
  126. return tce_build_pSeriesLP(tbl, tcenum, npages,
  127. uaddr, direction);
  128. __get_cpu_var(tce_page) = tcep;
  129. }
  130. rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
  131. proto_tce = TCE_PCI_READ;
  132. if (direction != DMA_TO_DEVICE)
  133. proto_tce |= TCE_PCI_WRITE;
  134. /* We can map max one pageful of TCEs at a time */
  135. do {
  136. /*
  137. * Set up the page with TCE data, looping through and setting
  138. * the values.
  139. */
  140. limit = min_t(long, npages, 4096/TCE_ENTRY_SIZE);
  141. for (l = 0; l < limit; l++) {
  142. tcep[l] = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
  143. rpn++;
  144. }
  145. rc = plpar_tce_put_indirect((u64)tbl->it_index,
  146. (u64)tcenum << 12,
  147. (u64)virt_to_abs(tcep),
  148. limit);
  149. npages -= limit;
  150. tcenum += limit;
  151. } while (npages > 0 && !rc);
  152. if (rc && printk_ratelimit()) {
  153. printk("tce_buildmulti_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
  154. printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
  155. printk("\tnpages = 0x%lx\n", (u64)npages);
  156. printk("\ttce[0] val = 0x%lx\n", tcep[0]);
  157. show_stack(current, (unsigned long *)__get_SP());
  158. }
  159. }
  160. static void tce_free_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
  161. {
  162. u64 rc;
  163. while (npages--) {
  164. rc = plpar_tce_put((u64)tbl->it_index, (u64)tcenum << 12, 0);
  165. if (rc && printk_ratelimit()) {
  166. printk("tce_free_pSeriesLP: plpar_tce_put failed. rc=%ld\n", rc);
  167. printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
  168. printk("\ttcenum = 0x%lx\n", (u64)tcenum);
  169. show_stack(current, (unsigned long *)__get_SP());
  170. }
  171. tcenum++;
  172. }
  173. }
  174. static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
  175. {
  176. u64 rc;
  177. rc = plpar_tce_stuff((u64)tbl->it_index, (u64)tcenum << 12, 0, npages);
  178. if (rc && printk_ratelimit()) {
  179. printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");
  180. printk("\trc = %ld\n", rc);
  181. printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
  182. printk("\tnpages = 0x%lx\n", (u64)npages);
  183. show_stack(current, (unsigned long *)__get_SP());
  184. }
  185. }
  186. static unsigned long tce_get_pSeriesLP(struct iommu_table *tbl, long tcenum)
  187. {
  188. u64 rc;
  189. unsigned long tce_ret;
  190. rc = plpar_tce_get((u64)tbl->it_index, (u64)tcenum << 12, &tce_ret);
  191. if (rc && printk_ratelimit()) {
  192. printk("tce_get_pSeriesLP: plpar_tce_get failed. rc=%ld\n",
  193. rc);
  194. printk("\tindex = 0x%lx\n", (u64)tbl->it_index);
  195. printk("\ttcenum = 0x%lx\n", (u64)tcenum);
  196. show_stack(current, (unsigned long *)__get_SP());
  197. }
  198. return tce_ret;
  199. }
  200. #ifdef CONFIG_PCI
  201. static void iommu_table_setparms(struct pci_controller *phb,
  202. struct device_node *dn,
  203. struct iommu_table *tbl)
  204. {
  205. struct device_node *node;
  206. const unsigned long *basep;
  207. const u32 *sizep;
  208. node = (struct device_node *)phb->arch_data;
  209. basep = of_get_property(node, "linux,tce-base", NULL);
  210. sizep = of_get_property(node, "linux,tce-size", NULL);
  211. if (basep == NULL || sizep == NULL) {
  212. printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has "
  213. "missing tce entries !\n", dn->full_name);
  214. return;
  215. }
  216. tbl->it_base = (unsigned long)__va(*basep);
  217. #ifndef CONFIG_CRASH_DUMP
  218. memset((void *)tbl->it_base, 0, *sizep);
  219. #endif
  220. tbl->it_busno = phb->bus->number;
  221. /* Units of tce entries */
  222. tbl->it_offset = phb->dma_window_base_cur >> IOMMU_PAGE_SHIFT;
  223. /* Test if we are going over 2GB of DMA space */
  224. if (phb->dma_window_base_cur + phb->dma_window_size > 0x80000000ul) {
  225. udbg_printf("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
  226. panic("PCI_DMA: Unexpected number of IOAs under this PHB.\n");
  227. }
  228. phb->dma_window_base_cur += phb->dma_window_size;
  229. /* Set the tce table size - measured in entries */
  230. tbl->it_size = phb->dma_window_size >> IOMMU_PAGE_SHIFT;
  231. tbl->it_index = 0;
  232. tbl->it_blocksize = 16;
  233. tbl->it_type = TCE_PCI;
  234. }
  235. /*
  236. * iommu_table_setparms_lpar
  237. *
  238. * Function: On pSeries LPAR systems, return TCE table info, given a pci bus.
  239. */
  240. static void iommu_table_setparms_lpar(struct pci_controller *phb,
  241. struct device_node *dn,
  242. struct iommu_table *tbl,
  243. const void *dma_window)
  244. {
  245. unsigned long offset, size;
  246. tbl->it_busno = PCI_DN(dn)->bussubno;
  247. of_parse_dma_window(dn, dma_window, &tbl->it_index, &offset, &size);
  248. tbl->it_base = 0;
  249. tbl->it_blocksize = 16;
  250. tbl->it_type = TCE_PCI;
  251. tbl->it_offset = offset >> IOMMU_PAGE_SHIFT;
  252. tbl->it_size = size >> IOMMU_PAGE_SHIFT;
  253. }
  254. static void pci_dma_bus_setup_pSeries(struct pci_bus *bus)
  255. {
  256. struct device_node *dn;
  257. struct iommu_table *tbl;
  258. struct device_node *isa_dn, *isa_dn_orig;
  259. struct device_node *tmp;
  260. struct pci_dn *pci;
  261. int children;
  262. dn = pci_bus_to_OF_node(bus);
  263. DBG("pci_dma_bus_setup_pSeries: setting up bus %s\n", dn->full_name);
  264. if (bus->self) {
  265. /* This is not a root bus, any setup will be done for the
  266. * device-side of the bridge in iommu_dev_setup_pSeries().
  267. */
  268. return;
  269. }
  270. pci = PCI_DN(dn);
  271. /* Check if the ISA bus on the system is under
  272. * this PHB.
  273. */
  274. isa_dn = isa_dn_orig = of_find_node_by_type(NULL, "isa");
  275. while (isa_dn && isa_dn != dn)
  276. isa_dn = isa_dn->parent;
  277. if (isa_dn_orig)
  278. of_node_put(isa_dn_orig);
  279. /* Count number of direct PCI children of the PHB. */
  280. for (children = 0, tmp = dn->child; tmp; tmp = tmp->sibling)
  281. children++;
  282. DBG("Children: %d\n", children);
  283. /* Calculate amount of DMA window per slot. Each window must be
  284. * a power of two (due to pci_alloc_consistent requirements).
  285. *
  286. * Keep 256MB aside for PHBs with ISA.
  287. */
  288. if (!isa_dn) {
  289. /* No ISA/IDE - just set window size and return */
  290. pci->phb->dma_window_size = 0x80000000ul; /* To be divided */
  291. while (pci->phb->dma_window_size * children > 0x80000000ul)
  292. pci->phb->dma_window_size >>= 1;
  293. DBG("No ISA/IDE, window size is 0x%lx\n",
  294. pci->phb->dma_window_size);
  295. pci->phb->dma_window_base_cur = 0;
  296. return;
  297. }
  298. /* If we have ISA, then we probably have an IDE
  299. * controller too. Allocate a 128MB table but
  300. * skip the first 128MB to avoid stepping on ISA
  301. * space.
  302. */
  303. pci->phb->dma_window_size = 0x8000000ul;
  304. pci->phb->dma_window_base_cur = 0x8000000ul;
  305. tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
  306. pci->phb->node);
  307. iommu_table_setparms(pci->phb, dn, tbl);
  308. pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
  309. /* Divide the rest (1.75GB) among the children */
  310. pci->phb->dma_window_size = 0x80000000ul;
  311. while (pci->phb->dma_window_size * children > 0x70000000ul)
  312. pci->phb->dma_window_size >>= 1;
  313. DBG("ISA/IDE, window size is 0x%lx\n", pci->phb->dma_window_size);
  314. }
  315. static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus)
  316. {
  317. struct iommu_table *tbl;
  318. struct device_node *dn, *pdn;
  319. struct pci_dn *ppci;
  320. const void *dma_window = NULL;
  321. dn = pci_bus_to_OF_node(bus);
  322. DBG("pci_dma_bus_setup_pSeriesLP: setting up bus %s\n", dn->full_name);
  323. /* Find nearest ibm,dma-window, walking up the device tree */
  324. for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
  325. dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
  326. if (dma_window != NULL)
  327. break;
  328. }
  329. if (dma_window == NULL) {
  330. DBG(" no ibm,dma-window property !\n");
  331. return;
  332. }
  333. ppci = PCI_DN(pdn);
  334. DBG(" parent is %s, iommu_table: 0x%p\n",
  335. pdn->full_name, ppci->iommu_table);
  336. if (!ppci->iommu_table) {
  337. /* Bussubno hasn't been copied yet.
  338. * Do it now because iommu_table_setparms_lpar needs it.
  339. */
  340. ppci->bussubno = bus->number;
  341. tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
  342. ppci->phb->node);
  343. iommu_table_setparms_lpar(ppci->phb, pdn, tbl, dma_window);
  344. ppci->iommu_table = iommu_init_table(tbl, ppci->phb->node);
  345. DBG(" created table: %p\n", ppci->iommu_table);
  346. }
  347. if (pdn != dn)
  348. PCI_DN(dn)->iommu_table = ppci->iommu_table;
  349. }
  350. static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
  351. {
  352. struct device_node *dn;
  353. struct iommu_table *tbl;
  354. DBG("pci_dma_dev_setup_pSeries: %s\n", pci_name(dev));
  355. dn = dev->dev.archdata.of_node;
  356. /* If we're the direct child of a root bus, then we need to allocate
  357. * an iommu table ourselves. The bus setup code should have setup
  358. * the window sizes already.
  359. */
  360. if (!dev->bus->self) {
  361. struct pci_controller *phb = PCI_DN(dn)->phb;
  362. DBG(" --> first child, no bridge. Allocating iommu table.\n");
  363. tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
  364. phb->node);
  365. iommu_table_setparms(phb, dn, tbl);
  366. PCI_DN(dn)->iommu_table = iommu_init_table(tbl, phb->node);
  367. dev->dev.archdata.dma_data = PCI_DN(dn)->iommu_table;
  368. return;
  369. }
  370. /* If this device is further down the bus tree, search upwards until
  371. * an already allocated iommu table is found and use that.
  372. */
  373. while (dn && PCI_DN(dn) && PCI_DN(dn)->iommu_table == NULL)
  374. dn = dn->parent;
  375. if (dn && PCI_DN(dn))
  376. dev->dev.archdata.dma_data = PCI_DN(dn)->iommu_table;
  377. else
  378. printk(KERN_WARNING "iommu: Device %s has no iommu table\n",
  379. pci_name(dev));
  380. }
  381. static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
  382. {
  383. struct device_node *pdn, *dn;
  384. struct iommu_table *tbl;
  385. const void *dma_window = NULL;
  386. struct pci_dn *pci;
  387. DBG("pci_dma_dev_setup_pSeriesLP: %s\n", pci_name(dev));
  388. /* dev setup for LPAR is a little tricky, since the device tree might
  389. * contain the dma-window properties per-device and not neccesarily
  390. * for the bus. So we need to search upwards in the tree until we
  391. * either hit a dma-window property, OR find a parent with a table
  392. * already allocated.
  393. */
  394. dn = pci_device_to_OF_node(dev);
  395. DBG(" node is %s\n", dn->full_name);
  396. for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
  397. pdn = pdn->parent) {
  398. dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
  399. if (dma_window)
  400. break;
  401. }
  402. if (!pdn || !PCI_DN(pdn)) {
  403. printk(KERN_WARNING "pci_dma_dev_setup_pSeriesLP: "
  404. "no DMA window found for pci dev=%s dn=%s\n",
  405. pci_name(dev), dn? dn->full_name : "<null>");
  406. return;
  407. }
  408. DBG(" parent is %s\n", pdn->full_name);
  409. /* Check for parent == NULL so we don't try to setup the empty EADS
  410. * slots on POWER4 machines.
  411. */
  412. if (dma_window == NULL || pdn->parent == NULL) {
  413. DBG(" no dma window for device, linking to parent\n");
  414. dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table;
  415. return;
  416. }
  417. pci = PCI_DN(pdn);
  418. if (!pci->iommu_table) {
  419. /* iommu_table_setparms_lpar needs bussubno. */
  420. pci->bussubno = pci->phb->bus->number;
  421. tbl = kmalloc_node(sizeof(struct iommu_table), GFP_KERNEL,
  422. pci->phb->node);
  423. iommu_table_setparms_lpar(pci->phb, pdn, tbl, dma_window);
  424. pci->iommu_table = iommu_init_table(tbl, pci->phb->node);
  425. DBG(" created table: %p\n", pci->iommu_table);
  426. } else {
  427. DBG(" found DMA window, table: %p\n", pci->iommu_table);
  428. }
  429. dev->dev.archdata.dma_data = pci->iommu_table;
  430. }
  431. #else /* CONFIG_PCI */
  432. #define pci_dma_bus_setup_pSeries NULL
  433. #define pci_dma_dev_setup_pSeries NULL
  434. #define pci_dma_bus_setup_pSeriesLP NULL
  435. #define pci_dma_dev_setup_pSeriesLP NULL
  436. #endif /* !CONFIG_PCI */
  437. static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
  438. {
  439. int err = NOTIFY_OK;
  440. struct device_node *np = node;
  441. struct pci_dn *pci = PCI_DN(np);
  442. switch (action) {
  443. case PSERIES_RECONFIG_REMOVE:
  444. if (pci && pci->iommu_table &&
  445. of_get_property(np, "ibm,dma-window", NULL))
  446. iommu_free_table(np);
  447. break;
  448. default:
  449. err = NOTIFY_DONE;
  450. break;
  451. }
  452. return err;
  453. }
  454. static struct notifier_block iommu_reconfig_nb = {
  455. .notifier_call = iommu_reconfig_notifier,
  456. };
  457. /* These are called very early. */
  458. void iommu_init_early_pSeries(void)
  459. {
  460. if (of_chosen && of_get_property(of_chosen, "linux,iommu-off", NULL)) {
  461. /* Direct I/O, IOMMU off */
  462. ppc_md.pci_dma_dev_setup = NULL;
  463. ppc_md.pci_dma_bus_setup = NULL;
  464. set_pci_dma_ops(&dma_direct_ops);
  465. return;
  466. }
  467. if (firmware_has_feature(FW_FEATURE_LPAR)) {
  468. if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
  469. ppc_md.tce_build = tce_buildmulti_pSeriesLP;
  470. ppc_md.tce_free = tce_freemulti_pSeriesLP;
  471. } else {
  472. ppc_md.tce_build = tce_build_pSeriesLP;
  473. ppc_md.tce_free = tce_free_pSeriesLP;
  474. }
  475. ppc_md.tce_get = tce_get_pSeriesLP;
  476. ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pSeriesLP;
  477. ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pSeriesLP;
  478. } else {
  479. ppc_md.tce_build = tce_build_pSeries;
  480. ppc_md.tce_free = tce_free_pSeries;
  481. ppc_md.tce_get = tce_get_pseries;
  482. ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pSeries;
  483. ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_pSeries;
  484. }
  485. pSeries_reconfig_notifier_register(&iommu_reconfig_nb);
  486. set_pci_dma_ops(&dma_iommu_ops);
  487. }