Skip to content

Commit 9e4d769

Browse files
committed
Merge tag 'arc-5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC fixes from Vineet Gupta: - User build systems to pass -mcpu - Fix potential EFA clobber in syscall handler - Fix ARCompact 2 levels of interrupts build - Detect newer HS CPU releases - misc other fixes * tag 'arc-5.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARCv2: support loop buffer (LPB) disabling ARC: build: remove deprecated toggle for arc700 builds ARC: build: allow users to specify -mcpu ARCv2: boot log: detect newer/upconing HS3x/HS4x releases ARC: elf: use right ELF_ARCH ARC: [arcompact] fix bitrot with 2 levels of interrupt ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE
2 parents a6bc851 + 10011f7 commit 9e4d769

File tree

7 files changed

+59
-27
lines changed

7 files changed

+59
-27
lines changed

arch/arc/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ config ARC_CPU_HS
170170

171171
endchoice
172172

173+
config ARC_TUNE_MCPU
174+
string "Override default -mcpu compiler flag"
175+
default ""
176+
help
177+
Override default -mcpu=xxx compiler flag (which is set depending on
178+
the ISA version) with the specified value.
179+
NOTE: If specified flag isn't supported by current compiler the
180+
ISA default value will be used as a fallback.
181+
173182
config CPU_BIG_ENDIAN
174183
bool "Enable Big Endian Mode"
175184
help
@@ -465,6 +474,12 @@ config ARC_IRQ_NO_AUTOSAVE
465474
This is programmable and can be optionally disabled in which case
466475
software INTERRUPT_PROLOGUE/EPILGUE do the needed work
467476

477+
config ARC_LPB_DISABLE
478+
bool "Disable loop buffer (LPB)"
479+
help
480+
On HS cores, loop buffer (LPB) is programmable in runtime and can
481+
be optionally disabled.
482+
468483
endif # ISA_ARCV2
469484

470485
endmenu # "ARC CPU Configuration"

arch/arc/Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-)
1010
endif
1111

1212
cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
13-
cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
14-
cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
13+
14+
tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700
15+
tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38
16+
17+
ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
18+
cflags-y += $(tune-mcpu-def-y)
19+
else
20+
tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
21+
tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu))
22+
ifeq ($(tune-mcpu-ok),y)
23+
cflags-y += $(tune-mcpu)
24+
else
25+
# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
26+
# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option.
27+
$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)')
28+
cflags-y += $(tune-mcpu-def-y)
29+
endif
30+
endif
31+
1532

1633
ifdef CONFIG_ARC_CURR_IN_REG
1734
# For a global register defintion, make sure it gets passed to every file

arch/arc/include/asm/elf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#define R_ARC_32_PCREL 0x31
2020

2121
/*to set parameters in the core dumps */
22-
#define ELF_ARCH EM_ARCOMPACT
22+
#define ELF_ARCH EM_ARC_INUSE
2323
#define ELF_CLASS ELFCLASS32
2424

2525
#ifdef CONFIG_CPU_BIG_ENDIAN

arch/arc/include/asm/irqflags-compact.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ static inline void arch_local_irq_restore(unsigned long flags)
9090
/*
9191
* Unconditionally Enable IRQs
9292
*/
93+
#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
94+
extern void arch_local_irq_enable(void);
95+
#else
9396
static inline void arch_local_irq_enable(void)
9497
{
9598
unsigned long temp;
@@ -102,7 +105,7 @@ static inline void arch_local_irq_enable(void)
102105
: "n"((STATUS_E1_MASK | STATUS_E2_MASK))
103106
: "cc", "memory");
104107
}
105-
108+
#endif
106109

107110
/*
108111
* Unconditionally Disable IRQs

arch/arc/kernel/entry.S

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ END(EV_Extension)
165165
tracesys:
166166
; save EFA in case tracer wants the PC of traced task
167167
; using ERET won't work since next-PC has already committed
168-
lr r12, [efa]
169168
GET_CURR_TASK_FIELD_PTR TASK_THREAD, r11
170169
st r12, [r11, THREAD_FAULT_ADDR] ; thread.fault_address
171170

@@ -208,15 +207,9 @@ tracesys_exit:
208207
; Breakpoint TRAP
209208
; ---------------------------------------------
210209
trap_with_param:
211-
212-
; stop_pc info by gdb needs this info
213-
lr r0, [efa]
210+
mov r0, r12 ; EFA in case ptracer/gdb wants stop_pc
214211
mov r1, sp
215212

216-
; Now that we have read EFA, it is safe to do "fake" rtie
217-
; and get out of CPU exception mode
218-
FAKE_RET_FROM_EXCPN
219-
220213
; Save callee regs in case gdb wants to have a look
221214
; SP will grow up by size of CALLEE Reg-File
222215
; NOTE: clobbers r12
@@ -243,16 +236,17 @@ ENTRY(EV_Trap)
243236

244237
EXCEPTION_PROLOGUE
245238

239+
lr r12, [efa]
240+
241+
FAKE_RET_FROM_EXCPN
242+
246243
;============ TRAP 1 :breakpoints
247244
; Check ECR for trap with arg (PROLOGUE ensures r10 has ECR)
248245
bmsk.f 0, r10, 7
249246
bnz trap_with_param
250247

251248
;============ TRAP (no param): syscall top level
252249

253-
; First return from Exception to pure K mode (Exception/IRQs renabled)
254-
FAKE_RET_FROM_EXCPN
255-
256250
; If syscall tracing ongoing, invoke pre-post-hooks
257251
GET_CURR_THR_INFO_FLAGS r10
258252
btst r10, TIF_SYSCALL_TRACE

arch/arc/kernel/head.S

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
bclr r5, r5, STATUS_AD_BIT
6060
#endif
6161
kflag r5
62+
63+
#ifdef CONFIG_ARC_LPB_DISABLE
64+
lr r5, [ARC_REG_LPB_BUILD]
65+
breq r5, 0, 1f ; LPB doesn't exist
66+
mov r5, 1
67+
sr r5, [ARC_REG_LPB_CTRL]
68+
1:
69+
#endif /* CONFIG_ARC_LPB_DISABLE */
6270
#endif
6371
; Config DSP_CTRL properly, so kernel may use integer multiply,
6472
; multiply-accumulate, and divide operations

arch/arc/kernel/setup.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ static const struct id_to_str arc_legacy_rel[] = {
5858
{ 0x00, NULL }
5959
};
6060

61-
static const struct id_to_str arc_cpu_rel[] = {
61+
static const struct id_to_str arc_hs_ver54_rel[] = {
6262
/* UARCH.MAJOR, Release */
6363
{ 0, "R3.10a"},
6464
{ 1, "R3.50a"},
65+
{ 2, "R3.60a"},
66+
{ 3, "R4.00a"},
6567
{ 0xFF, NULL }
6668
};
6769

@@ -117,12 +119,6 @@ static void decode_arc_core(struct cpuinfo_arc *cpu)
117119
struct bcr_uarch_build_arcv2 uarch;
118120
const struct id_to_str *tbl;
119121

120-
/*
121-
* Up until (including) the first core4 release (0x54) things were
122-
* simple: AUX IDENTITY.ARCVER was sufficient to identify arc family
123-
* and release: 0x50 to 0x53 was HS38, 0x54 was HS48 (dual issue)
124-
*/
125-
126122
if (cpu->core.family < 0x54) { /* includes arc700 */
127123

128124
for (tbl = &arc_legacy_rel[0]; tbl->id != 0; tbl++) {
@@ -143,11 +139,10 @@ static void decode_arc_core(struct cpuinfo_arc *cpu)
143139
}
144140

145141
/*
146-
* However the subsequent HS release (same 0x54) allow HS38 or HS48
147-
* configurations and encode this info in a different BCR.
148-
* The BCR was introduced in 0x54 so can't be read unconditionally.
142+
* Initial HS cores bumped AUX IDENTITY.ARCVER for each release until
143+
* ARCVER 0x54 which introduced AUX MICRO_ARCH_BUILD and subsequent
144+
* releases only update it.
149145
*/
150-
151146
READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch);
152147

153148
if (uarch.prod == 4) {
@@ -158,7 +153,7 @@ static void decode_arc_core(struct cpuinfo_arc *cpu)
158153
cpu->name = "HS38";
159154
}
160155

161-
for (tbl = &arc_cpu_rel[0]; tbl->id != 0xFF; tbl++) {
156+
for (tbl = &arc_hs_ver54_rel[0]; tbl->id != 0xFF; tbl++) {
162157
if (uarch.maj == tbl->id) {
163158
cpu->release = tbl->str;
164159
break;

0 commit comments

Comments
 (0)