lkml.org 
[lkml]   [2022]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/4 RESEND] dma-mapping: Add wrapper function to set dma_coherent
From
On 2022-03-17 16:25, Michael Kelley via iommu wrote:
> Add a wrapper function to set dma_coherent, avoiding the need for
> complex #ifdef's when setting it in architecture independent code.

No. It might happen to work out on the architectures you're looking at,
but if Hyper-V were ever to support, say, AArch32 VMs you might see the
problem. arch_setup_dma_ops() is the tool for this job.

Robin.

> Signed-off-by: Michael Kelley <mikelley@microsoft.com>
> ---
> include/linux/dma-map-ops.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
> index 0d5b06b..3350e7a 100644
> --- a/include/linux/dma-map-ops.h
> +++ b/include/linux/dma-map-ops.h
> @@ -254,11 +254,20 @@ static inline bool dev_is_dma_coherent(struct device *dev)
> {
> return dev->dma_coherent;
> }
> +static inline void dev_set_dma_coherent(struct device *dev,
> + bool coherent)
> +{
> + dev->dma_coherent = coherent;
> +}
> #else
> static inline bool dev_is_dma_coherent(struct device *dev)
> {
> return true;
> }
> +static inline void dev_set_dma_coherent(struct device *dev,
> + bool coherent)
> +{
> +}
> #endif /* CONFIG_ARCH_HAS_DMA_COHERENCE_H */
>
> void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,

\
 
 \ /
  Last update: 2022-03-17 18:20    [W:0.084 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site