Skip to content

Commit 9b651cc

Browse files
committed
Merge tag 'arc-v3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
Pull ARC updates from Vineet Gupta: "Nothing too exciting here, just minor fixes/cleanup. Only noteworthy ones are: - Moving cache disabling to early boot - ARC UART enabled only if earlyprintk setup in cmdline" * tag 'arc-v3.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: ARC: Disable caches in early boot if so configured ARC: [arcfpga] Early ARC UART to be only activated by cmdline ARC: [arcfpga] Get rid of legacy BVCI latency unit support ARC: remove duplicate header exports ARC: arc_local_timer_setup() need not pass own cpu id ARC: Fixed spelling errors within comments ARC: make start_thread() out-of-line ARC: fix mmuv2 warning ARC: [SMP] ISS SMP extension bitrot
2 parents 214b931 + ef680cd commit 9b651cc

16 files changed

Lines changed: 158 additions & 249 deletions

File tree

‎arch/arc/boot/dts/angel4.dts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
interrupt-parent = <&intc>;
1818

1919
chosen {
20-
bootargs = "console=ttyARC0,115200n8";
20+
bootargs = "console=ttyARC0,115200n8 earlyprintk=ttyARC0";
2121
};
2222

2323
aliases {

‎arch/arc/include/asm/cache.h‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,31 @@ extern void read_decode_cache_bcr(void);
5555

5656
#endif /* !__ASSEMBLY__ */
5757

58+
/* Instruction cache related Auxiliary registers */
59+
#define ARC_REG_IC_BCR 0x77 /* Build Config reg */
60+
#define ARC_REG_IC_IVIC 0x10
61+
#define ARC_REG_IC_CTRL 0x11
62+
#define ARC_REG_IC_IVIL 0x19
63+
#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4)
64+
#define ARC_REG_IC_PTAG 0x1E
65+
#endif
66+
67+
/* Bit val in IC_CTRL */
68+
#define IC_CTRL_CACHE_DISABLE 0x1
69+
70+
/* Data cache related Auxiliary registers */
71+
#define ARC_REG_DC_BCR 0x72 /* Build Config reg */
72+
#define ARC_REG_DC_IVDC 0x47
73+
#define ARC_REG_DC_CTRL 0x48
74+
#define ARC_REG_DC_IVDL 0x4A
75+
#define ARC_REG_DC_FLSH 0x4B
76+
#define ARC_REG_DC_FLDL 0x4C
77+
#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4)
78+
#define ARC_REG_DC_PTAG 0x5C
79+
#endif
80+
81+
/* Bit val in DC_CTRL */
82+
#define DC_CTRL_INV_MODE_FLUSH 0x40
83+
#define DC_CTRL_FLUSH_STATUS 0x100
84+
5885
#endif /* _ASM_CACHE_H */

‎arch/arc/include/asm/irq.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
#include <asm-generic/irq.h>
2020

2121
extern void arc_init_IRQ(void);
22-
extern int get_hw_config_num_irq(void);
23-
24-
void arc_local_timer_setup(unsigned int cpu);
22+
void arc_local_timer_setup(void);
2523

2624
#endif

‎arch/arc/include/asm/processor.h‎

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#ifndef __ASSEMBLY__
2020

21-
#include <asm/arcregs.h> /* for STATUS_E1_MASK et all */
2221
#include <asm/ptrace.h>
2322

2423
/* Arch specific stuff which needs to be saved per task.
@@ -41,15 +40,13 @@ struct thread_struct {
4140
/* Forward declaration, a strange C thing */
4241
struct task_struct;
4342

44-
/*
45-
* Return saved PC of a blocked thread.
46-
*/
43+
/* Return saved PC of a blocked thread */
4744
unsigned long thread_saved_pc(struct task_struct *t);
4845

4946
#define task_pt_regs(p) \
5047
((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1)
5148

52-
/* Free all resources held by a thread. */
49+
/* Free all resources held by a thread */
5350
#define release_thread(thread) do { } while (0)
5451

5552
/* Prepare to copy thread state - unlazy all lazy status */
@@ -82,26 +79,8 @@ unsigned long thread_saved_pc(struct task_struct *t);
8279
#define KSTK_BLINK(tsk) KSTK_REG(tsk, 4)
8380
#define KSTK_FP(tsk) KSTK_REG(tsk, 0)
8481

85-
/*
86-
* Do necessary setup to start up a newly executed thread.
87-
*
88-
* E1,E2 so that Interrupts are enabled in user mode
89-
* L set, so Loop inhibited to begin with
90-
* lp_start and lp_end seeded with bogus non-zero values so to easily catch
91-
* the ARC700 sr to lp_start hardware bug
92-
*/
93-
#define start_thread(_regs, _pc, _usp) \
94-
do { \
95-
set_fs(USER_DS); /* reads from user space */ \
96-
(_regs)->ret = (_pc); \
97-
/* Interrupts enabled in User Mode */ \
98-
(_regs)->status32 = STATUS_U_MASK | STATUS_L_MASK \
99-
| STATUS_E1_MASK | STATUS_E2_MASK; \
100-
(_regs)->sp = (_usp); \
101-
/* bogus seed values for debugging */ \
102-
(_regs)->lp_start = 0x10; \
103-
(_regs)->lp_end = 0x80; \
104-
} while (0)
82+
extern void start_thread(struct pt_regs * regs, unsigned long pc,
83+
unsigned long usp);
10584

10685
extern unsigned int get_wchan(struct task_struct *p);
10786

‎arch/arc/include/uapi/asm/Kbuild‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,4 @@
22
include include/uapi/asm-generic/Kbuild.asm
33
header-y += elf.h
44
header-y += page.h
5-
header-y += setup.h
6-
header-y += byteorder.h
75
header-y += cachectl.h
8-
header-y += ptrace.h
9-
header-y += sigcontext.h
10-
header-y += signal.h
11-
header-y += swab.h
12-
header-y += unistd.h

‎arch/arc/kernel/entry.S‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ARCFP_DATA int1_saved_reg
156156
int1_saved_reg:
157157
.zero 4
158158

159-
/* Each Interrupt level needs it's own scratch */
159+
/* Each Interrupt level needs its own scratch */
160160
#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
161161

162162
ARCFP_DATA int2_saved_reg
@@ -473,7 +473,7 @@ trap_with_param:
473473
lr r0, [efa]
474474
mov r1, sp
475475

476-
; Now that we have read EFA, its safe to do "fake" rtie
476+
; Now that we have read EFA, it is safe to do "fake" rtie
477477
; and get out of CPU exception mode
478478
FAKE_RET_FROM_EXCPN r11
479479

@@ -678,9 +678,9 @@ not_exception:
678678
brne r9, event_IRQ2, 149f
679679

680680
;------------------------------------------------------------------
681-
; if L2 IRQ interrupted a L1 ISR, we'd disbaled preemption earlier
682-
; so that sched doesnt move to new task, causing L1 to be delayed
683-
; undeterministically. Now that we've achieved that, lets reset
681+
; if L2 IRQ interrupted an L1 ISR, we'd disabled preemption earlier
682+
; so that sched doesn't move to new task, causing L1 to be delayed
683+
; undeterministically. Now that we've achieved that, let's reset
684684
; things to what they were, before returning from L2 context
685685
;----------------------------------------------------------------
686686

@@ -736,7 +736,7 @@ ENTRY(ret_from_fork)
736736
; put last task in scheduler queue
737737
bl @schedule_tail
738738

739-
; If kernel thread, jump to it's entry-point
739+
; If kernel thread, jump to its entry-point
740740
ld r9, [sp, PT_status32]
741741
brne r9, 0, 1f
742742

‎arch/arc/kernel/head.S‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,42 @@
1212
* to skip certain things during boot on simulator
1313
*/
1414

15+
#include <linux/linkage.h>
1516
#include <asm/asm-offsets.h>
1617
#include <asm/entry.h>
17-
#include <linux/linkage.h>
1818
#include <asm/arcregs.h>
19+
#include <asm/cache.h>
20+
21+
.macro CPU_EARLY_SETUP
22+
23+
; Setting up Vectror Table (in case exception happens in early boot
24+
sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE]
25+
26+
; Disable I-cache/D-cache if kernel so configured
27+
lr r5, [ARC_REG_IC_BCR]
28+
breq r5, 0, 1f ; I$ doesn't exist
29+
lr r5, [ARC_REG_IC_CTRL]
30+
#ifdef CONFIG_ARC_HAS_ICACHE
31+
bclr r5, r5, 0 ; 0 - Enable, 1 is Disable
32+
#else
33+
bset r5, r5, 0 ; I$ exists, but is not used
34+
#endif
35+
sr r5, [ARC_REG_IC_CTRL]
36+
37+
1:
38+
lr r5, [ARC_REG_DC_BCR]
39+
breq r5, 0, 1f ; D$ doesn't exist
40+
lr r5, [ARC_REG_DC_CTRL]
41+
bclr r5, r5, 6 ; Invalidate (discard w/o wback)
42+
#ifdef CONFIG_ARC_HAS_DCACHE
43+
bclr r5, r5, 0 ; Enable (+Inv)
44+
#else
45+
bset r5, r5, 0 ; Disable (+Inv)
46+
#endif
47+
sr r5, [ARC_REG_DC_CTRL]
48+
49+
1:
50+
.endm
1951

2052
.cpu A7
2153

@@ -27,7 +59,7 @@ stext:
2759
; Don't clobber r0-r2 yet. It might have bootloader provided info
2860
;-------------------------------------------------------------------
2961

30-
sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE]
62+
CPU_EARLY_SETUP
3163

3264
#ifdef CONFIG_SMP
3365
; Ensure Boot (Master) proceeds. Others wait in platform dependent way
@@ -90,7 +122,7 @@ stext:
90122

91123
first_lines_of_secondary:
92124

93-
sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE]
125+
CPU_EARLY_SETUP
94126

95127
; setup per-cpu idle task as "current" on this CPU
96128
ld r0, [@secondary_idle_tsk]

‎arch/arc/kernel/irq.c‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -150,24 +150,6 @@ void arch_do_IRQ(unsigned int irq, struct pt_regs *regs)
150150
set_irq_regs(old_regs);
151151
}
152152

153-
int get_hw_config_num_irq(void)
154-
{
155-
uint32_t val = read_aux_reg(ARC_REG_VECBASE_BCR);
156-
157-
switch (val & 0x03) {
158-
case 0:
159-
return 16;
160-
case 1:
161-
return 32;
162-
case 2:
163-
return 8;
164-
default:
165-
return 0;
166-
}
167-
168-
return 0;
169-
}
170-
171153
/*
172154
* arch_local_irq_enable - Enable interrupts.
173155
*

‎arch/arc/kernel/process.c‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,29 @@ int copy_thread(unsigned long clone_flags,
150150
return 0;
151151
}
152152

153+
/*
154+
* Do necessary setup to start up a new user task
155+
*/
156+
void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long usp)
157+
{
158+
set_fs(USER_DS); /* user space */
159+
160+
regs->sp = usp;
161+
regs->ret = pc;
162+
163+
/*
164+
* [U]ser Mode bit set
165+
* [L] ZOL loop inhibited to begin with - cleared by a LP insn
166+
* Interrupts enabled
167+
*/
168+
regs->status32 = STATUS_U_MASK | STATUS_L_MASK |
169+
STATUS_E1_MASK | STATUS_E2_MASK;
170+
171+
/* bogus seed values for debugging */
172+
regs->lp_start = 0x10;
173+
regs->lp_end = 0x80;
174+
}
175+
153176
/*
154177
* Some archs flush debug and FPU info here
155178
*/

‎arch/arc/kernel/smp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void start_kernel_secondary(void)
138138
if (machine_desc->init_smp)
139139
machine_desc->init_smp(smp_processor_id());
140140

141-
arc_local_timer_setup(cpu);
141+
arc_local_timer_setup();
142142

143143
local_irq_enable();
144144
preempt_disable();

0 commit comments

Comments
 (0)