diff mbox

[v3,2/3] cpu_common_reset: wrap TCG specific code in tcg_enabled()

Message ID 20170112154731.1028-3-alex.bennee@linaro.org
State Superseded
Headers show

Commit Message

Alex Bennée Jan. 12, 2017, 3:47 p.m. UTC
Both the cpu->tb_jmp_cache and SoftMMU TLB structures are only used
when running TCG code so we might as well skip them for anything else.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 qom/cpu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

-- 
2.11.0

Comments

Richard Henderson Jan. 12, 2017, 4:36 p.m. UTC | #1
On 01/12/2017 07:47 AM, Alex Bennée wrote:
> Both the cpu->tb_jmp_cache and SoftMMU TLB structures are only used

> when running TCG code so we might as well skip them for anything else.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  qom/cpu.c | 10 ++++++----

>  1 file changed, 6 insertions(+), 4 deletions(-)


Reviewed-by: Richard Henderson <rth@twiddle.net>



r~
Eduardo Habkost Jan. 12, 2017, 4:52 p.m. UTC | #2
On Thu, Jan 12, 2017 at 03:47:30PM +0000, Alex Bennée wrote:
> Both the cpu->tb_jmp_cache and SoftMMU TLB structures are only used

> when running TCG code so we might as well skip them for anything else.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


-- 
Eduardo
diff mbox

Patch

diff --git a/qom/cpu.c b/qom/cpu.c
index cc51de2a8c..61ee0cb88c 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -270,13 +270,15 @@  static void cpu_common_reset(CPUState *cpu)
     cpu->exception_index = -1;
     cpu->crash_occurred = false;
 
-    for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
-        atomic_set(&cpu->tb_jmp_cache[i], NULL);
-    }
+    if (tcg_enabled()) {
+        for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
+            atomic_set(&cpu->tb_jmp_cache[i], NULL);
+        }
 
 #ifdef CONFIG_SOFTMMU
-    tlb_flush(cpu, 0);
+        tlb_flush(cpu, 0);
 #endif
+    }
 }
 
 static bool cpu_common_has_work(CPUState *cs)