]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
iommu: Add generic_device_group() function
authorJoerg Roedel <jroedel@suse.de>
Wed, 21 Oct 2015 21:51:38 +0000 (23:51 +0200)
committerJoerg Roedel <jroedel@suse.de>
Wed, 21 Oct 2015 22:00:49 +0000 (00:00 +0200)
This function can be used as a device_group call-back and
just allocates one iommu-group per device.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c
include/linux/iommu.h

index fdea700ca12ce333a8d34ad76e3a58e49473298a..a80c9c5c26509336506de25da37929d52323c46d 100644 (file)
@@ -727,6 +727,21 @@ static int get_pci_alias_or_group(struct pci_dev *pdev, u16 alias, void *opaque)
        return data->group != NULL;
 }
 
+/*
+ * Generic device_group call-back function. It just allocates one
+ * iommu-group per device.
+ */
+struct iommu_group *generic_device_group(struct device *dev)
+{
+       struct iommu_group *group;
+
+       group = iommu_group_alloc();
+       if (IS_ERR(group))
+               return NULL;
+
+       return group;
+}
+
 /*
  * Use standard PCI bus topology, isolation features, and DMA alias quirks
  * to find or create an IOMMU group for a device.
index a1a06639a64ac77f4cc8c0d4a68d082325e2e680..f28dff313b07c3bb072dffc2235b27d5d0eaa09a 100644 (file)
@@ -319,6 +319,8 @@ static inline size_t iommu_map_sg(struct iommu_domain *domain,
 
 /* PCI device grouping function */
 extern struct iommu_group *pci_device_group(struct device *dev);
+/* Generic device grouping function */
+extern struct iommu_group *generic_device_group(struct device *dev);
 
 #else /* CONFIG_IOMMU_API */