From: Peter Maydell Date: Tue, 13 May 2014 15:09:38 +0000 (+0100) Subject: target-arm/helper.c: Don't flush the TLB if SCTLR is rewritten unchanged X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~209^2~844^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2f0d8631b74c873c8867a7b509335bc2bf8d8886;p=sdk%2Femulator%2Fqemu.git target-arm/helper.c: Don't flush the TLB if SCTLR is rewritten unchanged Linux makes a habit of writing the same value to the SCTLR that it already holds. In a sample boot of the kernel to a shell prompt it wrote the SCTLR with the value it already held 325465 times, and wrote different values just 3 times. Skip flushing the TLB if the SCTLR value isn't actually being changed; this speeds up my sample boot by 3-5%. Reported-by: Laurent Desnogues Reviewed-by: Laurent Desnogues Signed-off-by: Peter Maydell Message-id: 1399560029-19007-1-git-send-email-peter.maydell@linaro.org --- diff --git a/target-arm/helper.c b/target-arm/helper.c index 3be917c22e..417161e216 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -2081,6 +2081,13 @@ static void sctlr_write(CPUARMState *env, const ARMCPRegInfo *ri, { ARMCPU *cpu = arm_env_get_cpu(env); + if (env->cp15.c1_sys == value) { + /* Skip the TLB flush if nothing actually changed; Linux likes + * to do a lot of pointless SCTLR writes. + */ + return; + } + env->cp15.c1_sys = value; /* ??? Lots of these bits are not implemented. */ /* This may enable/disable the MMU, so do a TLB flush. */