summaryrefslogtreecommitdiff
blob: 172f0d6cd456797236ab4d9e82418b29c32e1db4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
https://bugs.gentoo.org/389953

--- vboxpci/linux/VBoxPci-linux.c
+++ vboxpci/linux/VBoxPci-linux.c
@@ -33,14 +33,22 @@
 #include "VBoxPciInternal.h"
 
 #ifdef VBOX_WITH_IOMMU
-#include <linux/dmar.h>
-#include <linux/intel-iommu.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0)
-# include <asm/amd_iommu.h>
-#else
-# include <linux/amd-iommu.h>
-#endif
-#endif
+# include <linux/dmar.h> 
+# include <linux/intel-iommu.h> 
+# include <linux/pci.h> 
+# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) 
+#  include <asm/amd_iommu.h> 
+# else 
+#  include <linux/amd-iommu.h> 
+# endif 
+# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0) 
+#  define IOMMU_PRESENT()      iommu_found() 
+#  define IOMMU_DOMAIN_ALLOC() iommu_domain_alloc() 
+# else 
+#  define IOMMU_PRESENT()      iommu_present(&pci_bus_type) 
+#  define IOMMU_DOMAIN_ALLOC() iommu_domain_alloc(&pci_bus_type) 
+# endif 
+#endif /* VBOX_WITH_IOMMU */ 
 
 
 /*******************************************************************************
@@ -146,7 +154,7 @@
 #endif
 
 #ifdef VBOX_WITH_IOMMU
-    if (iommu_found())
+    if (IOMMU_PRESENT())
         printk(KERN_INFO "vboxpci: IOMMU found\n");
     else
         printk(KERN_INFO "vboxpci: IOMMU not found (not registered)\n");
@@ -984,9 +992,9 @@
     printk(KERN_DEBUG "vboxPciOsInitVm: %p\n", pThis);
 #endif
 #ifdef VBOX_WITH_IOMMU
-    if (iommu_found())
+    if (IOMMU_PRESENT())
     {
-        pThis->pIommuDomain = iommu_domain_alloc();
+        pThis->pIommuDomain = IOMMU_DOMAIN_ALLOC();
         if (!pThis->pIommuDomain)
         {
             printk(KERN_DEBUG "cannot allocate IOMMU domain\n");