lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 12 May 2009 07:59:02 +0900
From:	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To:	arnd@...db.de
Cc:	fujita.tomonori@....ntt.co.jp, linux-kernel@...r.kernel.org,
	mingo@...e.hu, tony.luck@...el.com, linux-ia64@...r.kernel.org
Subject: Re: [PATCH -tip 1/5] add asm-generic/dma-mappig.h

On Thu, 7 May 2009 12:38:04 +0200
Arnd Bergmann <arnd@...db.de> wrote:

> On Thursday 07 May 2009, FUJITA Tomonori wrote:
> > This header file provides some generic dma mapping function
> > definitions for the users of struct dma_map_ops.
> > 
> > Signed-off-by: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
> 
> I'm currently trying to add asm-generic variants for all of
> the common headers. One of my goals there is to make them
> as complete as possible, i.e. if a header file in asm-generic
> has the same name as one in any of the architectures, it should
> IMHO provide the same (full) API.

I see.


> I would therefore suggest that you either rename the file to
> something like dma-mapping-common.h or add some template
> functions that can be overriden per architecture, like
> 
> #ifndef dma_get_ops
> static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> {
> 	return dma_ops;
> }
> #endif
> #ifndef dma_alloc_coherent
> /*
>  * to be defined out of line
>  */
> extern void *dma_alloc_coherent(struct device *dev, size_t size,
> 		dma_addr_t *dma_handle, gfp_t gfp);
> #endif
> 
> Then an architecture can opt-in to do things like:
> 
> #define dma_get_ops dma_get_ops
> static inline struct dma_map_ops *get_dma_ops(struct device *dev)
> {
> 	return dev->archdata.dma_ops;
> }
> 
> before the #include <asm-generic/dma-mapping.h>

It doesn't fit for what we want with dma-mapping.h and looks really
ugly.

ok, I'll go with something like include/linux/dma-mapping-common.h.


> > +static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
> > +					      size_t size,
> > +					      enum dma_data_direction dir,
> > +					      struct dma_attrs *attrs)
> > +{
> > +	struct dma_map_ops *ops = get_dma_ops(dev);
> > +	dma_addr_t addr;
> > +
> > +	kmemcheck_mark_initialized(ptr, size);
> > +	BUG_ON(!valid_dma_direction(dir));
> > +	addr = ops->map_page(dev, virt_to_page(ptr),
> > +			     (unsigned long)ptr & ~PAGE_MASK, size,
> > +			     dir, NULL);
> > +	debug_dma_map_page(dev, virt_to_page(ptr),
> > +			   (unsigned long)ptr & ~PAGE_MASK, size,
> > +			   dir, addr, true);
> > +	return addr;
> > +}
> 
> You are not passing the dma_attrs down here, which I think you need to,
> if any of the architectures using this file want to support DMA attributes.

Yeah, thanks. It's my silly mistake. IA64 needs dma_attrs so of course
we heed to pass it down here.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ