usb: gadget: Fix data aborts during USB ethernet boot
PATCH v3 1/1 usb: gadget: Fix data aborts during USB ethernet boot
As seen on GCC 4.6 Linaro compiler, control_req buffer is not aligned on 4 byte boundaray causing data aborts in eth_setup -> conf_buf during dhcp boot over usb_ether. Fix the issue my aligning control_req buffer using DEFINE_CACHE_ALIGN_BUFFER.
Tested on am335x_evm platform (beaglebone).
Applies on 2013.10-rc1 branch.
---
v2 changes:
- Using DEFINE_CACHE_ALIGN_BUFFER macro for the alignment.
- Also fixed alignment for status_req.
v3 changes:
- Adjusted commit message for v2 change.
drivers/usb/gadget/ether.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/gadget/ether.c +3 -2
@@ -849,9 +849,10 @@ static struct usb_gadget_strings stringtab = { };/*============================================================================*/ -static u8 control_req[USB_BUFSIZ ]; +DEFINE_CACHE_ALIGN_BUFFER (u8, control_req,USB_BUFSIZ ); +#if defined(CONFIG_USB_ETH_CDC ) || defined(CONFIG_USB_ETH_RNDIS ) -static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4))); +DEFINE_CACHE_ALIGN_BUFFER (u8, status_req,STATUS_BYTECOUNT );#endif
Signature · 1 line
1.8.1.2
PATCH v3 1/1 usb: gadget: Fix data aborts during USB ethernet boot
Hi Joel Fernandes,
Quoted 16 lines · Joel Fernandes
As seen on GCC 4.6 Linaro compiler,
control_reqbuffer is not aligned on 4 byte boundaray causing data aborts ineth_setup->conf_bufduring dhcp boot overusb_ether. Fix the issue my aligningcontrol_reqbuffer usingDEFINE_CACHE_ALIGN_BUFFER.Tested on
am335x_evmplatform (beaglebone).
Applies on 2013.10-rc1 branch.Cc Tom Rini <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Joel Fernandes <[email protected]>---
v2 changes:
- UsingDEFINE_CACHE_ALIGN_BUFFERmacro for the alignment.
- Also fixed alignment forstatus_req.
Quoted 5 lines
v3 changes:
- Adjusted commit message for v2 change.drivers/usb/gadget/ether.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Test on sama5d3xek board with RNDIS gadget, it still has the unaligned access issue.
However, I test with this patch "usb: gadget: config: fix unaligned access issues" from: Troy Kisky <[email protected]> really fix the unaligned access issue.
more information at: http://patchwork.ozlabs.org/patch/264151/
Quoted 5 lines
drivers/usb/gadget/ether.c +0
-0
drivers/usb/gadget/ether.c static struct usb_gadget_strings stringtab = { · line 856
Quoted 10 lines
drivers/usb/gadget/ether.c +3
-2@@ -849,9 +849,10 @@ static struct usb_gadget_strings stringtab = { };/*============================================================================*/ -static u8 control_req[USB_BUFSIZ ]; +DEFINE_CACHE_ALIGN_BUFFER (u8, control_req,USB_BUFSIZ ); +#if defined(CONFIG_USB_ETH_CDC ) || defined(CONFIG_USB_ETH_RNDIS ) -static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4))); +DEFINE_CACHE_ALIGN_BUFFER (u8, status_req,STATUS_BYTECOUNT );#endif
Best Regards,
Bo Shen
PATCH v3 1/1 usb: gadget: Fix data aborts during USB ethernet boot
Dear Bo Shen,
Quoted 26 lines
Hi Joel Fernandes,
Quoted 17 lines · Joel Fernandes
As seen on GCC 4.6 Linaro compiler,
control_reqbuffer is not aligned on 4 byte boundaray causing data aborts ineth_setup->conf_bufduring dhcp boot overusb_ether. Fix the issue my aligningcontrol_reqbuffer usingDEFINE_CACHE_ALIGN_BUFFER.Tested on
am335x_evmplatform (beaglebone).
Applies on 2013.10-rc1 branch.Cc Tom Rini <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Joel Fernandes <[email protected]>---
v2 changes:
- UsingDEFINE_CACHE_ALIGN_BUFFERmacro for the alignment.
- Also fixed alignment forstatus_req.Quoted 5 lines
v3 changes:
- Adjusted commit message for v2 change.drivers/usb/gadget/ether.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Quoted 8 lines
Test on sama5d3xek board with RNDIS gadget, it still has the unaligned access issue.
However, I test with this patch "usb: gadget: config: fix unaligned access issues" from: Troy Kisky <[email protected]> really fix the unaligned access issue.
more information at: http://patchwork.ozlabs.org/patch/264151/
Troy, care to fix up the patch's commit log so I can try and understand it?
Best regards,
Marek Vasut
Marek Vasut
AppliedPATCH v3 1/1 usb: gadget: Fix data aborts during USB ethernet boot
In reply to Joel FernandesDear Joel Fernandes,
Quoted 27 lines
As seen on GCC 4.6 Linaro compiler,
control_reqbuffer is not aligned on 4 byte boundaray causing data aborts ineth_setup->conf_bufduring dhcp boot overusb_ether. Fix the issue my aligningcontrol_reqbuffer usingDEFINE_CACHE_ALIGN_BUFFER.Tested on
am335x_evmplatform (beaglebone).
Applies on 2013.10-rc1 branch.Cc Tom Rini <[email protected]>Cc Marek Vasut <[email protected]>Signed-off-by Joel Fernandes <[email protected]>---
v2 changes:
- UsingDEFINE_CACHE_ALIGN_BUFFERmacro for the alignment.
- Also fixed alignment forstatus_req.v3 changes:
- Adjusted commit message for v2 change.drivers/usb/gadget/ether.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/usb/gadget/ether.c +0
-0
drivers/usb/gadget/ether.c static struct usb_gadget_strings stringtab = { · line 857
Quoted 10 lines
drivers/usb/gadget/ether.c +3
-1@@ -849,9 +849,10 @@ static struct usb_gadget_strings stringtab = { };/*======================================================================== ====*/ -static u8 control_req[USB_BUFSIZ]; +DEFINE_CACHE_ALIGN_BUFFER (u8, control_req,USB_BUFSIZ ); +#if defined(CONFIG_USB_ETH_CDC ) || defined(CONFIG_USB_ETH_RNDIS ) -static u8 status_req[STATUS_BYTECOUNT] __attribute__ ((aligned(4))); +DEFINE_CACHE_ALIGN_BUFFER (u8, status_req,STATUS_BYTECOUNT );#endif
Applied, thanks
Best regards,
Marek Vasut