From: Greg Ungerer <gerg@snapgear.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Philippe De Muyter <phdm@macqel.be>,
Greg Ungerer <gerg@uclinux.org>,
linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] m68k: Use generic strncpy_from_user(), strlen_user(), and strnlen_user()
Date: Wed, 6 Jun 2012 16:31:50 +1000 [thread overview]
Message-ID: <4FCEF956.9090603@snapgear.com> (raw)
In-Reply-To: <CAMuHMdW29QYN6XpBb9F3GGoJ-9frrD-00Wx=FchT9ALqW1LcPg@mail.gmail.com>
Hi Geert,
On 06/06/12 06:57, Geert Uytterhoeven wrote:
> On Wed, May 30, 2012 at 4:04 PM, Philippe De Muyter<phdm@macqel.be> wrote:
>> On Wed, May 30, 2012 at 01:20:02PM +0200, Geert Uytterhoeven wrote:
>>> On Wed, May 30, 2012 at 12:22 PM, Philippe De Muyter<phdm@macqel.be> wrote:
>>>> On Tue, May 29, 2012 at 11:33:36PM +0200, Geert Uytterhoeven wrote:
>>>>> Signed-off-by: Geert Uytterhoeven<geert@linux-m68k.org>
>>>>> ---
>>>>> Do we also want
>>>>>
>>>>> select HAVE_EFFICIENT_UNALIGNED_ACCESS if (!COLDFIRE&& !M68000)
>>>>
>>>> Sorry, I did not follow what happened to unaligned accesses, but
>>>> CPU32 family (at least 68340) crashes on unaligned accesses.
>>>
>>> We don't seem to have CONFIG_M68340 in arch/m68k/Kconfig.cpu?
>>
>> I have a local port here (but based on an ancient linux kernel, 2.6.2 IIRC)
>>
>>> But Freescale's website confirms both 68340 and 68360 are CPU32.
>>>
>>> arch/m68k/include/asm/unaligned.h assumes CPU32 (CONFIG_MCPU32)
>>> can do unaligned accesses:
>>
>> That's not true. Accessing a 16- or 32-bit word at an odd address
>> with a 68340 generates an Address Error Exception. I remember
>> discovering a bug in the ppp kernel code because of that.
>>
>>>
>>> #if defined(CONFIG_COLDFIRE) || defined(CONFIG_M68000)
>>> #include<linux/unaligned/be_struct.h>
>>> #include<linux/unaligned/le_byteshift.h>
>>> #include<linux/unaligned/generic.h>
>>>
>>> #define get_unaligned __get_unaligned_be
>>> #define put_unaligned __put_unaligned_be
>>>
>>> #else
>>> /*
>>> * The m68k can do unaligned accesses itself.
>>> */
>>> #include<linux/unaligned/access_ok.h>
>>> #include<linux/unaligned/generic.h>
>>>
>>> #define get_unaligned __get_unaligned_be
>>> #define put_unaligned __put_unaligned_be
>>>
>>> #endif
>>>
>>> Is this wrong?
>>
>> I can't tell from reading just the lines above, but I think one should add
>> "|| defined(CONFIG_MCPU32)" at the end of the if condition.
>
> Greg?
>
> If more CPUs cannot handle unaligned accesses, I propose to add
> CONFIG_CPU_HAS_NO_UNALIGNED.
Yes, looks like that should have a "|| defined(CONFIG_CPU32)".
(According to the CPU32 reference manual words and long words must
be aligned on word boundaries.)
I think something like CONFIG_CPU_HAS_NO_UNALIGNED makes sense.
>> I also think that the Coldfire 5272 can do unaligned accesses, but I
>> cannot test that at the moment.
According to the MCF5272 User Manual, "it supports misaligned data
accesses ...". So it looks like it does.
Having a CONFIG_CPU_HAS_NO_UNALIGNED looks like a really good solution
then. We need to be able select it as required on individual CPU types.
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
next prev parent reply other threads:[~2012-06-06 6:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-29 21:33 [PATCH] m68k: Use generic strncpy_from_user(), strlen_user(), and strnlen_user() Geert Uytterhoeven
2012-05-30 3:07 ` Greg Ungerer
2012-05-30 10:22 ` Philippe De Muyter
2012-05-30 11:20 ` Geert Uytterhoeven
[not found] ` <CAMuHMdV5GVZR1BvGD3EncDFfPt=Bt9ndkKE8Mp7euE9KoSaGNQ@mail.gmail.com>
2012-05-30 14:04 ` Philippe De Muyter
2012-06-05 20:57 ` Geert Uytterhoeven
[not found] ` <CAMuHMdW29QYN6XpBb9F3GGoJ-9frrD-00Wx=FchT9ALqW1LcPg@mail.gmail.com>
2012-06-06 6:31 ` Greg Ungerer [this message]
2012-06-06 17:46 ` Geert Uytterhoeven
[not found] ` <CAMuHMdWg6W4uOm3N-etXJud5Lw-vBkstQ2h7HK=6i+sCLgeksQ@mail.gmail.com>
2012-06-07 11:10 ` Greg Ungerer
2012-06-07 13:14 ` Andreas Schwab
[not found] ` <m2bokvw9f1.fsf@igel.home>
2012-06-08 4:14 ` Greg Ungerer
2012-06-06 13:44 ` Geert Uytterhoeven
2012-06-06 15:20 ` Philippe De Muyter
2012-05-30 14:42 ` Andreas Schwab
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=4FCEF956.9090603@snapgear.com \
--to=gerg@snapgear.com \
--cc=geert@linux-m68k.org \
--cc=gerg@uclinux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=phdm@macqel.be \
/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