Skip to contentSkip to conversation

Hexagon: HMX system

PATCH Superseded Brian Cain 2 participants 18 messages Oct 29 – Oct 30 Arm/Amlogic Meson SoC support

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Brian Cain

author
#0 lore raw

cover Hexagon: HMX system

Add HMX system emulation features and log the HMX opcodes as 'UNIMP' for now.

Brian Cain (8):
target/hexagon: add HMX attrs, state hw/hexagon: add the HMX context device target/hexagon: add per-CPU HMX configuration target/hexagon: import HMX instruction definitions target/hexagon: gate HMX exec on SSR:XE2 hw/hexagon: describe HMX in the device tree hw/hexagon: migrate the HMX state target/hexagon: implement mxclracc

 include/hw/hexagon/hexagon.h               |   5 +
 include/hw/hexagon/hexagon_hmx_context.h   |  24 ++
 target/hexagon/cpu.h                       |   9 +
 target/hexagon/gen_tcg_hmx.h               |  13 ++
 target/hexagon/helper.h                    |   2 +
 target/hexagon/hmx_config.h                |  17 ++
 target/hexagon/hmx_state.h                 |  92 ++++++++
 target/hexagon/insn.h                      |   1 +
 target/hexagon/translate.h                 |   2 +
 target/hexagon/attribs_def.h.inc           |  13 ++
 hw/hexagon/hex-board.c                     |   6 +
 hw/hexagon/hex-subsys.c                    |  23 ++
 hw/hexagon/hexagon_hmx_context.c           | 157 +++++++++++++
 target/hexagon/cpu.c                       |  25 +++
 target/hexagon/decode.c                    |   3 +
 target/hexagon/genptr.c                    |   1 +
 target/hexagon/hmx_config.c                |  15 ++
 target/hexagon/op_helper.c                 |  10 +
 target/hexagon/translate.c                 |  22 ++
 target/hexagon/tag_rev_info.c.inc          | 247 +++++++++++++++++++++
 hw/hexagon/meson.build                     |   1 +
 target/hexagon/hex_common.py               |   2 +
 target/hexagon/imported/allext.idef        |   6 +
 target/hexagon/imported/allextenc.def      |   4 +
 target/hexagon/imported/hmx/encode_ext.def | 149 +++++++++++++
 target/hexagon/imported/hmx/ext.idef       | 175 +++++++++++++++
 target/hexagon/meson.build                 |  14 +-
 tests/functional/hexagon/test_systests.py  |   3 +
 28 files changed, 1035 insertions(+), 6 deletions(-)
 create mode 100644 include/hw/hexagon/hexagon_hmx_context.h
 create mode 100644 target/hexagon/gen_tcg_hmx.h
 create mode 100644 target/hexagon/hmx_config.h
 create mode 100644 target/hexagon/hmx_state.h
 create mode 100644 hw/hexagon/hexagon_hmx_context.c
 create mode 100644 target/hexagon/hmx_config.c
 create mode 100644 target/hexagon/imported/hmx/encode_ext.def
 create mode 100644 target/hexagon/imported/hmx/ext.idef
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/8 target/hexagon: add HMX attrs, state

Add inst attributes for HMX and state definition.

---
 target/hexagon/hmx_state.h       | 92 ++++++++++++++++++++++++++++++++
 target/hexagon/attribs_def.h.inc | 13 +++++
 2 files changed, 105 insertions(+)
 create mode 100644 target/hexagon/hmx_state.h
target/hexagon/hmx_state.h new file +92 -0
new file mode 100644
index 00000000000..43c8cbd9e07
@@ -0,0 +1,92 @@
+/*
+ * Hexagon HMX (Matrix eXtensions) State Definitions
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HEXAGON_HMX_STATE_H
+#define HEXAGON_HMX_STATE_H
+
+#define HMX_SPATIAL_DIM_FXP     64
+#define HMX_SPATIAL_DIM_FP      32
+#define HMX_OUTPUT_CHANNELS     32
+#define HMX_NUM_ACC_SETS        2
+#define HMX_NUM_CVT_AGES        3
+#define HMX_NUM_BIAS_SETS       4
+
+#define HMX_ACT_CROUTON_SIZE    2048
+#define HMX_ACT_CACHE_SIZE      (2 * HMX_ACT_CROUTON_SIZE)
+
+typedef struct HmxAccFxp {
+    int32_t data[HMX_SPATIAL_DIM_FXP][HMX_OUTPUT_CHANNELS];
+} HmxAccFxp;
+
+/* FP accumulator cell storage: IEEE binary64 bit patterns */
+typedef struct HmxAccFp {
+    uint64_t data[HMX_SPATIAL_DIM_FP][HMX_OUTPUT_CHANNELS];
+} HmxAccFp;
+
+typedef struct HmxAccSet {
+    HmxAccFxp fxp_primary;
+    HmxAccFp  fp_primary;
+} HmxAccSet;
+
+typedef struct HmxCvtStateFxp {
+    uint16_t data[HMX_SPATIAL_DIM_FXP][HMX_OUTPUT_CHANNELS];
+} HmxCvtStateFxp;
+
+/* FP convert slot: one FP16 value, or an FP8 byte per spatial half */
+typedef struct HmxCvtStateFp {
+    uint16_t data[HMX_SPATIAL_DIM_FP][HMX_OUTPUT_CHANNELS];
+} HmxCvtStateFp;
+
+typedef struct HmxState {
+    HmxAccSet acc[HMX_NUM_ACC_SETS];
+
+    HmxCvtStateFxp cvt_fxp[HMX_NUM_CVT_AGES];
+    HmxCvtStateFp  cvt_fp[HMX_NUM_CVT_AGES];
+
+    HmxCvtStateFxp cvt_future_fxp;
+
+    uint64_t bias_raw[HMX_NUM_BIAS_SETS][HMX_OUTPUT_CHANNELS];
+
+    uint32_t current_acc_set;
+
+    uint8_t act_buffer[HMX_ACT_CACHE_SIZE];
+
+    uint32_t act_rs;
+    uint32_t act_type;
+    uint8_t  is_f8_odd;     /* Rs[0]: FP8 activation reads odd byte of pair */
+    uint8_t  fp8_odd_sel;   /* cvt Rs[11]: FP8 convert writes odd (1) half */
+
+    uint32_t format_offset;     /* SM=2, DM=0 */
+    uint32_t tile_x_mask;
+    uint32_t tile_y_mask;
+    uint32_t tile_x_inc;
+    uint32_t tile_y_inc;
+    uint32_t fx;
+    uint32_t fy;
+    int32_t  ch_start;          /* pre-computed channel start (raw) */
+    int32_t  ch_stop;           /* pre-computed channel stop (exclusive) */
+    uint32_t y_start;
+    uint32_t y_stop;
+    uint32_t y_dilate;
+    uint32_t blocks;
+    int32_t  dY;                /* offset to second activation crouton */
+    uint32_t group_conv;        /* ch_start > ch_stop */
+    uint32_t group_size;
+    uint32_t group_count;
+
+    int32_t  mac_cycle_limit;
+
+    /* Deferred CVT pipeline commit, at the next consumer or end of packet */
+    uint32_t cvt_fxp_pending;      /* 1 = future has uncommitted data */
+    uint32_t cvt_fxp_pending_age;  /* 1 = pipeline should age at commit */
+
+    /* Deferred accumulator clear/flip, at packet end or next accumulator use */
+    uint32_t cvt_acc_clear_pending;
+    uint32_t cvt_acc_clear_set;
+} HmxState;
+
+#endif /* HEXAGON_HMX_STATE_H */
target/hexagon/attribs_def.h.inc +13 -0
index 96ad1fd2f8e..439a268b591 100644
@@ -210,5 +210,18 @@ DEF_ATTRIB(HVX_IEEE_FP_OUT_32, "HVX IEEE FP 32-bit output", "", "")
 DEF_ATTRIB(CVI_VX_NO_TMP_LD, "HVX multiply without tmp load", "", "")
 DEF_ATTRIB(HVX_FLT, "This a floating point HVX instruction.", "", "")
 
+DEF_ATTRIB(SHARED_EXTENSION, "Shared extension instruction", "", "")
+DEF_ATTRIB(EA_REG_ONLY, "EA = input register only", "", "")
+DEF_ATTRIB(EA_PAGECROSS, "EA calculation can have a Page Cross Stall", "", "")
+DEF_ATTRIB(MPY, "Has a multiply", "", "")
+DEF_ATTRIB(PAIR_1OF2, "For assembler", "", "")
+DEF_ATTRIB(PAIR_2OF2, "For assembler", "", "")
+DEF_ATTRIB(HMX, "HMX coprocessor instruction", "", "")
+DEF_ATTRIB(HMX_CVT, "HMX convert instruction", "", "")
+DEF_ATTRIB(HMX_FLT, "HMX floating-point instruction", "", "")
+DEF_ATTRIB(HMX_CU_SCALAR, "HMX scalar operand", "", "")
+DEF_ATTRIB(HMX_BLOCK_ALIGN, "HMX block-aligned access", "", "")
+DEF_ATTRIB(HMX_128B_ALIGN, "HMX 128-byte aligned access", "", "")
+
 /* Keep this as the last attribute: */
 DEF_ATTRIB(ZZ_LASTATTRIB, "Last attribute in the file", "", "")
Signature · 1 line
2.34.1
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] target/hexagon: add HMX attrs, state

Quoted 10 lines · Brian Cain

Add inst attributes for HMX and state definition.

---
 target/hexagon/hmx_state.h       | 92 ++++++++++++++++++++++++++++++++
 target/hexagon/attribs_def.h.inc | 13 +++++
 2 files changed, 105 insertions(+)
 create mode 100644 target/hexagon/hmx_state.h
author
#3 lore raw

PATCH 2/8 hw/hexagon: add the HMX context device

In reply to Brian Cain

Add a sysbus device that owns the HMX state. A core has one HMX unit shared by all its threads.

---
 include/hw/hexagon/hexagon.h             |  5 +++
 include/hw/hexagon/hexagon_hmx_context.h | 24 ++++++++++++++
 hw/hexagon/hex-subsys.c                  | 16 ++++++++++
 hw/hexagon/hexagon_hmx_context.c         | 40 ++++++++++++++++++++++++
 hw/hexagon/meson.build                   |  1 +
 5 files changed, 86 insertions(+)
 create mode 100644 include/hw/hexagon/hexagon_hmx_context.h
 create mode 100644 hw/hexagon/hexagon_hmx_context.c
include/hw/hexagon/hexagon.h +5 -0
index 678e658a6d3..c45c2befa50 100644
@@ -40,6 +40,11 @@ typedef enum {
 #define HEXAGON_LATEST_REV v85
 #define HEXAGON_LATEST_REV_UPPER V85
 
+#define HEXAGON_COPROC_HMX (1U << 2)
+
+#define HEXAGON_CFGTABLE_HAS_HMX(t) \
+    ((t)->coproc2_reg0 != 0 || ((t)->coproc_present & HEXAGON_COPROC_HMX))
+
 /*
  * Config table address bases represent bits [35:16].
  */
include/hw/hexagon/hexagon_hmx_context.h new file +24 -0
new file mode 100644
index 00000000000..8ded9ad385d
@@ -0,0 +1,24 @@
+/*
+ * Hexagon HMX Extension Context QOM Object
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HEXAGON_HMX_CONTEXT_H
+#define HEXAGON_HMX_CONTEXT_H
+
+#include "hw/core/sysbus.h"
+#include "qom/object.h"
+#include "target/hexagon/hmx_state.h"
+
+#define TYPE_HEXAGON_HMX_CONTEXT "hexagon-hmx-context"
+OBJECT_DECLARE_SIMPLE_TYPE(HexagonHMXContextState, HEXAGON_HMX_CONTEXT)
+
+struct HexagonHMXContextState {
+    SysBusDevice parent_obj;
+
+    HmxState regs;
+};
+
+#endif /* HEXAGON_HMX_CONTEXT_H */
hw/hexagon/hex-subsys.c +16 -0
index 1e6578255eb..4d9a79cff74 100644
@@ -10,6 +10,7 @@
 #include "hw/hexagon/hex-subsys.h"
 #include "hw/hexagon/hexagon_globalreg.h"
 #include "hw/hexagon/hexagon_hvx_context.h"
+#include "hw/hexagon/hexagon_hmx_context.h"
 #include "hw/hexagon/hexagon_tlb.h"
 #include "hw/intc/hex-l2vic.h"
 #include "hw/timer/qct-qtimer.h"
@@ -120,6 +121,20 @@ static void hvx_contexts_create(HexagonCommonMachineState *hms,
     hms->num_hvx_ctx = n;
 }
 
+static void hmx_context_create(HexagonCommonMachineState *hms,
+                               const struct hexagon_machine_config *m_cfg)
+{
+    DeviceState *ctx;
+
+    if (!HEXAGON_CFGTABLE_HAS_HMX(&m_cfg->cfgtable)) {
+        return;
+    }
+
+    ctx = qdev_new(TYPE_HEXAGON_HMX_CONTEXT);
+    object_property_add_child(OBJECT(hms), "hmx-context", OBJECT(ctx));
+    sysbus_realize_and_unref(SYS_BUS_DEVICE(ctx), &error_fatal);
+}
+
 static DeviceState *cluster_create(HexagonCommonMachineState *hms)
 {
     DeviceState *cluster = qdev_new(TYPE_CPU_CLUSTER);
@@ -167,6 +182,7 @@ void hex_subsys_create(HexagonCommonMachineState *hms,
     hms->glob_regs = globalreg_create(hms, m_cfg, rev);
     hms->tlb = tlb_create(hms, m_cfg);
     hvx_contexts_create(hms, m_cfg);
+    hmx_context_create(hms, m_cfg);
 }
 
 void hex_subsys_add_cpu(HexagonCommonMachineState *hms, DeviceState *cpu)
hw/hexagon/hexagon_hmx_context.c new file +40 -0
new file mode 100644
index 00000000000..e3ea7b71474
@@ -0,0 +1,40 @@
+/*
+ * Hexagon HMX Extension Context QOM Object
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/hexagon/hexagon_hmx_context.h"
+
+static void hexagon_hmx_context_reset_hold(Object *obj, ResetType type)
+{
+    HexagonHMXContextState *s = HEXAGON_HMX_CONTEXT(obj);
+
+    memset(&s->regs, 0, sizeof(s->regs));
+}
+
+static void hexagon_hmx_context_class_init(ObjectClass *klass,
+                                           const void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
+
+    rc->phases.hold = hexagon_hmx_context_reset_hold;
+    dc->user_creatable = false;
+}
+
+static const TypeInfo hexagon_hmx_context_info = {
+    .name = TYPE_HEXAGON_HMX_CONTEXT,
+    .parent = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(HexagonHMXContextState),
+    .class_init = hexagon_hmx_context_class_init,
+};
+
+static void hexagon_hmx_context_register_types(void)
+{
+    type_register_static(&hexagon_hmx_context_info);
+}
+
+type_init(hexagon_hmx_context_register_types)
hw/hexagon/meson.build +1 -0
index fa5bc5eb9f1..e7abad1c234 100644
@@ -2,6 +2,7 @@ hexagon_ss = ss.source_set()
 hexagon_ss.add(files('hexagon_tlb.c'))
 hexagon_ss.add(files('hexagon_globalreg.c'))
 hexagon_ss.add(files('hexagon_hvx_context.c'))
+hexagon_ss.add(files('hexagon_hmx_context.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_DSP', if_true: files('hex-subsys.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_DSP', if_true: files('hexagon_dsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_BOARD', if_true: files('hex-board.c'))
Signature · 1 line
2.34.1
Reviewed-by on v1 2/8
#4 lore raw

Re: [PATCH 2/8] hw/hexagon: add the HMX context device

Quoted 5 lines · Brian Cain

Add a sysbus device that owns the HMX state. A core has one HMX unit shared by all its threads.

Quoted 10 lines
---
 include/hw/hexagon/hexagon.h             |  5 +++
 include/hw/hexagon/hexagon_hmx_context.h | 24 ++++++++++++++
 hw/hexagon/hex-subsys.c                  | 16 ++++++++++
 hw/hexagon/hexagon_hmx_context.c         | 40 ++++++++++++++++++++++++
 hw/hexagon/meson.build                   |  1 +
 5 files changed, 86 insertions(+)
 create mode 100644 include/hw/hexagon/hexagon_hmx_context.h
 create mode 100644 hw/hexagon/hexagon_hmx_context.c
author
#5 lore raw

PATCH 3/8 target/hexagon: add per-CPU HMX configuration

In reply to Brian Cain

Add HmxConfig and hmx_init_config(), which derive the HMX configuration from the CPU revision.

---
 target/hexagon/cpu.h        |  8 ++++++++
 target/hexagon/hmx_config.h | 17 +++++++++++++++++
 hw/hexagon/hex-subsys.c     |  7 +++++++
 target/hexagon/cpu.c        | 23 +++++++++++++++++++++++
 target/hexagon/hmx_config.c | 15 +++++++++++++++
 target/hexagon/meson.build  |  1 +
 6 files changed, 71 insertions(+)
 create mode 100644 target/hexagon/hmx_config.h
 create mode 100644 target/hexagon/hmx_config.c
target/hexagon/cpu.h +8 -0
index feb80368238..22aa1630767 100644
@@ -30,12 +30,15 @@
 typedef struct HexagonTLBState HexagonTLBState;
 typedef struct HexagonGlobalRegState HexagonGlobalRegState;
 typedef struct HexagonHVXContextState HexagonHVXContextState;
+typedef struct HexagonHMXContextState HexagonHMXContextState;
 
 #include "cpu-qom.h"
 #include "exec/cpu-common.h"
 #include "exec/target_long.h"
 #include "hex_regs.h"
 #include "mmvec/mmvec.h"
+#include "hmx_config.h"
+#include "hmx_state.h"
 #include "hw/core/registerfields.h"
 #include "qemu/bitmap.h"
 
@@ -197,6 +200,8 @@ typedef struct CPUArchState {
     target_ulong vstore_pending[VSTORES_MAX];
     bool vtcm_pending;
     VTCMStoreLog vtcm_log;
+
+    HmxState *hmx_state;
 } CPUHexagonState;
 
 typedef struct HexagonCPUClass {
@@ -217,12 +222,15 @@ struct ArchCPU {
     HexagonCPUConfig cfg;
 #ifndef CONFIG_USER_ONLY
     HexagonHVXContextState *hvx_ctx[HVX_CONTEXTS_MAX];
+    HexagonHMXContextState *hmx_ctx;
     HexagonTLBState *tlb;
     uint32_t boot_addr;
     HexagonGlobalRegState *globalregs;
     uint32_t htid;
     HexL2VicInterface *l2vic;
 #endif
+    HmxState *hmx;
+    HmxConfig hmx_cfg;
 };
 
 static inline HexagonHVXContext *hex_hvx(CPUHexagonState *env)
target/hexagon/hmx_config.h new file +17 -0
new file mode 100644
index 00000000000..cb1433f54b8
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HEXAGON_HMX_CONFIG_H
+#define HEXAGON_HMX_CONFIG_H
+
+#include "cpu-qom.h"
+
+typedef struct HmxConfig {
+    bool hmx_present;
+} HmxConfig;
+
+void hmx_init_config(HexagonCPU *cpu);
+
+#endif /* HEXAGON_HMX_CONFIG_H */
hw/hexagon/hex-subsys.c +7 -0
index 4d9a79cff74..5d227c0db2b 100644
@@ -187,6 +187,8 @@ void hex_subsys_create(HexagonCommonMachineState *hms,
 
 void hex_subsys_add_cpu(HexagonCommonMachineState *hms, DeviceState *cpu)
 {
+    Object *hmx;
+
     object_property_add_child(OBJECT(hms->cluster), "cpu[*]", OBJECT(cpu));
     object_property_set_link(OBJECT(cpu), "global-regs",
                              OBJECT(hms->glob_regs), &error_fatal);
@@ -200,6 +202,11 @@ void hex_subsys_add_cpu(HexagonCommonMachineState *hms, DeviceState *cpu)
 
         object_property_set_link(OBJECT(cpu), name, ctx, &error_fatal);
     }
+    hmx = object_resolve_path_component(OBJECT(hms), "hmx-context");
+    if (hmx) {
+        object_property_set_link(OBJECT(cpu), "hmx-context", hmx,
+                                 &error_fatal);
+    }
 }
 
 void hex_subsys_realize_cluster(HexagonCommonMachineState *hms)
target/hexagon/cpu.c +23 -0
index 281d201250b..83e23775ea2 100644
@@ -45,6 +45,7 @@
 #include "exec/target_page.h"
 #include "hw/hexagon/hexagon_globalreg.h"
 #include "hw/hexagon/hexagon_hvx_context.h"
+#include "hw/hexagon/hexagon_hmx_context.h"
 #endif
 
 static ObjectClass *hexagon_cpu_class_by_name(const char *cpu_model)
@@ -539,6 +540,24 @@ static void hexagon_cpu_realize(DeviceState *dev, Error **errp)
 
     cpu->cfg.hex_def = mcc->hex_def;
 
+    hmx_init_config(cpu);
+#ifdef CONFIG_USER_ONLY
+    /* All threads of the process share one HMX unit */
+    static HmxState *user_hmx;
+
+    if (cpu->hmx_cfg.hmx_present) {
+        if (!user_hmx) {
+            user_hmx = g_new0(HmxState, 1);
+        }
+        cpu->hmx = user_hmx;
+    }
+#else
+    if (cpu->hmx_ctx && cpu->hmx_cfg.hmx_present) {
+        cpu->hmx = &cpu->hmx_ctx->regs;
+    }
+#endif
+    cpu_env(cs)->hmx_state = cpu->hmx;
+
     gdb_register_coprocessor(cs, hexagon_hvx_gdb_read_register,
                              hexagon_hvx_gdb_write_register,
                              gdb_find_static_feature("hexagon-hvx.xml"));
@@ -629,6 +648,10 @@ static void hexagon_cpu_init(Object *obj)
                                  qdev_prop_allow_set_link_before_realize,
                                  OBJ_PROP_LINK_STRONG);
     }
+    object_property_add_link(obj, "hmx-context", TYPE_HEXAGON_HMX_CONTEXT,
+                             (Object **)&cpu->hmx_ctx,
+                             qdev_prop_allow_set_link_before_realize,
+                             OBJ_PROP_LINK_STRONG);
 #endif
 }
 
target/hexagon/hmx_config.c new file +15 -0
new file mode 100644
index 00000000000..11b3abadfbc
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "hmx_config.h"
+
+void hmx_init_config(HexagonCPU *cpu)
+{
+    HexagonVersion ver = cpu->cfg.hex_def->hex_version;
+
+    cpu->hmx_cfg.hmx_present = ver >= HEX_VER_V75;
+}
target/hexagon/meson.build +1 -0
index 06338523217..fe3206ef8b8 100644
@@ -254,6 +254,7 @@ hexagon_ss.add(files(
     'mmvec/system_ext_mmvec.c',
     'mmvec/hvx_ieee_fp.c',
     'mmvec/hvx_qfloat.c',
+    'hmx_config.c',
 ))
 
 hexagon_softmmu_ss.add(files(
Signature · 1 line
2.34.1
Reviewed-by on v1 3/8
#6 lore raw

Re: [PATCH 3/8] target/hexagon: add per-CPU HMX configuration

Quoted 5 lines · Brian Cain

Add HmxConfig and hmx_init_config(), which derive the HMX configuration from the CPU revision.

Quoted 11 lines
---
 target/hexagon/cpu.h        |  8 ++++++++
 target/hexagon/hmx_config.h | 17 +++++++++++++++++
 hw/hexagon/hex-subsys.c     |  7 +++++++
 target/hexagon/cpu.c        | 23 +++++++++++++++++++++++
 target/hexagon/hmx_config.c | 15 +++++++++++++++
 target/hexagon/meson.build  |  1 +
 6 files changed, 71 insertions(+)
 create mode 100644 target/hexagon/hmx_config.h
 create mode 100644 target/hexagon/hmx_config.c
author
#7 lore raw

PATCH 4/8 target/hexagon: import HMX instruction definitions

In reply to Brian Cain

Import the HMX instruction encodings and definitions. The semantics are no-ops for now.

---
 target/hexagon/tag_rev_info.c.inc          | 247 +++++++++++++++++++++
 target/hexagon/imported/allext.idef        |   6 +
 target/hexagon/imported/allextenc.def      |   4 +
 target/hexagon/imported/hmx/encode_ext.def | 149 +++++++++++++
 target/hexagon/imported/hmx/ext.idef       | 175 +++++++++++++++
 5 files changed, 581 insertions(+)
 create mode 100644 target/hexagon/imported/hmx/encode_ext.def
 create mode 100644 target/hexagon/imported/hmx/ext.idef
target/hexagon/tag_rev_info.c.inc +247 -0
index da0b1a648cf..5a57d66fa45 100644
@@ -620,6 +620,253 @@ static const struct tag_rev_info tag_rev_info[XX_LAST_OPCODE] = {
     [V6_vcombine_tmp] = { .introduced = HEX_VER_V69, .removed = HEX_VER_NONE },
     [V6_vmpyuhvs] = { .introduced = HEX_VER_V69, .removed = HEX_VER_NONE },
 
+    /* HMX (matrix) coprocessor extension */
+    [M8_cvt_rs_f8] = { .introduced = HEX_VER_V81, .removed = HEX_VER_NONE },
+    [M8_cvt_rs_hf] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_cvt_rs_ub] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_cvt_rs_ub_sc0] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_cvt_rs_ub_sc1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_cvt_rs_uh_2x1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_cvt_rs_uh_2x2] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxaccshl] = { .introduced = HEX_VER_V75, .removed = HEX_VER_V79 },
+    [M8_mxclracc] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxclracc_hf] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvta_sat_uh] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvta_sat_uh2x2] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvta_sat_uh2x2_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvta_sat_uh_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvta_uh] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvta_uh2x2] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvta_uh2x2_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvta_uh_r] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtb_sat_uh] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtb_sat_uh2x2] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtb_sat_uh2x2_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtb_sat_uh_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtb_uh] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtb_uh2x2] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtb_uh2x2_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtb_uh_r] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtl_dm_sat_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_dm_sat_ub_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_dm_ub] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtl_dm_ub_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_sat_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_sat_hf_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_sat_pos_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_sat_pos_hf_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_sat_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_sat_ub_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtl_ub] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtl_ub_r] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtr_dm_sat_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_dm_sat_ub_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_dm_ub] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtr_dm_ub_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_sat_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_sat_hf_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_sat_pos_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_sat_pos_hf_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_sat_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_sat_ub_r] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxcvtr_ub] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxcvtr_ub_r] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem2_bias] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem2_st_bias] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_2x2] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_b] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_b1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_c] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_n] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_n_2x] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_sb1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_sc] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmema_wei_sm] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_bias] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_blk_dm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_blk_sm_act_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_blk_sm_act_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_blk_sm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_cm] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_cm_deep] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemd_blk_dm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemd_blk_sm_act_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemd_blk_sm_act_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemd_blk_sm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_deep] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_deep_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_b] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_b1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_c] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_n] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_n_2x] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_sb1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_sc] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdi_wei_sm] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_dm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_b] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_b1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_c] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_n] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_n_2x] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_sb1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_sc] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdp_wei_sm] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_b] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_b1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_c] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_n] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_n_2x] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_sb1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_sc] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemdr_wei_sm] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_f8] = { .introduced = HEX_VER_V81, .removed = HEX_VER_NONE },
+    [M8_mxmems_blk_dm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_blk_sm_act_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_blk_sm_act_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_blk_sm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_sm_act_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_sm_act_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_sm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_st_bias] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_b] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_b1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_c] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_n] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_n_2x] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_sb1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_sc] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmems_wei_sm] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemu_blk_dm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemu_blk_sm_act_f8] = { .introduced = HEX_VER_V81,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemu_blk_sm_act_hf] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmemu_blk_sm_act_ub] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_b] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_b1] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_c] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_f8] = { .introduced = HEX_VER_V81, .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_hf] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_n] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_n_2x] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_sb1] = { .introduced = HEX_VER_V75,
+                             .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_sc] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxmem_wei_sm] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxswap] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+    [M8_mxswap_hf] = { .introduced = HEX_VER_V75, .removed = HEX_VER_NONE },
+
     [S2_pstorerbf_pi_nt] = { .introduced = HEX_VER_V79,
                              .removed = HEX_VER_NONE },
     [S2_pstorerbt_pi_nt] = { .introduced = HEX_VER_V79,
target/hexagon/imported/allext.idef +6 -0
index 9d4b23e9de6..32f6fb04a9b 100644
@@ -23,3 +23,9 @@
 #include "mmvec/ext.idef"
 #undef EXTNAME
 #undef EXTSTR
+
+#define EXTNAME hmx
+#define EXTSTR "hmx"
+#include "hmx/ext.idef"
+#undef EXTNAME
+#undef EXTSTR
target/hexagon/imported/allextenc.def +4 -0
index 39a3e93fad6..1d143149a9c 100644
@@ -18,3 +18,7 @@
 #define EXTNAME mmvec
 #include "mmvec/encode_ext.def"
 #undef EXTNAME
+
+#define EXTNAME hmx
+#include "hmx/encode_ext.def"
+#undef EXTNAME
target/hexagon/imported/hmx/encode_ext.def new file +149 -0

149 lines not on this page · raw message

target/hexagon/imported/hmx/ext.idef new file +175 -0

175 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw

Re: [PATCH 4/8] target/hexagon: import HMX instruction definitions

target/hexagon/tag_rev_info.c.inc static const struct tag_rev_info tag_rev_info[XX_LAST_OPCODE] = {

Quoted 20 lines · Brian Cain

Import the HMX instruction encodings and definitions. The semantics are no-ops for now.

---
 target/hexagon/tag_rev_info.c.inc          | 247 +++++++++++++++++++++
 target/hexagon/imported/allext.idef        |   6 +
 target/hexagon/imported/allextenc.def      |   4 +
 target/hexagon/imported/hmx/encode_ext.def | 149 +++++++++++++
 target/hexagon/imported/hmx/ext.idef       | 175 +++++++++++++++
 5 files changed, 581 insertions(+)
 create mode 100644 target/hexagon/imported/hmx/encode_ext.def
 create mode 100644 target/hexagon/imported/hmx/ext.idef
target/hexagon/tag_rev_info.c.inc +0 -0
index da0b1a648cf..5a57d66fa45 100644
@@ -620,6 +620,253 @@ static const struct tag_rev_info tag_rev_info[XX_LAST_OPCODE] = {

Some instructions have a wrong intro revision. These are the ones I found:

Marked v81, should be v79:
- M8_mxmem_blk_sm_act_f8
- M8_mxmem_sm_act_f8
- M8_mxmemu_blk_sm_act_f8
- M8_mxmems_blk_sm_act_f8
- M8_mxmemd_blk_sm_act_f8
- M8_mxmem_wei_f8
- M8_mxmems_wei_f8
- M8_mxmemdr_wei_f8
- M8_mxmemdp_wei_f8
- M8_mxmema_wei_f8
- M8_mxmemdi_wei_f8

Marked v75, should be v79:
- M8_mxmem_deep: mxmem(Rs,Rt):deep=cvt
- M8_mxmem_cm_deep: mxmem(Rs,Rt):cm:deep=cvt

author
#9 lore raw

PATCH 5/8 target/hexagon: gate HMX exec on SSR:XE2

In reply to Brian Cain

Executing an HMX instruction with SSR:XE2 clear raises a NO_COPROC2_ENABLE exception.

Log packets one as LOG_UNIMP for now.

---
 target/hexagon/cpu.h                      |  1 +
 target/hexagon/insn.h                     |  1 +
 target/hexagon/translate.h                |  2 ++
 target/hexagon/cpu.c                      |  2 ++
 target/hexagon/decode.c                   |  3 +++
 target/hexagon/translate.c                | 21 +++++++++++++++++++++
 tests/functional/hexagon/test_systests.py |  3 +++
 7 files changed, 33 insertions(+)
target/hexagon/cpu.h +1 -0
index 22aa1630767..1cdff583da4 100644
@@ -247,6 +247,7 @@ FIELD(TB_FLAGS, MMU_INDEX, 1, 3)
 FIELD(TB_FLAGS, HVX_COPROC_ENABLED, 5, 1)
 FIELD(TB_FLAGS, CPU_MODE, 6, 2)
 FIELD(TB_FLAGS, SS_ACTIVE, 8, 1)
+FIELD(TB_FLAGS, HMX_COPROC_ENABLED, 15, 1)
 
 G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env,
                                             uint32_t exception,
target/hexagon/insn.h +1 -0
index 5d59430da9e..afae928e679 100644
@@ -70,6 +70,7 @@ struct Packet {
     bool pkt_has_scalar_store_s1;
 
     bool pkt_has_hvx;
+    bool pkt_has_hmx;
     Insn *vhist_insn;
 
     Insn insn[INSTRUCTIONS_MAX];
target/hexagon/translate.h +2 -0
index bc5f202163f..88b948e8669 100644
@@ -101,6 +101,8 @@ typedef struct DisasContext {
     TCGv dczero_addr;
     bool hvx_coproc_enabled;
     bool hvx_check_emitted;
+    bool hmx_coproc_enabled;
+    bool hmx_check_emitted;
 } DisasContext;
 
 bool is_gather_store_insn(DisasContext *ctx);
target/hexagon/cpu.c +2 -0
index 83e23775ea2..1bfb948227b 100644
@@ -393,6 +393,8 @@ static TCGTBCPUState hexagon_get_tb_cpu_state(CPUState *cs)
     hex_flags = FIELD_DP32(hex_flags, TB_FLAGS, SS_ACTIVE,
                            GET_SSR_FIELD(SSR_SS, env->t_sreg[HEX_SREG_SSR]) &&
                            get_cpu_mode(env) != HEX_CPU_MODE_MONITOR);
+    hex_flags = FIELD_DP32(hex_flags, TB_FLAGS, HMX_COPROC_ENABLED,
+                           GET_SSR_FIELD(SSR_XE2, env->t_sreg[HEX_SREG_SSR]));
 #else
     hex_flags = FIELD_DP32(hex_flags, TB_FLAGS, MMU_INDEX, MMU_USER_IDX);
 #endif
target/hexagon/decode.c +3 -0
index 0ac87bbee0c..2916e4c68df 100644
@@ -773,9 +773,12 @@ int decode_packet(DisasContext *ctx, int max_words, const uint32_t *words,
 
     pkt->encod_pkt_size_in_bytes = words_read * 4;
     pkt->pkt_has_hvx = false;
+    pkt->pkt_has_hmx = false;
     for (i = 0; i < num_insns; i++) {
         pkt->pkt_has_hvx |=
             GET_ATTRIB(pkt->insn[i].opcode, A_CVI);
+        pkt->pkt_has_hmx |=
+            GET_ATTRIB(pkt->insn[i].opcode, A_HMX);
     }
 
     /*
target/hexagon/translate.c +21 -0
index 91925d2ddb1..4c84feaeeb5 100644
@@ -860,6 +860,24 @@ static void gen_start_packet(DisasContext *ctx)
         ctx->hvx_check_emitted = true;
     }
 #endif
+
+    if (ctx->pkt.pkt_has_hmx) {
+        for (i = 0; i < ctx->pkt.num_insns; i++) {
+            if (GET_ATTRIB(ctx->pkt.insn[i].opcode, A_HMX)) {
+                qemu_log_mask(LOG_UNIMP, "'%s' is not implemented\n",
+                              opcode_names[ctx->pkt.insn[i].opcode]);
+            }
+        }
+    }
+
+#ifndef CONFIG_USER_ONLY
+    /* HMX needs SSR:XE2 */
+    if (ctx->pkt.pkt_has_hmx && !ctx->hmx_coproc_enabled &&
+        !ctx->hmx_check_emitted) {
+        gen_precise_exception(HEX_CAUSE_NO_COPROC2_ENABLE, ctx->pkt.pc);
+        ctx->hmx_check_emitted = true;
+    }
+#endif
 }
 
 bool is_gather_store_insn(DisasContext *ctx)
@@ -1434,6 +1452,9 @@ static void hexagon_tr_init_disas_context(DisasContextBase *dcbase,
         ctx->base.max_insns = 1;
         ctx->is_tight_loop = false;
     }
+    ctx->hmx_coproc_enabled =
+        FIELD_EX32(hex_flags, TB_FLAGS, HMX_COPROC_ENABLED);
+    ctx->hmx_check_emitted = false;
 #endif
 }
 
tests/functional/hexagon/test_systests.py +3 -0
index 1c1d5440bb6..d3f9b95d961 100755
@@ -90,6 +90,9 @@ def test_access(self):
     def test_semihost(self):
         self.run_console_pattern("semihost", "PASS", "-append", "arg1", "arg2")
 
+    def test_invalid_hmx(self):
+        self.run_exit_zero("invalid_hmx")
+
     def test_dtg_interrupt(self):
         self.run_exit_zero("dtg_interrupt")
 
Signature · 1 line
2.34.1
Reviewed-by on v1 5/8
#10 lore raw

Re: [PATCH 5/8] target/hexagon: gate HMX exec on SSR:XE2

Quoted 7 lines · Brian Cain

Executing an HMX instruction with SSR:XE2 clear raises a NO_COPROC2_ENABLE exception.

Log packets one as LOG_UNIMP for now.

Quoted 10 lines
---
 target/hexagon/cpu.h                      |  1 +
 target/hexagon/insn.h                     |  1 +
 target/hexagon/translate.h                |  2 ++
 target/hexagon/cpu.c                      |  2 ++
 target/hexagon/decode.c                   |  3 +++
 target/hexagon/translate.c                | 21 +++++++++++++++++++++
 tests/functional/hexagon/test_systests.py |  3 +++
 7 files changed, 33 insertions(+)
author
#11 lore raw

PATCH 6/8 hw/hexagon: describe HMX in the device tree

In reply to Brian Cain

Add a /soc/hmx node for HMX units.

---
 hw/hexagon/hex-board.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/hexagon/hex-board.c +6 -0
index 3bf09e4e7c7..f38c244bb2b 100644
@@ -106,6 +106,12 @@ void hex_board_fdt_add_hvx(MachineState *ms,
         qemu_fdt_setprop_cells(ms->fdt, "/soc/hvx", "qcom,hvx-vlength",
                                t->hvx_vec_log_length);
     }
+
+    if (HEXAGON_CFGTABLE_HAS_HMX(t)) {
+        qemu_fdt_add_subnode(ms->fdt, "/soc/hmx");
+        qemu_fdt_setprop_string(ms->fdt, "/soc/hmx", "compatible",
+                                "qcom,hexagon-hmx");
+    }
 }
 
 void hex_board_fdt_add_cpus(MachineState *ms)
Signature · 1 line
2.34.1
#12 lore raw

Re: [PATCH 6/8] hw/hexagon: describe HMX in the device tree

Quoted 13 lines · Brian Cain

Add a /soc/hmx node for HMX units.

---
 hw/hexagon/hex-board.c | 6 ++++++
 1 file changed, 6 insertions(+)
hw/hexagon/hex-board.c +0 -0
index 3bf09e4e7c7..f38c244bb2b 100644

hw/hexagon/hex-board.c void hex_board_fdt_add_hvx(MachineState *ms, · line 114

Quoted 9 lines
hw/hexagon/hex-board.c +6 -0
@@ -106,6 +106,12 @@ void hex_board_fdt_add_hvx(MachineState *ms,
         qemu_fdt_setprop_cells(ms->fdt, "/soc/hvx", "qcom,hvx-vlength",
                                t->hvx_vec_log_length);
     }
+
+    if (HEXAGON_CFGTABLE_HAS_HMX(t)) {
+        qemu_fdt_add_subnode(ms->fdt, "/soc/hmx");
+        qemu_fdt_setprop_string(ms->fdt, "/soc/hmx", "compatible",
+                                "qcom,hexagon-hmx");
+    }

Should HEXAGON_CFGTABLE_HAS_HMX check rev >= V75 too? As
it is right now using it will change machines older than V75 adding HMX.

author
#13 lore raw

Re: [PATCH 6/8] hw/hexagon: describe HMX in the device tree

Quoted 2 lines · Marco Liebel

Should HEXAGON_CFGTABLE_HAS_HMX check rev >= V75 too? As
it is right now using it will change machines older than V75 adding HMX.

If it's present in the config table, it should be present in the device tree and QOM.  Regardless of which arch rev.

At best it could be an assertion IMO.

-Brian

author
#14 lore raw

PATCH 7/8 hw/hexagon: migrate the HMX state

In reply to Brian Cain
---
 hw/hexagon/hexagon_hmx_context.c | 117 +++++++++++++++++++++++++++++++
 1 file changed, 117 insertions(+)
hw/hexagon/hexagon_hmx_context.c +117 -0
index e3ea7b71474..3683bd9d416 100644
@@ -7,6 +7,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/hexagon/hexagon_hmx_context.h"
+#include "migration/vmstate.h"
 
 static void hexagon_hmx_context_reset_hold(Object *obj, ResetType type)
 {
@@ -15,6 +16,121 @@ static void hexagon_hmx_context_reset_hold(Object *obj, ResetType type)
     memset(&s->regs, 0, sizeof(s->regs));
 }
 
+static const VMStateDescription vmstate_hmx_acc_fxp = {
+    .name = "hexagon_hmx_acc_fxp",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_2DARRAY(data, HmxAccFxp, HMX_SPATIAL_DIM_FXP,
+                        HMX_OUTPUT_CHANNELS, 0, vmstate_info_int32, int32_t),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+static const VMStateDescription vmstate_hmx_acc_fp = {
+    .name = "hexagon_hmx_acc_fp",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_UINT64_2DARRAY(data, HmxAccFp, HMX_SPATIAL_DIM_FP,
+                               HMX_OUTPUT_CHANNELS),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+static const VMStateDescription vmstate_hmx_acc_set = {
+    .name = "hexagon_hmx_acc_set",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_STRUCT(fxp_primary, HmxAccSet, 0, vmstate_hmx_acc_fxp,
+                       HmxAccFxp),
+        VMSTATE_STRUCT(fp_primary, HmxAccSet, 0, vmstate_hmx_acc_fp,
+                       HmxAccFp),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+static const VMStateDescription vmstate_hmx_cvt_fxp = {
+    .name = "hexagon_hmx_cvt_fxp",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_UINT16_2DARRAY(data, HmxCvtStateFxp, HMX_SPATIAL_DIM_FXP,
+                               HMX_OUTPUT_CHANNELS),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+static const VMStateDescription vmstate_hmx_cvt_fp = {
+    .name = "hexagon_hmx_cvt_fp",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_UINT16_2DARRAY(data, HmxCvtStateFp, HMX_SPATIAL_DIM_FP,
+                               HMX_OUTPUT_CHANNELS),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+static const VMStateDescription vmstate_hmx_regs = {
+    .name = "hexagon_hmx_regs",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_STRUCT_ARRAY(acc, HmxState, HMX_NUM_ACC_SETS, 0,
+                             vmstate_hmx_acc_set, HmxAccSet),
+        VMSTATE_STRUCT_ARRAY(cvt_fxp, HmxState, HMX_NUM_CVT_AGES, 0,
+                             vmstate_hmx_cvt_fxp, HmxCvtStateFxp),
+        VMSTATE_STRUCT_ARRAY(cvt_fp, HmxState, HMX_NUM_CVT_AGES, 0,
+                             vmstate_hmx_cvt_fp, HmxCvtStateFp),
+        VMSTATE_STRUCT(cvt_future_fxp, HmxState, 0, vmstate_hmx_cvt_fxp,
+                       HmxCvtStateFxp),
+        VMSTATE_UINT64_2DARRAY(bias_raw, HmxState, HMX_NUM_BIAS_SETS,
+                               HMX_OUTPUT_CHANNELS),
+        VMSTATE_UINT32(current_acc_set, HmxState),
+        VMSTATE_BUFFER(act_buffer, HmxState),
+        VMSTATE_UINT32(act_rs, HmxState),
+        VMSTATE_UINT32(act_type, HmxState),
+        VMSTATE_UINT8(is_f8_odd, HmxState),
+        VMSTATE_UINT8(fp8_odd_sel, HmxState),
+        VMSTATE_UINT32(format_offset, HmxState),
+        VMSTATE_UINT32(tile_x_mask, HmxState),
+        VMSTATE_UINT32(tile_y_mask, HmxState),
+        VMSTATE_UINT32(tile_x_inc, HmxState),
+        VMSTATE_UINT32(tile_y_inc, HmxState),
+        VMSTATE_UINT32(fx, HmxState),
+        VMSTATE_UINT32(fy, HmxState),
+        VMSTATE_INT32(ch_start, HmxState),
+        VMSTATE_INT32(ch_stop, HmxState),
+        VMSTATE_UINT32(y_start, HmxState),
+        VMSTATE_UINT32(y_stop, HmxState),
+        VMSTATE_UINT32(y_dilate, HmxState),
+        VMSTATE_UINT32(blocks, HmxState),
+        VMSTATE_INT32(dY, HmxState),
+        VMSTATE_UINT32(group_conv, HmxState),
+        VMSTATE_UINT32(group_size, HmxState),
+        VMSTATE_UINT32(group_count, HmxState),
+        VMSTATE_INT32(mac_cycle_limit, HmxState),
+        VMSTATE_UINT32(cvt_fxp_pending, HmxState),
+        VMSTATE_UINT32(cvt_fxp_pending_age, HmxState),
+        VMSTATE_UINT32(cvt_acc_clear_pending, HmxState),
+        VMSTATE_UINT32(cvt_acc_clear_set, HmxState),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+static const VMStateDescription vmstate_hexagon_hmx_context = {
+    .name = "hexagon_hmx_context",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (const VMStateField[]) {
+        VMSTATE_STRUCT(regs, HexagonHMXContextState, 1, vmstate_hmx_regs,
+                       HmxState),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
 static void hexagon_hmx_context_class_init(ObjectClass *klass,
                                            const void *data)
 {
@@ -22,6 +138,7 @@ static void hexagon_hmx_context_class_init(ObjectClass *klass,
     ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     rc->phases.hold = hexagon_hmx_context_reset_hold;
+    dc->vmsd = &vmstate_hexagon_hmx_context;
     dc->user_creatable = false;
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 7/8
#15 lore raw

Re: [PATCH 7/8] hw/hexagon: migrate the HMX state

hw/hexagon/hexagon_hmx_context.c line 7

Quoted 12 lines · Brian Cain
---
 hw/hexagon/hexagon_hmx_context.c | 117 +++++++++++++++++++++++++++++++
 1 file changed, 117 insertions(+)
hw/hexagon/hexagon_hmx_context.c +0 -0
index e3ea7b71474..3683bd9d416 100644
@@ -7,6 +7,7 @@
 
author
#16 lore raw

PATCH 8/8 target/hexagon: implement mxclracc

In reply to Brian Cain

Implement an HMX accumulator clear instruction - mxclracc.

---
 target/hexagon/gen_tcg_hmx.h | 13 +++++++++++++
 target/hexagon/helper.h      |  2 ++
 target/hexagon/genptr.c      |  1 +
 target/hexagon/op_helper.c   | 10 ++++++++++
 target/hexagon/translate.c   |  3 ++-
 target/hexagon/hex_common.py |  2 ++
 target/hexagon/meson.build   | 13 +++++++------
 7 files changed, 37 insertions(+), 7 deletions(-)
 create mode 100644 target/hexagon/gen_tcg_hmx.h
target/hexagon/gen_tcg_hmx.h new file +13 -0
new file mode 100644
index 00000000000..d53d855af51
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HEXAGON_GEN_TCG_HMX_H
+#define HEXAGON_GEN_TCG_HMX_H
+
+#define fGEN_TCG_M8_mxclracc(SHORTCODE) \
+    gen_helper_mxclracc(tcg_env)
+
+#endif
target/hexagon/helper.h +2 -0
index 8c49e798093..70453bae61f 100644
@@ -31,6 +31,8 @@ DEF_HELPER_FLAGS_4(vacsh_pred, TCG_CALL_NO_RWG_SE, s32, env, s64, s64, s64)
 DEF_HELPER_FLAGS_2(cabacdecbin_val, TCG_CALL_NO_RWG_SE, s64, s64, s64)
 DEF_HELPER_FLAGS_2(cabacdecbin_pred, TCG_CALL_NO_RWG_SE, s32, s64, s64)
 
+DEF_HELPER_1(mxclracc, void, env)
+
 /* Floating point */
 DEF_HELPER_3(conv_sf2df, f64, env, f32, i32)
 DEF_HELPER_3(conv_df2sf, f32, env, f64, i32)
target/hexagon/genptr.c +1 -0
index 7ef36e336fa..a90e89e36e5 100644
@@ -32,6 +32,7 @@
 #undef QEMU_GENERATE
 #include "gen_tcg.h"
 #include "gen_tcg_hvx.h"
+#include "gen_tcg_hmx.h"
 #ifndef CONFIG_USER_ONLY
 #include "gen_tcg_sys.h"
 #endif
target/hexagon/op_helper.c +10 -0
index 6076a5f29fd..0cedc6239a3 100644
@@ -2138,6 +2138,16 @@ void HELPER(pending_interrupt)(CPUHexagonState *env)
 #define BOGUS_HELPER(tag) \
     printf("ERROR: bogus helper: " #tag "\n")
 
+void HELPER(mxclracc)(CPUHexagonState *env)
+{
+    HmxState *hmx = env->hmx_state;
+    int i;
+
+    for (i = 0; i < HMX_NUM_ACC_SETS; i++) {
+        memset(&hmx->acc[i].fxp_primary, 0, sizeof(hmx->acc[i].fxp_primary));
+    }
+}
+
 #include "helper_funcs_generated.c.inc"
 
 #define DO_ABSDIFF(NAME, TYPE, UTYPE) \
target/hexagon/translate.c +2 -1
index 4c84feaeeb5..4fcaca69e7b 100644
@@ -863,7 +863,8 @@ static void gen_start_packet(DisasContext *ctx)
 
     if (ctx->pkt.pkt_has_hmx) {
         for (i = 0; i < ctx->pkt.num_insns; i++) {
-            if (GET_ATTRIB(ctx->pkt.insn[i].opcode, A_HMX)) {
+            if (GET_ATTRIB(ctx->pkt.insn[i].opcode, A_HMX) &&
+                ctx->pkt.insn[i].opcode != M8_mxclracc) {
                 qemu_log_mask(LOG_UNIMP, "'%s' is not implemented\n",
                               opcode_names[ctx->pkt.insn[i].opcode]);
             }
target/hexagon/hex_common.py +2 -0
index 94e70b8657d..60268d183b3 100755
@@ -1538,6 +1538,7 @@ def parse_common_args(desc):
     parser.add_argument("overrides", help="overrides file")
     parser.add_argument("overrides_vec", help="vector overrides file")
     parser.add_argument("overrides_sys", help="system overrides file")
+    parser.add_argument("overrides_hmx", help="matrix overrides file")
     parser.add_argument("out", help="output file")
     parser.add_argument("--idef-parser",
                         help="file of instructions translated by idef-parser")
@@ -1546,6 +1547,7 @@ def parse_common_args(desc):
     read_overrides_file(args.overrides)
     read_overrides_file(args.overrides_vec)
     read_overrides_file(args.overrides_sys)
+    read_overrides_file(args.overrides_hmx)
     if args.idef_parser:
         read_idef_parser_enabled_file(args.idef_parser)
     calculate_attribs()
target/hexagon/meson.build +7 -6
index fe3206ef8b8..cd64767b5e8 100644
@@ -21,6 +21,7 @@ hex_common_py = 'hex_common.py'
 gen_tcg_h = meson.current_source_dir() / 'gen_tcg.h'
 gen_tcg_hvx_h = meson.current_source_dir() / 'gen_tcg_hvx.h'
 gen_tcg_sys_h = meson.current_source_dir() / 'gen_tcg_sys.h'
+gen_tcg_hmx_h = meson.current_source_dir() / 'gen_tcg_hmx.h'
 idef_parser_dir = meson.current_source_dir() / 'idef-parser'
 
 #
@@ -352,12 +353,12 @@ if idef_parser_enabled and ('hexagon-linux-user' in target_dirs or
     # Setup input and dependencies for the next step, this depends on whether or
     # not idef-parser is enabled
     helper_dep = [semantics_generated, idef_generated_tcg_c, idef_generated_tcg]
-    helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h, '--idef-parser', idef_generated_list]
+    helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h, gen_tcg_hmx_h, '--idef-parser', idef_generated_list]
 else
     # Setup input and dependencies for the next step, this depends on whether or
     # not idef-parser is enabled
     helper_dep = [semantics_generated]
-    helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h]
+    helper_in = [semantics_generated, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h, gen_tcg_hmx_h]
 endif
 
 #
@@ -371,7 +372,7 @@ helper_protos_generated = custom_target(
     'helper_protos_generated.h.inc',
     output: 'helper_protos_generated.h.inc',
     depends: helper_dep,
-    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h],
+    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h, gen_tcg_hmx_h],
     command: [python, files('gen_helper_protos.py'), helper_in, '@OUTPUT@'],
 )
 hexagon_ss.add(helper_protos_generated)
@@ -380,7 +381,7 @@ helper_funcs_generated = custom_target(
     'helper_funcs_generated.c.inc',
     output: 'helper_funcs_generated.c.inc',
     depends: helper_dep,
-    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h],
+    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h, gen_tcg_hmx_h],
     command: [python, files('gen_helper_funcs.py'), helper_in, '@OUTPUT@'],
 )
 hexagon_ss.add(helper_funcs_generated)
@@ -389,7 +390,7 @@ tcg_funcs_generated = custom_target(
     'tcg_funcs_generated.c.inc',
     output: 'tcg_funcs_generated.c.inc',
     depends: helper_dep,
-    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h],
+    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h, gen_tcg_hmx_h],
     command: [python, files('gen_tcg_funcs.py'), helper_in, '@OUTPUT@'],
 )
 hexagon_ss.add(tcg_funcs_generated)
@@ -398,7 +399,7 @@ analyze_funcs_generated = custom_target(
     'analyze_funcs_generated.c.inc',
     output: 'analyze_funcs_generated.c.inc',
     depends: helper_dep,
-    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h],
+    depend_files: [hex_common_py, gen_tcg_h, gen_tcg_hvx_h, gen_tcg_sys_h, gen_tcg_hmx_h],
     command: [python, files('gen_analyze_funcs.py'), helper_in, '@OUTPUT@'],
 )
 hexagon_ss.add(analyze_funcs_generated)
Signature · 1 line
2.34.1
#17 lore raw

Re: [PATCH 8/8] target/hexagon: implement mxclracc

Quoted 39 lines · Brian Cain

Implement an HMX accumulator clear instruction - mxclracc.

---
 target/hexagon/gen_tcg_hmx.h | 13 +++++++++++++
 target/hexagon/helper.h      |  2 ++
 target/hexagon/genptr.c      |  1 +
 target/hexagon/op_helper.c   | 10 ++++++++++
 target/hexagon/translate.c   |  3 ++-
 target/hexagon/hex_common.py |  2 ++
 target/hexagon/meson.build   | 13 +++++++------
 7 files changed, 37 insertions(+), 7 deletions(-)
 create mode 100644 target/hexagon/gen_tcg_hmx.h
target/hexagon/gen_tcg_hmx.h new file +13 -0
new file mode 100644
index 00000000000..d53d855af51
@@ -0,0 +1,13 @@
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HEXAGON_GEN_TCG_HMX_H
+#define HEXAGON_GEN_TCG_HMX_H
+
+#define fGEN_TCG_M8_mxclracc(SHORTCODE) \
+    gen_helper_mxclracc(tcg_env)
+
+#endif
target/hexagon/helper.h +0 -0
index 8c49e798093..70453bae61f 100644

target/hexagon/helper.h DEF_HELPER_FLAGS_4(vacsh_pred, TCG_CALL_NO_RWG_SE, s32, env, s64, s64, s64) · line 35

Quoted 5 lines
target/hexagon/helper.h +2 -0
@@ -31,6 +31,8 @@ DEF_HELPER_FLAGS_4(vacsh_pred, TCG_CALL_NO_RWG_SE, s32, env, s64, s64, s64)
 DEF_HELPER_FLAGS_2(cabacdecbin_val, TCG_CALL_NO_RWG_SE, s64, s64, s64)
 DEF_HELPER_FLAGS_2(cabacdecbin_pred, TCG_CALL_NO_RWG_SE, s32, s64, s64)
 
+DEF_HELPER_1(mxclracc, void, env)
+

The helper is only used in builds with idef-parser disabled. Since idef-parser is enabled by default, mxclracc gets an empty implementation in the default build.