[PATCH] sparc: Add assembly workaround for LEON3FT B2BST errata
This patch adds NOP instructions to prevent instruction sequences that are sensitive to the LEON3FT B2BST errata. See GRLIB-TN-0009: "LEON3FT Stale Cache Entry After Store with Data Tag Parity Error" for more information. The sequences are only modified if __FIX_LEON3FT_B2BST is defined. The patch works in conjunction with the -mfix-ut700, -mfix-gr712rc, and -mfix-ut699 GCC flags that prevents the sensitive sequences from being generated. See also https://devel.rtems.org/ticket/3057 --- c/src/lib/libbsp/sparc/shared/irq_asm.S | 47 + c/src/lib/libcpu/sparc/access/access.S | 28 +++ c/src/lib/libcpu/sparc/reg_win/window.S | 12 +++ cpukit/score/cpu/sparc/cpu_asm.S| 22 cpukit/score/cpu/sparc/rtems/score/sparc.h | 10 ++ cpukit/score/cpu/sparc/sparc-context-validate.S | 1 + 6 files changed, 120 insertions(+) diff --git a/c/src/lib/libbsp/sparc/shared/irq_asm.S b/c/src/lib/libbsp/sparc/shared/irq_asm.S index 075c780..b4374c3 100644 --- a/c/src/lib/libbsp/sparc/shared/irq_asm.S +++ b/c/src/lib/libbsp/sparc/shared/irq_asm.S @@ -66,14 +66,22 @@ SYM(_CPU_Context_switch): */ std %l0, [%o0 + L0_OFFSET] ! save the local registers +SPARC_LEON3FT_B2BST_NOP std %l2, [%o0 + L2_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l4, [%o0 + L4_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l6, [%o0 + L6_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i0, [%o0 + I0_OFFSET] ! save the input registers +SPARC_LEON3FT_B2BST_NOP std %i2, [%o0 + I2_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i4, [%o0 + I4_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i6, [%o0 + I6_FP_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %o6, [%o0 + O6_SP_OFFSET]! save the output registers @@ -158,14 +166,22 @@ save_frame_loop: */ std %l0, [%sp + CPU_STACK_FRAME_L0_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l2, [%sp + CPU_STACK_FRAME_L2_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l4, [%sp + CPU_STACK_FRAME_L4_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l6, [%sp + CPU_STACK_FRAME_L6_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i0, [%sp + CPU_STACK_FRAME_I0_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i2, [%sp + CPU_STACK_FRAME_I2_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i4, [%sp + CPU_STACK_FRAME_I4_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i6, [%sp + CPU_STACK_FRAME_I6_FP_OFFSET] +SPARC_LEON3FT_B2BST_NOP ba save_frame_loop nop @@ -375,13 +391,20 @@ win_ovflow: */ std %l0, [%sp + CPU_STACK_FRAME_L0_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l2, [%sp + CPU_STACK_FRAME_L2_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l4, [%sp + CPU_STACK_FRAME_L4_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %l6, [%sp + CPU_STACK_FRAME_L6_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i0, [%sp + CPU_STACK_FRAME_I0_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i2, [%sp + CPU_STACK_FRAME_I2_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i4, [%sp + CPU_STACK_FRAME_I4_OFFSET] +SPARC_LEON3FT_B2BST_NOP std %i6, [%sp + CPU_STACK_FRAME_I6_FP_OFFSET] restore @@ -406,15 +429,21 @@ dont_do_the_window: ! make space for ISF std %l0, [%sp + ISF_PSR_OFFSET]! save psr, PC +SPARC_LEON3FT_B2BST_NOP st %l2, [%sp + ISF_NPC_OFFSET]! save nPC st %g1, [%sp + ISF_G1_OFFSET] ! save g1 std %g2, [%sp + ISF_G2_OFFSET] ! save g2, g3 +SPARC_LEON3FT_B2BST_NOP std %l4, [%sp + ISF_G4_OFFSET] ! save g4, g5 -- see above +SPARC_LEON3FT_B2BST_NOP st %g7, [%sp + ISF_G7_OFFSET] ! save g7 std %i0, [%sp + ISF_I0_OFFSET] ! save i0, i1 +SPARC_LEON3FT_B2BST_NOP std %i2, [%sp + ISF_I2_OFFSET] ! save i2, i3 +SPARC_LEON3FT_B2BST_NOP std %i4, [%sp + ISF_I4_OFFSET] ! save i4, i5 +SPARC_LEON3FT_B2BST_NOP std %i6, [%sp + ISF_I6_FP_OFFSET] ! save i6/fp, i7 rd %y, %g1 @@ -440,6 +469,7 @@ dont_do_the_window: add %l7, 1, %l7 st %l7, [%g6 + PER_CPU_ISR_NEST_LEVEL] +SPARC_LEON3FT_B2BST_NOP add %l6, 1, %l6 st %l6, [%g6 + PER_CPU_THREAD_DISPATCH_DISABLE_LEVEL] @@ -587,6 +617,7 @@ profiling_not_outer_most_exit: ldub [%g6 + PER_CPU_DISPATCH_NEEDED], %o2 ld [%g6 + PER_CPU_ISR_DISPATCH_DISABLE], %o3 st %l7, [%g6 + PER_CPU_ISR_NEST_LEVEL] +SPARC_LEON3FT_B2BST_NOP
[PATCH] sparc: Rename NGMP to GR740 and add configs for UT699, UT700, and GR712RC
The UT699 requires -mcpu=leon as it does not support the CAS instruction provided by -mcpu=leon3. It also requires -mfix-ut699 for errata fixes. UT700 and GR712RC requires the -mfix-ut700 and -mfix-gr712rc flags that have been recently added to GCC's master and 7-branch. --- c/src/lib/libbsp/sparc/leon3/Makefile.am | 5 - c/src/lib/libbsp/sparc/leon3/make/custom/gr712rc.cfg | 18 ++ .../sparc/leon3/make/custom/{ngmp.cfg => gr740.cfg} | 0 c/src/lib/libbsp/sparc/leon3/make/custom/ut699.cfg | 18 ++ c/src/lib/libbsp/sparc/leon3/make/custom/ut700.cfg | 18 ++ c/src/lib/libbsp/sparc/leon3/preinstall.am | 18 +++--- .../lib/libbsp/sparc/leon3/startup/linkcmds.gr712rc | 20 .../leon3/startup/{linkcmds.ngmp => linkcmds.gr740} | 0 c/src/lib/libbsp/sparc/leon3/startup/linkcmds.ut699 | 20 c/src/lib/libbsp/sparc/leon3/startup/linkcmds.ut700 | 20 10 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 c/src/lib/libbsp/sparc/leon3/make/custom/gr712rc.cfg rename c/src/lib/libbsp/sparc/leon3/make/custom/{ngmp.cfg => gr740.cfg} (100%) create mode 100644 c/src/lib/libbsp/sparc/leon3/make/custom/ut699.cfg create mode 100644 c/src/lib/libbsp/sparc/leon3/make/custom/ut700.cfg create mode 100644 c/src/lib/libbsp/sparc/leon3/startup/linkcmds.gr712rc rename c/src/lib/libbsp/sparc/leon3/startup/{linkcmds.ngmp => linkcmds.gr740} (100%) create mode 100644 c/src/lib/libbsp/sparc/leon3/startup/linkcmds.ut699 create mode 100644 c/src/lib/libbsp/sparc/leon3/startup/linkcmds.ut700 diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am index 52f6b56..cd591dd 100644 --- a/c/src/lib/libbsp/sparc/leon3/Makefile.am +++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am @@ -26,7 +26,10 @@ project_lib_DATA = start.$(OBJEXT) dist_project_lib_DATA += ../shared/startup/linkcmds.base dist_project_lib_DATA += startup/linkcmds dist_project_lib_DATA += startup/linkcmds.leon3 -dist_project_lib_DATA += startup/linkcmds.ngmp +dist_project_lib_DATA += startup/linkcmds.ut699 +dist_project_lib_DATA += startup/linkcmds.gr712rc +dist_project_lib_DATA += startup/linkcmds.ut700 +dist_project_lib_DATA += startup/linkcmds.gr740 noinst_LIBRARIES += libbsp.a libbsp_a_SOURCES = diff --git a/c/src/lib/libbsp/sparc/leon3/make/custom/gr712rc.cfg b/c/src/lib/libbsp/sparc/leon3/make/custom/gr712rc.cfg new file mode 100644 index 000..0a20b2c --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon3/make/custom/gr712rc.cfg @@ -0,0 +1,18 @@ +# +# Config file for the GR712RC LEON3 SPARC processor. +# + +include $(RTEMS_ROOT)/make/custom/default.cfg + +RTEMS_CPU=sparc +RTEMS_CPU_MODEL=leon3 + +# This contains the compiler options necessary to select the CPU model +# and (hopefully) optimize for it. +CPU_CFLAGS = -mcpu=leon3 -msoft-float -mfix-gr712rc + +# optimize flag: typically -O2 +CFLAGS_OPTIMIZE_V = -O2 -g +CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections + +LDFLAGS = -Wl,--gc-sections diff --git a/c/src/lib/libbsp/sparc/leon3/make/custom/ngmp.cfg b/c/src/lib/libbsp/sparc/leon3/make/custom/gr740.cfg similarity index 100% rename from c/src/lib/libbsp/sparc/leon3/make/custom/ngmp.cfg rename to c/src/lib/libbsp/sparc/leon3/make/custom/gr740.cfg diff --git a/c/src/lib/libbsp/sparc/leon3/make/custom/ut699.cfg b/c/src/lib/libbsp/sparc/leon3/make/custom/ut699.cfg new file mode 100644 index 000..e1e4f84 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon3/make/custom/ut699.cfg @@ -0,0 +1,18 @@ +# +# Config file for the UT699 LEON3 SPARC processor. +# + +include $(RTEMS_ROOT)/make/custom/default.cfg + +RTEMS_CPU=sparc +RTEMS_CPU_MODEL=leon3 + +# This contains the compiler options necessary to select the CPU model +# and (hopefully) optimize for it. +CPU_CFLAGS = -mcpu=leon -msoft-float -mfix-ut699 + +# optimize flag: typically -O2 +CFLAGS_OPTIMIZE_V = -O2 -g +CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections + +LDFLAGS = -Wl,--gc-sections diff --git a/c/src/lib/libbsp/sparc/leon3/make/custom/ut700.cfg b/c/src/lib/libbsp/sparc/leon3/make/custom/ut700.cfg new file mode 100644 index 000..3f0c016 --- /dev/null +++ b/c/src/lib/libbsp/sparc/leon3/make/custom/ut700.cfg @@ -0,0 +1,18 @@ +# +# Config file for the UT699e/UT700 LEON3 SPARC processor. +# + +include $(RTEMS_ROOT)/make/custom/default.cfg + +RTEMS_CPU=sparc +RTEMS_CPU_MODEL=leon3 + +# This contains the compiler options necessary to select the CPU model +# and (hopefully) optimize for it. +CPU_CFLAGS = -mcpu=leon3 -msoft-float -mfix-ut700 + +# optimize flag: typically -O2 +CFLAGS_OPTIMIZE_V = -O2 -g +CFLAGS_OPTIMIZE_V += -ffunction-sections -fdata-sections + +LDFLAGS = -Wl,--gc-sections diff --git a/c/src/lib/libbsp/sparc/leon3/preinstall.am b/c/src/lib/libbsp/sparc/leon3/preinstall.am index 273a52d..70d58c8 100644 --- a/c/src/lib/libbsp/sparc/leon3/preinstall.am +++ b/c/
Re: [PATCH] sparc: Rename NGMP to GR740 and add configs for UT699, UT700, and GR712RC
All the BSPs use -msoft-float. How do we want to address the soft-float vs. hard-float issue on SPARC? This is a never ending story so far. Is soft-float really used in the majority of applications? All the users I talked up to now said they use hard-float. What about enabling SPARC_USE_SAFE_FP_SUPPORT also in uniprocessor configurations and maybe add a lazy floating point safe as an optimization? -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] sparc: Rename NGMP to GR740 and add configs for UT699, UT700, and GR712RC
On 2017-07-13 10:43, Sebastian Huber wrote: All the BSPs use -msoft-float. How do we want to address the soft-float vs. hard-float issue on SPARC? This is a never ending story so far. Is soft-float really used in the majority of applications? All the users I talked up to now said they use hard-float. What about enabling SPARC_USE_SAFE_FP_SUPPORT also in uniprocessor configurations and maybe add a lazy floating point safe as an optimization? In RCC we have not taken advantage of the Makefile fragments that are generated for each BSP. Instead we have added custom flags to GCC, such as -qleon2, which adds the correct include and library paths. So the flags in leon3.cfg have only affected the compilation of the kernel, which does not use floats. For the kernel we have a patch to always enable floating-point support, but only use it if a FPU is available, which is detected by probing. So in RCC hard floats have always been used if the hardware supports it, as I understand it. I could revise the patch to remove the -msoft-flag as, as you say, most people would like to use hard floats. -- Daniel Cederman Software Engineer Cobham Gaisler ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] sparc: Rename NGMP to GR740 and add configs for UT699, UT700, and GR712RC
On 2017-07-13 10:43, Sebastian Huber wrote: What about enabling SPARC_USE_SAFE_FP_SUPPORT also in uniprocessor configurations and maybe add a lazy floating point safe as an optimization? With this optimization, would it behave like the standard deferred method, but with the FP context only being saved if the last FP task was switched out as the result of an interrupt? And similar for loading the FP context? No need to load it if returning from a call to rtems_task_wake_after() I guess. -- Daniel Cederman Software Engineer Cobham Gaisler ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] sparc: Rename NGMP to GR740 and add configs for UT699, UT700, and GR712RC
On 13/07/17 14:12, Daniel Cederman wrote: On 2017-07-13 10:43, Sebastian Huber wrote: What about enabling SPARC_USE_SAFE_FP_SUPPORT also in uniprocessor configurations and maybe add a lazy floating point safe as an optimization? With this optimization, would it behave like the standard deferred method, but with the FP context only being saved if the last FP task was switched out as the result of an interrupt? And similar for loading the FP context? No need to load it if returning from a call to rtems_task_wake_after() I guess. Yes, but this optimization works only in uniprocessor configurations. -- Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.hu...@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [rtems-docs commit] c-user: Fix interrupt lock documentation
On 14/07/2017 15:52, Sebastian Huber wrote: > Module:rtems-docs > Branch:master The automatic updating of the online docs is down until I update the process to use the TrueNAS box now attached to docs.rtems.org at OSU OSL. I hope this will be sorted soon. Chris ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel