All of lore.kernel.org
 help / color / mirror / Atom feed
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: Thu, 7 Jun 2012 21:10:19 +1000	[thread overview]
Message-ID: <4FD08C1B.1090107@snapgear.com> (raw)
In-Reply-To: <CAMuHMdWg6W4uOm3N-etXJud5Lw-vBkstQ2h7HK=6i+sCLgeksQ@mail.gmail.com>

Hi Geert,

On 06/07/2012 03:46 AM, Geert Uytterhoeven wrote:
> On Wed, Jun 6, 2012 at 8:31 AM, Greg Ungerer<gerg@snapgear.com>  wrote:
>> 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.
>
> OK, doing that now...
>
> Then I saw arch/m68k/lib/memcpy.c.
>
> commit f230e80b423f6cb002015ab4771c06a53d5a2287
> ("m68k: fix memcpy to unmatched/unaligned source and dest on 68000")
>
> | The original 68000 processors cannot copy 16bit or larger quantities from
> | odd addresses. All newer members of the 68k family (including ColdFire)
> | can do this.
>
> So all Coldfires can do unaligned _reads_, but not unaligned _writes_
> (exceptions below)?

This strikes me as odd. Maybe this has been wrong all along. I need
to check further but in a little testing I did today I think it may
well be that all ColdFire support unaligned reads and writes.


>>>> 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.
>
> For now, I just make COLDFIRE select it, but we can move it to the individual
> CPU types later.

No matter what I find I still think this is the way to go.

Thanks
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close,                            FAX:         +61 7 3891 3630
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

WARNING: multiple messages have this Message-ID (diff)
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@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] m68k: Use generic strncpy_from_user(), strlen_user(), and strnlen_user()
Date: Thu, 7 Jun 2012 21:10:19 +1000	[thread overview]
Message-ID: <4FD08C1B.1090107@snapgear.com> (raw)
In-Reply-To: <CAMuHMdWg6W4uOm3N-etXJud5Lw-vBkstQ2h7HK=6i+sCLgeksQ@mail.gmail.com>

Hi Geert,

On 06/07/2012 03:46 AM, Geert Uytterhoeven wrote:
> On Wed, Jun 6, 2012 at 8:31 AM, Greg Ungerer<gerg@snapgear.com>  wrote:
>> 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.
>
> OK, doing that now...
>
> Then I saw arch/m68k/lib/memcpy.c.
>
> commit f230e80b423f6cb002015ab4771c06a53d5a2287
> ("m68k: fix memcpy to unmatched/unaligned source and dest on 68000")
>
> | The original 68000 processors cannot copy 16bit or larger quantities from
> | odd addresses. All newer members of the 68k family (including ColdFire)
> | can do this.
>
> So all Coldfires can do unaligned _reads_, but not unaligned _writes_
> (exceptions below)?

This strikes me as odd. Maybe this has been wrong all along. I need
to check further but in a little testing I did today I think it may
well be that all ColdFire support unaligned reads and writes.


>>>> 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.
>
> For now, I just make COLDFIRE select it, but we can move it to the individual
> CPU types later.

No matter what I find I still think this is the way to go.

Thanks
Greg


------------------------------------------------------------------------
Greg Ungerer  --  Principal Engineer        EMAIL:     gerg@snapgear.com
SnapGear Group, McAfee                      PHONE:       +61 7 3435 2888
8 Gardner Close,                            FAX:         +61 7 3891 3630
Milton, QLD, 4064, Australia                WEB: http://www.SnapGear.com

  reply	other threads:[~2012-06-07 11:10 UTC|newest]

Thread overview: 28+ 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-29 21:33 ` Geert Uytterhoeven
2012-05-30  3:07 ` Greg Ungerer
2012-05-30  3:07   ` Greg Ungerer
2012-05-30 10:22 ` Philippe De Muyter
2012-05-30 10:22   ` Philippe De Muyter
2012-05-30 11:20   ` Geert Uytterhoeven
2012-05-30 11:20   ` Geert Uytterhoeven
2012-05-30 14:04     ` Philippe De Muyter
2012-05-30 14:04       ` Philippe De Muyter
2012-06-05 20:57       ` Geert Uytterhoeven
2012-06-05 20:57       ` Geert Uytterhoeven
2012-06-06  6:31         ` Greg Ungerer
2012-06-06  6:31           ` Greg Ungerer
2012-06-06 17:46           ` Geert Uytterhoeven
2012-06-06 17:46           ` Geert Uytterhoeven
2012-06-07 11:10             ` Greg Ungerer [this message]
2012-06-07 11:10               ` Greg Ungerer
2012-06-07 13:14               ` Andreas Schwab
2012-06-08  4:14                 ` Greg Ungerer
2012-06-08  4:14                 ` Greg Ungerer
2012-06-07 13:14               ` Andreas Schwab
2012-06-06 13:44       ` Geert Uytterhoeven
2012-06-06 13:44         ` Geert Uytterhoeven
2012-06-06 15:20         ` Philippe De Muyter
2012-06-06 15:20           ` Philippe De Muyter
2012-05-30 14:42     ` Andreas Schwab
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=4FD08C1B.1090107@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.