diff mbox

[v6,15/19] target-arm/cpu: don't reset TLB structures, use cputlb to do it

Message ID 20161109145748.27282-16-alex.bennee@linaro.org
State New
Headers show

Commit Message

Alex Bennée Nov. 9, 2016, 2:57 p.m. UTC
cputlb owns the TLB entries and knows how to safely update them in
MTTCG.

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

---
 target-arm/cpu.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.10.1

Comments

Richard Henderson Nov. 10, 2016, 5:48 p.m. UTC | #1
On 11/09/2016 03:57 PM, Alex Bennée wrote:
> +#ifdef CONFIG_SOFTMMU

> +    memset(env, 0, offsetof(CPUARMState, tlb_table));

> +    tlb_flush(s, 0);

> +#else

>      memset(env, 0, offsetof(CPUARMState, features));

> +#endif


I'd really prefer to see the tlb_flush be moved into parent_reset, so that we 
handle it identically for all targets.

As for the memset, do we really need to distinguish softmmu?  I don't like you 
picking out a variable name within CPU_COMMON.  Better to use empty struct 
markers, like the

       struct {} start_init_save;

that x86 uses.


r~
Alex Bennée Nov. 10, 2016, 6:08 p.m. UTC | #2
Richard Henderson <rth@twiddle.net> writes:

> On 11/09/2016 03:57 PM, Alex Bennée wrote:

>> +#ifdef CONFIG_SOFTMMU

>> +    memset(env, 0, offsetof(CPUARMState, tlb_table));

>> +    tlb_flush(s, 0);

>> +#else

>>      memset(env, 0, offsetof(CPUARMState, features));

>> +#endif

>

> I'd really prefer to see the tlb_flush be moved into parent_reset, so that we

> handle it identically for all targets.


Yeah I'll prepare a series to do that separate from MTTCG.

>

> As for the memset, do we really need to distinguish softmmu?  I don't like you

> picking out a variable name within CPU_COMMON.  Better to use empty struct

> markers, like the

>

>        struct {} start_init_save;

>

> that x86 uses.


OK fair enough.

--
Alex Bennée
diff mbox

Patch

diff --git a/target-arm/cpu.c b/target-arm/cpu.c
index 99f0dbe..990bcb1 100644
--- a/target-arm/cpu.c
+++ b/target-arm/cpu.c
@@ -122,7 +122,13 @@  static void arm_cpu_reset(CPUState *s)
 
     acc->parent_reset(s);
 
+#ifdef CONFIG_SOFTMMU
+    memset(env, 0, offsetof(CPUARMState, tlb_table));
+    tlb_flush(s, 0);
+#else
     memset(env, 0, offsetof(CPUARMState, features));
+#endif
+
     g_hash_table_foreach(cpu->cp_regs, cp_reg_reset, cpu);
     g_hash_table_foreach(cpu->cp_regs, cp_reg_check_reset, cpu);