@@ -98,9 +98,6 @@ static inline uint64_t dmar_set_bitslice(uint64_t var, uint64_t mask, uint32_t p
98
98
#define DMAR_IR_ENABLE_EIM_SHIFT 11UL
99
99
#define DMAR_IR_ENABLE_EIM (1UL << DMAR_IR_ENABLE_EIM_SHIFT)
100
100
101
- #define DMAR_IECI_INDEXED 1U
102
- #define DMAR_IEC_GLOBAL_INVL 0U
103
-
104
101
enum dmar_cirg_type {
105
102
DMAR_CIRG_RESERVED = 0 ,
106
103
DMAR_CIRG_GLOBAL ,
@@ -634,7 +631,7 @@ static void dmar_invalid_context_cache(struct dmar_drhd_rt *dmar_unit,
634
631
invalidate_desc .lo_64 |= DMA_CONTEXT_DOMAIN_INVL | dma_ccmd_did (did );
635
632
break ;
636
633
case DMAR_CIRG_DEVICE :
637
- invalidate_desc .lo_64 |= DMA_CCMD_DEVICE_INVL | dma_ccmd_did (did ) | dma_ccmd_sid (sid ) | dma_ccmd_fm (fm );
634
+ invalidate_desc .lo_64 |= DMA_CONTEXT_DEVICE_INVL | dma_ccmd_did (did ) | dma_ccmd_sid (sid ) | dma_ccmd_fm (fm );
638
635
break ;
639
636
default :
640
637
invalidate_desc .lo_64 = 0UL ;
@@ -992,6 +989,7 @@ static void dmar_enable(struct dmar_drhd_rt *dmar_unit)
992
989
dev_dbg (ACRN_DBG_IOMMU , "enable dmar uint [0x%x]" , dmar_unit -> drhd -> reg_base_addr );
993
990
dmar_invalid_context_cache_global (dmar_unit );
994
991
dmar_invalid_iotlb_global (dmar_unit );
992
+ dmar_invalid_iec_global (dmar_unit );
995
993
dmar_enable_translation (dmar_unit );
996
994
}
997
995
@@ -1009,6 +1007,7 @@ static void dmar_suspend(struct dmar_drhd_rt *dmar_unit)
1009
1007
1010
1008
dmar_invalid_context_cache_global (dmar_unit );
1011
1009
dmar_invalid_iotlb_global (dmar_unit );
1010
+ dmar_invalid_iec_global (dmar_unit );
1012
1011
1013
1012
dmar_disable (dmar_unit );
1014
1013
@@ -1149,6 +1148,7 @@ static int32_t remove_iommu_device(const struct iommu_domain *domain, uint16_t s
1149
1148
struct dmar_entry * context ;
1150
1149
struct dmar_entry * root_entry ;
1151
1150
struct dmar_entry * context_entry ;
1151
+ union pci_bdf sid ;
1152
1152
int32_t ret = 0 ;
1153
1153
1154
1154
dmar_unit = device_to_dmaru (segment , bus , devfun );
@@ -1184,8 +1184,11 @@ static int32_t remove_iommu_device(const struct iommu_domain *domain, uint16_t s
1184
1184
context_entry -> hi_64 = 0UL ;
1185
1185
iommu_flush_cache (dmar_unit , context_entry , sizeof (struct dmar_entry ));
1186
1186
1187
- dmar_invalid_context_cache_global (dmar_unit );
1188
- dmar_invalid_iotlb_global (dmar_unit );
1187
+ sid .bits .b = bus ;
1188
+ sid .bits .d = pci_slot (devfun );
1189
+ sid .bits .f = pci_func (devfun );
1190
+ dmar_invalid_context_cache (dmar_unit , vmid_to_domainid (domain -> vm_id ), sid .value , 0U , DMAR_CIRG_DEVICE );
1191
+ dmar_invalid_iotlb (dmar_unit , vmid_to_domainid (domain -> vm_id ), 0UL , 0U , false, DMAR_IIRG_DOMAIN );
1189
1192
}
1190
1193
}
1191
1194
}
@@ -1407,7 +1410,7 @@ int32_t dmar_assign_irte(struct intr_source intr_src, union dmar_ir_entry irte,
1407
1410
ir_entry -> entry .lo_64 = irte .entry .lo_64 ;
1408
1411
1409
1412
iommu_flush_cache (dmar_unit , ir_entry , sizeof (union dmar_ir_entry ));
1410
- dmar_invalid_iec_global (dmar_unit );
1413
+ dmar_invalid_iec (dmar_unit , index , 0U , false );
1411
1414
}
1412
1415
return ret ;
1413
1416
}
@@ -1438,6 +1441,6 @@ void dmar_free_irte(struct intr_source intr_src, uint16_t index)
1438
1441
ir_entry -> bits .present = 0x0UL ;
1439
1442
1440
1443
iommu_flush_cache (dmar_unit , ir_entry , sizeof (union dmar_ir_entry ));
1441
- dmar_invalid_iec_global (dmar_unit );
1444
+ dmar_invalid_iec (dmar_unit , index , 0U , false );
1442
1445
}
1443
1446
}
0 commit comments