Skip to content

Commit

Permalink
Merge tag 'arc-v3.16-rc1' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/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
  • Loading branch information
Linus Torvalds committed Jun 10, 2014
2 parents 214b931 + ef680cd commit 9b651cc
Show file tree
Hide file tree
Showing 16 changed files with 158 additions and 249 deletions.
2 changes: 1 addition & 1 deletion arch/arc/boot/dts/angel4.dts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
interrupt-parent = <&intc>;

chosen {
bootargs = "console=ttyARC0,115200n8";
bootargs = "console=ttyARC0,115200n8 earlyprintk=ttyARC0";
};

aliases {
Expand Down
27 changes: 27 additions & 0 deletions arch/arc/include/asm/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,31 @@ extern void read_decode_cache_bcr(void);

#endif /* !__ASSEMBLY__ */

/* Instruction cache related Auxiliary registers */
#define ARC_REG_IC_BCR 0x77 /* Build Config reg */
#define ARC_REG_IC_IVIC 0x10
#define ARC_REG_IC_CTRL 0x11
#define ARC_REG_IC_IVIL 0x19
#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4)
#define ARC_REG_IC_PTAG 0x1E
#endif

/* Bit val in IC_CTRL */
#define IC_CTRL_CACHE_DISABLE 0x1

/* Data cache related Auxiliary registers */
#define ARC_REG_DC_BCR 0x72 /* Build Config reg */
#define ARC_REG_DC_IVDC 0x47
#define ARC_REG_DC_CTRL 0x48
#define ARC_REG_DC_IVDL 0x4A
#define ARC_REG_DC_FLSH 0x4B
#define ARC_REG_DC_FLDL 0x4C
#if defined(CONFIG_ARC_MMU_V3) || defined (CONFIG_ARC_MMU_V4)
#define ARC_REG_DC_PTAG 0x5C
#endif

/* Bit val in DC_CTRL */
#define DC_CTRL_INV_MODE_FLUSH 0x40
#define DC_CTRL_FLUSH_STATUS 0x100

#endif /* _ASM_CACHE_H */
4 changes: 1 addition & 3 deletions arch/arc/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include <asm-generic/irq.h>

extern void arc_init_IRQ(void);
extern int get_hw_config_num_irq(void);

void arc_local_timer_setup(unsigned int cpu);
void arc_local_timer_setup(void);

#endif
29 changes: 4 additions & 25 deletions arch/arc/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#ifndef __ASSEMBLY__

#include <asm/arcregs.h> /* for STATUS_E1_MASK et all */
#include <asm/ptrace.h>

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

/*
* Return saved PC of a blocked thread.
*/
/* Return saved PC of a blocked thread */
unsigned long thread_saved_pc(struct task_struct *t);

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

/* Free all resources held by a thread. */
/* Free all resources held by a thread */
#define release_thread(thread) do { } while (0)

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

/*
* Do necessary setup to start up a newly executed thread.
*
* E1,E2 so that Interrupts are enabled in user mode
* L set, so Loop inhibited to begin with
* lp_start and lp_end seeded with bogus non-zero values so to easily catch
* the ARC700 sr to lp_start hardware bug
*/
#define start_thread(_regs, _pc, _usp) \
do { \
set_fs(USER_DS); /* reads from user space */ \
(_regs)->ret = (_pc); \
/* Interrupts enabled in User Mode */ \
(_regs)->status32 = STATUS_U_MASK | STATUS_L_MASK \
| STATUS_E1_MASK | STATUS_E2_MASK; \
(_regs)->sp = (_usp); \
/* bogus seed values for debugging */ \
(_regs)->lp_start = 0x10; \
(_regs)->lp_end = 0x80; \
} while (0)
extern void start_thread(struct pt_regs * regs, unsigned long pc,
unsigned long usp);

extern unsigned int get_wchan(struct task_struct *p);

Expand Down
7 changes: 0 additions & 7 deletions arch/arc/include/uapi/asm/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@
include include/uapi/asm-generic/Kbuild.asm
header-y += elf.h
header-y += page.h
header-y += setup.h
header-y += byteorder.h
header-y += cachectl.h
header-y += ptrace.h
header-y += sigcontext.h
header-y += signal.h
header-y += swab.h
header-y += unistd.h
12 changes: 6 additions & 6 deletions arch/arc/kernel/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ ARCFP_DATA int1_saved_reg
int1_saved_reg:
.zero 4

/* Each Interrupt level needs it's own scratch */
/* Each Interrupt level needs its own scratch */
#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS

ARCFP_DATA int2_saved_reg
Expand Down Expand Up @@ -473,7 +473,7 @@ trap_with_param:
lr r0, [efa]
mov r1, sp

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

Expand Down Expand Up @@ -678,9 +678,9 @@ not_exception:
brne r9, event_IRQ2, 149f

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

Expand Down Expand Up @@ -736,7 +736,7 @@ ENTRY(ret_from_fork)
; put last task in scheduler queue
bl @schedule_tail

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

Expand Down
38 changes: 35 additions & 3 deletions arch/arc/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,42 @@
* to skip certain things during boot on simulator
*/

#include <linux/linkage.h>
#include <asm/asm-offsets.h>
#include <asm/entry.h>
#include <linux/linkage.h>
#include <asm/arcregs.h>
#include <asm/cache.h>

.macro CPU_EARLY_SETUP

; Setting up Vectror Table (in case exception happens in early boot
sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE]

; Disable I-cache/D-cache if kernel so configured
lr r5, [ARC_REG_IC_BCR]
breq r5, 0, 1f ; I$ doesn't exist
lr r5, [ARC_REG_IC_CTRL]
#ifdef CONFIG_ARC_HAS_ICACHE
bclr r5, r5, 0 ; 0 - Enable, 1 is Disable
#else
bset r5, r5, 0 ; I$ exists, but is not used
#endif
sr r5, [ARC_REG_IC_CTRL]

1:
lr r5, [ARC_REG_DC_BCR]
breq r5, 0, 1f ; D$ doesn't exist
lr r5, [ARC_REG_DC_CTRL]
bclr r5, r5, 6 ; Invalidate (discard w/o wback)
#ifdef CONFIG_ARC_HAS_DCACHE
bclr r5, r5, 0 ; Enable (+Inv)
#else
bset r5, r5, 0 ; Disable (+Inv)
#endif
sr r5, [ARC_REG_DC_CTRL]

1:
.endm

.cpu A7

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

sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE]
CPU_EARLY_SETUP

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

first_lines_of_secondary:

sr @_int_vec_base_lds, [AUX_INTR_VEC_BASE]
CPU_EARLY_SETUP

; setup per-cpu idle task as "current" on this CPU
ld r0, [@secondary_idle_tsk]
Expand Down
18 changes: 0 additions & 18 deletions arch/arc/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,6 @@ void arch_do_IRQ(unsigned int irq, struct pt_regs *regs)
set_irq_regs(old_regs);
}

int get_hw_config_num_irq(void)
{
uint32_t val = read_aux_reg(ARC_REG_VECBASE_BCR);

switch (val & 0x03) {
case 0:
return 16;
case 1:
return 32;
case 2:
return 8;
default:
return 0;
}

return 0;
}

/*
* arch_local_irq_enable - Enable interrupts.
*
Expand Down
23 changes: 23 additions & 0 deletions arch/arc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,29 @@ int copy_thread(unsigned long clone_flags,
return 0;
}

/*
* Do necessary setup to start up a new user task
*/
void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long usp)
{
set_fs(USER_DS); /* user space */

regs->sp = usp;
regs->ret = pc;

/*
* [U]ser Mode bit set
* [L] ZOL loop inhibited to begin with - cleared by a LP insn
* Interrupts enabled
*/
regs->status32 = STATUS_U_MASK | STATUS_L_MASK |
STATUS_E1_MASK | STATUS_E2_MASK;

/* bogus seed values for debugging */
regs->lp_start = 0x10;
regs->lp_end = 0x80;
}

/*
* Some archs flush debug and FPU info here
*/
Expand Down
2 changes: 1 addition & 1 deletion arch/arc/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void start_kernel_secondary(void)
if (machine_desc->init_smp)
machine_desc->init_smp(smp_processor_id());

arc_local_timer_setup(cpu);
arc_local_timer_setup();

local_irq_enable();
preempt_disable();
Expand Down
11 changes: 6 additions & 5 deletions arch/arc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,13 @@ static struct irqaction arc_timer_irq = {
/*
* Setup the local event timer for @cpu
*/
void arc_local_timer_setup(unsigned int cpu)
void arc_local_timer_setup()
{
struct clock_event_device *clk = &per_cpu(arc_clockevent_device, cpu);
struct clock_event_device *evt = this_cpu_ptr(&arc_clockevent_device);
int cpu = smp_processor_id();

clk->cpumask = cpumask_of(cpu);
clockevents_config_and_register(clk, arc_get_core_freq(),
evt->cpumask = cpumask_of(cpu);
clockevents_config_and_register(evt, arc_get_core_freq(),
0, ARC_TIMER_MAX);

/*
Expand Down Expand Up @@ -261,7 +262,7 @@ void __init time_init(void)
clocksource_register_hz(&arc_counter, arc_get_core_freq());

/* sets up the periodic event timer */
arc_local_timer_setup(smp_processor_id());
arc_local_timer_setup();

if (machine_desc->init_time)
machine_desc->init_time();
Expand Down
Loading

0 comments on commit 9b651cc

Please sign in to comment.