Skip to content

Commit 834da19

Browse files
author
Rich Felker
committed
sh: add AT_HWCAP flag for J-Core cas.l instruction
The J-Core cpu has, as an ISA extension, an atomic compare-and-swap instruction cas.l which applications need to use (instead the imask or gusa atomic models, which are fundamentally limited to UP) for synchronization in order to be compatible with SMP systems. Provide a hwcap flag so that it's possible to do runtime selection and support both. Signed-off-by: Rich Felker <dalias@libc.org>
1 parent 5a846ab commit 834da19

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

‎arch/sh/include/uapi/asm/cpu-features.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
#define CPU_HAS_L2_CACHE 0x0080 /* Secondary cache / URAM */
2323
#define CPU_HAS_OP32 0x0100 /* 32-bit instruction support */
2424
#define CPU_HAS_PTEAEX 0x0200 /* PTE ASID Extension support */
25+
#define CPU_HAS_CAS_L 0x0400 /* cas.l atomic compare-and-swap */
2526

2627
#endif /* __ASM_SH_CPU_FEATURES_H */

‎arch/sh/kernel/cpu/sh2/probe.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ void __ref cpu_probe(void)
5757
boot_cpu_data.dcache.entry_shift = 5;
5858
boot_cpu_data.dcache.linesz = 32;
5959
boot_cpu_data.dcache.flags = 0;
60+
61+
boot_cpu_data.flags |= CPU_HAS_CAS_L;
6062
#else
6163
/*
6264
* SH-2 doesn't have separate caches

0 commit comments

Comments
 (0)