With per-bus iommu_ops the iommu_found function needs to
work on a bus_type too. This patch adds a bus_type parameter
to that function and converts all call-places.
The function is also renamed to iommu_present because the
function now checks if an iommu is present for a given bus
and does not check for a global iommu anymore.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
#include <linux/uaccess.h>
#include <linux/iommu.h>
#include <linux/intel-iommu.h>
#include <linux/uaccess.h>
#include <linux/iommu.h>
#include <linux/intel-iommu.h>
#include <asm/pgtable.h>
#include <asm/gcc_intrin.h>
#include <asm/pgtable.h>
#include <asm/gcc_intrin.h>
r = KVM_COALESCED_MMIO_PAGE_OFFSET;
break;
case KVM_CAP_IOMMU:
r = KVM_COALESCED_MMIO_PAGE_OFFSET;
break;
case KVM_CAP_IOMMU:
+ r = iommu_present(&pci_bus_type);
#include <linux/perf_event.h>
#include <linux/uaccess.h>
#include <linux/hash.h>
#include <linux/perf_event.h>
#include <linux/uaccess.h>
#include <linux/hash.h>
#include <trace/events/kvm.h>
#define CREATE_TRACE_POINTS
#include <trace/events/kvm.h>
#define CREATE_TRACE_POINTS
r = 0;
break;
case KVM_CAP_IOMMU:
r = 0;
break;
case KVM_CAP_IOMMU:
+ r = iommu_present(&pci_bus_type);
break;
case KVM_CAP_MCE:
r = KVM_MAX_MCE_BANKS;
break;
case KVM_CAP_MCE:
r = KVM_MAX_MCE_BANKS;
}
EXPORT_SYMBOL_GPL(bus_set_iommu);
}
EXPORT_SYMBOL_GPL(bus_set_iommu);
+bool iommu_present(struct bus_type *bus)
- return iommu_ops != NULL;
+ if (bus->iommu_ops != NULL)
+ return true;
+ else
+ return iommu_ops != NULL;
-EXPORT_SYMBOL_GPL(iommu_found);
+EXPORT_SYMBOL_GPL(iommu_present);
struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
{
struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
{
extern void register_iommu(struct iommu_ops *ops);
extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
extern void register_iommu(struct iommu_ops *ops);
extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
-extern bool iommu_found(void);
+extern bool iommu_present(struct bus_type *bus);
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
extern void iommu_domain_free(struct iommu_domain *domain);
extern int iommu_attach_device(struct iommu_domain *domain,
extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
extern void iommu_domain_free(struct iommu_domain *domain);
extern int iommu_attach_device(struct iommu_domain *domain,
-static inline bool iommu_found(void)
+static inline bool iommu_present(struct bus_type *bus)
+ if (!iommu_present(&pci_bus_type)) {
printk(KERN_ERR "%s: iommu not found\n", __func__);
return -ENODEV;
}
printk(KERN_ERR "%s: iommu not found\n", __func__);
return -ENODEV;
}