]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
powerpc/powernv/ioda: Protect PE list
authorFrederic Barrat <fbarrat@linux.ibm.com>
Thu, 21 Nov 2019 13:49:09 +0000 (14:49 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 23 Jan 2020 10:31:16 +0000 (21:31 +1100)
Protect the PHB's list of PE. Probably not needed as long as it was
populated during PHB creation, but it feels right and will become
required once we can add/remove opencapi devices on hotplug.

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191121134918.7155-3-fbarrat@linux.ibm.com
arch/powerpc/platforms/powernv/pci-ioda.c

index 82e81fe83637c91aca1b9bc2976a826f752e5608..4bf67d8a3385ea3a69b880159b8d9eb083b6d8fd 100644 (file)
@@ -1087,8 +1087,9 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev)
        }
 
        /* Put PE to the list */
+       mutex_lock(&phb->ioda.pe_list_mutex);
        list_add_tail(&pe->list, &phb->ioda.pe_list);
-
+       mutex_unlock(&phb->ioda.pe_list_mutex);
        return pe;
 }
 
@@ -3528,7 +3529,10 @@ static void pnv_ioda_release_pe(struct pnv_ioda_pe *pe)
        struct pnv_phb *phb = pe->phb;
        struct pnv_ioda_pe *slave, *tmp;
 
+       mutex_lock(&phb->ioda.pe_list_mutex);
        list_del(&pe->list);
+       mutex_unlock(&phb->ioda.pe_list_mutex);
+
        switch (phb->type) {
        case PNV_PHB_IODA1:
                pnv_pci_ioda1_release_pe_dma(pe);