From 635de1791f8b7412e3a530afe2b154a47b8c314b Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Tue, 18 Nov 2014 13:25:00 +0100 Subject: [PATCH] hw: fix panda instability on kernel exits Invalidating all branch predictors before switching the PD fixes instability problems on Panda and has not much effect on the performance of other boards. However, we neither know why this is a fix nor wether it fixes the real cause of the problem. fix #1294 --- .../src/core/spec/arm_v7/mode_transition.s | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/repos/base-hw/src/core/spec/arm_v7/mode_transition.s b/repos/base-hw/src/core/spec/arm_v7/mode_transition.s index ad41f5a8c..52777ed6f 100644 --- a/repos/base-hw/src/core/spec/arm_v7/mode_transition.s +++ b/repos/base-hw/src/core/spec/arm_v7/mode_transition.s @@ -104,6 +104,14 @@ .endm +/* + * Invalidate all branch predictors + */ +.macro _bpiall + mcr p15, 0, r0, c7, c5, 6 +.endm + + /** * Switch to a given protection domain * @@ -112,6 +120,15 @@ * \param new_ttbr0 new TTBR0 value, read/write reg */ .macro _switch_protection_domain transit_ttbr0, new_cidr, new_ttbr0 + + /* + * FIXME: Fixes instability problems that were observed on the + * PandaBoard only. We neither know why invalidating predictions + * at PD switches is a fix nor wether not doing so is the real + * cause of this instability. + */ + _bpiall + _write_ttbr0 \transit_ttbr0 isb _write_cidr \new_cidr