target/hexagon: Add sysemu_ops, cpu_get_phys_page_debug()
Reviewed-by: Taylor Simpson <ltaylorsimpson@gmail.com> Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
Brian Cain committed
Jun 22, 2026 at 15:28 UTC
9b2bf948d7c531afbb7fc21934b5c8f3ad1139a4
1 file changed
+32
target/hexagon/cpu.c
+32
@@ -20,6 +20,7 @@
20
#include "qemu/qemu-print.h"
21
#include "cpu.h"
22
#include "internal.h"
23
+#include "exec/cputlb.h"
24
#include "exec/translation-block.h"
25
#include "qapi/error.h"
26
#include "hw/core/qdev-properties.h"
@@ -37,6 +38,7 @@
38
#include "accel/tcg/cpu-ldst.h"
39
#include "qemu/main-loop.h"
40
#include "hex_interrupts.h"
41
+#include "hexswi.h"
42
#include "exec/cpu-interrupt.h"
43
#include "exec/page-protection.h"
44
#include "exec/target_page.h"
@@ -504,6 +506,24 @@ static void find_qemu_subpage(vaddr *addr, hwaddr *phys, uint64_t page_size)
506
*phys += offset;
507
}
508
509
+static hwaddr hexagon_cpu_get_phys_addr_debug(CPUState *cs, vaddr addr)
510
+{
511
+ CPUHexagonState *env = cpu_env(cs);
512
+ hwaddr phys_addr;
513
+ int prot;
514
+ uint64_t page_size = 0;
515
+ int32_t excp = 0;
516
+ int mmu_idx = MMU_KERNEL_IDX;
517
+
518
+ if (get_physical_address(env, &phys_addr, &prot, &page_size, &excp,
519
+ addr, 0, mmu_idx)) {
520
+ find_qemu_subpage(&addr, &phys_addr, page_size);
521
+ return phys_addr;
522
+ }
523
+
524
+ return -1;
525
+}
526
+
527
528
#define INVALID_BADVA 0xbadabada
529
@@ -611,6 +631,13 @@ static bool hexagon_tlb_fill(CPUState *cs, vaddr address, int size,
631
do_raise_exception(env, cs->exception_index, env->gpr[HEX_REG_PC], retaddr);
632
}
633
634
+#include "hw/core/sysemu-cpu-ops.h"
635
+
636
+static const struct SysemuCPUOps hexagon_sysemu_ops = {
637
+ .has_work = hexagon_cpu_has_work,
638
+ .get_phys_addr_debug = hexagon_cpu_get_phys_addr_debug,
639
+};
640
+
641
static bool hexagon_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
642
{
643
CPUHexagonState *env = cpu_env(cs);
@@ -653,6 +680,8 @@ static const TCGCPUOps hexagon_tcg_ops = {
680
.pointer_wrap = hexagon_pointer_wrap,
681
.cpu_exec_reset = cpu_reset,
682
.tlb_fill = hexagon_tlb_fill,
683
+ .cpu_exec_halt = hexagon_cpu_has_work,
684
+ .do_interrupt = hexagon_cpu_do_interrupt,
685
#endif /* !CONFIG_USER_ONLY */
686
};
687
@@ -680,9 +709,12 @@ static void hexagon_cpu_class_init(ObjectClass *c, const void *data)
709
cc->gdb_core_xml_file = "hexagon-core.xml";
710
cc->disas_set_info = hexagon_cpu_disas_set_info;
711
#ifndef CONFIG_USER_ONLY
712
+ cc->sysemu_ops = &hexagon_sysemu_ops;
713
dc->vmsd = &vmstate_hexagon_cpu;
714
#endif
715
+#ifdef CONFIG_TCG
716
cc->tcg_ops = &hexagon_tcg_ops;
717
+#endif
718
}
719
720
static void hexagon_cpu_class_base_init(ObjectClass *c, const void *data)