Skip to contentSkip to conversation

ARM: Thumb-2: Make CONFIG_THUMB2_KERNEL depend on !CPU_V6

PATCH New David Brownell 3 participants 5 messages Dec 8, 2010

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · Dave Martin

From: Dave Martin <[email protected]>
Subject: [PATCH] ARM: Thumb-2: Make CONFIG_THUMB2_KERNEL depend on !CPU_V6...

This makes sense, because Thumb-2
code can't execute on anything
prior to ARMv7.

WRONG ... but you may be overlooking the
fact that there are at least three
flavors of Thumb-2 ...

- Original, as on some ARMv6 chips ARM1156 was
the introductory Thumb2 core).  It's Thumb1
plus a very few 32-bit instructions.  (And
maybe the SIMD instructions too; I forget.  Not
suitable for OS work like IRQ handling, ISTR; or
at least, not as suitable as the ARMv7 flavors.

-Microcontroller ... ARMv7M chips, and likely
not available on Linux-capable hardware ...   Suitable for RTOS work like IRQ handling.

- Applications ... ARMv7A chips ... like those V6 chips with THUMB2, but with SIMD "multimedia" instructions and maybe a bit more.  Worth tossing
THUMB-EE in this bag too.

Quoted 21 lines


  config THUMB2_KERNEL
      bool "Compile the kernel in Thumb-2 mode"
-    depends on CPU_V7 &&
EXPERIMENTAL
+    depends on CPU_V7 && !CPU_V6
&& EXPERIMENTAL
      select AEABI
      select ARM_ASM_UNIFIED
      help

Signature · 7 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe
linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw

PATCH 1/1 ARM: Thumb-2: Make CONFIG_THUMB2_KERNEL depend on !CPU_V6

Quoted 21 lines · David Brownell
Quoted 6 lines · Dave Martin

From: Dave Martin <[email protected]>
Subject: [PATCH] ARM: Thumb-2: Make CONFIG_THUMB2_KERNEL depend on !CPU_V6...

This makes sense, because Thumb-2
code can't execute on anything
prior to ARMv7.

WRONG ... but you may be overlooking the fact that there are at least three flavors of Thumb-2 ...

?- Original, as on some ARMv6 chips ARM1156 was the introductory Thumb2 core).? It's Thumb1 plus a very few 32-bit instructions.? (And maybe the SIMD instructions too; I forget.? Not suitable for OS work like IRQ handling, ISTR; or at least, not as suitable as the ARMv7 flavors.

Quoted 3 lines

?-Microcontroller ... ARMv7M chips, and likely
not available on Linux-capable hardware ...???Suitable for RTOS work like IRQ handling.

You're correct on some points ... *but* v7-M is not supported in the kernel yet, and in any case full linux is not applicable - this will be ucLinux territory. v7-M shares much of the instruction set with v7-A/R, bit it's a substantially different architecture when it comes to things like exception handling etc.

The v6T2 architecture supported by arm1156 does have comprehensive Thumb-2 support (not just a few 32-bit instructions), and arm1156 supports taking of exceptions in Thumb-2 etc., so in principle the complete OS could be built in Thumb-2 as is the case for v7. But this particular processor is rare and I believe it's not supported in the kernel right now ... and not likely to be. No other processors implement v6T2, and no new processors will implement it either.

The rules might need to be refined later, but !CPU_V6 seems sensible for now.

Cheers
---Dave

#2 lore raw

PATCH 1/1 ARM: Thumb-2: Make CONFIG_THUMB2_KERNEL depend on !CPU_V6

So to recapitulate ... you're agreeing with me on my key point -- that ARM1156, a V6T2 core with
Thumb2 support (used in fact to introduce
Thumb2), should work for some in-kernel Thumb2 usage, degree TBD, but obviously the v7 cores are more capable (with SIMD support in T2, etc).

And no, *I* never said anything about a V7M Linux,
that was your words. I'm used to the advantages of using MMUs with fork() and mprotect(), etc.

But the updated reason you gave for not allowing V6T2 is that it's an uncommon architecture (one core, not widely manufactured today) ... not impossibility.

In short, the basic premise of $PATCH is wrong, as I pointed out, but there may be other reasons to merge it, related to V6T2 chip availability not the actual architecture specs from ARM.

A similar argument would be that making the ASM code cope with core variants would get ugly/messy. At least the GNU assembler is, as I recall, aware of which instructions which cores support, so it would provide clean errors if given instructions that are Thumb2 (some flavor) but not accepted by the target. But Linux code shouldn't trigger such errors in the first place, even if they're a good backstop (and that implies ugly core-driven conditional code.

#3 lore raw
Quoted 5 lines · David Brownell

So to recapitulate ... you're agreeing with me on my key point -- that ARM1156, a V6T2 core with Thumb2 support (used in fact to introduce Thumb2), should work for some in-kernel Thumb2 usage, degree TBD, but obviously the v7 cores are more capable (with SIMD support in T2, etc).

The ARM1156 implements the full Thumb2 instruction set, exactly the same as in v7 except for ThumbEE and features new to v7 in general.

Quoted 3 lines

But the updated reason you gave for not allowing V6T2 is that it's an uncommon architecture (one core, not widely manufactured today) ... not impossibility.

The architecture being uncommon is not in my opinion cause to make life harder than necessary for whomever might some day want to add support for it.

Does the patch solve any real problem today?

Signature · 7 lines
Måns Rullgård
[email protected]

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

PATCH 1/1 ARM: Thumb-2: Make CONFIG_THUMB2_KERNEL depend on !CPU_V6

In reply to David Brownell

Hi,

Quoted 6 lines · David Brownell

So to recapitulate ... you're agreeing with me on my key point -- that ARM1156, a V6T2 core with ?Thumb2 support (used in fact to introduce Thumb2), should ?work for some in-kernel Thumb2 usage, degree TBD, but obviously the v7 cores are more capable (with SIMD support in T2, etc).

To be strictly accurate, 1156 is not an ARMv6 core -- it's an ARMv6T2 core, so it's debatable whether CPU_V6 should be set in this case. A separate config item, such as CPU_V6T2 might be needed to express this distinction if support for 1156 were to be added.

I believe if multiple CPU_* are defined, this usually means a kernel configured to support multiple platforms in the same binary; this is supported by some mach tress. A kernel binary intended to execute on a set of platforms including a plain v6 platform (indicated by CPU_V6 being set) most not be built in Thumb-2, since it then wouldn't work on those v6 platforms.

Quoted 8 lines

And no, *I* never said anything about a V7M Linux,
that was your words. ?I'm used to the advantages of using MMUs with fork() and mprotect(), etc.

But the updated reason you gave for not allowing V6T2 is that it's an uncommon architecture (one core, not widely manufactured today) ... not impossibility.

Agreed. Out of interest, do you know of anyone working with 1156 of patches to support it? This would be a different story, since then it would be clearer how CONFIG_THUMB2_KERNEL should integrate in this case.

Quoted 5 lines

In short, the basic premise of $PATCH is wrong, as I pointed out, but there may be other reasons to merge it, related to V6T2 chip availability not the actual architecture specs from ARM.

Well, the statement "Thumb-2 code can't execute on anything prior to ARMv7" was a generalisation; the commit message can certainly be made clearer. Really, what I meant was something like "Thumb-2 code can't execute on any common architecture prior to ARMv7", but I'm happy to make it clearer to explain the v6T2 case.

Quoted 11 lines

A similar argument would be that making the ASM code cope with core variants would get ugly/messy. ?At least the GNU assembler is, as I recall, aware of which instructions which cores support, so it would provide clean errors if given instructions that are Thumb2 (some flavor) but not accepted by the target. But Linux code shouldn't trigger such errors in the first place, even if they're a good backstop (and that implies ugly core-driven conditional code.

That's why I prefer not to allow CONFIG_THUMB2_KERNEL to be turned on in situations where it won't work.

If you have a cleaner solution, feel free to suggest it.

Cheers
---Dave