bsps: bsp_start_on_secondary_processor()

Pass current processor control as first parameter in
bsp_start_on_secondary_processor() and qoriq_start_thread() to make
dependency more explicit.
This commit is contained in:
Sebastian Huber
2018-07-24 10:50:39 +02:00
parent 0d362ff397
commit 4678d1a8b0
7 changed files with 23 additions and 15 deletions

View File

@@ -167,6 +167,8 @@ static inline void bsp_work_area_initialize_with_table(
void bsp_work_area_initialize(void); void bsp_work_area_initialize(void);
struct Per_CPU_Control;
/** /**
* @brief Standard start routine for secondary processors. * @brief Standard start routine for secondary processors.
* *
@@ -175,7 +177,7 @@ void bsp_work_area_initialize(void);
* of this function is a call to * of this function is a call to
* _SMP_Start_multitasking_on_secondary_processor(). * _SMP_Start_multitasking_on_secondary_processor().
*/ */
void bsp_start_on_secondary_processor(void); void bsp_start_on_secondary_processor(struct Per_CPU_Control *cpu_self);
/** @} */ /** @} */

View File

@@ -105,7 +105,9 @@ typedef struct {
extern qoriq_start_spin_table * extern qoriq_start_spin_table *
qoriq_start_spin_table_addr[QORIQ_CPU_COUNT / QORIQ_THREAD_COUNT]; qoriq_start_spin_table_addr[QORIQ_CPU_COUNT / QORIQ_THREAD_COUNT];
void qoriq_start_thread(void); struct Per_CPU_Control;
void qoriq_start_thread(struct Per_CPU_Control *);
void qoriq_restart_secondary_processor( void qoriq_restart_secondary_processor(
const qoriq_start_spin_table *spin_table const qoriq_start_spin_table *spin_table

View File

@@ -44,10 +44,8 @@ static bool is_started_by_u_boot(uint32_t cpu_index)
return cpu_index % QORIQ_THREAD_COUNT == 0; return cpu_index % QORIQ_THREAD_COUNT == 0;
} }
void qoriq_start_thread(void) void qoriq_start_thread(Per_CPU_Control *cpu_self)
{ {
const Per_CPU_Control *cpu_self = _Per_CPU_Get();
ppc_exc_initialize_interrupt_stack( ppc_exc_initialize_interrupt_stack(
(uintptr_t) cpu_self->interrupt_stack_low, (uintptr_t) cpu_self->interrupt_stack_low,
rtems_configuration_get_interrupt_stack_size() rtems_configuration_get_interrupt_stack_size()
@@ -85,14 +83,14 @@ static void start_thread_if_necessary(uint32_t cpu_index_self)
#endif #endif
} }
void bsp_start_on_secondary_processor(void) void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)
{ {
uint32_t cpu_index_self = _SMP_Get_current_processor(); uint32_t cpu_index_self;
const Per_CPU_Control *cpu_self = _Per_CPU_Get_by_index(cpu_index_self);
qoriq_initialize_exceptions(cpu_self->interrupt_stack_low); qoriq_initialize_exceptions(cpu_self->interrupt_stack_low);
bsp_interrupt_facility_initialize(); bsp_interrupt_facility_initialize();
cpu_index_self = _Per_CPU_Get_index(cpu_self);
start_thread_if_necessary(cpu_index_self); start_thread_if_necessary(cpu_index_self);
_SMP_Start_multitasking_on_secondary_processor(); _SMP_Start_multitasking_on_secondary_processor();

View File

@@ -38,6 +38,7 @@
#define START_STACK r15 #define START_STACK r15
#define SAVED_LINK_REGISTER r16 #define SAVED_LINK_REGISTER r16
#define FDT_REGISTER r17 #define FDT_REGISTER r17
#define CPU_SELF r18
.globl _start .globl _start
#ifdef RTEMS_SMP #ifdef RTEMS_SMP
@@ -195,7 +196,7 @@ _start:
LA r13, _SDA_BASE_ LA r13, _SDA_BASE_
#endif #endif
SET_SELF_CPU_CONTROL r4, r5 SET_SELF_CPU_CONTROL CPU_SELF, r5
blr blr
@@ -316,8 +317,7 @@ _start_thread:
bl .Linitearly bl .Linitearly
/* Initialize start stack */ /* Initialize start stack */
GET_SELF_CPU_CONTROL r3 PPC_REG_LOAD r3, PER_CPU_INTERRUPT_STACK_HIGH(CPU_SELF)
PPC_REG_LOAD r3, PER_CPU_INTERRUPT_STACK_HIGH(r3)
subi r1, r3, PPC_MINIMUM_STACK_FRAME_SIZE subi r1, r3, PPC_MINIMUM_STACK_FRAME_SIZE
clrrwi r1, r1, PPC_STACK_ALIGN_POWER clrrwi r1, r1, PPC_STACK_ALIGN_POWER
li r0, 0 li r0, 0
@@ -327,6 +327,7 @@ _start_thread:
bl .Linitfpu bl .Linitfpu
#endif #endif
mr r3, CPU_SELF
b qoriq_start_thread b qoriq_start_thread
PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE
#endif #endif
@@ -339,6 +340,7 @@ _start_secondary_processor:
bl .Linitmore bl .Linitmore
li r3, 0 li r3, 0
bl .Linitmmu bl .Linitmmu
mr r3, CPU_SELF
b bsp_start_on_secondary_processor b bsp_start_on_secondary_processor
PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE PPC64_NOP_FOR_LINKER_TOC_POINTER_RESTORE
#endif /* RTEMS_SMP */ #endif /* RTEMS_SMP */

View File

@@ -35,9 +35,9 @@ static rtems_isr bsp_inter_processor_interrupt(
_SMP_Inter_processor_interrupt_handler(_Per_CPU_Get()); _SMP_Inter_processor_interrupt_handler(_Per_CPU_Get());
} }
void bsp_start_on_secondary_processor() void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)
{ {
uint32_t cpu_index_self = _CPU_SMP_Get_current_processor(); uint32_t cpu_index_self;
/* /*
* If data cache snooping is not enabled we terminate using BSP_fatal_exit() * If data cache snooping is not enabled we terminate using BSP_fatal_exit()
@@ -49,6 +49,7 @@ void bsp_start_on_secondary_processor()
BSP_fatal_exit( LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR ); BSP_fatal_exit( LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR );
/* Unmask IPI interrupts at Interrupt controller for this CPU */ /* Unmask IPI interrupts at Interrupt controller for this CPU */
cpu_index_self = _Per_CPU_Get_index(cpu_self);
LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_mp_irq; LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_mp_irq;
_SMP_Start_multitasking_on_secondary_processor(); _SMP_Start_multitasking_on_secondary_processor();

View File

@@ -310,6 +310,7 @@ SYM(hard_reset):
andn %sp, 0x0f, %sp ! align stack on 16-byte boundary andn %sp, 0x0f, %sp ! align stack on 16-byte boundary
mov %sp, %fp ! set frame pointer mov %sp, %fp ! set frame pointer
mv %o0, %g6
call SYM(bsp_start_on_secondary_processor) ! does not return call SYM(bsp_start_on_secondary_processor) ! does not return
sub %sp, SPARC_MINIMUM_STACK_FRAME_SIZE, %sp sub %sp, SPARC_MINIMUM_STACK_FRAME_SIZE, %sp
.Lbootcpu: .Lbootcpu:

View File

@@ -34,15 +34,17 @@ const char rtems_test_name[] = "SMPFATAL 8";
* without BSP support. * without BSP support.
*/ */
void bsp_start_on_secondary_processor(void) void bsp_start_on_secondary_processor(struct Per_CPU_Control *cpu_self)
{ {
/* Provided to avoid multiple definitions of the CPU SMP support functions */ /* Provided to avoid multiple definitions of the CPU SMP support functions */
(void) cpu_self;
} }
#if QORIQ_THREAD_COUNT > 1 #if QORIQ_THREAD_COUNT > 1
void qoriq_start_thread(void) void qoriq_start_thread(Per_CPU_Control *cpu_self)
{ {
/* Provided to avoid multiple definitions of the CPU SMP support functions */ /* Provided to avoid multiple definitions of the CPU SMP support functions */
(void) cpu_self;
} }
#endif #endif