@@ -205,7 +205,7 @@ static inline uint16_t vmid_to_domainid(uint16_t vm_id)
205
205
}
206
206
207
207
static int32_t dmar_register_hrhd (struct dmar_drhd_rt * dmar_unit );
208
- static struct dmar_drhd_rt * device_to_dmaru (uint16_t segment , uint8_t bus , uint8_t devfun );
208
+ static struct dmar_drhd_rt * device_to_dmaru (uint8_t bus , uint8_t devfun );
209
209
static int32_t register_hrhd_units (void )
210
210
{
211
211
struct dmar_drhd_rt * drhd_rt ;
@@ -553,26 +553,21 @@ static struct dmar_drhd_rt *ioapic_to_dmaru(uint16_t ioapic_id, union pci_bdf *s
553
553
return dmar_unit ;
554
554
}
555
555
556
- static struct dmar_drhd_rt * device_to_dmaru (uint16_t segment , uint8_t bus , uint8_t devfun )
556
+ static struct dmar_drhd_rt * device_to_dmaru (uint8_t bus , uint8_t devfun )
557
557
{
558
558
struct dmar_drhd_rt * dmar_unit = NULL ;
559
559
uint32_t i , j ;
560
560
561
561
for (j = 0U ; j < platform_dmar_info -> drhd_count ; j ++ ) {
562
562
dmar_unit = & dmar_drhd_units [j ];
563
563
564
- if (dmar_unit -> drhd -> segment != segment ) {
565
- continue ;
566
- }
567
-
568
564
for (i = 0U ; i < dmar_unit -> drhd -> dev_cnt ; i ++ ) {
569
565
if ((dmar_unit -> drhd -> devices [i ].bus == bus ) &&
570
566
(dmar_unit -> drhd -> devices [i ].devfun == devfun )) {
571
567
break ;
572
568
}
573
569
}
574
570
575
- /* found exact one or the one which has the same segment number with INCLUDE_PCI_ALL set */
576
571
if ((i != dmar_unit -> drhd -> dev_cnt ) || ((dmar_unit -> drhd -> flags & DRHD_FLAG_INCLUDE_PCI_ALL_MASK ) != 0U )) {
577
572
break ;
578
573
}
@@ -1049,7 +1044,7 @@ static void dmar_resume(struct dmar_drhd_rt *dmar_unit)
1049
1044
dmar_enable_intr_remapping (dmar_unit );
1050
1045
}
1051
1046
1052
- static int32_t add_iommu_device (struct iommu_domain * domain , uint16_t segment , uint8_t bus , uint8_t devfun )
1047
+ static int32_t add_iommu_device (struct iommu_domain * domain , uint8_t bus , uint8_t devfun )
1053
1048
{
1054
1049
struct dmar_drhd_rt * dmar_unit ;
1055
1050
struct dmar_entry * root_table ;
@@ -1066,7 +1061,7 @@ static int32_t add_iommu_device(struct iommu_domain *domain, uint16_t segment, u
1066
1061
sid .fields .bus = bus ;
1067
1062
sid .fields .devfun = devfun ;
1068
1063
1069
- dmar_unit = device_to_dmaru (segment , bus , devfun );
1064
+ dmar_unit = device_to_dmaru (bus , devfun );
1070
1065
if (dmar_unit == NULL ) {
1071
1066
pr_err ("no dmar unit found for device: %x:%x.%x" , bus , sid .bits .d , sid .bits .f );
1072
1067
ret = - EINVAL ;
@@ -1164,7 +1159,7 @@ static int32_t add_iommu_device(struct iommu_domain *domain, uint16_t segment, u
1164
1159
return ret ;
1165
1160
}
1166
1161
1167
- static int32_t remove_iommu_device (const struct iommu_domain * domain , uint16_t segment , uint8_t bus , uint8_t devfun )
1162
+ static int32_t remove_iommu_device (const struct iommu_domain * domain , uint8_t bus , uint8_t devfun )
1168
1163
{
1169
1164
struct dmar_drhd_rt * dmar_unit ;
1170
1165
struct dmar_entry * root_table ;
@@ -1176,7 +1171,7 @@ static int32_t remove_iommu_device(const struct iommu_domain *domain, uint16_t s
1176
1171
union pci_bdf sid ;
1177
1172
int32_t ret = 0 ;
1178
1173
1179
- dmar_unit = device_to_dmaru (segment , bus , devfun );
1174
+ dmar_unit = device_to_dmaru (bus , devfun );
1180
1175
1181
1176
sid .fields .bus = bus ;
1182
1177
sid .fields .devfun = devfun ;
@@ -1302,11 +1297,11 @@ int32_t move_pt_device(const struct iommu_domain *from_domain, struct iommu_doma
1302
1297
1303
1298
if (bus_local < CONFIG_IOMMU_BUS_NUM ) {
1304
1299
if (from_domain != NULL ) {
1305
- status = remove_iommu_device (from_domain , 0U , bus , devfun );
1300
+ status = remove_iommu_device (from_domain , bus , devfun );
1306
1301
}
1307
1302
1308
1303
if ((status == 0 ) && (to_domain != NULL )) {
1309
- status = add_iommu_device (to_domain , 0U , bus , devfun );
1304
+ status = add_iommu_device (to_domain , bus , devfun );
1310
1305
}
1311
1306
} else {
1312
1307
status = - EINVAL ;
@@ -1373,7 +1368,7 @@ int32_t dmar_assign_irte(struct intr_source intr_src, union dmar_ir_entry irte,
1373
1368
int32_t ret = 0 ;
1374
1369
1375
1370
if (intr_src .is_msi ) {
1376
- dmar_unit = device_to_dmaru (0U , (uint8_t )intr_src .src .msi .bits .b , intr_src .src .msi .fields .devfun );
1371
+ dmar_unit = device_to_dmaru ((uint8_t )intr_src .src .msi .bits .b , intr_src .src .msi .fields .devfun );
1377
1372
sid .value = intr_src .src .msi .value ;
1378
1373
trigger_mode = 0x0UL ;
1379
1374
} else {
@@ -1417,7 +1412,7 @@ void dmar_free_irte(struct intr_source intr_src, uint16_t index)
1417
1412
union pci_bdf sid ;
1418
1413
1419
1414
if (intr_src .is_msi ) {
1420
- dmar_unit = device_to_dmaru (0U , (uint8_t )intr_src .src .msi .bits .b , intr_src .src .msi .fields .devfun );
1415
+ dmar_unit = device_to_dmaru ((uint8_t )intr_src .src .msi .bits .b , intr_src .src .msi .fields .devfun );
1421
1416
} else {
1422
1417
dmar_unit = ioapic_to_dmaru (intr_src .src .ioapic_id , & sid );
1423
1418
}
0 commit comments