Skip to contentSkip to conversation

Hexagon: Add real SoC-style machines

PATCH Superseded Brian Cain 3 participants 19 messages Oct 21 Arm/Amlogic Meson SoC support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Brian Cain

author
#0 lore raw

v2 cover Hexagon: Add real SoC-style machines

Previously we added synthetic machines intended for compatibility with programs created by the Hexagon SDK. These simple configurations have a memory/irq map that doesn't match any real chips, and they are limited to an interrupt controller and a timer device.

Here we add DSP machines that reflect real-world devices and run some of the commercial firmware to test it. Note that for now the boot will not progress much beyond the initial kernel boot. Dependencies on other yet-to-be-modeled devices are preventing the firmware from coming up fully to a steady/idle state.

In v2:
- added range checks for RAM/FDT/initrd bounds, subsystem_base addr.
- fixed endianness bug in bootloader creation.
- Used full URLs for Asset()s in test_qcom_dsp_firmware.py, switched from a sha to a tag.
- Included the "report ISA HWCAP through v85" patch from another series for better context.

v1: https://lore.kernel.org/qemu-devel/[email protected]/

Brian Cain (15):
Hexagon: add v85 CPU model linux-user/hexagon: report ISA HWCAP through v85 hw/hexagon: let a machine place its DDR hw/hexagon: introduce hex-board abstraction hw/hexagon: convert virt board to hex-board hw/misc: add the QDSP6SS PLL, RCG hw/hexagon: add the QCS6490 CDSP machine hw/hexagon: add the SA8775P CDSP machine hw/hexagon: add the SC8480XP NSP0 machine hw/hexagon: add the SA8797P NSP0 machine hw/hexagon: add the SM8975 NSP machine hw/hexagon: add v79NA1 machine hw/hexagon: add subsystem-base property target/hexagon: fix the allocframe framekey tests/functional/hexagon: boot DSP firmware

 MAINTAINERS                                   |   6 +
 docs/system/hexagon/emulation.rst             |   2 +-
 include/hw/hexagon/hex-board.h                |  65 +++
 include/hw/hexagon/hexagon.h                  |  10 +
 include/hw/hexagon/qcom_dsp.h                 |  81 ++++
 include/hw/hexagon/virt.h                     |   6 -
 include/hw/misc/qcom-qdsp6ss-clk.h            |  15 +
 linux-user/hexagon/target_elf.h               |   2 +
 target/hexagon/cpu-qom.h                      |   4 +
 hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc     |  65 +++
 hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc     |   6 +-
 hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc     |  56 +++
 hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc    |  52 +++
 hw/hexagon/machine_cfg_sm8975_nsp.h.inc       |  55 +++
 hw/hexagon/machine_cfg_v79na_1.h.inc          |  34 ++
 hw/hexagon/hex-board.c                        | 265 +++++++++++
 hw/hexagon/hex-subsys.c                       |   4 +-
 hw/hexagon/hexagon_dsp.c                      |  93 +++-
 hw/hexagon/qcom_dsp.c                         | 410 ++++++++++++++++++
 hw/hexagon/qcs6490_cdsp.c                     |  64 +++
 hw/hexagon/sa8775p_cdsp.c                     |  59 +++
 hw/hexagon/sa8797p_nsp0.c                     |  68 +++
 hw/hexagon/sc8480xp_nsp0.c                    |  90 ++++
 hw/hexagon/sm8975_nsp.c                       | 102 +++++
 hw/hexagon/virt.c                             | 309 ++-----------
 hw/misc/qcom-qdsp6ss-clk.c                    | 208 +++++++++
 linux-user/hexagon/elfload.c                  |  10 +
 target/hexagon/cpu.c                          |   2 +
 target/hexagon/idef-parser/parser-helpers.c   |   2 +-
 tests/qtest/hexagon-config-test.c             |  78 ++++
 tests/qtest/l2vic-test.c                      |  10 +
 tests/qtest/qcom-dsp-test.c                   | 113 +++++
 tests/qtest/qct-qtimer-test.c                 |  10 +
 tests/tcg/hexagon/framekey.c                  |  67 +++
 hw/hexagon/Kconfig                            |  48 +-
 hw/hexagon/meson.build                        |   7 +
 hw/misc/Kconfig                               |   3 +
 hw/misc/meson.build                           |   3 +
 tests/functional/hexagon/meson.build          |   2 +
 .../hexagon/test_qcom_dsp_firmware.py         |  92 ++++
 tests/qtest/meson.build                       |   4 +-
 tests/tcg/hexagon/meson.build                 |   1 +
 42 files changed, 2285 insertions(+), 298 deletions(-)
 create mode 100644 include/hw/hexagon/hex-board.h
 create mode 100644 include/hw/hexagon/qcom_dsp.h
 create mode 100644 include/hw/misc/qcom-qdsp6ss-clk.h
 create mode 100644 hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc
 create mode 100644 hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc
 create mode 100644 hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc
 create mode 100644 hw/hexagon/machine_cfg_sm8975_nsp.h.inc
 create mode 100644 hw/hexagon/machine_cfg_v79na_1.h.inc
 create mode 100644 hw/hexagon/hex-board.c
 create mode 100644 hw/hexagon/qcom_dsp.c
 create mode 100644 hw/hexagon/qcs6490_cdsp.c
 create mode 100644 hw/hexagon/sa8775p_cdsp.c
 create mode 100644 hw/hexagon/sa8797p_nsp0.c
 create mode 100644 hw/hexagon/sc8480xp_nsp0.c
 create mode 100644 hw/hexagon/sm8975_nsp.c
 create mode 100644 hw/misc/qcom-qdsp6ss-clk.c
 create mode 100644 tests/qtest/hexagon-config-test.c
 create mode 100644 tests/qtest/qcom-dsp-test.c
 create mode 100644 tests/tcg/hexagon/framekey.c
 create mode 100755 tests/functional/hexagon/test_qcom_dsp_firmware.py
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/15 Hexagon: add v85 CPU model

---
 docs/system/hexagon/emulation.rst | 2 +-
 target/hexagon/cpu-qom.h          | 4 ++++
 linux-user/hexagon/elfload.c      | 4 ++++
 target/hexagon/cpu.c              | 2 ++
 4 files changed, 11 insertions(+), 1 deletion(-)
docs/system/hexagon/emulation.rst +1 -1
index 12385311aa4..fb57c77ae90 100644
@@ -6,7 +6,7 @@ Hexagon CPU architecture support
 ================================
 
 QEMU's TCG emulation includes support for v65, v66, v67, v68, v69, v71, v73,
-v75, v77, v79, v81.
+v75, v77, v79, v81, v83, v85.
 It also has support for the following architecture extensions:
 
 - HVX (Hexagon Vector eXtensions)
target/hexagon/cpu-qom.h +4 -0
index 2bfa4d5d0fc..d4c8413ded3 100644
@@ -28,6 +28,8 @@ typedef enum {
     HEX_VER_V75 = 0x75,
     HEX_VER_V79 = 0x79,
     HEX_VER_V81 = 0x81,
+    HEX_VER_V83 = 0x83,
+    HEX_VER_V85 = 0x85,
     HEX_VER_ANY = 0xff,
 } HexagonVersion;
 
@@ -55,6 +57,8 @@ typedef struct {
 #define TYPE_HEXAGON_CPU_V75 HEXAGON_CPU_TYPE_NAME("v75")
 #define TYPE_HEXAGON_CPU_V79 HEXAGON_CPU_TYPE_NAME("v79")
 #define TYPE_HEXAGON_CPU_V81 HEXAGON_CPU_TYPE_NAME("v81")
+#define TYPE_HEXAGON_CPU_V83 HEXAGON_CPU_TYPE_NAME("v83")
+#define TYPE_HEXAGON_CPU_V85 HEXAGON_CPU_TYPE_NAME("v85")
 
 OBJECT_DECLARE_CPU_TYPE(HexagonCPU, HexagonCPUClass, HEXAGON_CPU)
 
linux-user/hexagon/elfload.c +4 -0
index 3a6ba4e1304..9f98ad8fb86 100644
@@ -113,6 +113,10 @@ const char *get_elf_cpu_model(uint32_t eflags)
         return "v79";
     case 0x81:
         return "v81";
+    case 0x83:
+        return "v83";
+    case 0x85:
+        return "v85";
     }
 
     err = snprintf(buf, sizeof(buf), "unknown (0x%x)", eflags);
target/hexagon/cpu.c +2 -0
index f20d6de6f63..1e3df5d0d03 100644
@@ -934,6 +934,8 @@ static const TypeInfo hexagon_cpu_type_infos[] = {
     DEFINE_CPU(TYPE_HEXAGON_CPU_V75,              HEX_VER_V75),
     DEFINE_CPU(TYPE_HEXAGON_CPU_V79,              HEX_VER_V79),
     DEFINE_CPU(TYPE_HEXAGON_CPU_V81,              HEX_VER_V81),
+    DEFINE_CPU(TYPE_HEXAGON_CPU_V83,              HEX_VER_V83),
+    DEFINE_CPU(TYPE_HEXAGON_CPU_V85,              HEX_VER_V85),
 };
 
 DEFINE_TYPES(hexagon_cpu_type_infos)
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v2 2/15 linux-user/hexagon: report ISA HWCAP through v85

In reply to Brian Cain
---
 linux-user/hexagon/target_elf.h | 2 ++
 linux-user/hexagon/elfload.c    | 6 ++++++
 2 files changed, 8 insertions(+)
linux-user/hexagon/target_elf.h +2 -0
index 90e5032d5aa..b1eb5ea5037 100644
@@ -43,6 +43,8 @@ enum {
     HWCAP_HEXAGON_ISA_V77           = 16,
     HWCAP_HEXAGON_ISA_V79           = 17,
     HWCAP_HEXAGON_ISA_V81           = 18,
+    HWCAP_HEXAGON_ISA_V83           = 19,
+    HWCAP_HEXAGON_ISA_V85           = 20,
     HWCAP_HEXAGON_HVX               = 1 << 7,
     HWCAP_HEXAGON_CABAC             = 1 << 8,
     HWCAP_HEXAGON_HVX_LENGTH_128B   = 1 << 9,
linux-user/hexagon/elfload.c +6 -0
index 9f98ad8fb86..db0bf299cc0 100644
@@ -62,6 +62,12 @@ abi_ulong get_elf_hwcap(CPUState *cs)
     case HEX_VER_V81:
         hwcaps = HWCAP_HEXAGON_ISA_V81;
         break;
+    case HEX_VER_V83:
+        hwcaps = HWCAP_HEXAGON_ISA_V83;
+        break;
+    case HEX_VER_V85:
+        hwcaps = HWCAP_HEXAGON_ISA_V85;
+        break;
     default:
         return 0;
     }
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v2 3/15 hw/hexagon: let a machine place its DDR

In reply to Brian Cain

hex_subsys_create() always maps the main DDR at address 0. This is appropriate for hexagon-sim-style machines, but real SoCs map it elsewhere.

---
 include/hw/hexagon/hexagon.h | 2 ++
 hw/hexagon/hex-subsys.c      | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)
include/hw/hexagon/hexagon.h +2 -0
index 9b5d33ffc3b..6955e600aee 100644
@@ -145,6 +145,8 @@ union hexagon_config_table {
 };
 
 struct hexagon_machine_config {
+    /* Base address of the main DDR region */
+    hwaddr ddr_base;
     /* Base address of config table */
     uint32_t cfgbase;
     /* Size of L2 TCM */
hw/hexagon/hex-subsys.c +2 -2
index 9818cf58878..382f45bd09f 100644
@@ -136,10 +136,10 @@ void hex_subsys_create(HexagonCommonMachineState *hms,
     MachineState *machine = MACHINE(hms);
     MemoryRegion *sysmem = get_system_memory();
 
-    /* Main DDR at the reset vector. */
+    /* Main DDR. */
     memory_region_init_ram(&hms->ram, NULL, "ddr.ram", machine->ram_size,
                            &error_fatal);
-    memory_region_add_subregion(sysmem, 0x0, &hms->ram);
+    memory_region_add_subregion(sysmem, m_cfg->ddr_base, &hms->ram);
 
     /* Config-table ROM and the blob that backs it. */
     memory_region_init_rom(&hms->cfgtable_rom, NULL, "config_table.rom",
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH v2 4/15 hw/hexagon: introduce hex-board abstraction

In reply to Brian Cain

Move what virt.c does to build a board out of it into helpers in a new hex-board.c, so that other Hexagon machines that describe themselves with a generated device tree can reuse it.

This will be used by future commits.

---
 MAINTAINERS                    |   2 +
 include/hw/hexagon/hex-board.h |  65 ++++++++
 hw/hexagon/hex-board.c         | 265 +++++++++++++++++++++++++++++++++
 hw/hexagon/Kconfig             |   9 +-
 hw/hexagon/meson.build         |   1 +
 5 files changed, 340 insertions(+), 2 deletions(-)
 create mode 100644 include/hw/hexagon/hex-board.h
 create mode 100644 hw/hexagon/hex-board.c
MAINTAINERS +2 -0
index 33b4f7c259d..7c14d006f64 100644
@@ -256,6 +256,8 @@ F: tests/qtest/l2vic-test.c
 F: hw/timer/qct-qtimer.c
 F: include/hw/timer/qct-qtimer.h
 F: tests/qtest/qct-qtimer-test.c
+F: hw/hexagon/hex-board.c
+F: include/hw/hexagon/hex-board.h
 X: target/hexagon/idef-parser/
 X: target/hexagon/gen_idef_parser_funcs.py
 F: linux-user/hexagon/
include/hw/hexagon/hex-board.h new file +65 -0

65 lines not on this page · raw message

hw/hexagon/hex-board.c new file +265 -0

265 lines not on this page · raw message

hw/hexagon/Kconfig +7 -2
index bb8a254fd26..63ee8836aca 100644
@@ -7,12 +7,17 @@ config HEX_DSP
     select HEX_QTIMER
     select ARM_COMPATIBLE_SEMIHOSTING
 
-config HEX_VIRT
+config HEX_BOARD
     bool
-    default y
     depends on HEX_DSP && FDT
     select DEVICE_TREE
     select VIRTIO_MMIO
     select PL011
+
+config HEX_VIRT
+    bool
+    default y
+    depends on HEX_DSP && FDT
+    select HEX_BOARD
     select VIRTIO_BLK
     select VIRTIO_SCSI
hw/hexagon/meson.build +1 -0
index c4b257dfa28..57bff31ad00 100644
@@ -4,6 +4,7 @@ hexagon_ss.add(files('hexagon_globalreg.c'))
 hexagon_ss.add(files('hexagon_hvx_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'))
 hexagon_ss.add(when: 'CONFIG_HEX_VIRT', if_true: files('virt.c'))
 
 hw_arch += {'hexagon': hexagon_ss}
Signature · 1 line
2.34.1
author
#5 lore raw

PATCH v2 5/15 hw/hexagon: convert virt board to hex-board

In reply to Brian Cain

Build the virt machine with the hex-board helpers instead of its own copies, and drop the machine state that nothing used. The machine, its device tree and its devices are unchanged; virt writes interrupts as the bare line number.

---
 include/hw/hexagon/virt.h |   6 -
 hw/hexagon/virt.c         | 309 ++++----------------------------------
 2 files changed, 26 insertions(+), 289 deletions(-)
include/hw/hexagon/virt.h +0 -6
index 4ca2f1ef859..dc9f22a83c4 100644
@@ -17,15 +17,9 @@ struct HexagonVirtMachineState {
     HexagonCommonMachineState parent_obj;
 
     int fdt_size;
-    MemoryRegion *sys;
     MemoryRegion tcm;
-    MemoryRegion bios;
-    Clock *apb_clk;
-    DeviceState *virtio_mmio[VIRTIO_DEV_COUNT];
 };
 
-void hexagon_load_fdt(const struct HexagonVirtMachineState *vms);
-
 #define TYPE_HEXAGON_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
 OBJECT_DECLARE_SIMPLE_TYPE(HexagonVirtMachineState, HEXAGON_VIRT_MACHINE)
 
hw/hexagon/virt.c +26 -283

349 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#6 lore raw

PATCH v2 6/15 hw/misc: add the QDSP6SS PLL, RCG

In reply to Brian Cain

Firmware brings a Hexagon DSP's clocks up by programming a PLL and polling its lock-detect. Then it asks the RCG to switch to the new clock.

---
 MAINTAINERS                        |   2 +
 include/hw/misc/qcom-qdsp6ss-clk.h |  15 +++
 hw/misc/qcom-qdsp6ss-clk.c         | 208 +++++++++++++++++++++++++++++
 hw/misc/Kconfig                    |   3 +
 hw/misc/meson.build                |   3 +
 5 files changed, 231 insertions(+)
 create mode 100644 include/hw/misc/qcom-qdsp6ss-clk.h
 create mode 100644 hw/misc/qcom-qdsp6ss-clk.c
MAINTAINERS +2 -0
index 7c14d006f64..794fd79d7d9 100644
@@ -1380,7 +1380,9 @@ M: Brian Cain <[email protected]>
 R: Pierrick Bouvier <[email protected]>
 S: Supported
 F: hw/hexagon/
+F: hw/misc/qcom-qdsp6ss-clk.c
 F: include/hw/hexagon/
+F: include/hw/misc/qcom-qdsp6ss-clk.h
 F: configs/devices/hexagon-softmmu/default.mak
 F: docs/system/hexagon/
 F: tests/functional/hexagon/
include/hw/misc/qcom-qdsp6ss-clk.h new file +15 -0
new file mode 100644
index 00000000000..9e3c58b5726
@@ -0,0 +1,15 @@
+/*
+ * Qualcomm QDSP6SS clock blocks: the Lucid alpha PLL and the root clock
+ * generator that firmware programs while bringing a Hexagon DSP up.
+ *
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_MISC_QCOM_QDSP6SS_CLK_H
+#define HW_MISC_QCOM_QDSP6SS_CLK_H
+
+#define TYPE_QCOM_LUCID_PLL "qcom-lucid-pll"
+#define TYPE_QCOM_RCG "qcom-rcg"
+
+#endif /* HW_MISC_QCOM_QDSP6SS_CLK_H */
hw/misc/qcom-qdsp6ss-clk.c new file +208 -0

208 lines not on this page · raw message

hw/misc/Kconfig +3 -0
index 7abd22869a4..363930230b4 100644
@@ -267,3 +267,6 @@ config SOPHGO_CV1800B_CLK
     bool
 
 source macio/Kconfig
+
+config QCOM_QDSP6SS_CLK
+    bool
hw/misc/meson.build +3 -0
index 8a94aba751d..2b437f53d6a 100644
@@ -179,3 +179,6 @@ system_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa_ec.c'))
 system_ss.add(when: 'CONFIG_LASI', if_true: files('lasi.c'))
 
 system_ss.add(when: 'CONFIG_AXIADO_CLK', if_true: files('axiado_clk.c'))
+
+# Qualcomm Hexagon DSP subsystems
+system_ss.add(when: 'CONFIG_QCOM_QDSP6SS_CLK', if_true: files('qcom-qdsp6ss-clk.c'))
Signature · 1 line
2.34.1
author
#7 lore raw

PATCH v2 7/15 hw/hexagon: add the QCS6490 CDSP machine

In reply to Brian Cain
---
 MAINTAINERS                               |   1 +
 include/hw/hexagon/hexagon.h              |   1 +
 include/hw/hexagon/qcom_dsp.h             |  81 +++++
 hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc |  65 ++++
 hw/hexagon/qcom_dsp.c                     | 410 ++++++++++++++++++++++
 hw/hexagon/qcs6490_cdsp.c                 |  64 ++++
 tests/qtest/l2vic-test.c                  |   2 +
 tests/qtest/qcom-dsp-test.c               |  93 +++++
 tests/qtest/qct-qtimer-test.c             |   2 +
 hw/hexagon/Kconfig                        |  15 +
 hw/hexagon/meson.build                    |   2 +
 tests/qtest/meson.build                   |   3 +-
 12 files changed, 738 insertions(+), 1 deletion(-)
 create mode 100644 include/hw/hexagon/qcom_dsp.h
 create mode 100644 hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc
 create mode 100644 hw/hexagon/qcom_dsp.c
 create mode 100644 hw/hexagon/qcs6490_cdsp.c
 create mode 100644 tests/qtest/qcom-dsp-test.c
MAINTAINERS +1 -0
index 794fd79d7d9..9449e66d33b 100644
@@ -1386,6 +1386,7 @@ F: include/hw/misc/qcom-qdsp6ss-clk.h
 F: configs/devices/hexagon-softmmu/default.mak
 F: docs/system/hexagon/
 F: tests/functional/hexagon/
+F: tests/qtest/qcom-dsp-test.c
 F: docs/devel/hexagon-sys.rst
 
 LoongArch Machines
include/hw/hexagon/hexagon.h +1 -0
index 6955e600aee..1d0d55ea938 100644
@@ -23,6 +23,7 @@ typedef enum {
     v66_rev = 0xa666,
     v67_rev = 0x2667,
     v68_rev = 0x8d68,
+    v68_qcs6490_rev = 0x8a68,
     v69_rev = 0x8c69,
     v71_rev = 0x8c71,
     v73_rev = 0x8c73,
include/hw/hexagon/qcom_dsp.h new file +81 -0

81 lines not on this page · raw message

hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc new file +65 -0

65 lines not on this page · raw message

hw/hexagon/qcom_dsp.c new file +410 -0

410 lines not on this page · raw message

hw/hexagon/qcs6490_cdsp.c new file +64 -0

64 lines not on this page · raw message

tests/qtest/l2vic-test.c +2 -0
index adb4dc7281e..2e0d7dcb0f1 100644
@@ -11,6 +11,7 @@
 
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
+#include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
 
 /* L2VIC register offsets exercised by this test */
 #define L2VIC_INT_ENABLEn 0x100 /* Read/Write */
@@ -45,6 +46,7 @@ typedef struct {
 static const L2VICMachineCfg l2vic_machines[] = {
     { "virt",      &v68n_1024 },
     { "V66G_1024", &v66g_1024 },
+    { "qcs6490-cdsp", &qcs6490_cdsp },
 };
 
 static uint32_t l2vic_read32(uint64_t base, uint32_t offset)
tests/qtest/qcom-dsp-test.c new file +93 -0

93 lines not on this page · raw message

tests/qtest/qct-qtimer-test.c +2 -0
index fd8bb0af776..263751b55bf 100644
@@ -12,6 +12,7 @@
 
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
+#include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
 
 #define QTIMER_DEFAULT_FREQ_HZ 19200000ULL
 
@@ -342,6 +343,7 @@ typedef struct {
 static const QtimerMachineCfg qtimer_machines[] = {
     { "virt",      &v68n_1024 },
     { "V66G_1024", &v66g_1024 },
+    { "qcs6490-cdsp", &qcs6490_cdsp },
 };
 
 static void test_qtimer_on_machine(gconstpointer data)
hw/hexagon/Kconfig +15 -0
index 63ee8836aca..ffc8623691c 100644
@@ -21,3 +21,18 @@ config HEX_VIRT
     select HEX_BOARD
     select VIRTIO_BLK
     select VIRTIO_SCSI
+
+config HEX_QCOM_DSP
+    bool
+    depends on HEX_DSP && FDT
+    select HEX_BOARD
+    select UNIMP
+    select QCOM_QDSP6SS_CLK
+    select VIRTIO_BLK
+    select VIRTIO_SCSI
+
+config HEX_QCS6490_CDSP
+    bool
+    default y
+    depends on HEX_DSP && FDT
+    select HEX_QCOM_DSP
hw/hexagon/meson.build +2 -0
index 57bff31ad00..7145e8a65df 100644
@@ -6,5 +6,7 @@ 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'))
 hexagon_ss.add(when: 'CONFIG_HEX_VIRT', if_true: files('virt.c'))
+hexagon_ss.add(when: 'CONFIG_HEX_QCOM_DSP', if_true: files('qcom_dsp.c'))
+hexagon_ss.add(when: 'CONFIG_HEX_QCS6490_CDSP', if_true: files('qcs6490_cdsp.c'))
 
 hw_arch += {'hexagon': hexagon_ss}
tests/qtest/meson.build +2 -1
index 019c63ca60b..0bbca236659 100644
@@ -320,7 +320,8 @@ qtests_riscv64 = ['riscv-csr-test'] + \
    ['k230-ddr-test', 'k230-wdt-test', 'k230-gsdma-test', 'k230-decomp-gzip-test'] : []) + \
    ['milkv-duo-test']
 
-qtests_hexagon = ['boot-serial-test', 'l2vic-test', 'qct-qtimer-test']
+qtests_hexagon = ['boot-serial-test', 'l2vic-test', 'qcom-dsp-test',
+                  'qct-qtimer-test']
 
 qos_test_ss = ss.source_set()
 qos_test_ss.add(
Signature · 1 line
2.34.1
Reviewed-by Anton Johansson on v2 7/15
#8 lore raw

Re: [PATCH v2 07/15] hw/hexagon: add the QCS6490 CDSP machine

Quoted 12 lines · Brian Cain
---
 MAINTAINERS                               |   1 +
 include/hw/hexagon/hexagon.h              |   1 +
 include/hw/hexagon/qcom_dsp.h             |  81 +++++
 hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc |  65 ++++
 hw/hexagon/qcom_dsp.c                     | 410 ++++++++++++++++++++++
 hw/hexagon/qcs6490_cdsp.c                 |  64 ++++
 tests/qtest/l2vic-test.c                  |   2 +
 tests/qtest/qcom-dsp-test.c               |  93 +++++
 tests/qtest/qct-qtimer-test.c             |   2 +
 hw/hexagon/Kconfig                        |  15 +
Quoted 8 lines
 hw/hexagon/meson.build                    |   2 +
 tests/qtest/meson.build                   |   3 +-
 12 files changed, 738 insertions(+), 1 deletion(-)
 create mode 100644 include/hw/hexagon/qcom_dsp.h
 create mode 100644 hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc
 create mode 100644 hw/hexagon/qcom_dsp.c
 create mode 100644 hw/hexagon/qcs6490_cdsp.c
 create mode 100644 tests/qtest/qcom-dsp-test.c
author
#9 lore raw

PATCH v2 8/15 hw/hexagon: add the SA8775P CDSP machine

In reply to Brian Cain
---
 hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc |  6 ++-
 hw/hexagon/sa8775p_cdsp.c                 | 59 +++++++++++++++++++++++
 tests/qtest/l2vic-test.c                  |  2 +
 tests/qtest/qcom-dsp-test.c               |  1 +
 tests/qtest/qct-qtimer-test.c             |  2 +
 hw/hexagon/Kconfig                        |  6 +++
 hw/hexagon/meson.build                    |  1 +
 7 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 hw/hexagon/sa8775p_cdsp.c
hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc +5 -1
index 442cbe3be31..7e2ef42b9e2 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
 
 static const struct hexagon_machine_config SA8775P_cdsp0 = {
+    .ddr_base =        0x80000000,
     .cfgbase =         0x24000000 + 0x180000,
     .l2tcm_size =      0x00000000,
     .l2vic_base =      0x26300000 + 0x90000,
@@ -25,7 +26,7 @@ static const struct hexagon_machine_config SA8775P_cdsp0 = {
         .vtcm_base = 0x00002500,
         .vtcm_size_kb = 0x00002000,
         .l2tag_size = 0x00000400,
-        .l2ecomem_size = 0x00000000,
+        .l2ecomem_size = 0x00000400,
         .thread_enable_mask = 0x0000003f,
         .eccreg_base = 0x0000241f,
         .l2line_size = 0x00000080,
@@ -60,5 +61,8 @@ static const struct hexagon_machine_config SA8775P_cdsp0 = {
         .consistency_domain = 0x000000e0,
         .capacity_domain = 0x00000080,
         .axi3_lowaddr = 0x00000000,
+        .coproc2_int8_subcolumns = 0x00000002,
+        .corecfg_present = 0x00000005,
+        .coproc2_fp16_acc_exp = 0x00000007,
     },
 };
hw/hexagon/sa8775p_cdsp.c new file +59 -0

59 lines not on this page · raw message

tests/qtest/l2vic-test.c +2 -0
index 2e0d7dcb0f1..5d30d18a9fd 100644
@@ -12,6 +12,7 @@
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
 
 /* L2VIC register offsets exercised by this test */
 #define L2VIC_INT_ENABLEn 0x100 /* Read/Write */
@@ -47,6 +48,7 @@ static const L2VICMachineCfg l2vic_machines[] = {
     { "virt",      &v68n_1024 },
     { "V66G_1024", &v66g_1024 },
     { "qcs6490-cdsp", &qcs6490_cdsp },
+    { "sa8775p-cdsp", &SA8775P_cdsp0 },
 };
 
 static uint32_t l2vic_read32(uint64_t base, uint32_t offset)
tests/qtest/qcom-dsp-test.c +1 -0
index 39d6e53bc4e..586e113c181 100644
@@ -24,6 +24,7 @@
 
 static const char *const qcom_dsp_machines[] = {
     "qcs6490-cdsp",
+    "sa8775p-cdsp",
 };
 
 static void test_console(const void *machine)
tests/qtest/qct-qtimer-test.c +2 -0
index 263751b55bf..b20d4a2bced 100644
@@ -13,6 +13,7 @@
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
 
 #define QTIMER_DEFAULT_FREQ_HZ 19200000ULL
 
@@ -344,6 +345,7 @@ static const QtimerMachineCfg qtimer_machines[] = {
     { "virt",      &v68n_1024 },
     { "V66G_1024", &v66g_1024 },
     { "qcs6490-cdsp", &qcs6490_cdsp },
+    { "sa8775p-cdsp", &SA8775P_cdsp0 },
 };
 
 static void test_qtimer_on_machine(gconstpointer data)
hw/hexagon/Kconfig +6 -0
index ffc8623691c..bdda7872878 100644
@@ -36,3 +36,9 @@ config HEX_QCS6490_CDSP
     default y
     depends on HEX_DSP && FDT
     select HEX_QCOM_DSP
+
+config HEX_SA8775P_CDSP
+    bool
+    default y
+    depends on HEX_DSP && FDT
+    select HEX_QCOM_DSP
hw/hexagon/meson.build +1 -0
index 7145e8a65df..b7496426c9a 100644
@@ -8,5 +8,6 @@ hexagon_ss.add(when: 'CONFIG_HEX_BOARD', if_true: files('hex-board.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_VIRT', if_true: files('virt.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_QCOM_DSP', if_true: files('qcom_dsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_QCS6490_CDSP', if_true: files('qcs6490_cdsp.c'))
+hexagon_ss.add(when: 'CONFIG_HEX_SA8775P_CDSP', if_true: files('sa8775p_cdsp.c'))
 
 hw_arch += {'hexagon': hexagon_ss}
Signature · 1 line
2.34.1
author
#10 lore raw

PATCH v2 9/15 hw/hexagon: add the SC8480XP NSP0 machine

In reply to Brian Cain
---
 include/hw/hexagon/hexagon.h               |  1 +
 hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc | 52 +++++++++++++
 hw/hexagon/sc8480xp_nsp0.c                 | 90 ++++++++++++++++++++++
 tests/qtest/l2vic-test.c                   |  2 +
 tests/qtest/qcom-dsp-test.c                |  1 +
 tests/qtest/qct-qtimer-test.c              |  2 +
 hw/hexagon/Kconfig                         |  6 ++
 hw/hexagon/meson.build                     |  1 +
 8 files changed, 155 insertions(+)
 create mode 100644 hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc
 create mode 100644 hw/hexagon/sc8480xp_nsp0.c
include/hw/hexagon/hexagon.h +1 -0
index 1d0d55ea938..5f993214784 100644
@@ -29,6 +29,7 @@ typedef enum {
     v73_rev = 0x8c73,
     v73m_rev = 0xcc73,
     v81_rev = 0x8781,
+    v81_sc8480xp_rev = 0x8081,
     v81dgb_1_rev = 0xcc81,
 } Rev_t;
 #define HEXAGON_LATEST_REV v73
hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc new file +52 -0

52 lines not on this page · raw message

hw/hexagon/sc8480xp_nsp0.c new file +90 -0

90 lines not on this page · raw message

tests/qtest/l2vic-test.c +2 -0
index 5d30d18a9fd..7afeabdbed8 100644
@@ -12,6 +12,7 @@
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
 
 /* L2VIC register offsets exercised by this test */
@@ -49,6 +50,7 @@ static const L2VICMachineCfg l2vic_machines[] = {
     { "V66G_1024", &v66g_1024 },
     { "qcs6490-cdsp", &qcs6490_cdsp },
     { "sa8775p-cdsp", &SA8775P_cdsp0 },
+    { "sc8480xp-nsp0", &sc8480xp_nsp0 },
 };
 
 static uint32_t l2vic_read32(uint64_t base, uint32_t offset)
tests/qtest/qcom-dsp-test.c +1 -0
index 586e113c181..46bbae47881 100644
@@ -25,6 +25,7 @@
 static const char *const qcom_dsp_machines[] = {
     "qcs6490-cdsp",
     "sa8775p-cdsp",
+    "sc8480xp-nsp0",
 };
 
 static void test_console(const void *machine)
tests/qtest/qct-qtimer-test.c +2 -0
index b20d4a2bced..629a11802ef 100644
@@ -13,6 +13,7 @@
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
 
 #define QTIMER_DEFAULT_FREQ_HZ 19200000ULL
@@ -346,6 +347,7 @@ static const QtimerMachineCfg qtimer_machines[] = {
     { "V66G_1024", &v66g_1024 },
     { "qcs6490-cdsp", &qcs6490_cdsp },
     { "sa8775p-cdsp", &SA8775P_cdsp0 },
+    { "sc8480xp-nsp0", &sc8480xp_nsp0 },
 };
 
 static void test_qtimer_on_machine(gconstpointer data)
hw/hexagon/Kconfig +6 -0
index bdda7872878..8785129da0e 100644
@@ -42,3 +42,9 @@ config HEX_SA8775P_CDSP
     default y
     depends on HEX_DSP && FDT
     select HEX_QCOM_DSP
+
+config HEX_SC8480XP_NSP0
+    bool
+    default y
+    depends on HEX_DSP && FDT
+    select HEX_QCOM_DSP
hw/hexagon/meson.build +1 -0
index b7496426c9a..b42a37b14de 100644
@@ -9,5 +9,6 @@ hexagon_ss.add(when: 'CONFIG_HEX_VIRT', if_true: files('virt.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_QCOM_DSP', if_true: files('qcom_dsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_QCS6490_CDSP', if_true: files('qcs6490_cdsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_SA8775P_CDSP', if_true: files('sa8775p_cdsp.c'))
+hexagon_ss.add(when: 'CONFIG_HEX_SC8480XP_NSP0', if_true: files('sc8480xp_nsp0.c'))
 
 hw_arch += {'hexagon': hexagon_ss}
Signature · 1 line
2.34.1
author
#11 lore raw

PATCH v2 10/15 hw/hexagon: add the SA8797P NSP0 machine

In reply to Brian Cain
---
 hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc | 56 +++++++++++++++++++
 hw/hexagon/sa8797p_nsp0.c                 | 68 +++++++++++++++++++++++
 tests/qtest/l2vic-test.c                  |  2 +
 tests/qtest/qcom-dsp-test.c               |  1 +
 tests/qtest/qct-qtimer-test.c             |  2 +
 hw/hexagon/Kconfig                        |  6 ++
 hw/hexagon/meson.build                    |  1 +
 7 files changed, 136 insertions(+)
 create mode 100644 hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc
 create mode 100644 hw/hexagon/sa8797p_nsp0.c
hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc new file +56 -0
new file mode 100644
index 00000000000..abc02a3e9ce
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/*
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+static const struct hexagon_machine_config sa8797p_nsp0 = {
+    .ddr_base = 0x80000000,
+    .cfgbase = 0x30180000,
+    .l2vic_base = 0x32390000,
+    .l2vic_size = 0x1000,
+    .l2tcm_size = 0x100000,
+    .csr_base = 0x323a0000,
+    .qtmr_region = 0x323a1000,
+    .cfgtable = {
+        .l2tcm_base = 0x3000,
+        .subsystem_base = 0x3238,
+        .etm_base = 0x3019,
+        .l2cfg_base = 0x301a,
+        .l1s0_base = 0x3100,
+        .fastl2vic_base = 0x301e,
+        .jtlb_size_entries = 0x80,
+        .coproc_present = 0xd,
+        .ext_contexts = 8,
+        .vtcm_base = 0x3100,
+        .vtcm_size_kb = 0x4000,
+        .l2tag_size = 0x400,
+        .l2ecomem_size = 0x400,
+        .thread_enable_mask = 0xfff,
+        .eccreg_base = 0x301f,
+        .l2line_size = 0x80,
+        .l2itcm_base = 0x3000,
+        .dma_version = 8,
+        .hvx_vec_log_length = 7,
+        .coproc2_reg0 = 0x10,
+        .coproc2_reg1 = 8,
+        .v2x_mode = 1,
+        .acd_preset = 1,
+        .mnd_preset = 1,
+        .l1d_size_kb = 0x40,
+        .l1i_size_kb = 0x40,
+        .l1d_write_policy = 2,
+        .vtcm_bank_width = 0x80,
+        .reserved4 = 1,
+        .reserved6 = 3,
+        .consistency_domain = 0xe0,
+        .capacity_domain = 0x80,
+        .corecfg_present = 0xd,
+        .coproc2_fp16_acc_exp = 1,
+        .AXIM_data_width = 0x100,
+        .l1d_ways = 8,
+        .l1i_ways = 4,
+        .l2way_num = 8,
+        .dma_jtlb_entries = 0x40,
+    },
+};
hw/hexagon/sa8797p_nsp0.c new file +68 -0

68 lines not on this page · raw message

tests/qtest/l2vic-test.c +2 -0
index 7afeabdbed8..4cd0319e8b5 100644
@@ -12,6 +12,7 @@
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
 
@@ -51,6 +52,7 @@ static const L2VICMachineCfg l2vic_machines[] = {
     { "qcs6490-cdsp", &qcs6490_cdsp },
     { "sa8775p-cdsp", &SA8775P_cdsp0 },
     { "sc8480xp-nsp0", &sc8480xp_nsp0 },
+    { "sa8797p-nsp0", &sa8797p_nsp0 },
 };
 
 static uint32_t l2vic_read32(uint64_t base, uint32_t offset)
tests/qtest/qcom-dsp-test.c +1 -0
index 46bbae47881..def389a0e9e 100644
@@ -26,6 +26,7 @@ static const char *const qcom_dsp_machines[] = {
     "qcs6490-cdsp",
     "sa8775p-cdsp",
     "sc8480xp-nsp0",
+    "sa8797p-nsp0",
 };
 
 static void test_console(const void *machine)
tests/qtest/qct-qtimer-test.c +2 -0
index 629a11802ef..21870de5649 100644
@@ -13,6 +13,7 @@
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
 
@@ -348,6 +349,7 @@ static const QtimerMachineCfg qtimer_machines[] = {
     { "qcs6490-cdsp", &qcs6490_cdsp },
     { "sa8775p-cdsp", &SA8775P_cdsp0 },
     { "sc8480xp-nsp0", &sc8480xp_nsp0 },
+    { "sa8797p-nsp0", &sa8797p_nsp0 },
 };
 
 static void test_qtimer_on_machine(gconstpointer data)
hw/hexagon/Kconfig +6 -0
index 8785129da0e..bcf368cb8b7 100644
@@ -48,3 +48,9 @@ config HEX_SC8480XP_NSP0
     default y
     depends on HEX_DSP && FDT
     select HEX_QCOM_DSP
+
+config HEX_SA8797P_NSP0
+    bool
+    default y
+    depends on HEX_DSP && FDT
+    select HEX_QCOM_DSP
hw/hexagon/meson.build +1 -0
index b42a37b14de..5a10ae694fe 100644
@@ -10,5 +10,6 @@ hexagon_ss.add(when: 'CONFIG_HEX_QCOM_DSP', if_true: files('qcom_dsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_QCS6490_CDSP', if_true: files('qcs6490_cdsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_SA8775P_CDSP', if_true: files('sa8775p_cdsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_SC8480XP_NSP0', if_true: files('sc8480xp_nsp0.c'))
+hexagon_ss.add(when: 'CONFIG_HEX_SA8797P_NSP0', if_true: files('sa8797p_nsp0.c'))
 
 hw_arch += {'hexagon': hexagon_ss}
Signature · 1 line
2.34.1
author
#12 lore raw

PATCH v2 11/15 hw/hexagon: add the SM8975 NSP machine

In reply to Brian Cain
---
 include/hw/hexagon/hexagon.h            |   1 +
 hw/hexagon/machine_cfg_sm8975_nsp.h.inc |  55 +++++++++++++
 hw/hexagon/sm8975_nsp.c                 | 102 ++++++++++++++++++++++++
 tests/qtest/l2vic-test.c                |   2 +
 tests/qtest/qcom-dsp-test.c             |  17 ++++
 tests/qtest/qct-qtimer-test.c           |   2 +
 hw/hexagon/Kconfig                      |   6 ++
 hw/hexagon/meson.build                  |   1 +
 8 files changed, 186 insertions(+)
 create mode 100644 hw/hexagon/machine_cfg_sm8975_nsp.h.inc
 create mode 100644 hw/hexagon/sm8975_nsp.c
include/hw/hexagon/hexagon.h +1 -0
index 5f993214784..26b0a1b3757 100644
@@ -31,6 +31,7 @@ typedef enum {
     v81_rev = 0x8781,
     v81_sc8480xp_rev = 0x8081,
     v81dgb_1_rev = 0xcc81,
+    v85_sm8975_rev = 0x8085,
 } Rev_t;
 #define HEXAGON_LATEST_REV v73
 #define HEXAGON_LATEST_REV_UPPER V73
hw/hexagon/machine_cfg_sm8975_nsp.h.inc new file +55 -0

55 lines not on this page · raw message

hw/hexagon/sm8975_nsp.c new file +102 -0

102 lines not on this page · raw message

tests/qtest/l2vic-test.c +2 -0
index 4cd0319e8b5..82f93fd58f9 100644
@@ -12,6 +12,7 @@
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sm8975_nsp.h.inc"
 #include "hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
@@ -53,6 +54,7 @@ static const L2VICMachineCfg l2vic_machines[] = {
     { "sa8775p-cdsp", &SA8775P_cdsp0 },
     { "sc8480xp-nsp0", &sc8480xp_nsp0 },
     { "sa8797p-nsp0", &sa8797p_nsp0 },
+    { "sm8975-nsp", &sm8975_nsp },
 };
 
 static uint32_t l2vic_read32(uint64_t base, uint32_t offset)
tests/qtest/qcom-dsp-test.c +17 -0
index def389a0e9e..9cca6a835d0 100644
@@ -9,6 +9,8 @@
 #include "qemu/osdep.h"
 #include "libqtest.h"
 #include "libqtest-single.h"
+#include "hw/hexagon/hexagon.h"
+#include "hw/hexagon/machine_cfg_sm8975_nsp.h.inc"
 
 #define QCOM_DSP_UART_BASE 0x37000000
 #define QCOM_DSP_VIRTIO_BASE 0x37010000
@@ -27,6 +29,7 @@ static const char *const qcom_dsp_machines[] = {
     "sa8775p-cdsp",
     "sc8480xp-nsp0",
     "sa8797p-nsp0",
+    "sm8975-nsp",
 };
 
 static void test_console(const void *machine)
@@ -76,6 +79,18 @@ static void test_default_drive(const void *machine)
     qtest_end();
 }
 
+static void test_tcm(const void *unused)
+{
+    uint64_t base = (uint64_t)sm8975_nsp.cfgtable.l2tcm_base << 16;
+
+    qtest_start("-machine sm8975-nsp");
+    writel(base, 0xdeadbeef);
+    writel(base + sm8975_nsp.l2tcm_size - 4, 0xcafef00d);
+    g_assert_cmphex(readl(base), ==, 0xdeadbeef);
+    g_assert_cmphex(readl(base + sm8975_nsp.l2tcm_size - 4), ==, 0xcafef00d);
+    qtest_end();
+}
+
 int main(int argc, char **argv)
 {
     g_test_init(&argc, &argv, NULL);
@@ -92,5 +107,7 @@ int main(int argc, char **argv)
         qtest_add_data_func(path, name, test_default_drive);
     }
 
+    qtest_add_data_func("/qcom-dsp/sm8975-nsp/tcm", NULL, test_tcm);
+
     return g_test_run();
 }
tests/qtest/qct-qtimer-test.c +2 -0
index 21870de5649..b4c1b9e37f4 100644
@@ -13,6 +13,7 @@
 #include "hw/hexagon/machine_cfg_v68n_1024.h.inc"
 #include "hw/hexagon/machine_cfg_v66g_1024.h.inc"
 #include "hw/hexagon/machine_cfg_qcs6490_cdsp.h.inc"
+#include "hw/hexagon/machine_cfg_sm8975_nsp.h.inc"
 #include "hw/hexagon/machine_cfg_sa8797p_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sc8480xp_nsp0.h.inc"
 #include "hw/hexagon/machine_cfg_sa8775_cdsp0.h.inc"
@@ -350,6 +351,7 @@ static const QtimerMachineCfg qtimer_machines[] = {
     { "sa8775p-cdsp", &SA8775P_cdsp0 },
     { "sc8480xp-nsp0", &sc8480xp_nsp0 },
     { "sa8797p-nsp0", &sa8797p_nsp0 },
+    { "sm8975-nsp", &sm8975_nsp },
 };
 
 static void test_qtimer_on_machine(gconstpointer data)
hw/hexagon/Kconfig +6 -0
index bcf368cb8b7..177d87f7f94 100644
@@ -54,3 +54,9 @@ config HEX_SA8797P_NSP0
     default y
     depends on HEX_DSP && FDT
     select HEX_QCOM_DSP
+
+config HEX_SM8975_NSP
+    bool
+    default y
+    depends on HEX_DSP && FDT
+    select HEX_QCOM_DSP
hw/hexagon/meson.build +1 -0
index 5a10ae694fe..fa5bc5eb9f1 100644
@@ -11,5 +11,6 @@ hexagon_ss.add(when: 'CONFIG_HEX_QCS6490_CDSP', if_true: files('qcs6490_cdsp.c')
 hexagon_ss.add(when: 'CONFIG_HEX_SA8775P_CDSP', if_true: files('sa8775p_cdsp.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_SC8480XP_NSP0', if_true: files('sc8480xp_nsp0.c'))
 hexagon_ss.add(when: 'CONFIG_HEX_SA8797P_NSP0', if_true: files('sa8797p_nsp0.c'))
+hexagon_ss.add(when: 'CONFIG_HEX_SM8975_NSP', if_true: files('sm8975_nsp.c'))
 
 hw_arch += {'hexagon': hexagon_ss}
Signature · 1 line
2.34.1
author
#13 lore raw

PATCH v2 12/15 hw/hexagon: add v79NA1 machine

In reply to Brian Cain

Add the Hexagon V79NA_1 simulator machine, with the config table of the v79 core and eight CPUs by default.

---
 include/hw/hexagon/hexagon.h         |  1 +
 hw/hexagon/machine_cfg_v79na_1.h.inc | 34 ++++++++++++++++++++++++++++
 hw/hexagon/hexagon_dsp.c             | 22 ++++++++++++++++++
 3 files changed, 57 insertions(+)
 create mode 100644 hw/hexagon/machine_cfg_v79na_1.h.inc
include/hw/hexagon/hexagon.h +1 -0
index 26b0a1b3757..7d15a9e1eb0 100644
@@ -28,6 +28,7 @@ typedef enum {
     v71_rev = 0x8c71,
     v73_rev = 0x8c73,
     v73m_rev = 0xcc73,
+    v79_rev = 0x8c79,
     v81_rev = 0x8781,
     v81_sc8480xp_rev = 0x8081,
     v81dgb_1_rev = 0xcc81,
hw/hexagon/machine_cfg_v79na_1.h.inc new file +34 -0
new file mode 100644
index 00000000000..70a7ae58bc5
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+static const struct hexagon_machine_config v79na_1 = {
+    .cfgbase =             0xd8180000,
+    .l2tcm_size =          0x00000000,
+    .l2vic_base =          0xfc910000,
+    .l2vic_size =          0x00001000,
+    .csr_base =            0xfc900000,
+    .qtmr_region =         0xfc921000,
+    .cfgtable = {
+        .l2tcm_base = 0x0000d800, .subsystem_base = 0x00002000,
+        .etm_base = 0x0000d819, .l2cfg_base = 0x0000d81a,
+        .l1s0_base = 0x0000d900, .axi2_lowaddr = 0x00003000,
+        .fastl2vic_base = 0x0000d81e, .jtlb_size_entries = 0x00000080,
+        .coproc_present = 0x0000000d, .ext_contexts = 0x00000006,
+        .vtcm_base = 0x0000d900, .vtcm_size_kb = 0x00002000,
+        .l2tag_size = 0x00000400, .l2ecomem_size = 0x00000400,
+        .thread_enable_mask = 0x000000ff, .l2line_size = 0x00000080,
+        .l2itcm_base = 0x0000d800, .dma_version = 0x00000006,
+        .hvx_vec_log_length = 0x00000007, .coproc2_reg0 = 0x00000040,
+        .coproc2_reg1 = 0x00000020, .v2x_mode = 0x00000001,
+        .coproc2_reg2 = 0x00000010, .coproc2_reg3 = 0x00000020,
+        .coproc2_reg4 = 0x00000020, .coproc2_reg5 = 0x00000008,
+        .coproc2_reg6 = 0x00000016, .coproc2_reg7 = 0x00000008,
+        .acd_preset = 0x00000001, .mnd_preset = 0x00000001,
+        .l1d_size_kb = 0x00000020, .l1i_size_kb = 0x00000020,
+        .l1d_write_policy = 0x00000002, .vtcm_bank_width = 0x00000080,
+        .reserved4 = 0x00000001, .coproc2_cvt_mpy_size = 0x0000000a,
+        .consistency_domain = 0x000000e0, .capacity_domain = 0x00000080,
+        .axi3_lowaddr = 0x00004000, .coproc2_int8_subcolumns = 0x00000002,
+        .corecfg_present = 0x0000000d, .coproc2_fp16_acc_exp = 0x00000007,
+        .AXIM2_secondary_base = 0x00004000, .AXIM_data_width = 0x00000100,
+    },
+};
hw/hexagon/hexagon_dsp.c +22 -0
index 8824fe10a59..9f6f34ef9be 100644
@@ -30,6 +30,7 @@
 
 #include "machine_cfg_v66g_1024.h.inc"
 #include "machine_cfg_v68n_1024.h.inc"
+#include "machine_cfg_v79na_1.h.inc"
 #include "machine_cfg_v81dgb_1.h.inc"
 #include "machine_cfg_v81qa_1.h.inc"
 
@@ -205,6 +206,22 @@ static void v81dgb_1_config_init(MachineState *machine)
     hexagon_common_init(machine, v81dgb_1_rev, &v81dgb_1);
 }
 
+static void v79na_1_config_init(MachineState *machine)
+{
+    hexagon_common_init(machine, v79_rev, &v79na_1);
+}
+
+static void v79na_1_init(ObjectClass *oc, const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->desc = "Hexagon V79NA_1";
+    mc->init = v79na_1_config_init;
+    init_mc(mc);
+    mc->default_cpu_type = TYPE_HEXAGON_CPU_V79;
+    mc->default_cpus = 8;
+}
+
 static void v81dgb_1_init(ObjectClass *oc, const void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
@@ -258,6 +275,11 @@ static const TypeInfo hexagon_machine_types[] = {
         .parent = TYPE_HEXAGON_DSP_MACHINE,
         .class_init = v68n_1024_init,
     },
+    {
+        .name = MACHINE_TYPE_NAME("V79NA_1"),
+        .parent = TYPE_HEXAGON_DSP_MACHINE,
+        .class_init = v79na_1_init,
+    },
     {
         .name = MACHINE_TYPE_NAME("V81DGB_1"),
         .parent = TYPE_HEXAGON_DSP_MACHINE,
Signature · 1 line
2.34.1
author
#14 lore raw

PATCH v2 13/15 hw/hexagon: add subsystem-base property

In reply to Brian Cain

Let the hexagon-sim-style machines their QDSP6 subsystem, and with it the l2vic and QTimer.

The config table's subsystem base is updated to align with the chosen address.

---
 MAINTAINERS                       |  1 +
 include/hw/hexagon/hexagon.h      |  4 ++
 hw/hexagon/hexagon_dsp.c          | 71 +++++++++++++++++++++++++++-
 tests/qtest/hexagon-config-test.c | 78 +++++++++++++++++++++++++++++++
 tests/qtest/meson.build           |  3 +-
 5 files changed, 155 insertions(+), 2 deletions(-)
 create mode 100644 tests/qtest/hexagon-config-test.c
MAINTAINERS +1 -0
index 9449e66d33b..8f327cf3371 100644
@@ -1386,6 +1386,7 @@ F: include/hw/misc/qcom-qdsp6ss-clk.h
 F: configs/devices/hexagon-softmmu/default.mak
 F: docs/system/hexagon/
 F: tests/functional/hexagon/
+F: tests/qtest/hexagon-config-test.c
 F: tests/qtest/qcom-dsp-test.c
 F: docs/devel/hexagon-sys.rst
 
include/hw/hexagon/hexagon.h +4 -0
index 7d15a9e1eb0..32acc2aa26b 100644
@@ -44,6 +44,10 @@ typedef enum {
 
 #define HEXAGON_CFGSPACE_ENTRIES (128)
 
+/* Offsets of q6ss cfg peripherals from the subsystem base. */
+#define HEXAGON_L2VIC_OFFSET  0x10000
+#define HEXAGON_QTIMER_OFFSET 0x21000
+
 union hexagon_config_table {
     struct {
         /* Base address of L2TCM space */
hw/hexagon/hexagon_dsp.c +70 -1

137 lines not on this page · raw message

tests/qtest/hexagon-config-test.c new file +78 -0

78 lines not on this page · raw message

tests/qtest/meson.build +2 -1
index 0bbca236659..1cbf8cd391a 100644
@@ -320,7 +320,8 @@ qtests_riscv64 = ['riscv-csr-test'] + \
    ['k230-ddr-test', 'k230-wdt-test', 'k230-gsdma-test', 'k230-decomp-gzip-test'] : []) + \
    ['milkv-duo-test']
 
-qtests_hexagon = ['boot-serial-test', 'l2vic-test', 'qcom-dsp-test',
+qtests_hexagon = ['boot-serial-test', 'hexagon-config-test', 'l2vic-test',
+                  'qcom-dsp-test',
                   'qct-qtimer-test']
 
 qos_test_ss = ss.source_set()
Signature · 1 line
2.34.1
Reviewed-by Anton Johansson on v2 13/15
#15 lore raw

Re: [PATCH v2 13/15] hw/hexagon: add subsystem-base property

Quoted 7 lines · Brian Cain

Let the hexagon-sim-style machines their QDSP6 subsystem, and with it the l2vic and QTimer.

The config table's subsystem base is updated to align with the chosen address.

Quoted 8 lines
---
 MAINTAINERS                       |  1 +
 include/hw/hexagon/hexagon.h      |  4 ++
 hw/hexagon/hexagon_dsp.c          | 71 +++++++++++++++++++++++++++-
 tests/qtest/hexagon-config-test.c | 78 +++++++++++++++++++++++++++++++
 tests/qtest/meson.build           |  3 +-
 5 files changed, 155 insertions(+), 2 deletions(-)
 create mode 100644 tests/qtest/hexagon-config-test.c
author
#16 lore raw

PATCH v2 14/15 target/hexagon: fix the allocframe framekey

In reply to Brian Cain

The frame that allocframe pushes is {LR, FP}, and what is scrambled is the LR word: FRAMEKEY is XOR'd into the upper 32 bits. The generated code for fFRAME_SCRAMBLE built the key from FRAMEKEY in both halves of a 64-bit value, so it scrambled FP as well. deallocframe and dealloc_return only undo the upper word, so a FP restored from a frame pushed with a non-zero FRAMEKEY was corrupt.

Uncovered by testing some boot images using QuRT.

---
 target/hexagon/idef-parser/parser-helpers.c |  2 +-
 tests/tcg/hexagon/framekey.c                | 67 +++++++++++++++++++++
 tests/tcg/hexagon/meson.build               |  1 +
 3 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/hexagon/framekey.c
target/hexagon/idef-parser/parser-helpers.c +1 -1
index 49cc11fddd8..14840d98737 100644
@@ -1989,7 +1989,7 @@ HexValue gen_rvalue_fscr(Context *c, YYLTYPE *locp, HexValue *value)
     *value = gen_rvalue_extend(c, locp, value);
     OUT(c, locp, "gen_read_reg(", &frame_key, ", HEX_REG_FRAMEKEY);\n");
     OUT(c, locp, "tcg_gen_concat_i32_i64(",
-        &key, ", ", &frame_key, ", ", &frame_key, ");\n");
+        &key, ", tcg_constant_tl(0), ", &frame_key, ");\n");
     OUT(c, locp, "tcg_gen_xor_i64(", &res, ", ", value, ", ", &key, ");\n");
     return res;
 }
tests/tcg/hexagon/framekey.c new file +67 -0

67 lines not on this page · raw message

tests/tcg/hexagon/meson.build +1 -0
index a6ace4c77c2..0fd62ce7e4c 100644
@@ -68,6 +68,7 @@ tests += {
   'overflow.c': {'cflags': cflags, 'exe_name': 'hex-overflow'},
   'preg_alias.c': {'cflags': cflags},
   'dual_stores.c': {'cflags': cflags},
+  'framekey.c': {'cflags': cflags},
   'multi_result.c': {'cflags': cflags},
   'mem_noshuf.c': {'cflags': cflags},
   'mem_noshuf_exception.c': {'cflags': cflags},
Signature · 1 line
2.34.1
author
#17 lore raw

PATCH v2 15/15 tests/functional/hexagon: boot DSP firmware

In reply to Brian Cain

Download the firmware and run it on the corresponding DSP machine.

The images are third-party binaries, so the tests run only when untrusted code is allowed.

---
 tests/functional/hexagon/meson.build          |  2 +
 .../hexagon/test_qcom_dsp_firmware.py         | 92 +++++++++++++++++++
 2 files changed, 94 insertions(+)
 create mode 100755 tests/functional/hexagon/test_qcom_dsp_firmware.py
tests/functional/hexagon/meson.build +2 -0
index e182bc98a06..0fd90e491a2 100644
@@ -2,10 +2,12 @@
 
 tests_hexagon_system_thorough = [
   'arch_tests',
+  'qcom_dsp_firmware',
   'systests',
   'minivm',
 ]
 
 test_hexagon_timeouts = {
+  'qcom_dsp_firmware': 240,
   'systests': 180,
 }
tests/functional/hexagon/test_qcom_dsp_firmware.py new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v2 15/15
#18 lore raw

Re: [PATCH v2 15/15] tests/functional/hexagon: boot DSP firmware

Quoted 5 lines · Brian Cain

Download the firmware and run it on the corresponding DSP machine.

The images are third-party binaries, so the tests run only when untrusted code is allowed.

Quoted 7 lines
---
  tests/functional/hexagon/meson.build          |  2 +
  .../hexagon/test_qcom_dsp_firmware.py         | 92 +++++++++++++++++++
  2 files changed, 94 insertions(+)

create mode 100755 tests/functional/hexagon/test_qcom_dsp_firmware.py