]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/pseries/pci: Add support of MSI domains to PHB hotplug
authorCédric Le Goater <clg@kaod.org>
Thu, 1 Jul 2021 13:27:28 +0000 (15:27 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 10 Aug 2021 13:14:58 +0000 (23:14 +1000)
Simply allocate or release the MSI domains when a PHB is inserted in
or removed from the machine.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210701132750.1475580-11-clg@kaod.org
arch/powerpc/platforms/pseries/msi.c
arch/powerpc/platforms/pseries/pci_dlpar.c
arch/powerpc/platforms/pseries/pseries.h

index f9635b01b2bfe671a2ac7cd787b3168670506342..e2127a3f7ebddeeed668b1e973a033e99afc8909 100644 (file)
@@ -733,6 +733,16 @@ int pseries_msi_allocate_domains(struct pci_controller *phb)
        return __pseries_msi_allocate_domains(phb, count);
 }
 
+void pseries_msi_free_domains(struct pci_controller *phb)
+{
+       if (phb->msi_domain)
+               irq_domain_remove(phb->msi_domain);
+       if (phb->dev_domain)
+               irq_domain_remove(phb->dev_domain);
+       if (phb->fwnode)
+               irq_domain_free_fwnode(phb->fwnode);
+}
+
 static void rtas_msi_pci_irq_fixup(struct pci_dev *pdev)
 {
        /* No LSI -> leave MSIs (if any) configured */
index a8f9140a24fa3c5ad14fcee2bda20b52494c67f0..90c9d3531694b0897608d80c7f23ffdfe86a524a 100644 (file)
@@ -33,6 +33,8 @@ struct pci_controller *init_phb_dynamic(struct device_node *dn)
 
        pci_devs_phb_init_dynamic(phb);
 
+       pseries_msi_allocate_domains(phb);
+
        /* Create EEH devices for the PHB */
        eeh_phb_pe_create(phb);
 
@@ -74,6 +76,8 @@ int remove_phb_dynamic(struct pci_controller *phb)
                }
        }
 
+       pseries_msi_free_domains(phb);
+
        /* Remove the PCI bus and unregister the bridge device from sysfs */
        phb->bus = NULL;
        pci_remove_bus(b);
index d9280262588b24ad4322241b3913b74d047c65fe..3544778e06d01ac1c0c23be4b162cd8e1ace1ea0 100644 (file)
@@ -86,6 +86,7 @@ int pseries_root_bridge_prepare(struct pci_host_bridge *bridge);
 
 extern struct pci_controller_ops pseries_pci_controller_ops;
 int pseries_msi_allocate_domains(struct pci_controller *phb);
+void pseries_msi_free_domains(struct pci_controller *phb);
 
 unsigned long pseries_memory_block_size(void);