public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix ehci alignment error
@ 2011-10-10 12:38 Harro Haan
  2011-10-10 14:14 ` Greg KH
  2011-10-10 15:28 ` Alan Stern
  0 siblings, 2 replies; 8+ messages in thread
From: Harro Haan @ 2011-10-10 12:38 UTC (permalink / raw)
  To: Alan Stern, Greg Kroah-Hartman
  Cc: Lennert Buytenhek, Nicolas Pitre, linux-usb, linux-arm-kernel,
	linux-kernel, Harro Haan

[-- Attachment #1: fix-ehci-alignment-error.patch --]
[-- Type: text/plain, Size: 688 bytes --]

The Kirkwood gave an unaligned memory access error on
line 742 of drivers/usb/host/echi-hcd.c:
"ehci->last_periodic_enable = ktime_get_real();"

Signed-off-by: Harro Haan <hrhaan@gmail.com>
---
 include/linux/usb/hcd.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 0097136..c0ecc5a 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -178,7 +178,7 @@ struct usb_hcd {
 	 * this structure.
 	 */
 	unsigned long hcd_priv[0]
-			__attribute__ ((aligned(sizeof(unsigned long))));
+			__attribute__ ((aligned(sizeof(s64))));
 };
 
 /* 2.4 does this a bit differently ... */
-- 
1.7.0.4





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] fix ehci alignment error
  2011-10-10 12:38 [PATCH] fix ehci alignment error Harro Haan
@ 2011-10-10 14:14 ` Greg KH
  2011-10-10 16:29   ` Måns Rullgård
  2011-10-10 15:28 ` Alan Stern
  1 sibling, 1 reply; 8+ messages in thread
From: Greg KH @ 2011-10-10 14:14 UTC (permalink / raw)
  To: Harro Haan
  Cc: Alan Stern, Lennert Buytenhek, Nicolas Pitre, linux-usb,
	linux-arm-kernel, linux-kernel

On Mon, Oct 10, 2011 at 02:38:27PM +0200, Harro Haan wrote:
> The Kirkwood gave an unaligned memory access error on
> line 742 of drivers/usb/host/echi-hcd.c:
> "ehci->last_periodic_enable = ktime_get_real();"

What is "The Kirkwood"?  What size processor is this?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fix ehci alignment error
  2011-10-10 12:38 [PATCH] fix ehci alignment error Harro Haan
  2011-10-10 14:14 ` Greg KH
@ 2011-10-10 15:28 ` Alan Stern
  1 sibling, 0 replies; 8+ messages in thread
From: Alan Stern @ 2011-10-10 15:28 UTC (permalink / raw)
  To: Harro Haan
  Cc: Greg Kroah-Hartman, Lennert Buytenhek, Nicolas Pitre, linux-usb,
	linux-arm-kernel, linux-kernel

On Mon, 10 Oct 2011, Harro Haan wrote:

> The Kirkwood gave an unaligned memory access error on
> line 742 of drivers/usb/host/echi-hcd.c:
> "ehci->last_periodic_enable = ktime_get_real();"
> 
> Signed-off-by: Harro Haan <hrhaan@gmail.com>
> ---
>  include/linux/usb/hcd.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
> index 0097136..c0ecc5a 100644
> --- a/include/linux/usb/hcd.h
> +++ b/include/linux/usb/hcd.h
> @@ -178,7 +178,7 @@ struct usb_hcd {
>  	 * this structure.
>  	 */
>  	unsigned long hcd_priv[0]
> -			__attribute__ ((aligned(sizeof(unsigned long))));
> +			__attribute__ ((aligned(sizeof(s64))));
>  };
>  
>  /* 2.4 does this a bit differently ... */

Acked-by: Alan Stern <stern@rowland.harvard.edu>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fix ehci alignment error
  2011-10-10 14:14 ` Greg KH
@ 2011-10-10 16:29   ` Måns Rullgård
  2011-10-10 17:00     ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Måns Rullgård @ 2011-10-10 16:29 UTC (permalink / raw)
  To: Greg KH
  Cc: Harro Haan, Alan Stern, Lennert Buytenhek, Nicolas Pitre,
	linux-usb, linux-arm-kernel, linux-kernel

Greg KH <gregkh@suse.de> writes:

> On Mon, Oct 10, 2011 at 02:38:27PM +0200, Harro Haan wrote:
>> The Kirkwood gave an unaligned memory access error on
>> line 742 of drivers/usb/host/echi-hcd.c:
>> "ehci->last_periodic_enable = ktime_get_real();"
>
> What is "The Kirkwood"?  What size processor is this?

It's an ARM926-like CPU from Marvell.

-- 
Måns Rullgård
mans@mansr.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fix ehci alignment error
  2011-10-10 16:29   ` Måns Rullgård
@ 2011-10-10 17:00     ` Greg KH
  2011-10-10 17:31       ` Mikael Pettersson
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2011-10-10 17:00 UTC (permalink / raw)
  To: Måns Rullgård
  Cc: Harro Haan, Alan Stern, Lennert Buytenhek, Nicolas Pitre,
	linux-usb, linux-arm-kernel, linux-kernel

On Mon, Oct 10, 2011 at 05:29:13PM +0100, Måns Rullgård wrote:
> Greg KH <gregkh@suse.de> writes:
> 
> > On Mon, Oct 10, 2011 at 02:38:27PM +0200, Harro Haan wrote:
> >> The Kirkwood gave an unaligned memory access error on
> >> line 742 of drivers/usb/host/echi-hcd.c:
> >> "ehci->last_periodic_enable = ktime_get_real();"
> >
> > What is "The Kirkwood"?  What size processor is this?
> 
> It's an ARM926-like CPU from Marvell.

32 or 64bit?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fix ehci alignment error
  2011-10-10 17:00     ` Greg KH
@ 2011-10-10 17:31       ` Mikael Pettersson
  2011-10-10 17:38         ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Mikael Pettersson @ 2011-10-10 17:31 UTC (permalink / raw)
  To: Greg KH
  Cc: Måns Rullgård, Nicolas Pitre, linux-usb, Harro Haan,
	linux-kernel, Alan Stern, Lennert Buytenhek, linux-arm-kernel

Greg KH writes:
 > On Mon, Oct 10, 2011 at 05:29:13PM +0100, Måns Rullgård wrote:
 > > Greg KH <gregkh@suse.de> writes:
 > > 
 > > > On Mon, Oct 10, 2011 at 02:38:27PM +0200, Harro Haan wrote:
 > > >> The Kirkwood gave an unaligned memory access error on
 > > >> line 742 of drivers/usb/host/echi-hcd.c:
 > > >> "ehci->last_periodic_enable = ktime_get_real();"
 > > >
 > > > What is "The Kirkwood"?  What size processor is this?
 > > 
 > > It's an ARM926-like CPU from Marvell.
 > 
 > 32 or 64bit?

All ARMs are 32-bit, but some have instructions for loading or
storing 2 x 32 bits at a time, but also require the corresponding
memory address to be 64-bit aligned.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fix ehci alignment error
  2011-10-10 17:31       ` Mikael Pettersson
@ 2011-10-10 17:38         ` Greg KH
  2011-10-10 18:41           ` Måns Rullgård
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2011-10-10 17:38 UTC (permalink / raw)
  To: Mikael Pettersson
  Cc: Måns Rullgård, Nicolas Pitre, linux-usb, Harro Haan,
	linux-kernel, Alan Stern, Lennert Buytenhek, linux-arm-kernel

On Mon, Oct 10, 2011 at 07:31:26PM +0200, Mikael Pettersson wrote:
> Greg KH writes:
>  > On Mon, Oct 10, 2011 at 05:29:13PM +0100, Måns Rullgård wrote:
>  > > Greg KH <gregkh@suse.de> writes:
>  > > 
>  > > > On Mon, Oct 10, 2011 at 02:38:27PM +0200, Harro Haan wrote:
>  > > >> The Kirkwood gave an unaligned memory access error on
>  > > >> line 742 of drivers/usb/host/echi-hcd.c:
>  > > >> "ehci->last_periodic_enable = ktime_get_real();"
>  > > >
>  > > > What is "The Kirkwood"?  What size processor is this?
>  > > 
>  > > It's an ARM926-like CPU from Marvell.
>  > 
>  > 32 or 64bit?
> 
> All ARMs are 32-bit, but some have instructions for loading or
> storing 2 x 32 bits at a time, but also require the corresponding
> memory address to be 64-bit aligned.

Ah, ok, that makes more sense here.  I'll go queue it up.

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fix ehci alignment error
  2011-10-10 17:38         ` Greg KH
@ 2011-10-10 18:41           ` Måns Rullgård
  0 siblings, 0 replies; 8+ messages in thread
From: Måns Rullgård @ 2011-10-10 18:41 UTC (permalink / raw)
  To: Greg KH
  Cc: Mikael Pettersson, Måns Rullgård, Nicolas Pitre,
	linux-usb, Harro Haan, linux-kernel, Alan Stern,
	Lennert Buytenhek, linux-arm-kernel

Greg KH <gregkh@suse.de> writes:

> On Mon, Oct 10, 2011 at 07:31:26PM +0200, Mikael Pettersson wrote:
>> Greg KH writes:
>>  > On Mon, Oct 10, 2011 at 05:29:13PM +0100, Måns Rullgård wrote:
>>  > > Greg KH <gregkh@suse.de> writes:
>>  > > 
>>  > > > On Mon, Oct 10, 2011 at 02:38:27PM +0200, Harro Haan wrote:
>>  > > >> The Kirkwood gave an unaligned memory access error on
>>  > > >> line 742 of drivers/usb/host/echi-hcd.c:
>>  > > >> "ehci->last_periodic_enable = ktime_get_real();"
>>  > > >
>>  > > > What is "The Kirkwood"?  What size processor is this?
>>  > > 
>>  > > It's an ARM926-like CPU from Marvell.
>>  > 
>>  > 32 or 64bit?
>> 
>> All ARMs are 32-bit, but some have instructions for loading or
>> storing 2 x 32 bits at a time, but also require the corresponding
>> memory address to be 64-bit aligned.

To be perfectly accurate, all ARMs have the dual load/store instructions,
but only some (ARMv5 and earlier) require a 64-bit aligned address for
these.  The Kirkwood is an ARMv5 so it does need this alignment.

Furthermore, the standard ARM ABI requires 8-byte alignment for 64-bit
data types regardless of CPU version, which is perhaps a bit unusual for
a 32-bit architecture.

-- 
Måns Rullgård
mans@mansr.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-10-10 18:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-10 12:38 [PATCH] fix ehci alignment error Harro Haan
2011-10-10 14:14 ` Greg KH
2011-10-10 16:29   ` Måns Rullgård
2011-10-10 17:00     ` Greg KH
2011-10-10 17:31       ` Mikael Pettersson
2011-10-10 17:38         ` Greg KH
2011-10-10 18:41           ` Måns Rullgård
2011-10-10 15:28 ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox