Commit 6f0b1c60 authored by Michael Ellerman's avatar Michael Ellerman Committed by Benjamin Herrenschmidt

powerpc: Swiotlb breaks pseries

Turning on SWIOTLB selects or enables PPC_NEED_DMA_SYNC_OPS, which means
we get the non empty versions of dma_sync_* in asm/dma-mapping.h

On my pseries machine the dma_ops have no such routines and we die with
a null pointer - this patch gets it booting, is there a more elegant way
to do it?
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 987fed3b
...@@ -309,6 +309,8 @@ static inline void dma_sync_single_for_cpu(struct device *dev, ...@@ -309,6 +309,8 @@ static inline void dma_sync_single_for_cpu(struct device *dev,
struct dma_mapping_ops *dma_ops = get_dma_ops(dev); struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
BUG_ON(!dma_ops); BUG_ON(!dma_ops);
if (dma_ops->sync_single_range_for_cpu)
dma_ops->sync_single_range_for_cpu(dev, dma_handle, 0, dma_ops->sync_single_range_for_cpu(dev, dma_handle, 0,
size, direction); size, direction);
} }
...@@ -320,6 +322,8 @@ static inline void dma_sync_single_for_device(struct device *dev, ...@@ -320,6 +322,8 @@ static inline void dma_sync_single_for_device(struct device *dev,
struct dma_mapping_ops *dma_ops = get_dma_ops(dev); struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
BUG_ON(!dma_ops); BUG_ON(!dma_ops);
if (dma_ops->sync_single_range_for_device)
dma_ops->sync_single_range_for_device(dev, dma_handle, dma_ops->sync_single_range_for_device(dev, dma_handle,
0, size, direction); 0, size, direction);
} }
...@@ -331,6 +335,8 @@ static inline void dma_sync_sg_for_cpu(struct device *dev, ...@@ -331,6 +335,8 @@ static inline void dma_sync_sg_for_cpu(struct device *dev,
struct dma_mapping_ops *dma_ops = get_dma_ops(dev); struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
BUG_ON(!dma_ops); BUG_ON(!dma_ops);
if (dma_ops->sync_sg_for_cpu)
dma_ops->sync_sg_for_cpu(dev, sgl, nents, direction); dma_ops->sync_sg_for_cpu(dev, sgl, nents, direction);
} }
...@@ -341,6 +347,8 @@ static inline void dma_sync_sg_for_device(struct device *dev, ...@@ -341,6 +347,8 @@ static inline void dma_sync_sg_for_device(struct device *dev,
struct dma_mapping_ops *dma_ops = get_dma_ops(dev); struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
BUG_ON(!dma_ops); BUG_ON(!dma_ops);
if (dma_ops->sync_sg_for_device)
dma_ops->sync_sg_for_device(dev, sgl, nents, direction); dma_ops->sync_sg_for_device(dev, sgl, nents, direction);
} }
...@@ -351,6 +359,8 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev, ...@@ -351,6 +359,8 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
struct dma_mapping_ops *dma_ops = get_dma_ops(dev); struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
BUG_ON(!dma_ops); BUG_ON(!dma_ops);
if (dma_ops->sync_single_range_for_cpu)
dma_ops->sync_single_range_for_cpu(dev, dma_handle, dma_ops->sync_single_range_for_cpu(dev, dma_handle,
offset, size, direction); offset, size, direction);
} }
...@@ -362,6 +372,8 @@ static inline void dma_sync_single_range_for_device(struct device *dev, ...@@ -362,6 +372,8 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
struct dma_mapping_ops *dma_ops = get_dma_ops(dev); struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
BUG_ON(!dma_ops); BUG_ON(!dma_ops);
if (dma_ops->sync_single_range_for_device)
dma_ops->sync_single_range_for_device(dev, dma_handle, offset, dma_ops->sync_single_range_for_device(dev, dma_handle, offset,
size, direction); size, direction);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment