Re: [PATCH 1/2] USB: Allow HCDs to specifiy their DMA alignment requirements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/9/5 Martin Fuzzey <mfuzzey@xxxxxxxxx>:
> On Sat, Sep 4, 2010 at 4:46 PM, Ming Lei <tom.leiming@xxxxxxxxx> wrote:
>>
>> Seems there is very few such cases (buffer is not aligned to the
>> HC controller requirement) now, why not fix it in upper driver (do the
>> bounce and PIO in interface driver instead of usbcore)?
>>
> What is the "upper driver"?  (the Host Controller Driver or the usb
> "function" driver (usbnet, etc etc). [Is there an accepted non ambiguous
> term for this more explicit than just "usb driver"?]

Maybe 'usb interface driver' is better than 'function driver', as I said,
since function is used to describe entity in usb gadaget generally.

>
> I don't think fixing this in the "function" driver is right - there are too
> many of them and they shouldn't need to be concerned with this type
> of low level issue. Whether they should be able to discover the low
> level requirements to perform _optional_ optimisations is another
> question.

Yes, there are lots of usb interface drivers in kernel, but very few may
pass unaligned buffer address to usbcore, the 'unaligned' means unaligned
in DMA mapping.

If you think there are many interface drivers which may pass unaligned
buffer address into usbcore, please post them in mail list.

Generally speaking, if one buffer address is aligned in DMA mapping, it is
certainly aligned in HC hardware requirement.

So I recommend to fix the problem in usb interface driver, instead of usbcore
or HCD.

>
> Here are the tradeoffs I see between usbcore and HCD implementation:
>
> Advantages of usbcore implementation:
> * Single point of implementation for all HCDs that may need it
>
> Currently I think imx21-hcd is the only in tree one but at least
> two others not yet in tree have similar requirements. Someone
> also reported using this patch for musb but I think there's another
> patch out there for that.
> There is already a precedent in that usbcore manages bounce
> buffers for HCDs requiring "local" memory (HCD_LOCAL_MEM)
>
> * For core mapped buffers no need to sync the buffer before
> copying it (since the core can copy the buffer before mapping it)
>
> Advantages of HCD implementation:
> * HCD can make "intelligent" decisions (such as using bounce
> buffer for large unaligned transfers and PIO for small ones)

I don't think HCD has knowledge to conclude one buffer is dma coherent
or streaming mapping.

thanks,
-- 
Lei Ming
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux