diff mbox

[UBOOT,RFC,13/13] dwc3: core: Change the bounce buffer size to 4096

Message ID 1408372115-4570-14-git-send-email-kishon@ti.com
State New
Headers show

Commit Message

Kishon Vijay Abraham I Aug. 18, 2014, 2:28 p.m. UTC
Bounce buffer is used for transferring requests which is not maxpacket
aligned. In the case of DFU the requests can be upto 4096 bytes.

While the actual fix for this should be using two chained TRBs to handle
the transfer, this can be used as a temporary fix.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/usb/dwc3/core.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kishon Vijay Abraham I Aug. 19, 2014, 4:15 p.m. UTC | #1
Hi,

On Monday 18 August 2014 08:11 PM, Felipe Balbi wrote:
> On Mon, Aug 18, 2014 at 07:58:35PM +0530, Kishon Vijay Abraham I wrote:
>> Bounce buffer is used for transferring requests which is not maxpacket
>> aligned. In the case of DFU the requests can be upto 4096 bytes.
>>
>> While the actual fix for this should be using two chained TRBs to handle
>> the transfer, this can be used as a temporary fix.
> 
> Did you manage to trigger this fault ? Was the size larger than 512 ?

yeah.. transferring any kernel image resulted in a size larger than 512.
> I'm inclined into getting a real fix instead of just patching around.
> 
> That way, the kernel benefits too as we can port the same patch there.


sure.

Thanks
Kishon
Felipe Balbi Aug. 19, 2014, 4:27 p.m. UTC | #2
On Tue, Aug 19, 2014 at 09:45:11PM +0530, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On Monday 18 August 2014 08:11 PM, Felipe Balbi wrote:
> > On Mon, Aug 18, 2014 at 07:58:35PM +0530, Kishon Vijay Abraham I wrote:
> >> Bounce buffer is used for transferring requests which is not maxpacket
> >> aligned. In the case of DFU the requests can be upto 4096 bytes.
> >>
> >> While the actual fix for this should be using two chained TRBs to handle
> >> the transfer, this can be used as a temporary fix.
> > 
> > Did you manage to trigger this fault ? Was the size larger than 512 ?
> 
> yeah.. transferring any kernel image resulted in a size larger than 512.

but it's also larger than 4KiB :-)
Kishon Vijay Abraham I Aug. 22, 2014, 11:02 a.m. UTC | #3
Hi,

On Tuesday 19 August 2014 09:57 PM, Felipe Balbi wrote:
> On Tue, Aug 19, 2014 at 09:45:11PM +0530, Kishon Vijay Abraham I wrote:
>> Hi,
>>
>> On Monday 18 August 2014 08:11 PM, Felipe Balbi wrote:
>>> On Mon, Aug 18, 2014 at 07:58:35PM +0530, Kishon Vijay Abraham I wrote:
>>>> Bounce buffer is used for transferring requests which is not maxpacket
>>>> aligned. In the case of DFU the requests can be upto 4096 bytes.
>>>>
>>>> While the actual fix for this should be using two chained TRBs to handle
>>>> the transfer, this can be used as a temporary fix.
>>>
>>> Did you manage to trigger this fault ? Was the size larger than 512 ?
>>
>> yeah.. transferring any kernel image resulted in a size larger than 512.
> 
> but it's also larger than 4KiB :-)

Yeah. But the DFU specifies the maximum transfer size in wTransferSize (DFU
function descriptor) to the host which is 4096 bytes (DFU_USB_BUFSIZ).

So the max size will be only 4KB.

Thanks
Kishon
Felipe Balbi Aug. 22, 2014, 1:54 p.m. UTC | #4
On Fri, Aug 22, 2014 at 04:32:10PM +0530, Kishon Vijay Abraham I wrote:
> Hi,
> 
> On Tuesday 19 August 2014 09:57 PM, Felipe Balbi wrote:
> > On Tue, Aug 19, 2014 at 09:45:11PM +0530, Kishon Vijay Abraham I wrote:
> >> Hi,
> >>
> >> On Monday 18 August 2014 08:11 PM, Felipe Balbi wrote:
> >>> On Mon, Aug 18, 2014 at 07:58:35PM +0530, Kishon Vijay Abraham I wrote:
> >>>> Bounce buffer is used for transferring requests which is not maxpacket
> >>>> aligned. In the case of DFU the requests can be upto 4096 bytes.
> >>>>
> >>>> While the actual fix for this should be using two chained TRBs to handle
> >>>> the transfer, this can be used as a temporary fix.
> >>>
> >>> Did you manage to trigger this fault ? Was the size larger than 512 ?
> >>
> >> yeah.. transferring any kernel image resulted in a size larger than 512.
> > 
> > but it's also larger than 4KiB :-)
> 
> Yeah. But the DFU specifies the maximum transfer size in wTransferSize (DFU
> function descriptor) to the host which is 4096 bytes (DFU_USB_BUFSIZ).
> 
> So the max size will be only 4KB.

ah, ok. Thanks for that detail.
diff mbox

Patch

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index e9ea7ca..e9f43b4 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -24,7 +24,7 @@ 
 #include <linux/usb/otg.h>
 
 /* Global constants */
-#define DWC3_EP0_BOUNCE_SIZE	512
+#define DWC3_EP0_BOUNCE_SIZE	4096
 #define DWC3_ENDPOINTS_NUM	32
 #define DWC3_XHCI_RESOURCES_NUM	2