@@ -294,6 +294,9 @@ struct apple_dart_domain {
294294 * @streams: streams for this device
295295 */
296296struct apple_dart_master_cfg {
297+ /* Union of DART capabilitles */
298+ u32 supports_bypass : 1 ;
299+
297300 struct apple_dart_stream_map stream_maps [MAX_DARTS_PER_DEVICE ];
298301};
299302
@@ -860,7 +863,7 @@ static int apple_dart_attach_dev(struct iommu_domain *domain,
860863
861864 if (dart0 -> force_bypass && domain -> type != IOMMU_DOMAIN_IDENTITY )
862865 return - EINVAL ;
863- if (!dart0 -> supports_bypass && domain -> type == IOMMU_DOMAIN_IDENTITY )
866+ if (!cfg -> supports_bypass && domain -> type == IOMMU_DOMAIN_IDENTITY )
864867 return - EINVAL ;
865868 if (dart0 -> locked && domain -> type != IOMMU_DOMAIN_DMA &&
866869 domain -> type != IOMMU_DOMAIN_UNMANAGED )
@@ -975,22 +978,27 @@ static int apple_dart_of_xlate(struct device *dev, struct of_phandle_args *args)
975978 return - EINVAL ;
976979 sid = args -> args [0 ];
977980
978- if (!cfg )
981+ if (!cfg ) {
979982 cfg = kzalloc (sizeof (* cfg ), GFP_KERNEL );
983+
984+ /* Will be ANDed with DART capabilities */
985+ cfg -> supports_bypass = true;
986+ }
980987 if (!cfg )
981988 return - ENOMEM ;
982989 dev_iommu_priv_set (dev , cfg );
983990
984991 cfg_dart = cfg -> stream_maps [0 ].dart ;
985992 if (cfg_dart ) {
986- if (cfg_dart -> supports_bypass != dart -> supports_bypass )
987- return - EINVAL ;
988993 if (cfg_dart -> force_bypass != dart -> force_bypass )
989994 return - EINVAL ;
990995 if (cfg_dart -> pgsize != dart -> pgsize )
991996 return - EINVAL ;
992997 }
993998
999+ if (!dart -> supports_bypass )
1000+ cfg -> supports_bypass = false;
1001+
9941002 for (i = 0 ; i < MAX_DARTS_PER_DEVICE ; ++ i ) {
9951003 if (cfg -> stream_maps [i ].dart == dart ) {
9961004 set_bit (sid , cfg -> stream_maps [i ].sidmap );
0 commit comments