[PATCH 1/2] bsp/sparc: Flush icache before first time enabling interrupts

Daniel Cederman cederman at gaisler.com
Fri Jul 4 09:54:58 UTC 2014


Thank you for your comments Joel!

 > I really don't like adding calls to anything BSP_xxx in score/cpu.
 >
 > Can this be done in bsp_postdriver_hook() for the LEON3?

It is only the main cpu that calls bsp_postdriver_hook() and the cache 
invalidation code needs to be run on the secondary cpus. I could rename 
it to _SPARC_Start_multitasking and place it in score/cpu instead, as 
was done for ARM7VM?

Daniel Cederman
Software Engineer
Aeroflex Gaisler AB
Aeroflex Microelectronic Solutions – HiRel
Kungsgatan 12
SE-411 19 Gothenburg, Sweden
Phone: +46 31 7758665
cederman at gaisler.com
www.Aeroflex.com/Gaisler

On 2014-07-03 17:55, Joel Sherrill wrote:
>
> On 7/3/2014 4:39 AM, Daniel Cederman wrote:
>> A secondary processor might miss changes done to the trap table
>> if the instruction cache is not flushed. Once interrupts are enabled
>> any other required cache flushes can be ordered via the cache
>> manager.
>> ---
>>   c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c |    9 +++++++++
>>   cpukit/score/cpu/sparc/rtems/score/cpu.h      |    4 ++++
>>   2 files changed, 13 insertions(+)
>>
>> diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c b/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
>> index 567eecc..9166ad5 100644
>> --- a/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
>> +++ b/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
>> @@ -15,6 +15,7 @@
>>
>>   #include <bsp.h>
>>   #include <bsp/bootcard.h>
>> +#include <cache_.h>
>>   #include <leon.h>
>>   #include <rtems/bspIo.h>
>>   #include <rtems/score/smpimpl.h>
>> @@ -80,3 +81,11 @@ void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
>>     /* send interrupt to destination CPU */
>>     LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
>>   }
>> +
>> +void _BSP_Start_multitasking(
>> +  Context_Control *heir
>> +)
>> +{
>> +  _CPU_cache_invalidate_entire_instruction();
>> +  _CPU_Context_Restart_self( heir );
>> +}
>> diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h
>> index c010005..4a08441 100644
>> --- a/cpukit/score/cpu/sparc/rtems/score/cpu.h
>> +++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h
>> @@ -1203,6 +1203,10 @@ register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__( "g6" );
>>
>>     void _CPU_SMP_Send_interrupt( uint32_t target_processor_index );
>>
>> +  void _BSP_Start_multitasking( Context_Control *heir )
>> +    RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
>> +  #define _CPU_Start_multitasking _BSP_Start_multitasking
>> +
> I really don't like adding calls to anything BSP_xxx in score/cpu.
>
> Can this be done in bsp_postdriver_hook() for the LEON3?
>>     static inline void _CPU_SMP_Processor_event_broadcast( void )
>>     {
>>       __asm__ volatile ( "" : : : "memory" );
>



More information about the devel mailing list