lkml.org 
[lkml]   [2007]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC/PATCH] allow memory to be tagged "coherent" via dma_map_sg()
On Mon, Jul 16, 2007 at 07:18:12PM -0700, akepner@sgi.com wrote:

> diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h
> index 6299b51..22af26b 100644
> --- a/include/asm-ia64/dma-mapping.h
> +++ b/include/asm-ia64/dma-mapping.h
> @@ -73,4 +73,26 @@ dma_cache_sync (struct device *dev, void *vaddr, size_t size,
>
> #define dma_is_consistent(d, h) (1) /* all we do is coherent memory... */
>
> +#define ARCH_DOES_POSTED_DMA
> +#define DMA_ATTR_SHIFT 8 /* bottom 8 bits for direction, upper bits
> + * for additional "attributes". For now the
> + * only attribute is "flush in-flight dma
> + * when writing to scatterlist" */
> +#define DMA_DIR_MASK ((1 << DMA_ATTR_SHIFT) - 1)
> +#define DMA_ATTR_MASK ~DMA_DIR_MASK
> +static inline int
> +dma_data_direction_set_dmaflush(enum dma_data_direction dir, int dmaflush) {
> + return (dir | (dmaflush << DMA_ATTR_SHIFT));
> +}
> +
> +static inline int
> +dma_data_direction_get_direction(enum dma_data_direction dir) {
> + return (dir & DMA_DIR_MASK);
> +}
> +
> +static inline int
> +dma_data_direction_get_dmaflush(enum dma_data_direction dir) {
> + return ((dir & DMA_ATTR_MASK) >> DMA_ATTR_SHIFT);
> +}
> +
> #endif /* _ASM_IA64_DMA_MAPPING_H */
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 9a663c6..885589a 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -95,4 +95,11 @@ static inline void dmam_release_declared_memory(struct device *dev)
> }
> #endif /* ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY */
>
> +#ifndef ARCH_DOES_POSTED_DMA
> +static inline int
> +dma_data_direction_set_dmaflush(enum dma_data_direction dir, int dmaflush) {
> + return (dir);
> +}
> +#endif /* ARCH_DOES_POSTED_DMA */
> +
> #endif

The generic bits look much better than the previous version,
thanks. Is the generic dma_data_direction_set_dmaflush really needed?
if yes, what about dma_data_direction_get_direction and
dma_data_direction_get_dmaflush?

Cheers,
Muli
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-17 12:19    [W:0.034 / U:16.760 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site