summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Currey <ruscur@russell.cc>2018-06-19 16:21:13 +1000
committerTimothy Pearson <tpearson@raptorengineering.com>2018-06-23 16:28:05 -0500
commitd6f04ab57bcac50f0d1f1ef4da1a29655afbeced (patch)
tree6864f23adbba61ee8e5cf42e31e20330bbc07322
parent6e58b78b283e1f4e981d8ee1c1e0f1c8debb22f7 (diff)
downloadop-kernel-dev-d6f04ab57bcac50f0d1f1ef4da1a29655afbeced.zip
op-kernel-dev-d6f04ab57bcac50f0d1f1ef4da1a29655afbeced.tar.gz
powerpc/powernv/pci: Safety fixes for pseudobypass TCE allocation
Signed-off-by: Russell Currey <ruscur@russell.cc>
-rw-r--r--arch/powerpc/platforms/powernv/pci-dma.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/powernv/pci-dma.c b/arch/powerpc/platforms/powernv/pci-dma.c
index 1d5409b..237940a 100644
--- a/arch/powerpc/platforms/powernv/pci-dma.c
+++ b/arch/powerpc/platforms/powernv/pci-dma.c
@@ -29,8 +29,9 @@ static int dma_pseudo_bypass_select_tce(struct pnv_ioda_pe *pe, phys_addr_t addr
{
int tce;
__be64 old, new;
+ unsigned long flags;
- spin_lock(&pe->tce_alloc_lock);
+ spin_lock_irqsave(&pe->tce_alloc_lock, flags);
tce = bitmap_find_next_zero_area(pe->tce_bitmap,
pe->tce_count,
0,
@@ -40,9 +41,10 @@ static int dma_pseudo_bypass_select_tce(struct pnv_ioda_pe *pe, phys_addr_t addr
old = pe->tces[tce];
new = cpu_to_be64(addr | TCE_PCI_READ | TCE_PCI_WRITE);
pe->tces[tce] = new;
+ mb();
pe_info(pe, "allocating TCE %i 0x%016llx (old 0x%016llx)\n",
tce, new, old);
- spin_unlock(&pe->tce_alloc_lock);
+ spin_unlock_irqrestore(&pe->tce_alloc_lock, flags);
return tce;
}
OpenPOWER on IntegriCloud