From: Grant Likely <grant.likely@secretlab.ca>
To: Steve Deiters <SteveDeiters@basler.com>
Cc: linuxppc-dev@lists.ozlabs.org, David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] arch/powerpc/lib/copy_32.S: Use alternate memcpy for MPC512x and MPC52xx
Date: Thu, 8 Jul 2010 09:22:03 -0600 [thread overview]
Message-ID: <AANLkTikP_ZrWddakihhslDHphEaDsW-IQY4C-lDoXEgm@mail.gmail.com> (raw)
In-Reply-To: <181804936ABC2349BE503168465576460F3D3E66@exchserver.basler.com>
On Thu, Jul 8, 2010 at 8:38 AM, Steve Deiters <SteveDeiters@basler.com> wro=
te:
>> -----Original Message-----
>> From: glikely@secretlab.ca [mailto:glikely@secretlab.ca] On
>> Behalf Of Grant Likely
>> Sent: Thursday, July 08, 2010 12:38 AM
>> To: Benjamin Herrenschmidt
>> Cc: Steve Deiters; linuxppc-dev@lists.ozlabs.org
>> Subject: Re: [PATCH] arch/powerpc/lib/copy_32.S: Use
>> alternate memcpy for MPC512x and MPC52xx
>>
>> On Wed, Jul 7, 2010 at 11:10 PM, Benjamin Herrenschmidt
>> <benh@kernel.crashing.org> wrote:
>> > On Tue, 2010-06-29 at 11:04 -0500, Steve Deiters wrote:
>> >> These processors will corrupt data if accessing the local bus with
>> >> unaligned addresses. This version fixes the typical case
>> of copying
>> >> from Flash on the local bus by keeping the source address always
>> >> aligned.
>> >
>> > Shouldn't this be solved by using memcpy_to/fromio ?
>>
>> Maybe. =A0plain memcpy() access to anything localbus-attached
>> on the mpc5xxx is the wrong thing to do. =A0memcpy_to/fromio
>> might do the right thing; but the caller must understand the
>> limitations of the localplus bus. =A0The byte-wise alignment
>> that memcpy_to/fromio() does may not work (depending on
>> configuration).
>>
>> Steve, what code is doing a memcpy from flash?
>>
>> g.
>
> This was done in the JFFS2 code, in fs/jffs2/scan.c. =A0At least in one
> function, in jffs2_scan_dirent_node it was using memcpy on a localbus
> mapped structure. =A0I was getting JFFS2 filesystem corruption because of
> this. =A0In fact I first tried changing this to memcpy_fromio and it fixe=
d
> that particular problem. =A0I was concerned though that other places I wa=
s
> not aware of might be using memcpy from the localbus in a similar manner
> so I decided to just tweak the memcpy routine.
[cc'ing David Woodhouse]
Sounds to me like the right thing to do is to fix the jffs2 code.
> Just out of curiousity, what configuration might cause a byte-wise
> alignment not to work?
Can't remember the register configuration, but I worked on one project
where this was the case. In hindsight, it was probably a
mis-configuration of the localbus CS for the particular device.
g.
--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
next prev parent reply other threads:[~2010-07-08 15:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-29 16:04 [PATCH] arch/powerpc/lib/copy_32.S: Use alternate memcpy for MPC512x and MPC52xx Steve Deiters
2010-06-29 16:58 ` Segher Boessenkool
2010-07-08 5:10 ` Benjamin Herrenschmidt
2010-07-08 5:38 ` Grant Likely
2010-07-08 14:38 ` Steve Deiters
2010-07-08 15:22 ` Grant Likely [this message]
2010-07-08 18:40 ` Albrecht Dreß
2010-07-08 19:30 ` Segher Boessenkool
2010-07-08 20:09 ` Scott Wood
2010-07-09 12:59 ` Segher Boessenkool
2010-07-09 16:18 ` Scott Wood
2010-07-08 20:09 ` Albrecht Dreß
2010-07-09 13:03 ` Segher Boessenkool
2010-07-11 7:40 ` Milton Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTikP_ZrWddakihhslDHphEaDsW-IQY4C-lDoXEgm@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=SteveDeiters@basler.com \
--cc=dwmw2@infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).