Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8401707f authored by Konrad Eisele's avatar Konrad Eisele Committed by David S. Miller
Browse files

sparc,leon: Sparc-Leon SMP support



Support SMP for a Sparc-Leon multiprocessor system.
Add Leon specific SMP code to arch/sparc/kernel/leon_smp.c.

Signed-off-by: default avatarKonrad Eisele <konrad@gaisler.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b6727b12
Loading
Loading
Loading
Loading
+28 −0
Original line number Original line Diff line number Diff line
@@ -340,6 +340,30 @@ extern int leon_flush_needed(void);
extern void leon_switch_mm(void);
extern void leon_switch_mm(void);
extern int srmmu_swprobe_trace;
extern int srmmu_swprobe_trace;


#ifdef CONFIG_SMP
extern int leon_smp_nrcpus(void);
extern void leon_clear_profile_irq(int cpu);
extern void leon_smp_done(void);
extern void leon_boot_cpus(void);
extern int leon_boot_one_cpu(int i);
void leon_init_smp(void);
extern void cpu_probe(void);
extern void cpu_idle(void);
extern void init_IRQ(void);
extern void cpu_panic(void);
extern int __leon_processor_id(void);
void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu);

extern unsigned int real_irq_entry[], smpleon_ticker[];
extern unsigned int patchme_maybe_smp_msg[];
extern unsigned long trapbase_cpu1[];
extern unsigned long trapbase_cpu2[];
extern unsigned long trapbase_cpu3[];
extern unsigned int t_nmi[], linux_trap_ipi15_leon[];
extern unsigned int linux_trap_ipi15_sun4m[];

#endif /* CONFIG_SMP */

#endif /* __KERNEL__ */
#endif /* __KERNEL__ */


#endif /* __ASSEMBLY__ */
#endif /* __ASSEMBLY__ */
@@ -356,6 +380,10 @@ extern int srmmu_swprobe_trace;
#define leon_switch_mm() do {} while (0)
#define leon_switch_mm() do {} while (0)
#define leon_init_IRQ() do {} while (0)
#define leon_init_IRQ() do {} while (0)
#define init_leon() do {} while (0)
#define init_leon() do {} while (0)
#define leon_smp_done() do {} while (0)
#define leon_boot_cpus() do {} while (0)
#define leon_boot_one_cpu(i) 1
#define leon_init_smp() do {} while (0)


#endif /* !defined(CONFIG_SPARC_LEON) */
#endif /* !defined(CONFIG_SPARC_LEON) */


+9 −0
Original line number Original line Diff line number Diff line
@@ -106,6 +106,15 @@ static inline int hard_smp4d_processor_id(void)
	return cpuid;
	return cpuid;
}
}


extern inline int hard_smpleon_processor_id(void)
{
	int cpuid;
	__asm__ __volatile__("rd     %%asr17,%0\n\t"
			     "srl    %0,28,%0" :
			     "=&r" (cpuid) : );
	return cpuid;
}

#ifndef MODULE
#ifndef MODULE
static inline int hard_smp_processor_id(void)
static inline int hard_smp_processor_id(void)
{
{
+1 −1
Original line number Original line Diff line number Diff line
@@ -72,7 +72,7 @@ obj-y += dma.o
obj-$(CONFIG_SPARC32_PCI) += pcic.o
obj-$(CONFIG_SPARC32_PCI) += pcic.o


obj-$(CONFIG_SMP)         += trampoline_$(BITS).o smp_$(BITS).o
obj-$(CONFIG_SMP)         += trampoline_$(BITS).o smp_$(BITS).o
obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o
obj-$(CONFIG_SPARC32_SMP) += sun4m_smp.o sun4d_smp.o leon_smp.o
obj-$(CONFIG_SPARC64_SMP) += hvtramp.o
obj-$(CONFIG_SPARC64_SMP) += hvtramp.o


obj-y                     += auxio_$(BITS).o
obj-y                     += auxio_$(BITS).o
+33 −0
Original line number Original line Diff line number Diff line
@@ -400,6 +400,39 @@ linux_trap_ipi15_sun4d:
	/* FIXME */
	/* FIXME */
1:	b,a	1b
1:	b,a	1b


#ifdef CONFIG_SPARC_LEON

	.globl	smpleon_ticker
	/* SMP per-cpu ticker interrupts are handled specially. */
smpleon_ticker:
        SAVE_ALL
	or	%l0, PSR_PIL, %g2
	wr	%g2, 0x0, %psr
	WRITE_PAUSE
	wr	%g2, PSR_ET, %psr
	WRITE_PAUSE
	call	leon_percpu_timer_interrupt
	 add	%sp, STACKFRAME_SZ, %o0
	wr	%l0, PSR_ET, %psr
	WRITE_PAUSE
	RESTORE_ALL

	.align	4
	.globl	linux_trap_ipi15_leon
linux_trap_ipi15_leon:
	SAVE_ALL
	or	%l0, PSR_PIL, %l4
	wr	%l4, 0x0, %psr
	WRITE_PAUSE
	wr	%l4, PSR_ET, %psr
	WRITE_PAUSE
	call	leon_cross_call_irq
	 nop
	b	ret_trap_lockless_ipi
	 clr	%l6

#endif /* CONFIG_SPARC_LEON */

#endif /* CONFIG_SMP */
#endif /* CONFIG_SMP */


	/* This routine handles illegal instructions and privileged
	/* This routine handles illegal instructions and privileged
+22 −0
Original line number Original line Diff line number Diff line
@@ -811,8 +811,30 @@ found_version:
got_prop:
got_prop:
#ifdef CONFIG_SPARC_LEON
#ifdef CONFIG_SPARC_LEON
	        /* no cpu-type check is needed, it is a SPARC-LEON */
	        /* no cpu-type check is needed, it is a SPARC-LEON */
#ifdef CONFIG_SMP
		ba leon_smp_init
		 nop

		.global leon_smp_init
leon_smp_init:
		sethi	%hi(boot_cpu_id), %g1    ! master always 0
		stb	%g0, [%g1 + %lo(boot_cpu_id)]
		sethi	%hi(boot_cpu_id4), %g1   ! master always 0
		stb	%g0, [%g1 + %lo(boot_cpu_id4)]

		rd     %asr17,%g1
		srl    %g1,28,%g1

		cmp %g0,%g1
		 beq sun4c_continue_boot         !continue with master
		nop

		ba leon_smp_cpu_startup
		 nop
#else
		ba sun4c_continue_boot
		ba sun4c_continue_boot
		 nop
		 nop
#endif
#endif
#endif
		set	cputypval, %o2
		set	cputypval, %o2
		ldub	[%o2 + 0x4], %l1
		ldub	[%o2 + 0x4], %l1
Loading