File tree 3 files changed +23
-5
lines changed
3 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ void *pci_traverse_device_nodes(struct device_node *start,
29
29
void * (* fn )(struct device_node * , void * ),
30
30
void * data );
31
31
extern void pci_devs_phb_init_dynamic (struct pci_controller * phb );
32
+ extern void ppc_iommu_register_device (struct pci_controller * phb );
33
+ extern void ppc_iommu_unregister_device (struct pci_controller * phb );
34
+
32
35
33
36
/* From rtas_pci.h */
34
37
extern void init_pci_config_tokens (void );
Original file line number Diff line number Diff line change @@ -1388,6 +1388,21 @@ static const struct attribute_group *spapr_tce_iommu_groups[] = {
1388
1388
NULL ,
1389
1389
};
1390
1390
1391
+ void ppc_iommu_register_device (struct pci_controller * phb )
1392
+ {
1393
+ iommu_device_sysfs_add (& phb -> iommu , phb -> parent ,
1394
+ spapr_tce_iommu_groups , "iommu-phb%04x" ,
1395
+ phb -> global_number );
1396
+ iommu_device_register (& phb -> iommu , & spapr_tce_iommu_ops ,
1397
+ phb -> parent );
1398
+ }
1399
+
1400
+ void ppc_iommu_unregister_device (struct pci_controller * phb )
1401
+ {
1402
+ iommu_device_unregister (& phb -> iommu );
1403
+ iommu_device_sysfs_remove (& phb -> iommu );
1404
+ }
1405
+
1391
1406
/*
1392
1407
* This registers IOMMU devices of PHBs. This needs to happen
1393
1408
* after core_initcall(iommu_init) + postcore_initcall(pci_driver_init) and
@@ -1398,11 +1413,7 @@ static int __init spapr_tce_setup_phb_iommus_initcall(void)
1398
1413
struct pci_controller * hose ;
1399
1414
1400
1415
list_for_each_entry (hose , & hose_list , list_node ) {
1401
- iommu_device_sysfs_add (& hose -> iommu , hose -> parent ,
1402
- spapr_tce_iommu_groups , "iommu-phb%04x" ,
1403
- hose -> global_number );
1404
- iommu_device_register (& hose -> iommu , & spapr_tce_iommu_ops ,
1405
- hose -> parent );
1416
+ ppc_iommu_register_device (hose );
1406
1417
}
1407
1418
return 0 ;
1408
1419
}
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ struct pci_controller *init_phb_dynamic(struct device_node *dn)
35
35
36
36
pseries_msi_allocate_domains (phb );
37
37
38
+ ppc_iommu_register_device (phb );
39
+
38
40
/* Create EEH devices for the PHB */
39
41
eeh_phb_pe_create (phb );
40
42
@@ -76,6 +78,8 @@ int remove_phb_dynamic(struct pci_controller *phb)
76
78
}
77
79
}
78
80
81
+ ppc_iommu_unregister_device (phb );
82
+
79
83
pseries_msi_free_domains (phb );
80
84
81
85
/* Keep a reference so phb isn't freed yet */
You can’t perform that action at this time.
0 commit comments