This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ARM unaligned MMIO access with attribute((packed))
- From: Rabin Vincent <rabin at rab dot in>
- To: Alan Stern <stern at rowland dot harvard dot edu>
- Cc: Arnd Bergmann <arnd at arndb dot de>, linux-arm-kernel at lists dot infradead dot org, linux-usb at vger dot kernel dot org, Ulrich Weigand <Ulrich dot Weigand at de dot ibm dot com>, linux-kernel at vger dot kernel dot org, gcc at gcc dot gnu dot org, Peter Maydell <peter dot maydell at linaro dot org>
- Date: Wed, 27 Apr 2011 19:36:00 +0530
- Subject: Re: ARM unaligned MMIO access with attribute((packed))
- References: <BANLkTi=-DFfdiBKZzRBxF-yMJFtWnzuk1g@mail.gmail.com> <Pine.LNX.4.44L0.1104261447481.2035-100000@iolanthe.rowland.org>
On Wed, Apr 27, 2011 at 00:21, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Tue, 26 Apr 2011, Rabin Vincent wrote:
>> In my case it's this writel() in ehci-hub.c that gets chopped into
>> strbs:
>>
>> ? ? ? /* force reset to complete */
>> ? ? ? ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET),
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? status_reg);
>
> Why would that get messed up? ?The status_reg variable doesn't have any
> __atribute__((packed)) associated with it.
The initialization of status_reg is:
u32 __iomem *status_reg
= &ehci->regs->port_status[(wIndex & 0xff) - 1];
where ehci->regs is a pointer to the packed struct ehci_regs. So, this
is the same problem of casting pointers to stricter alignment.