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]
Message-ID: <Pine.LNX.4.44L0.1308191106040.3616-100000@netrider.rowland.org>
Date:	Mon, 19 Aug 2013 11:09:32 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
cc:	Arnd Bergmann <arnd@...db.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
	Linux Media Mailing List <linux-media@...r.kernel.org>,
	USB list <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: USB host support should depend on HAS_DMA

On Sun, 18 Aug 2013, Geert Uytterhoeven wrote:

> On Thu, Jul 11, 2013 at 1:12 AM, Arnd Bergmann <arnd@...db.de> wrote:
> > On Wednesday 10 July 2013, Alan Stern wrote:
> >> This isn't right.  There are USB host controllers that use PIO, not
> >> DMA.  The HAS_DMA dependency should go with the controller driver, not
> >> the USB core.
> >>
> >> On the other hand, the USB core does call various routines like
> >> dma_unmap_single.  It ought to be possible to compile these calls even
> >> when DMA isn't enabled.  That is, they should be defined as do-nothing
> >> stubs.
> >
> > The asm-generic/dma-mapping-broken.h file intentionally causes link
> > errors, but that could be changed.
> >
> > The better approach in my mind would be to replace code like
> >
> >
> >         if (hcd->self.uses_dma)
> >
> > with
> >
> >         if (IS_ENABLED(CONFIG_HAS_DMA) && hcd->self.uses_dma) {
> >
> > which will reliably cause that reference to be omitted from object code,
> > but not stop giving link errors for drivers that actually require
> > DMA.
> 
> This can be done for drivers/usb/core/hcd.c.
> 
> But I'm a bit puzzled by drivers/usb/core/buffer.c. E.g.
> 
> void *hcd_buffer_alloc(...)
> {
>         ....
>         /* some USB hosts just use PIO */
>         if (!bus->controller->dma_mask &&
>             !(hcd->driver->flags & HCD_LOCAL_MEM)) {

I don't remember the full story.  You should check with the person who
added the HCD_LOCAL_MEM flag originally.

> So if DMA is not used (!hcd->self.uses_dma, i.e. bus->controller->dma_mask
> is zero), and HCD_LOCAL_MEM is set, we still end up calling dma_pool_alloc()?
> 
> (Naively, I'm not so familiar with the USB code) I'd expect it to use
> kmalloc() instead?

Maybe what happens in this case is that some sort of hook causes the 
allocation to be made from a special memory-mapped region on board the 
controller.

Alan Stern

--
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