@@ -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 )
@@ -973,22 +976,27 @@ static int apple_dart_of_xlate(struct device *dev, struct of_phandle_args *args)
973976 return - EINVAL ;
974977 sid = args -> args [0 ];
975978
976- if (!cfg )
979+ if (!cfg ) {
977980 cfg = kzalloc (sizeof (* cfg ), GFP_KERNEL );
981+
982+ /* Will be ANDed with DART capabilities */
983+ cfg -> supports_bypass = true;
984+ }
978985 if (!cfg )
979986 return - ENOMEM ;
980987 dev_iommu_priv_set (dev , cfg );
981988
982989 cfg_dart = cfg -> stream_maps [0 ].dart ;
983990 if (cfg_dart ) {
984- if (cfg_dart -> supports_bypass != dart -> supports_bypass )
985- return - EINVAL ;
986991 if (cfg_dart -> force_bypass != dart -> force_bypass )
987992 return - EINVAL ;
988993 if (cfg_dart -> pgsize != dart -> pgsize )
989994 return - EINVAL ;
990995 }
991996
997+ if (!dart -> supports_bypass )
998+ cfg -> supports_bypass = false;
999+
9921000 for (i = 0 ; i < MAX_DARTS_PER_DEVICE ; ++ i ) {
9931001 if (cfg -> stream_maps [i ].dart == dart ) {
9941002 set_bit (sid , cfg -> stream_maps [i ].sidmap );
0 commit comments