From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: let CPUs not being able to run in ARM mode enter in THUMB mode
Date: Mon, 14 Jan 2013 10:50:50 +0100 [thread overview]
Message-ID: <20130114095050.GO14860@pengutronix.de> (raw)
In-Reply-To: <20130111162016.GM14860@pengutronix.de>
Hello Russell,
On Fri, Jan 11, 2013 at 05:20:16PM +0100, Uwe Kleine-K?nig wrote:
> On Fri, Jan 11, 2013 at 04:07:53PM +0000, Russell King - ARM Linux wrote:
> > On Fri, Jan 11, 2013 at 12:39:57PM +0100, Uwe Kleine-K?nig wrote:
> > > +# Select this if your CPU doesn't support the 32 bit ARM instructions.
> > > +config THUMBONLY_CPU
> > > + bool
> > > + select THUMB2_KERNEL
> > > + select ARM_THUMB
> >
> > Hmm, not convinced this is the best solution. Yes, fine for there to be
> > a THUMBONLY_CPU option, _but_ not the select statements onto user visible
> > symbols. We can get this instead by:
> >
> > config THUMB2_KERNEL
> > bool "Compile the kernel in Thumb-2 mode" if !THUMBONLY_CPU
> > depends on (CPU_V7 && !CPU_V6 && !CPU_V6K) || THUMBONLY_CPU
> > default y if THUMBONLY_CPU
> > select AEABI
> > select ARM_ASM_UNIFIED
> > select ARM_UNWIND
> >
> > and:
> >
> > config ARM_THUMB
> > bool "Support Thumb user binaries" if !THUMBONLY_CPU
> > depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || \
> > CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || \
> > CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || \
> > CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || \
> > CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || \
> > CPU_V6K || CPU_V7 || CPU_FEROCEON || THUMBONLY_CPU
> > default y
> >
> > And... I'm left wondering - should we have this instead:
> >
> > config CPU_ARM
> > bool
> >
> > config CPU_THUMB
> > bool
> >
> > which indicates whether the CPU supports the ARM instruction set or the
> > Thumb instruction set (or both) - that should then allow us to select
> > those from the individual CPU_xxx options and eliminate that big long
> > list of dependencies against ARM_THUMB.
> I like your idea and I will come up with a patch.
This looks nice and clean, but after having thought about it for a while
it turns out not to be that easy.
For THUMB2_KERNEL only CPUs must be supported that can do Thumb2. That
means the logic must be something like:
config THUMB2_KERNEL
bool "Compile the kernel in Thumb-2 mode" if ALL_CONFIGURED_CPUS_SUPPORT_ARM
depends on ALL_CONFIGURED_CPUS_SUPPORT_THUMB2
default y if !ALL_CONFIGURED_CPUS_SUPPORT_ARM
for the ALL_CONFIGURED_CPUS_SUPPORT_ARM and .._THUMB2 symbols to do the
right thing, we'd need something like:
config CPU_32v4
bool
...
select ISA_ARM
select ISA_THUMB_NONE
config CPU_32v4T
bool
...
select ISA_ARM
select ISA_THUMB1
...
config CPU_32v7
bool
select ISA_ARM
select ISA_THUMB2
config CPU_32v7M
bool
select ISA_ARM_NONE
select ISA_THUMB2
config ALL_CONFIGURED_CPUS_SUPPORT_ARM
bool
default ISA_ARM && !ISA_ARM_NONE
config ALL_CONFIGURED_CPUS_SUPPORT_THUMB2
bool
default ISA_THUMB2 && !ISA_THUMB1 && !ISA_THUMB_NONE
which looks less nice than what I thought first.
What do you think? Is it still worthwhile to implement this?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2013-01-14 9:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-11 11:39 [PATCH] ARM: let CPUs not being able to run in ARM mode enter in THUMB mode Uwe Kleine-König
2013-01-11 15:34 ` Jonathan Austin
2013-01-11 15:51 ` Uwe Kleine-König
2013-01-12 17:19 ` Nicolas Pitre
2013-01-11 16:07 ` Russell King - ARM Linux
2013-01-11 16:20 ` Uwe Kleine-König
2013-01-14 9:50 ` Uwe Kleine-König [this message]
2013-01-11 18:00 ` Jonathan Austin
2013-01-11 18:12 ` Russell King - ARM Linux
2013-01-14 11:15 ` [PATCH v2] " Uwe Kleine-König
2013-01-14 21:53 ` Nicolas Pitre
2013-01-29 12:44 ` [PATCH] " Dave Martin
2013-01-31 15:51 ` Uwe Kleine-König
2013-02-19 11:39 ` Dave Martin
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=20130114095050.GO14860@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).