On Wednesday 28 March 2007 9:09 am, Alan Stern wrote: > On Wed, 28 Mar 2007, Tony Lindgren wrote: > > > Hi, > > > > Here's a little patch to make sure tranfer_buffer is always if DMA > > is temporarily unavailable. I ran into this with tusb6010 that > > currently can only do limited DMA. This fixes a problem of connecting > > storage devices and doing mixed DMA/PIO access.
And isn't that just nasty code, too. Three different DMA engines, three different blocks of unsharable code in the RX and TX paths of both host and peripheral side. Partly that's just nasty code leftover from Mentor ... but a lot of it seems to be because of some software-unfriendly factoring of the DMA interface. > Your patch isn't correct, or at least, it is very misleading. It calls > page_address() in a situation where it cannot be certain that the page > frame lies in accessible kernel memory. On some systems the value it > calculates will be garbage. That is, the usb_buffer_map_sg() can work on highmem pages (which don't tend to exist on ARM!) so that there *is* no valid address to use with transfer_buffer. If you're going to have such code, then it needs to encapsulate some "ifdef CONFIG_HIGHMEM" logic to ensure that the current behavior applies unless there's no highmem. ISTR another issue motivating the either/or use of dma/cpu addresses. It had to do with the dma unmapping operation ... in some cases it will invalidate buffer copies in the CPU cache. That'd mean that if it were appropriate in some case to use the CPU address when a DMA address is provided, the lowlevel code should write back those parts of the dcache, so that if the unmap invalidates them then the data in memory is still correct. - Dave > At a minimum you need to add a comment explaining that if the page isn't > accessible, the transfer_buffer value won't ever be used. > > Alan Stern > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel