@@ -1266,12 +1266,24 @@ static void amd_iommu_flush_irt_all(struct amd_iommu *iommu)
1266
1266
u32 devid ;
1267
1267
u16 last_bdf = iommu -> pci_seg -> last_bdf ;
1268
1268
1269
+ if (iommu -> irtcachedis_enabled )
1270
+ return ;
1271
+
1269
1272
for (devid = 0 ; devid <= last_bdf ; devid ++ )
1270
1273
iommu_flush_irt (iommu , devid );
1271
1274
1272
1275
iommu_completion_wait (iommu );
1273
1276
}
1274
1277
1278
+ static void iommu_flush_irt_and_complete (struct amd_iommu * iommu , u16 devid )
1279
+ {
1280
+ if (iommu -> irtcachedis_enabled )
1281
+ return ;
1282
+
1283
+ iommu_flush_irt (iommu , devid );
1284
+ iommu_completion_wait (iommu );
1285
+ }
1286
+
1275
1287
void iommu_flush_all_caches (struct amd_iommu * iommu )
1276
1288
{
1277
1289
if (iommu_feature (iommu , FEATURE_IA )) {
@@ -3030,8 +3042,7 @@ static int modify_irte_ga(struct amd_iommu *iommu, u16 devid, int index,
3030
3042
3031
3043
raw_spin_unlock_irqrestore (& table -> lock , flags );
3032
3044
3033
- iommu_flush_irt (iommu , devid );
3034
- iommu_completion_wait (iommu );
3045
+ iommu_flush_irt_and_complete (iommu , devid );
3035
3046
3036
3047
return 0 ;
3037
3048
}
@@ -3050,8 +3061,7 @@ static int modify_irte(struct amd_iommu *iommu,
3050
3061
table -> table [index ] = irte -> val ;
3051
3062
raw_spin_unlock_irqrestore (& table -> lock , flags );
3052
3063
3053
- iommu_flush_irt (iommu , devid );
3054
- iommu_completion_wait (iommu );
3064
+ iommu_flush_irt_and_complete (iommu , devid );
3055
3065
3056
3066
return 0 ;
3057
3067
}
@@ -3069,8 +3079,7 @@ static void free_irte(struct amd_iommu *iommu, u16 devid, int index)
3069
3079
iommu -> irte_ops -> clear_allocated (table , index );
3070
3080
raw_spin_unlock_irqrestore (& table -> lock , flags );
3071
3081
3072
- iommu_flush_irt (iommu , devid );
3073
- iommu_completion_wait (iommu );
3082
+ iommu_flush_irt_and_complete (iommu , devid );
3074
3083
}
3075
3084
3076
3085
static void irte_prepare (void * entry ,
0 commit comments