Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu/arm-smmu: Add support for the fsl-mc bus

Implement bus specific support for the fsl-mc bus including
registering arm_smmu_ops and bus specific device add operations.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>

authored by

Nipun Gupta and committed by
Joerg Roedel
eab03e2a fa0656b4

+30
+7
drivers/iommu/arm-smmu.c
··· 52 52 #include <linux/spinlock.h> 53 53 54 54 #include <linux/amba/bus.h> 55 + #include <linux/fsl/mc.h> 55 56 56 57 #include "io-pgtable.h" 57 58 #include "arm-smmu-regs.h" ··· 1460 1459 1461 1460 if (dev_is_pci(dev)) 1462 1461 group = pci_device_group(dev); 1462 + else if (dev_is_fsl_mc(dev)) 1463 + group = fsl_mc_device_group(dev); 1463 1464 else 1464 1465 group = generic_device_group(dev); 1465 1466 ··· 2038 2035 pci_request_acs(); 2039 2036 bus_set_iommu(&pci_bus_type, &arm_smmu_ops); 2040 2037 } 2038 + #endif 2039 + #ifdef CONFIG_FSL_MC_BUS 2040 + if (!iommu_present(&fsl_mc_bus_type)) 2041 + bus_set_iommu(&fsl_mc_bus_type, &arm_smmu_ops); 2041 2042 #endif 2042 2043 } 2043 2044
+13
drivers/iommu/iommu.c
··· 32 32 #include <linux/pci.h> 33 33 #include <linux/bitops.h> 34 34 #include <linux/property.h> 35 + #include <linux/fsl/mc.h> 35 36 #include <trace/events/iommu.h> 36 37 37 38 static struct kset *iommu_group_kset; ··· 1023 1022 1024 1023 /* No shared group found, allocate new */ 1025 1024 return iommu_group_alloc(); 1025 + } 1026 + 1027 + /* Get the IOMMU group for device on fsl-mc bus */ 1028 + struct iommu_group *fsl_mc_device_group(struct device *dev) 1029 + { 1030 + struct device *cont_dev = fsl_mc_cont_dev(dev); 1031 + struct iommu_group *group; 1032 + 1033 + group = iommu_group_get(cont_dev); 1034 + if (!group) 1035 + group = iommu_group_alloc(); 1036 + return group; 1026 1037 } 1027 1038 1028 1039 /**
+8
include/linux/fsl/mc.h
··· 351 351 #define dev_is_fsl_mc(_dev) (0) 352 352 #endif 353 353 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 + 354 362 /* 355 363 * module_fsl_mc_driver() - Helper macro for drivers that don't do 356 364 * anything special in module init/exit. This eliminates a lot of
+2
include/linux/iommu.h
··· 377 377 extern struct iommu_group *pci_device_group(struct device *dev); 378 378 /* Generic device grouping function */ 379 379 extern 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); 380 382 381 383 /** 382 384 * struct iommu_fwspec - per-device IOMMU instance data