File tree Expand file tree Collapse file tree 3 files changed +23
-5
lines changed Expand file tree Collapse file tree 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,
2929 void * (* fn )(struct device_node * , void * ),
3030 void * data );
3131extern 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+
3235
3336/* From rtas_pci.h */
3437extern 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[] = {
13881388 NULL ,
13891389};
13901390
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+
13911406/*
13921407 * This registers IOMMU devices of PHBs. This needs to happen
13931408 * 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)
13981413 struct pci_controller * hose ;
13991414
14001415 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 );
14061417 }
14071418 return 0 ;
14081419}
Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ struct pci_controller *init_phb_dynamic(struct device_node *dn)
3535
3636 pseries_msi_allocate_domains (phb );
3737
38+ ppc_iommu_register_device (phb );
39+
3840 /* Create EEH devices for the PHB */
3941 eeh_phb_pe_create (phb );
4042
@@ -76,6 +78,8 @@ int remove_phb_dynamic(struct pci_controller *phb)
7678 }
7779 }
7880
81+ ppc_iommu_unregister_device (phb );
82+
7983 pseries_msi_free_domains (phb );
8084
8185 /* Keep a reference so phb isn't freed yet */
You can’t perform that action at this time.
0 commit comments