diff options
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 3 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 3 | ||||
-rw-r--r-- | drivers/iommu/iommu.c | 9 | ||||
-rw-r--r-- | include/linux/iommu.h | 4 | ||||
-rw-r--r-- | virt/kvm/iommu.c | 2 |
5 files changed, 13 insertions, 8 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index 8213efe1998c..43f4c92816ef 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/uaccess.h> | 33 | #include <linux/uaccess.h> |
34 | #include <linux/iommu.h> | 34 | #include <linux/iommu.h> |
35 | #include <linux/intel-iommu.h> | 35 | #include <linux/intel-iommu.h> |
36 | #include <linux/pci.h> | ||
36 | 37 | ||
37 | #include <asm/pgtable.h> | 38 | #include <asm/pgtable.h> |
38 | #include <asm/gcc_intrin.h> | 39 | #include <asm/gcc_intrin.h> |
@@ -204,7 +205,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
204 | r = KVM_COALESCED_MMIO_PAGE_OFFSET; | 205 | r = KVM_COALESCED_MMIO_PAGE_OFFSET; |
205 | break; | 206 | break; |
206 | case KVM_CAP_IOMMU: | 207 | case KVM_CAP_IOMMU: |
207 | r = iommu_found(); | 208 | r = iommu_present(&pci_bus_type); |
208 | break; | 209 | break; |
209 | default: | 210 | default: |
210 | r = 0; | 211 | r = 0; |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 84a28ea45fa4..73c6a4268bf4 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/perf_event.h> | 44 | #include <linux/perf_event.h> |
45 | #include <linux/uaccess.h> | 45 | #include <linux/uaccess.h> |
46 | #include <linux/hash.h> | 46 | #include <linux/hash.h> |
47 | #include <linux/pci.h> | ||
47 | #include <trace/events/kvm.h> | 48 | #include <trace/events/kvm.h> |
48 | 49 | ||
49 | #define CREATE_TRACE_POINTS | 50 | #define CREATE_TRACE_POINTS |
@@ -2095,7 +2096,7 @@ int kvm_dev_ioctl_check_extension(long ext) | |||
2095 | r = 0; | 2096 | r = 0; |
2096 | break; | 2097 | break; |
2097 | case KVM_CAP_IOMMU: | 2098 | case KVM_CAP_IOMMU: |
2098 | r = iommu_found(); | 2099 | r = iommu_present(&pci_bus_type); |
2099 | break; | 2100 | break; |
2100 | case KVM_CAP_MCE: | 2101 | case KVM_CAP_MCE: |
2101 | r = KVM_MAX_MCE_BANKS; | 2102 | r = KVM_MAX_MCE_BANKS; |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 46e1c24f2f43..ad8ce1addb4d 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -66,11 +66,14 @@ int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops) | |||
66 | } | 66 | } |
67 | EXPORT_SYMBOL_GPL(bus_set_iommu); | 67 | EXPORT_SYMBOL_GPL(bus_set_iommu); |
68 | 68 | ||
69 | bool iommu_found(void) | 69 | bool iommu_present(struct bus_type *bus) |
70 | { | 70 | { |
71 | return iommu_ops != NULL; | 71 | if (bus->iommu_ops != NULL) |
72 | return true; | ||
73 | else | ||
74 | return iommu_ops != NULL; | ||
72 | } | 75 | } |
73 | EXPORT_SYMBOL_GPL(iommu_found); | 76 | EXPORT_SYMBOL_GPL(iommu_present); |
74 | 77 | ||
75 | struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) | 78 | struct iommu_domain *iommu_domain_alloc(struct bus_type *bus) |
76 | { | 79 | { |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index c78d068930b7..f56e559442a2 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
@@ -56,7 +56,7 @@ struct iommu_ops { | |||
56 | 56 | ||
57 | extern void register_iommu(struct iommu_ops *ops); | 57 | extern void register_iommu(struct iommu_ops *ops); |
58 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); | 58 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); |
59 | extern bool iommu_found(void); | 59 | extern bool iommu_present(struct bus_type *bus); |
60 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); | 60 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); |
61 | extern void iommu_domain_free(struct iommu_domain *domain); | 61 | extern void iommu_domain_free(struct iommu_domain *domain); |
62 | extern int iommu_attach_device(struct iommu_domain *domain, | 62 | extern int iommu_attach_device(struct iommu_domain *domain, |
@@ -76,7 +76,7 @@ extern int iommu_domain_has_cap(struct iommu_domain *domain, | |||
76 | 76 | ||
77 | struct iommu_ops {}; | 77 | struct iommu_ops {}; |
78 | 78 | ||
79 | static inline bool iommu_found(void) | 79 | static inline bool iommu_present(struct bus_type *bus) |
80 | { | 80 | { |
81 | return false; | 81 | return false; |
82 | } | 82 | } |
diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 20115b1aac6a..d149940608da 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c | |||
@@ -228,7 +228,7 @@ int kvm_iommu_map_guest(struct kvm *kvm) | |||
228 | { | 228 | { |
229 | int r; | 229 | int r; |
230 | 230 | ||
231 | if (!iommu_found()) { | 231 | if (!iommu_present(&pci_bus_type)) { |
232 | printk(KERN_ERR "%s: iommu not found\n", __func__); | 232 | printk(KERN_ERR "%s: iommu not found\n", __func__); |
233 | return -ENODEV; | 233 | return -ENODEV; |
234 | } | 234 | } |