Skip to contentSkip to conversation

ARM: patches for randconfig build errors

PATCH In review Arnd Bergmann 6 participants 23 messages Aug 22, 2012 – Aug 23, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ARM: patches for randconfig build errors

Hi Russell,

I've done some testing with the experimental multiplatform tree and that uncovered a few preexisting bugs. Here are the ones that should go through your tree. Please have a look to see if the fixes make sense. I can put the patches in the patch tracker or send you a pull request then.

Arnd
---
Cc: Jon Medhurst <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Magnus Damm <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Russell King <[email protected]>
Cc: Shinya Kuribayashi <[email protected]>
Cc: Stephen Boyd <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Will Deacon <[email protected]>

Arnd Bergmann (4):
ARM: export read_current_timer
ARM: allow PID_IN_CONTEXTIDR only for ARMv7
ARM: export set_irq_flags/irq_set_chip_and_handler
ARM: kprobes: make more tests conditional

 arch/arm/Kconfig.debug             |    1 +
 arch/arm/kernel/arch_timer.c       |    2 ++
 arch/arm/kernel/irq.c              |    2 ++
 arch/arm/kernel/kprobes-test-arm.c |    4 +++-
 kernel/irq/chip.c                  |    2 ++
 5 files changed, 10 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/4 ARM: export read_current_timer

read_current_timer is used in the get_cycles() function when ARM_ARCH_TIMER is set, and that function can be inlined into driver modules, so we should export the function to avoid errors like

ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!

Cc Shinya Kuribayashi <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Will Deacon <[email protected]>
Cc Russell King <[email protected]>
---
 arch/arm/kernel/arch_timer.c |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/kernel/arch_timer.c +2 -0
index cf25880..6327d1f 100644
@@ -14,6 +14,7 @@
 #include <linux/device.h>
 #include <linux/smp.h>
 #include <linux/cpu.h>
+#include <linux/export.h>
 #include <linux/jiffies.h>
 #include <linux/clockchips.h>
 #include <linux/interrupt.h>
@@ -232,6 +233,7 @@ int read_current_timer(unsigned long *timer_val)
 	*timer_val = arch_counter_get_cntpct();
 	return 0;
 }
+EXPORT_SYMBOL_GPL(read_current_timer);
 
 static struct clocksource clocksource_counter = {
 	.name	= "arch_sys_counter",
Signature · 1 line
1.7.10
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] ARM: export read_current_timer

Quoted 10 lines · Arnd Bergmann

read_current_timer is used in the get_cycles() function when ARM_ARCH_TIMER is set, and that function can be inlined into driver modules, so we should export the function to avoid errors like

ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!

Cc Shinya Kuribayashi <[email protected]>

I ran into this last week but forgot to send the patch. Thanks.

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Acked-by
#3 lore raw

Re: [PATCH 1/4] ARM: export read_current_timer

Quoted 9 lines · Stephen Boyd
Quoted 8 lines · Arnd Bergmann

read_current_timer is used in the get_cycles() function when ARM_ARCH_TIMER is set, and that function can be inlined into driver modules, so we should export the function to avoid errors like

ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!

Quoted 6 lines
Quoted 2 lines
Cc Shinya Kuribayashi <[email protected]>

I ran into this last week but forgot to send the patch. Thanks.

Looks good to me, thanks Arnd:

On the topic of the timer stuff: Shinya/Stephen, did you have a chance to look at the registration stuff that was proposed? I'm happy to push it if people will actually use it.

Cheers,

Will

#4 lore raw

Re: [PATCH 1/4] ARM: export read_current_timer

Quoted 3 lines · Will Deacon

On the topic of the timer stuff: Shinya/Stephen, did you have a chance to look at the registration stuff that was proposed? I'm happy to push it if people will actually use it.

Yes I have tested it on our internal trees and it looks good. I plan to send a patch to move MSM's timers over to it later this week so that we have at least two users upstream.

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#5 lore raw

Re: [PATCH 1/4] ARM: export read_current_timer

Quoted 8 lines · Stephen Boyd
Quoted 3 lines · Will Deacon

On the topic of the timer stuff: Shinya/Stephen, did you have a chance to look at the registration stuff that was proposed? I'm happy to push it if people will actually use it.

Yes I have tested it on our internal trees and it looks good. I plan to send a patch to move MSM's timers over to it later this week so that we have at least two users upstream.

Awesome, I'll dust that series off at -rc3 then.

Will

#6 lore raw

Re: [PATCH 1/4] ARM: export read_current_timer

Quoted 9 lines · Will Deacon
Quoted 8 lines · Stephen Boyd
Quoted 3 lines · Will Deacon

On the topic of the timer stuff: Shinya/Stephen, did you have a chance to look at the registration stuff that was proposed? I'm happy to push it if people will actually use it.

Yes I have tested it on our internal trees and it looks good. I plan to send a patch to move MSM's timers over to it later this week so that we have at least two users upstream.

And I think other A9 MPcore platforms, namely OMAP and EXYNOS, would also be candidates, who tried to skip calibrate_delay() in the past (OMAP) or currently provide non-smp_twd timers as localtimers (EXYNOS). I may miss the latest status of those BSPs, but believe that we would have more users (>2) in the future.

Quoted 1 line

Awesome, I'll dust that series off at -rc3 then.

It works for me for weeks without troubles, looking forward to it. --
Shinya Kuribayashi
Renesas Electronics

#7 lore raw

Re: [PATCH 1/4] ARM: export read_current_timer

In reply to Will Deacon
Quoted 13 lines · Will Deacon
Quoted 12 lines · Stephen Boyd
Quoted 10 lines · Arnd Bergmann

read_current_timer is used in the get_cycles() function when ARM_ARCH_TIMER is set, and that function can be inlined into driver modules, so we should export the function to avoid errors like

ERROR: "read_current_timer" [drivers/video/udlfb.ko] undefined!
ERROR: "read_current_timer" [crypto/tcrypt.ko] undefined!

Cc Shinya Kuribayashi <[email protected]>
Quoted 7 lines
Quoted 3 lines

I ran into this last week but forgot to send the patch. Thanks.

Looks good to me, thanks Arnd:

I haven't hit with this so far with our configs though, but why not?

#8 lore raw

PATCH 2/4 ARM: allow PID_IN_CONTEXTIDR only for ARMv7

In reply to Arnd Bergmann

When ARMv6 is enabled, we build the kernel with -march=armv6 or -march=armv6k, which means the bfi instruction is not available. Instead, it only works with -march=armv6t2 or -march=armv7-a.

Without this patch, building rand-enIHAOL results in:

/tmp/ccwCsCXC.s: Assembler messages:
/tmp/ccwCsCXC.s:49: Error: selected processor does not support ARM mode `bfi r3,r2,#0,#8'

Cc Will Deacon <[email protected]>
Cc Russell King <[email protected]>
---
 arch/arm/Kconfig.debug |    1 +
 1 file changed, 1 insertion(+)
arch/arm/Kconfig.debug +1 -0
index f15f82b..11b9ff4 100644
@@ -398,6 +398,7 @@ config ARM_KPROBES_TEST
 config PID_IN_CONTEXTIDR
 	bool "Write the current PID to the CONTEXTIDR register"
 	depends on CPU_COPY_V6
+	depends on CPU_V7 && !CPU_V6
 	help
 	  Enabling this option causes the kernel to write the current PID to
 	  the PROCID field of the CONTEXTIDR register, at the expense of some
Signature · 1 line
1.7.10
#9 lore raw

Re: [PATCH 2/4] ARM: allow PID_IN_CONTEXTIDR only for ARMv7

Hi Arnd,

Quoted 21 lines · Arnd Bergmann

When ARMv6 is enabled, we build the kernel with -march=armv6 or -march=armv6k, which means the bfi instruction is not available. Instead, it only works with -march=armv6t2 or -march=armv7-a.

Without this patch, building rand-enIHAOL results in:

/tmp/ccwCsCXC.s: Assembler messages:
/tmp/ccwCsCXC.s:49: Error: selected processor does not support ARM mode `bfi r3,r2,#0,#8'

Cc Will Deacon <[email protected]>
Cc Russell King <[email protected]>
---
 arch/arm/Kconfig.debug |    1 +
 1 file changed, 1 insertion(+)
arch/arm/Kconfig.debug +0 -0
index f15f82b..11b9ff4 100644

arch/arm/Kconfig.debug config ARM_KPROBES_TEST · line 404

Quoted 7 lines
arch/arm/Kconfig.debug +1 -0
@@ -398,6 +398,7 @@ config ARM_KPROBES_TEST
 config PID_IN_CONTEXTIDR
 	bool "Write the current PID to the CONTEXTIDR register"
 	depends on CPU_COPY_V6
+	depends on CPU_V7 && !CPU_V6
 	help
 	  Enabling this option causes the kernel to write the current PID to
 	  the PROCID field of the CONTEXTIDR register, at the expense of some

Nah, I'll fix the contextidr_notifier instead. I forgot that this stuff gets used on non-SMP v6 platforms.

Cheers,

Will

#10 lore raw

Re: [PATCH 2/4] ARM: allow PID_IN_CONTEXTIDR only for ARMv7

Quoted 12 lines · Will Deacon

arch/arm/Kconfig.debug config ARM_KPROBES_TEST · line 404

Quoted 8 lines
arch/arm/Kconfig.debug +1 -0
@@ -398,6 +398,7 @@ config ARM_KPROBES_TEST
 config PID_IN_CONTEXTIDR
      bool "Write the current PID to the CONTEXTIDR register"
      depends on CPU_COPY_V6
+     depends on CPU_V7 && !CPU_V6
      help
        Enabling this option causes the kernel to write the current PID to
        the PROCID field of the CONTEXTIDR register, at the expense of some

Nah, I'll fix the contextidr_notifier instead. I forgot that this stuff gets used on non-SMP v6 platforms.

Ok, thanks!

Arnd

#11 lore raw

PATCH 3/4 ARM: export set_irq_flags/irq_set_chip_and_handler

In reply to Arnd Bergmann

The recently added Emma Mobile GPIO driver calls set_irq_flags and irq_set_chip_and_handler for the interrupts it exports and it can be built as a module, which currently fails with

ERROR: "set_irq_flags" [drivers/gpio/gpio-em.ko] undefined!
ERROR: "irq_set_chip_and_handler_name" [drivers/gpio/gpio-em.ko] undefined!

We either need to replace the call to set_irq_flags with something else or export that function. This patch does the latter.

Cc Magnus Damm <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Russell King <[email protected]>
---
 arch/arm/kernel/irq.c |    2 ++
 kernel/irq/chip.c     |    2 ++
 2 files changed, 4 insertions(+)
arch/arm/kernel/irq.c +2 -0
index 16cedb4..8961650 100644
@@ -34,6 +34,7 @@
 #include <linux/list.h>
 #include <linux/kallsyms.h>
 #include <linux/proc_fs.h>
+#include <linux/export.h>
 
 #include <asm/exception.h>
 #include <asm/mach/arch.h>
@@ -109,6 +110,7 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
 	/* Order is clear bits in "clr" then set bits in "set" */
 	irq_modify_status(irq, clr, set & ~clr);
 }
+EXPORT_SYMBOL_GPL(set_irq_flags);
 
 void __init init_IRQ(void)
 {
kernel/irq/chip.c +2 -0
index eebd6d5..3c3cea3 100644
@@ -13,6 +13,7 @@
 #include <linux/irq.h>
 #include <linux/msi.h>
 #include <linux/module.h>
+#include <linux/export.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
 
@@ -671,6 +672,7 @@ irq_set_chip_and_handler_name(unsigned int irq, struct irq_chip *chip,
 	irq_set_chip(irq, chip);
 	__irq_set_handler(irq, handle, 0, name);
 }
+EXPORT_SYMBOL_GPL(irq_set_chip_and_handler_name);
 
 void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
 {
Signature · 1 line
1.7.10
#12 lore raw

PATCH 4/4 ARM: kprobes: make more tests conditional

In reply to Arnd Bergmann

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrex/strex are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
---
 arch/arm/kernel/kprobes-test-arm.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/kernel/kprobes-test-arm.c +3 -1
index 38c1a3b..3e87ff7 100644
@@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
+#endif
 	TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
@@ -454,7 +456,7 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1500090") /* Unallocated space */
 	TEST_UNSUPPORTED(".word	0xe1600090") /* Unallocated space */
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
-#if __LINUX_ARM_ARCH__ >= 6
+#ifdef CONFIG_CPU_32v6K
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
Signature · 1 line
1.7.10
#13 lore raw

Re: [PATCH 4/4] ARM: kprobes: make more tests conditional

Quoted 4 lines · Arnd Bergmann

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrex/strex are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

The ldrex/strex instructions are available on ARMv6. It's only the d variants (strexd/ldrexd) which are only available from ARMv6k.

Nicolas

#14 lore raw

Re: [PATCH 4/4] ARM: kprobes: make more tests conditional

Quoted 9 lines · Nicolas Pitre
Quoted 4 lines · Arnd Bergmann

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrex/strex are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

The ldrex/strex instructions are available on ARMv6. It's only the d variants (strexd/ldrexd) which are only available from ARMv6k.

Ok. How is the version below then? I haven't tested this one yet.

Arnd

8<---

Quoted 1 line

From d878ab212cf0ac1957be83ad80dc734ace2b476c Mon Sep 17 00:00:00 2001

From: Arnd Bergmann <[email protected]>
Date: Thu, 16 Aug 2012 07:49:31 +0000
Subject: [PATCH] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
---
 arch/arm/kernel/kprobes-test-arm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..fc9f6e0 100644
@@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
+#endif
 	TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
@@ -456,8 +458,10 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#ifdef CONFIG_CPU_32v6K
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
+#endif
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
 	TEST_UNSUPPORTED("ldrexb	r2, [sp]")
 	TEST_UNSUPPORTED("strexh	r0, r2, [sp]")
Signature · 1 line
1.7.10
#15 lore raw

Re: [PATCH 4/4] ARM: kprobes: make more tests conditional

Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Nicolas Pitre
Quoted 4 lines · Arnd Bergmann

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrex/strex are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

Quoted 4 lines
Quoted 2 lines

The ldrex/strex instructions are available on ARMv6. It's only the d variants (strexd/ldrexd) which are only available from ARMv6k.

Ok. How is the version below then? I haven't tested this one yet.

In fact, I think the b variants are ARMv6k+ as well. Only the plain (non b non d) variants are available on ARMv6.

Quoted 58 lines

Arnd

8<---
From d878ab212cf0ac1957be83ad80dc734ace2b476c Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 16 Aug 2012 07:49:31 +0000
Subject: [PATCH] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
---
 arch/arm/kernel/kprobes-test-arm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..fc9f6e0 100644
@@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
+#endif
 	TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
@@ -456,8 +458,10 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#ifdef CONFIG_CPU_32v6K
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
+#endif
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
 	TEST_UNSUPPORTED("ldrexb	r2, [sp]")
 	TEST_UNSUPPORTED("strexh	r0, r2, [sp]")
Signature · 1 line
1.7.10
#16 lore raw

PATCH v3 4/4 ARM: kprobes: make more tests conditional

Quoted 9 lines · Nicolas Pitre
Quoted 5 lines · Arnd Bergmann
Quoted 3 lines

The ldrex/strex instructions are available on ARMv6. It's only the d variants (strexd/ldrexd) which are only available from ARMv6k.

Ok. How is the version below then? I haven't tested this one yet.

In fact, I think the b variants are ARMv6k+ as well. Only the plain (non b non d) variants are available on ARMv6.

Ok, third attempt then. This leaves ldrex for ARMv6 but marks {st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).

Arnd

8<-----

Quoted 1 line

From 6eab418c61c18393006f30d189e2f28d6e403040 Mon Sep 17 00:00:00 2001

From: Arnd Bergmann <[email protected]>
Date: Thu, 16 Aug 2012 07:49:31 +0000
Subject: [PATCH] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
---
 arch/arm/kernel/kprobes-test-arm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..58dd6c3 100644
@@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
+#endif
 	TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
@@ -456,6 +458,7 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#ifdef CONFIG_CPU_32v6K
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
@@ -463,6 +466,7 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED("strexh	r0, r2, [sp]")
 	TEST_UNSUPPORTED("ldrexh	r2, [sp]")
 #endif
+#endif
 	TEST_GROUP("Extra load/store instructions")
 
 	TEST_RPR(  "strh	r",0, VAL1,", [r",1, 48,", -r",2, 24,"]")
Signature · 1 line
1.7.10
Acked-by on v3 4/4
#17 lore raw

Re: [PATCHv3 4/4] ARM: kprobes: make more tests conditional

Quoted 32 lines · Arnd Bergmann
Quoted 9 lines · Nicolas Pitre
Quoted 5 lines · Arnd Bergmann
Quoted 3 lines

The ldrex/strex instructions are available on ARMv6. It's only the d variants (strexd/ldrexd) which are only available from ARMv6k.

Ok. How is the version below then? I haven't tested this one yet.

In fact, I think the b variants are ARMv6k+ as well. Only the plain (non b non d) variants are available on ARMv6.

Ok, third attempt then. This leaves ldrex for ARMv6 but marks {st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).

Arnd

8<-----
From 6eab418c61c18393006f30d189e2f28d6e403040 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 16 Aug 2012 07:49:31 +0000
Subject: [PATCH] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Quoted 5 lines
Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
Quoted 41 lines
---
 arch/arm/kernel/kprobes-test-arm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..58dd6c3 100644
@@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
+#endif
 	TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
@@ -456,6 +458,7 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#ifdef CONFIG_CPU_32v6K
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
@@ -463,6 +466,7 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED("strexh	r0, r2, [sp]")
 	TEST_UNSUPPORTED("ldrexh	r2, [sp]")
 #endif
+#endif
 	TEST_GROUP("Extra load/store instructions")
 
 	TEST_RPR(  "strh	r",0, VAL1,", [r",1, 48,", -r",2, 24,"]")
Signature · 1 line
1.7.10
#18 lore raw

Re: [PATCHv3 4/4] ARM: kprobes: make more tests conditional

In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Nicolas Pitre
Quoted 4 lines · Arnd Bergmann
Quoted 3 lines

The ldrex/strex instructions are available on ARMv6. It's only the d variants (strexd/ldrexd) which are only available from ARMv6k.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Ok. How is the version below then? I haven't tested this one yet.

In fact, I think the b variants are ARMv6k+ as well. Only the plain (non b non d) variants are available on ARMv6.

Ok, third attempt then. This leaves ldrex for ARMv6 but marks {st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).

ARMv7 does set CPU_32v6K, because arch/arm/mm/Kconfig has

config CPU_V7

	bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
	select CPU_32v6K
	select CPU_32v7

but this seems more for peripheral reasons not because all the various CPU configs systematically select the earlier architecture variants, e.g. CPU_V7 doesn't select CPU_32v6.

So I would have been inclined to test for

#if defined(CONFIG_CPU_32v6K) || (__LINUX_ARM_ARCH__ >= 7)

but as the current patch is functionally correct I'm not going to suggest a v4 patch :-)

If you do feel so inclined for a v4 however ;-) you could also make the mls part of the patch tidier by moving the added #endif to instead terminate the preceding "#if __LINUX_ARM_ARCH__ >= 6", i.e.

@@ -367,8 +367,10 @@ void kprobe_arm_test_cases(void)
TEST_UNSUPPORTED(".word 0xe0500090 @ undef") TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif

+#if __LINUX_ARM_ARCH__ >= 7

 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")

this looks funny in patch form, but the resulting source file is more consistent with other conditional tests.

Quoted 59 lines

Arnd

8<-----
From 6eab418c61c18393006f30d189e2f28d6e403040 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 16 Aug 2012 07:49:31 +0000
Subject: [PATCH] ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol. Just testing for ARMv6 is not enough.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
---
 arch/arm/kernel/kprobes-test-arm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..58dd6c3 100644
@@ -367,9 +367,11 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
+#endif
 	TEST_UNSUPPORTED(".word 0xe06f3291 @ mls pc, r1, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe060329f @ mls r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0603f91 @ mls r0, r1, pc, r3")
@@ -456,6 +458,7 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#ifdef CONFIG_CPU_32v6K
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
@@ -463,6 +466,7 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED("strexh	r0, r2, [sp]")
 	TEST_UNSUPPORTED("ldrexh	r2, [sp]")
 #endif
+#endif
 	TEST_GROUP("Extra load/store instructions")
 
 	TEST_RPR(  "strh	r",0, VAL1,", [r",1, 48,", -r",2, 24,"]")
#19 lore raw

Re: [PATCHv4 4/4] ARM: kprobes: make more tests conditional

Quoted 15 lines · Tixy

If you do feel so inclined for a v4 however ;-) you could also make the mls part of the patch tidier by moving the added #endif to instead terminate the preceding "#if __LINUX_ARM_ARCH__ >= 6", i.e.

(quoted diff) +2 -0
@@ -367,8 +367,10 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
 
 
Quoted 2 lines

this looks funny in patch form, but the resulting source file is more consistent with other conditional tests.

Ok, here we go.

Arnd

commit abfef4db8731591fbb721262bd4712662aaa6d14

Author: Arnd Bergmann <[email protected]>
Date:   Thu Aug 16 07:49:31 2012 +0000

ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..8393129 100644
@@ -366,7 +366,9 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
@@ -456,6 +458,8 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#endif
+#if (__LINUX_ARM_ARCH__ >= 7) || defined(CONFIG_CPU_32v6K)
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
Acked-by
#20 lore raw

Re: [PATCHv4 4/4] ARM: kprobes: make more tests conditional

Quoted 16 lines · Arnd Bergmann

commit abfef4db8731591fbb721262bd4712662aaa6d14

Author: Arnd Bergmann <[email protected]>
Date:   Thu Aug 16 07:49:31 2012 +0000

ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Quoted 5 lines
Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>

Thanks for your indulgence :-) With the white-space damage fixed...

I test built this for v6, v6k and v7 before and after applying the patch to verify if behaves as expected, so you can add my Tested-by if you want.

I also tried a v4 platform (forgot we supported those) and there will be a patch coming to fix that...

Quoted 23 lines
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..8393129 100644
@@ -366,7 +366,9 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
@@ -456,6 +458,8 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#endif
+#if (__LINUX_ARM_ARCH__ >= 7) || defined(CONFIG_CPU_32v6K)
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
Acked-by
#21 lore raw

Re: [PATCHv4 4/4] ARM: kprobes: make more tests conditional

In reply to Arnd Bergmann
Quoted 41 lines · Arnd Bergmann
Quoted 15 lines · Tixy

If you do feel so inclined for a v4 however ;-) you could also make the mls part of the patch tidier by moving the added #endif to instead terminate the preceding "#if __LINUX_ARM_ARCH__ >= 6", i.e.

arch/arm/kernel/kprobes-test-arm.c +2 -0
@@ -367,8 +367,10 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
 
 
Quoted 2 lines

this looks funny in patch form, but the resulting source file is more consistent with other conditional tests.

Ok, here we go.

Arnd

commit abfef4db8731591fbb721262bd4712662aaa6d14

Author: Arnd Bergmann <[email protected]>
Date:   Thu Aug 16 07:49:31 2012 +0000

ARM: kprobes: make more tests conditional

The mls instruction is not available in ARMv6K or below, so we should make the test conditional on at least ARMv7. ldrexd/strexd are available in ARMv6K or ARMv7, which we can test by checking the CONFIG_CPU_32v6K symbol.

/tmp/ccuMTZ8D.s: Assembler messages:
/tmp/ccuMTZ8D.s:22188: Error: selected processor does not support ARM mode mls r0,r1,r2,r3' /tmp/ccuMTZ8D.s:22222: Error: selected processor does not support ARM mode mlshi r7,r8,r9,r10' /tmp/ccuMTZ8D.s:22252: Error: selected processor does not support ARM mode `mls lr,r1,r2,r13'

Quoted 5 lines
Cc Jon Medhurst <[email protected]>
Cc Russell King <[email protected]>
Cc Nicolas Pitre <[email protected]>
Cc Leif Lindholm <[email protected]>
Quoted 25 lines
arch/arm/kernel/kprobes-test-arm.c +4 -0
index 38c1a3b..8393129 100644
@@ -366,7 +366,9 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word 0xe04f0392 @ umaal r0, pc, r2, r3")
 	TEST_UNSUPPORTED(".word 0xe0500090 @ undef")
 	TEST_UNSUPPORTED(".word 0xe05fff9f @ undef")
+#endif
 
+#if __LINUX_ARM_ARCH__ >= 7
 	TEST_RRR(  "mls		r0, r",1, VAL1,", r",2, VAL2,", r",3,  VAL3,"")
 	TEST_RRR(  "mlshi	r7, r",8, VAL3,", r",9, VAL1,", r",10, VAL2,"")
 	TEST_RR(   "mls		lr, r",1, VAL2,", r",2, VAL3,", r13")
@@ -456,6 +458,8 @@ void kprobe_arm_test_cases(void)
 	TEST_UNSUPPORTED(".word	0xe1700090") /* Unallocated space */
 #if __LINUX_ARM_ARCH__ >= 6
 	TEST_UNSUPPORTED("ldrex	r2, [sp]")
+#endif
+#if (__LINUX_ARM_ARCH__ >= 7) || defined(CONFIG_CPU_32v6K)
 	TEST_UNSUPPORTED("strexd	r0, r2, r3, [sp]")
 	TEST_UNSUPPORTED("ldrexd	r2, r3, [sp]")
 	TEST_UNSUPPORTED("strexb	r0, r2, [sp]")
#22 lore raw

Re: [PATCHv3 4/4] ARM: kprobes: make more tests conditional

In reply to Tixy
Quoted 22 lines · Tixy
Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Nicolas Pitre
Quoted 4 lines · Arnd Bergmann
Quoted 3 lines

The ldrex/strex instructions are available on ARMv6. It's only the d variants (strexd/ldrexd) which are only available from ARMv6k.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Ok. How is the version below then? I haven't tested this one yet.

In fact, I think the b variants are ARMv6k+ as well. Only the plain (non b non d) variants are available on ARMv6.

Ok, third attempt then. This leaves ldrex for ARMv6 but marks {st,ld}rex{b,h,d} as V6K specific (which includes ARMv7).

ARMv7 does set CPU_32v6K, because arch/arm/mm/Kconfig has

config CPU_V7

	bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
	select CPU_32v6K
	select CPU_32v7
Quoted 7 lines

but this seems more for peripheral reasons not because all the various CPU configs systematically select the earlier architecture variants, e.g. CPU_V7 doesn't select CPU_32v6.

So I would have been inclined to test for

#if defined(CONFIG_CPU_32v6K) || (__LINUX_ARM_ARCH__ >= 7)

FWIW, the selection of the optimised atomic64 implementation for ARM (which uses the double-word exclusive instructions) boils down to CONFIG_CPU_32v6K, so I think the additional __LINUX_ARM_ARCH__ check is probably overkill.

Will