@samitouri / QOSamiQemu / commits / 5b93743833

hexagon: make dump_mmu() take MonitorHMP

Avoid unsafe MONITOR_HMP() casts. The function has no caller since its introduction and could be dropped if it is not wired to a HMP command. Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-ID: <20260828-qemu-no-hmp-v5-38-9227de146347@redhat.com>

Marc-André Lureau committed Aug 28, 2026 at 16:04 UTC 5b93743833a3bf10d5a44a1d707ddd0be3de5678
4 files changed +10 -10
hw/hexagon/hexagon_tlb.c
+3 -5
@@ -122,10 +122,8 @@ static inline uint64_t hex_tlb_virt_addr(uint64_t entry)
122 return (uint64_t)GET_PTE_VPN(entry) << qemu_target_page_bits();
123 }
124
125 -bool hexagon_tlb_dump_entry(Monitor *mon, uint64_t entry)
125 +bool hexagon_tlb_dump_entry(MonitorHMP *hmp, uint64_t entry)
126 {
127 - MonitorHMP *hmp = MONITOR_HMP(mon);
128 -
127 if (GET_PTE_V(entry)) {
128 uint64_t PA = hex_tlb_phys_addr(entry);
129 uint64_t VA = hex_tlb_virt_addr(entry);
@@ -379,10 +377,10 @@ int hexagon_tlb_check_overlap(HexagonTLBState *tlb, uint64_t entry,
377 return -1;
378 }
379
382 -void hexagon_tlb_dump(Monitor *mon, HexagonTLBState *tlb)
380 +void hexagon_tlb_dump(MonitorHMP *hmp, HexagonTLBState *tlb)
381 {
382 for (uint32_t i = 0; i < tlb->num_entries; i++) {
385 - hexagon_tlb_dump_entry(mon, tlb->entries[i]);
383 + hexagon_tlb_dump_entry(hmp, tlb->entries[i]);
384 }
385 }
386
include/hw/hexagon/hexagon_tlb.h
+3 -2
@@ -12,6 +12,7 @@
12 #include "qom/object.h"
13 #include "exec/hwaddr.h"
14 #include "exec/mmu-access-type.h"
15 +#include "monitor/hmp.h"
16
17 #define TYPE_HEXAGON_TLB "hexagon-tlb"
18 OBJECT_DECLARE_SIMPLE_TYPE(HexagonTLBState, HEXAGON_TLB)
@@ -37,9 +38,9 @@ uint32_t hexagon_tlb_lookup(HexagonTLBState *tlb, uint32_t asid,
38 int hexagon_tlb_check_overlap(HexagonTLBState *tlb, uint64_t entry,
39 uint64_t index);
40
40 -void hexagon_tlb_dump(Monitor *mon, HexagonTLBState *tlb);
41 +void hexagon_tlb_dump(MonitorHMP *hmp, HexagonTLBState *tlb);
42
42 -bool hexagon_tlb_dump_entry(Monitor *mon, uint64_t entry);
43 +bool hexagon_tlb_dump_entry(MonitorHMP *hmp, uint64_t entry);
44
45 uint32_t hexagon_tlb_get_num_entries(HexagonTLBState *tlb);
46
target/hexagon/hex_mmu.c
+2 -2
@@ -107,10 +107,10 @@ int hex_tlb_check_overlap(CPUHexagonState *env, uint64_t entry, uint64_t index)
107 return hexagon_tlb_check_overlap(cpu->tlb, entry, index);
108 }
109
110 -void dump_mmu(Monitor *mon, CPUHexagonState *env)
110 +void dump_mmu(MonitorHMP *hmp, CPUHexagonState *env)
111 {
112 HexagonCPU *cpu = env_archcpu(env);
113 - hexagon_tlb_dump(mon, cpu->tlb);
113 + hexagon_tlb_dump(hmp, cpu->tlb);
114 }
115
116 static inline void print_thread(const char *str, CPUState *cs)
target/hexagon/hex_mmu.h
+2 -1
@@ -10,6 +10,7 @@
10 #include "exec/hwaddr.h"
11 #include "exec/mmu-access-type.h"
12 #include "cpu.h"
13 +#include "monitor/hmp.h"
14
15 extern void hex_tlbw(CPUHexagonState *env, uint32_t index, uint64_t value);
16 extern uint32_t hex_tlb_lookup(CPUHexagonState *env, uint32_t ssr, uint32_t VA);
@@ -23,5 +24,5 @@ extern int hex_tlb_check_overlap(CPUHexagonState *env, uint64_t entry,
24 uint64_t index);
25 extern void hex_tlb_lock(CPUHexagonState *env);
26 extern void hex_tlb_unlock(CPUHexagonState *env);
26 -void dump_mmu(Monitor *mon, CPUHexagonState *env);
27 +void dump_mmu(MonitorHMP *hmp, CPUHexagonState *env);
28 #endif