[PATCH v2 34/40] target/hexagon: Add {TLB, k0}lock, cause code, wait_next_pc

Brian Cain posted 40 patches 3 weeks, 5 days ago
Maintainers: Brian Cain <brian.cain@oss.qualcomm.com>, "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Laurent Vivier <laurent@vivier.eu>, Alessandro Di Federico <ale@rev.ng>, Anton Johansson <anjo@rev.ng>
[PATCH v2 34/40] target/hexagon: Add {TLB, k0}lock, cause code, wait_next_pc
Posted by Brian Cain via 3 weeks, 5 days ago
From: Brian Cain <bcain@quicinc.com>

{TLB,k0}lock counts are used to represent the TLB, k0 locks among
hardware threads.

wait_next_pc represents the program counter to set when resuming from
a wait-for-interrupts state.

cause_code contains the precise exception cause.This will be used by
subsequent commits.

Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
 target/hexagon/cpu.h     | 3 +++
 target/hexagon/cpu.c     | 4 ++++
 target/hexagon/machine.c | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
index 8b1ff23c01..6b49912c08 100644
--- a/target/hexagon/cpu.h
+++ b/target/hexagon/cpu.h
@@ -130,11 +130,14 @@ typedef struct CPUArchState {
     target_ulong t_sreg[NUM_SREGS];
 
     target_ulong greg[NUM_GREGS];
+    target_ulong wait_next_pc;
 
     /* This alias of CPUState.cpu_index is used by imported sources: */
     target_ulong threadId;
     hex_lock_state_t tlb_lock_state;
     hex_lock_state_t k0_lock_state;
+    target_ulong tlb_lock_count;
+    target_ulong k0_lock_count;
 #endif
     target_ulong next_PC;
     target_ulong new_value_usr;
diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
index 56098b4c55..43fd13cd0d 100644
--- a/target/hexagon/cpu.c
+++ b/target/hexagon/cpu.c
@@ -307,7 +307,11 @@ static void hexagon_cpu_reset_hold(Object *obj, ResetType type)
     env->threadId = cs->cpu_index;
     env->tlb_lock_state = HEX_LOCK_UNLOCKED;
     env->k0_lock_state = HEX_LOCK_UNLOCKED;
+    env->tlb_lock_count = 0;
+    env->k0_lock_count = 0;
     env->next_PC = 0;
+    env->wait_next_pc = 0;
+    env->cause_code = HEX_EVENT_NONE;
 #endif
     env->cause_code = HEX_EVENT_NONE;
 }
diff --git a/target/hexagon/machine.c b/target/hexagon/machine.c
index 18c3f87188..10e0fe9688 100644
--- a/target/hexagon/machine.c
+++ b/target/hexagon/machine.c
@@ -22,7 +22,11 @@ const VMStateDescription vmstate_hexagon_cpu = {
         VMSTATE_UINTTL(env.next_PC, HexagonCPU),
         VMSTATE_UINTTL(env.tlb_lock_state, HexagonCPU),
         VMSTATE_UINTTL(env.k0_lock_state, HexagonCPU),
+        VMSTATE_UINTTL(env.tlb_lock_count, HexagonCPU),
+        VMSTATE_UINTTL(env.k0_lock_count, HexagonCPU),
         VMSTATE_UINTTL(env.threadId, HexagonCPU),
+        VMSTATE_UINTTL(env.cause_code, HexagonCPU),
+        VMSTATE_UINTTL(env.wait_next_pc, HexagonCPU),
         VMSTATE_END_OF_LIST()
     },
 };
-- 
2.34.1