[PATCH 01/26] sparc: Remove sequences that the B2BST scan script warns about

daniel at gaisler.com daniel at gaisler.com
Fri Oct 16 13:13:29 UTC 2020



2020-10-16 07:40 skrev Sebastian Huber:
> On 29/06/2020 13:27, Daniel Hellstrom wrote:
>> From: Daniel Cederman <cederman at gaisler.com>
>> 
>> ---
>>   cpukit/score/cpu/sparc/cpu_asm.S | 6 ++++--
>>   cpukit/score/cpu/sparc/syscall.S | 3 ++-
>>   2 files changed, 6 insertions(+), 3 deletions(-)
>> 
>> diff --git a/cpukit/score/cpu/sparc/cpu_asm.S 
>> b/cpukit/score/cpu/sparc/cpu_asm.S
>> index d5afd5f..bfad3fb 100644
>> --- a/cpukit/score/cpu/sparc/cpu_asm.S
>> +++ b/cpukit/score/cpu/sparc/cpu_asm.S
>> @@ -683,11 +683,13 @@ isr_dispatch:
>>           cmp     %l6, %l7
>>           bne,a   .Ldisable_fp
>>            andn   %l0, %l5, %l0
>> +        st      %g0, [%g6 + SPARC_PER_CPU_FP_OWNER_OFFSET]
>>           ba      .Lthread_dispatch_done
>> -         st     %g0, [%g6 + SPARC_PER_CPU_FP_OWNER_OFFSET]
>> +         nop
>>   .Ldisable_fp:
>> +        st       %l0, [%fp + ISF_PSR_OFFSET]
>>           ba      .Lthread_dispatch_done
>> -         st      %l0, [%fp + ISF_PSR_OFFSET]
>> +         nop
>>   .Lnon_fp_thread_dispatch:
>>   #elif defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH)
>>           /* Test if we interrupted a floating point thread (PSR[EF] 
>> == 1) */
>> diff --git a/cpukit/score/cpu/sparc/syscall.S 
>> b/cpukit/score/cpu/sparc/syscall.S
>> index 4f4ef32..737a501 100644
>> --- a/cpukit/score/cpu/sparc/syscall.S
>> +++ b/cpukit/score/cpu/sparc/syscall.S
>> @@ -218,9 +218,10 @@ SYM(syscall_lazy_fp_switch):
>>   .Lfp_save_done:
>>     	/* Restore the floating point context if necessary */
>> +	st	%g0, [%l4 + 
>> %lo(SPARC_THREAD_CONTROL_REGISTERS_FP_CONTEXT_OFFSET)]
>>   	cmp	%l6, 0
>>   	be	.Lfp_restore_done
>> -	 st	%g0, [%l4 + 
>> %lo(SPARC_THREAD_CONTROL_REGISTERS_FP_CONTEXT_OFFSET)]
>> +	 nop
>>   	ldd	[%l6 + SPARC_FP_CONTEXT_OFFSET_F0_F1], %f0
>>   	ldd	[%l6 + SPARC_FP_CONTEXT_OFFSET_F2_F3], %f2
>>   	ldd	[%l6 + SPARC_FP_CONTEXT_OFFSET_F4_F5], %f4
> 
> Some areas use the __FIX_LEON3FT_B2BST define to enable this
> workaround. I am not sure if using the delay slots gives a measurable
> performance boost. It would be good to mention the errata in the
> documentation and give some advice how the workarounds should be
> applied to RTEMS.
> 
> https://docs.rtems.org/branches/master/cpu-supplement/sparc.html

Indeed it is a bit messy, and we don't what to have comments all over 
the SPARC code about 0009 either. At Gaisler we scan the images at every 
release (and master from time to time) to discover inconsistencies and 
then we address them if new instances are found. It makes sense to add a 
LEON specific errata section. That will be good since it also document 
what errata is worked around by RTEMS and toolchain. I will at least 
document:
  * listing all errata
  * linking all the documents, for reference.
  * describe how they are activated them in the build,
  * what BSP and multilib is affected

I have updated the three patches related to TN-0009, now referencing 
#4154. However I will consider #4154 closed once I submit proper 
documentation in the sparc cpu supplement as propose. UI hope this is 
acceptable.

Thanks,
Daniel


More information about the devel mailing list