File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252#include <linux/spinlock.h>
5353
5454#include <linux/amba/bus.h>
55+ #include <linux/fsl/mc.h>
5556
5657#include "io-pgtable.h"
5758#include "arm-smmu-regs.h"
@@ -1459,6 +1460,8 @@ static struct iommu_group *arm_smmu_device_group(struct device *dev)
14591460
14601461 if (dev_is_pci (dev ))
14611462 group = pci_device_group (dev );
1463+ else if (dev_is_fsl_mc (dev ))
1464+ group = fsl_mc_device_group (dev );
14621465 else
14631466 group = generic_device_group (dev );
14641467
@@ -2036,6 +2039,10 @@ static void arm_smmu_bus_init(void)
20362039 bus_set_iommu (& pci_bus_type , & arm_smmu_ops );
20372040 }
20382041#endif
2042+ #ifdef CONFIG_FSL_MC_BUS
2043+ if (!iommu_present (& fsl_mc_bus_type ))
2044+ bus_set_iommu (& fsl_mc_bus_type , & arm_smmu_ops );
2045+ #endif
20392046}
20402047
20412048static int arm_smmu_device_probe (struct platform_device * pdev )
Original file line number Diff line number Diff line change 3232#include <linux/pci.h>
3333#include <linux/bitops.h>
3434#include <linux/property.h>
35+ #include <linux/fsl/mc.h>
3536#include <trace/events/iommu.h>
3637
3738static struct kset * iommu_group_kset ;
@@ -1024,6 +1025,18 @@ struct iommu_group *pci_device_group(struct device *dev)
10241025 return iommu_group_alloc ();
10251026}
10261027
1028+ /* Get the IOMMU group for device on fsl-mc bus */
1029+ struct iommu_group * fsl_mc_device_group (struct device * dev )
1030+ {
1031+ struct device * cont_dev = fsl_mc_cont_dev (dev );
1032+ struct iommu_group * group ;
1033+
1034+ group = iommu_group_get (cont_dev );
1035+ if (!group )
1036+ group = iommu_group_alloc ();
1037+ return group ;
1038+ }
1039+
10271040/**
10281041 * iommu_group_get_for_dev - Find or create the IOMMU group for a device
10291042 * @dev: target device
Original file line number Diff line number Diff line change @@ -351,6 +351,14 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct fsl_mc_command *cmd);
351351#define dev_is_fsl_mc (_dev ) (0)
352352#endif
353353
354+ /* Macro to check if a device is a container device */
355+ #define fsl_mc_is_cont_dev (_dev ) (to_fsl_mc_device(_dev)->flags & \
356+ FSL_MC_IS_DPRC)
357+
358+ /* Macro to get the container device of a MC device */
359+ #define fsl_mc_cont_dev (_dev ) (fsl_mc_is_cont_dev(_dev) ? \
360+ (_dev) : (_dev)->parent)
361+
354362/*
355363 * module_fsl_mc_driver() - Helper macro for drivers that don't do
356364 * anything special in module init/exit. This eliminates a lot of
Original file line number Diff line number Diff line change @@ -377,6 +377,8 @@ static inline void iommu_tlb_sync(struct iommu_domain *domain)
377377extern struct iommu_group * pci_device_group (struct device * dev );
378378/* Generic device grouping function */
379379extern struct iommu_group * generic_device_group (struct device * dev );
380+ /* FSL-MC device grouping function */
381+ struct iommu_group * fsl_mc_device_group (struct device * dev );
380382
381383/**
382384 * struct iommu_fwspec - per-device IOMMU instance data
You can’t perform that action at this time.
0 commit comments