Skip to content

Commit 3c349ea

Browse files
Merge patch "riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y"
This is a single fix, but it conflicts with some recent features. I'm merging it on top of the commit it fixes to ease backporting. * b4-shazam-merge: riscv: Fix build with CONFIG_CC_OPTIMIZE_FOR_SIZE=y Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2 parents c1d6105 + 0b1d60d commit 3c349ea

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

arch/riscv/include/asm/hwcap.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ static_assert(RISCV_ISA_EXT_ID_MAX <= RISCV_ISA_EXT_MAX);
7070
*/
7171
enum riscv_isa_ext_key {
7272
RISCV_ISA_EXT_KEY_FPU, /* For 'F' and 'D' */
73-
RISCV_ISA_EXT_KEY_ZIHINTPAUSE,
7473
RISCV_ISA_EXT_KEY_SVINVAL,
7574
RISCV_ISA_EXT_KEY_MAX,
7675
};
@@ -91,8 +90,6 @@ static __always_inline int riscv_isa_ext2key(int num)
9190
return RISCV_ISA_EXT_KEY_FPU;
9291
case RISCV_ISA_EXT_d:
9392
return RISCV_ISA_EXT_KEY_FPU;
94-
case RISCV_ISA_EXT_ZIHINTPAUSE:
95-
return RISCV_ISA_EXT_KEY_ZIHINTPAUSE;
9693
case RISCV_ISA_EXT_SVINVAL:
9794
return RISCV_ISA_EXT_KEY_SVINVAL;
9895
default:

arch/riscv/include/asm/vdso/processor.h

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,26 @@
44

55
#ifndef __ASSEMBLY__
66

7-
#include <linux/jump_label.h>
87
#include <asm/barrier.h>
9-
#include <asm/hwcap.h>
108

119
static inline void cpu_relax(void)
1210
{
13-
if (!static_branch_likely(&riscv_isa_ext_keys[RISCV_ISA_EXT_KEY_ZIHINTPAUSE])) {
1411
#ifdef __riscv_muldiv
15-
int dummy;
16-
/* In lieu of a halt instruction, induce a long-latency stall. */
17-
__asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy));
12+
int dummy;
13+
/* In lieu of a halt instruction, induce a long-latency stall. */
14+
__asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy));
1815
#endif
19-
} else {
20-
/*
21-
* Reduce instruction retirement.
22-
* This assumes the PC changes.
23-
*/
24-
#ifdef CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE
25-
__asm__ __volatile__ ("pause");
16+
17+
#ifdef __riscv_zihintpause
18+
/*
19+
* Reduce instruction retirement.
20+
* This assumes the PC changes.
21+
*/
22+
__asm__ __volatile__ ("pause");
2623
#else
27-
/* Encoding of the pause instruction */
28-
__asm__ __volatile__ (".4byte 0x100000F");
24+
/* Encoding of the pause instruction */
25+
__asm__ __volatile__ (".4byte 0x100000F");
2926
#endif
30-
}
3127
barrier();
3228
}
3329

0 commit comments

Comments
 (0)