From: Brian Cain <brian.cain@oss.qualcomm.com>
To: qemu-devel@nongnu.org, stefanha@redhat.com
Cc: brian.cain@oss.qualcomm.com,
Taylor Simpson <ltaylorsimpson@gmail.com>,
Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>,
Anton Johansson <anjo@rev.ng>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Subject: [PULL 1/9] Hexagon (target/hexagon) Properly handle Hexagon CPU version
Date: Thu, 23 Apr 2026 19:35:58 -0700 [thread overview]
Message-ID: <20260424023606.2556830-2-brian.cain@oss.qualcomm.com> (raw)
In-Reply-To: <20260424023606.2556830-1-brian.cain@oss.qualcomm.com>
From: Taylor Simpson <ltaylorsimpson@gmail.com>
Add the following CPU versions that were previously missing
v5
v55
v60
v61
v62
v65
Create a CPUHexagonDef struct to represent the definition of a core
Currently contains an enum with the known Hexagon CPU versions
Add a field to HexagonCPUClass to note the Hexagon definition
Co-authored-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
Co-authored-by: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
target/hexagon/cpu-qom.h | 27 +++++++++++++++++++++++
target/hexagon/cpu.h | 2 ++
target/hexagon/cpu.c | 46 ++++++++++++++++++++++++----------------
3 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/target/hexagon/cpu-qom.h b/target/hexagon/cpu-qom.h
index 0b149bd5fea..6e1bb040704 100644
--- a/target/hexagon/cpu-qom.h
+++ b/target/hexagon/cpu-qom.h
@@ -11,11 +11,38 @@
#include "hw/core/cpu.h"
+typedef enum {
+ HEX_VER_NONE = 0x00,
+ HEX_VER_V5 = 0x04,
+ HEX_VER_V55 = 0x05,
+ HEX_VER_V60 = 0x60,
+ HEX_VER_V61 = 0x61,
+ HEX_VER_V62 = 0x62,
+ HEX_VER_V65 = 0x65,
+ HEX_VER_V66 = 0x66,
+ HEX_VER_V67 = 0x67,
+ HEX_VER_V68 = 0x68,
+ HEX_VER_V69 = 0x69,
+ HEX_VER_V71 = 0x71,
+ HEX_VER_V73 = 0x73,
+ HEX_VER_ANY = 0xff,
+} HexagonVersion;
+
+typedef struct {
+ HexagonVersion hex_version;
+} HexagonCPUDef;
+
#define TYPE_HEXAGON_CPU "hexagon-cpu"
#define HEXAGON_CPU_TYPE_SUFFIX "-" TYPE_HEXAGON_CPU
#define HEXAGON_CPU_TYPE_NAME(name) (name HEXAGON_CPU_TYPE_SUFFIX)
+#define TYPE_HEXAGON_CPU_V5 HEXAGON_CPU_TYPE_NAME("v5")
+#define TYPE_HEXAGON_CPU_V55 HEXAGON_CPU_TYPE_NAME("v55")
+#define TYPE_HEXAGON_CPU_V60 HEXAGON_CPU_TYPE_NAME("v60")
+#define TYPE_HEXAGON_CPU_V61 HEXAGON_CPU_TYPE_NAME("v61")
+#define TYPE_HEXAGON_CPU_V62 HEXAGON_CPU_TYPE_NAME("v62")
+#define TYPE_HEXAGON_CPU_V65 HEXAGON_CPU_TYPE_NAME("v65")
#define TYPE_HEXAGON_CPU_V66 HEXAGON_CPU_TYPE_NAME("v66")
#define TYPE_HEXAGON_CPU_V67 HEXAGON_CPU_TYPE_NAME("v67")
#define TYPE_HEXAGON_CPU_V68 HEXAGON_CPU_TYPE_NAME("v68")
diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h
index 85afd592778..f99647dfb61 100644
--- a/target/hexagon/cpu.h
+++ b/target/hexagon/cpu.h
@@ -117,6 +117,8 @@ typedef struct HexagonCPUClass {
DeviceRealize parent_realize;
ResettablePhases parent_phases;
+
+ const HexagonCPUDef *hex_def;
} HexagonCPUClass;
struct ArchCPU {
diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
index ffd14bb4678..23ac91e7b47 100644
--- a/target/hexagon/cpu.c
+++ b/target/hexagon/cpu.c
@@ -27,13 +27,6 @@
#include "exec/gdbstub.h"
#include "accel/tcg/cpu-ops.h"
-static void hexagon_v66_cpu_init(Object *obj) { }
-static void hexagon_v67_cpu_init(Object *obj) { }
-static void hexagon_v68_cpu_init(Object *obj) { }
-static void hexagon_v69_cpu_init(Object *obj) { }
-static void hexagon_v71_cpu_init(Object *obj) { }
-static void hexagon_v73_cpu_init(Object *obj) { }
-
static ObjectClass *hexagon_cpu_class_by_name(const char *cpu_model)
{
ObjectClass *oc;
@@ -377,11 +370,21 @@ static void hexagon_cpu_class_init(ObjectClass *c, const void *data)
cc->tcg_ops = &hexagon_tcg_ops;
}
-#define DEFINE_CPU(type_name, initfn) \
- { \
- .name = type_name, \
- .parent = TYPE_HEXAGON_CPU, \
- .instance_init = initfn \
+static void hexagon_cpu_class_base_init(ObjectClass *c, const void *data)
+{
+ HexagonCPUClass *mcc = HEXAGON_CPU_CLASS(c);
+ /* Make sure all CPU models define a HexagonCPUDef */
+ g_assert(!object_class_is_abstract(c) && data != NULL);
+ mcc->hex_def = data;
+}
+
+#define DEFINE_CPU(type_name, version) \
+ { \
+ .name = type_name, \
+ .parent = TYPE_HEXAGON_CPU, \
+ .class_data = &(const HexagonCPUDef) { \
+ .hex_version = version, \
+ } \
}
static const TypeInfo hexagon_cpu_type_infos[] = {
@@ -394,13 +397,20 @@ static const TypeInfo hexagon_cpu_type_infos[] = {
.abstract = true,
.class_size = sizeof(HexagonCPUClass),
.class_init = hexagon_cpu_class_init,
+ .class_base_init = hexagon_cpu_class_base_init,
},
- DEFINE_CPU(TYPE_HEXAGON_CPU_V66, hexagon_v66_cpu_init),
- DEFINE_CPU(TYPE_HEXAGON_CPU_V67, hexagon_v67_cpu_init),
- DEFINE_CPU(TYPE_HEXAGON_CPU_V68, hexagon_v68_cpu_init),
- DEFINE_CPU(TYPE_HEXAGON_CPU_V69, hexagon_v69_cpu_init),
- DEFINE_CPU(TYPE_HEXAGON_CPU_V71, hexagon_v71_cpu_init),
- DEFINE_CPU(TYPE_HEXAGON_CPU_V73, hexagon_v73_cpu_init),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V5, HEX_VER_V5),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V55, HEX_VER_V55),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V60, HEX_VER_V60),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V61, HEX_VER_V61),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V62, HEX_VER_V62),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V65, HEX_VER_V65),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V66, HEX_VER_V66),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V67, HEX_VER_V67),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V68, HEX_VER_V68),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V69, HEX_VER_V69),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V71, HEX_VER_V71),
+ DEFINE_CPU(TYPE_HEXAGON_CPU_V73, HEX_VER_V73),
};
DEFINE_TYPES(hexagon_cpu_type_infos)
--
2.34.1
next prev parent reply other threads:[~2026-04-24 2:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 2:35 [PULL 0/9] hex queue Brian Cain
2026-04-24 2:35 ` Brian Cain [this message]
2026-04-24 2:35 ` [PULL 2/9] Hexagon (linux-user/hexagon) Identify Hexagon version in ELF file Brian Cain
2026-04-24 2:36 ` [PULL 3/9] Hexagon (target/hexagon) Add Hexagon definition field to DisasContext Brian Cain
2026-04-24 2:36 ` [PULL 4/9] Hexagon (target/hexagon) Introduce tag_rev_info.c.inc Brian Cain
2026-04-24 2:36 ` [PULL 5/9] Hexagon (target/hexagon) Check each opcode against current CPU definition Brian Cain
2026-04-24 2:36 ` [PULL 6/9] Hexagon (target/hexagon) Disassembly of invalid packets Brian Cain
2026-04-24 2:36 ` [PULL 7/9] tests/tcg/hexagon: Add test for revision-gated instruction decoding Brian Cain
2026-04-24 2:36 ` [PULL 8/9] Hexagon (target/hexagon) Remove snprint_a_pkt_debug Brian Cain
2026-04-24 2:36 ` [PULL 9/9] target/hexagon: Change DisasContext packet type Brian Cain
2026-04-25 16:59 ` [PULL 0/9] hex queue Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260424023606.2556830-2-brian.cain@oss.qualcomm.com \
--to=brian.cain@oss.qualcomm.com \
--cc=anjo@rev.ng \
--cc=ltaylorsimpson@gmail.com \
--cc=matheus.bernardino@oss.qualcomm.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.