Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'arc-4.11-final' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc

Pull ARC fix from Vineet Gupta:
"Last minute fixes for ARC:

- build error in Mellanox nps platform

- addressing lack of saving FPU regs in releavnt configs"

* tag 'arc-4.11-final' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc:
ARCv2: entry: save Accumulator register pair (r58:59) if present
ARC: [plat-eznps] Fix build error

+45 -10
+8
arch/arc/Kconfig
··· 406 bool "Insn: div, divu, rem, remu" 407 default y 408 409 endif # ISA_ARCV2 410 411 endmenu # "ARC CPU Configuration"
··· 406 bool "Insn: div, divu, rem, remu" 407 default y 408 409 + config ARC_HAS_ACCL_REGS 410 + bool "Reg Pair ACCL:ACCH (FPU and/or MPY > 6)" 411 + default n 412 + help 413 + Depending on the configuration, CPU can contain accumulator reg-pair 414 + (also referred to as r58:r59). These can also be used by gcc as GPR so 415 + kernel needs to save/restore per process 416 + 417 endif # ISA_ARCV2 418 419 endmenu # "ARC CPU Configuration"
+2 -1
arch/arc/include/asm/atomic.h
··· 17 #include <asm/barrier.h> 18 #include <asm/smp.h> 19 20 #ifndef CONFIG_ARC_PLAT_EZNPS 21 22 #define atomic_read(v) READ_ONCE((v)->counter) 23 - #define ATOMIC_INIT(i) { (i) } 24 25 #ifdef CONFIG_ARC_HAS_LLSC 26
··· 17 #include <asm/barrier.h> 18 #include <asm/smp.h> 19 20 + #define ATOMIC_INIT(i) { (i) } 21 + 22 #ifndef CONFIG_ARC_PLAT_EZNPS 23 24 #define atomic_read(v) READ_ONCE((v)->counter) 25 26 #ifdef CONFIG_ARC_HAS_LLSC 27
+10
arch/arc/include/asm/entry-arcv2.h
··· 16 ; 17 ; Now manually save: r12, sp, fp, gp, r25 18 19 PUSH r30 20 PUSH r12 21 ··· 79 1: 80 POP r12 81 POP r30 82 83 .endm 84
··· 16 ; 17 ; Now manually save: r12, sp, fp, gp, r25 18 19 + #ifdef CONFIG_ARC_HAS_ACCL_REGS 20 + PUSH r59 21 + PUSH r58 22 + #endif 23 + 24 PUSH r30 25 PUSH r12 26 ··· 74 1: 75 POP r12 76 POP r30 77 + 78 + #ifdef CONFIG_ARC_HAS_ACCL_REGS 79 + POP r58 80 + POP r59 81 + #endif 82 83 .endm 84
+4
arch/arc/include/asm/ptrace.h
··· 86 87 unsigned long r12, r30; 88 89 /*------- Below list auto saved by h/w -----------*/ 90 unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; 91
··· 86 87 unsigned long r12, r30; 88 89 + #ifdef CONFIG_ARC_HAS_ACCL_REGS 90 + unsigned long r58, r59; /* ACCL/ACCH used by FPU / DSP MPY */ 91 + #endif 92 + 93 /*------- Below list auto saved by h/w -----------*/ 94 unsigned long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; 95
+21 -9
arch/arc/kernel/setup.c
··· 319 static void arc_chk_core_config(void) 320 { 321 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 322 - int fpu_enabled; 323 324 if (!cpu->extn.timer0) 325 panic("Timer0 is not present!\n"); ··· 347 348 /* 349 * FP hardware/software config sanity 350 - * -If hardware contains DPFP, kernel needs to save/restore FPU state 351 * -If not, it will crash trying to save/restore the non-existant regs 352 - * 353 - * (only DPDP checked since SP has no arch visible regs) 354 */ 355 - fpu_enabled = IS_ENABLED(CONFIG_ARC_FPU_SAVE_RESTORE); 356 357 - if (cpu->extn.fpu_dp && !fpu_enabled) 358 - pr_warn("CONFIG_ARC_FPU_SAVE_RESTORE needed for working apps\n"); 359 - else if (!cpu->extn.fpu_dp && fpu_enabled) 360 - panic("FPU non-existent, disable CONFIG_ARC_FPU_SAVE_RESTORE\n"); 361 } 362 363 /*
··· 319 static void arc_chk_core_config(void) 320 { 321 struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; 322 + int saved = 0, present = 0; 323 + char *opt_nm = NULL;; 324 325 if (!cpu->extn.timer0) 326 panic("Timer0 is not present!\n"); ··· 346 347 /* 348 * FP hardware/software config sanity 349 + * -If hardware present, kernel needs to save/restore FPU state 350 * -If not, it will crash trying to save/restore the non-existant regs 351 */ 352 353 + if (is_isa_arcompact()) { 354 + opt_nm = "CONFIG_ARC_FPU_SAVE_RESTORE"; 355 + saved = IS_ENABLED(CONFIG_ARC_FPU_SAVE_RESTORE); 356 + 357 + /* only DPDP checked since SP has no arch visible regs */ 358 + present = cpu->extn.fpu_dp; 359 + } else { 360 + opt_nm = "CONFIG_ARC_HAS_ACCL_REGS"; 361 + saved = IS_ENABLED(CONFIG_ARC_HAS_ACCL_REGS); 362 + 363 + /* Accumulator Low:High pair (r58:59) present if DSP MPY or FPU */ 364 + present = cpu->extn_mpy.dsp | cpu->extn.fpu_sp | cpu->extn.fpu_dp; 365 + } 366 + 367 + if (present && !saved) 368 + pr_warn("Enable %s for working apps\n", opt_nm); 369 + else if (!present && saved) 370 + panic("Disable %s, hardware NOT present\n", opt_nm); 371 } 372 373 /*