Skip to contentSkip to conversation

target/riscv: tt-ascalon: Add Tenstorrent mvendorid

PATCH Superseded Joel Stanley 3 participants 3 messages Jan 9 – Jan 12 RISC-V

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/riscv: tt-ascalon: Add Tenstorrent mvendorid

JEP106 has two vendor IDs for Tenstorrent. We will use Bank 16, hex 0xa1:

((16 - 1) << 7) | (0xa1 & ~0x80) = 0x7a1

Add it to the Ascalon CPU definition as the mvendorid CSR.

---
This stands alone from the atlantis series and can go in asap.

 target/riscv/cpu_vendorid.h | 2 ++
 target/riscv/cpu.c          | 2 ++
 2 files changed, 4 insertions(+)
target/riscv/cpu_vendorid.h +2 -0
index f1ffc66542a0..751a13aace47 100644
@@ -8,4 +8,6 @@
 #define VEYRON_V1_MIMPID        0x111
 #define VEYRON_V1_MVENDORID     0x61f
 
+#define TENSTORRENT_VENDOR_ID   0x7a1
+
 #endif /*  TARGET_RISCV_CPU_VENDORID_H */
target/riscv/cpu.c +2 -0
index efdec49e49ed..85ce4d83a371 100644
@@ -3190,6 +3190,8 @@ static const TypeInfo riscv_cpu_type_infos[] = {
         .cfg.ext_svnapot = true,
         .cfg.ext_svpbmt = true,
 
+        .cfg.mvendorid = TENSTORRENT_VENDOR_ID,
+
         .cfg.max_satp_mode = VM_1_10_SV57,
     ),
 
Signature · 1 line
2.47.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Joel Stanley

JEP106 has two vendor IDs for Tenstorrent. We will use Bank 16, hex 0xa1:

((16 - 1) << 7) | (0xa1 & ~0x80) = 0x7a1

Add it to the Ascalon CPU definition as the mvendorid CSR.

---

Quoted 30 lines

This stands alone from the atlantis series and can go in asap.

  target/riscv/cpu_vendorid.h | 2 ++
  target/riscv/cpu.c          | 2 ++
  2 files changed, 4 insertions(+)
target/riscv/cpu_vendorid.h +2 -0
index f1ffc66542a0..751a13aace47 100644
@@ -8,4 +8,6 @@
  #define VEYRON_V1_MIMPID        0x111
  #define VEYRON_V1_MVENDORID     0x61f
 
+#define TENSTORRENT_VENDOR_ID   0x7a1
+
  #endif /*  TARGET_RISCV_CPU_VENDORID_H */
target/riscv/cpu.c +2 -0
index efdec49e49ed..85ce4d83a371 100644
@@ -3190,6 +3190,8 @@ static const TypeInfo riscv_cpu_type_infos[] = {
          .cfg.ext_svnapot = true,
          .cfg.ext_svpbmt = true,
 
+        .cfg.mvendorid = TENSTORRENT_VENDOR_ID,
+
          .cfg.max_satp_mode = VM_1_10_SV57,
      ),
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Joel Stanley
Quoted 4 lines · Joel Stanley

JEP106 has two vendor IDs for Tenstorrent. We will use Bank 16, hex 0xa1:

((16 - 1) << 7) | (0xa1 & ~0x80) = 0x7a1

The value LGTM, it matches JEP106BM, and matches the Tenstorrent documentation I have.

I would probably say that it's company 33. Which is 0xa1 with the parity bit added, but the parity bit isn't used in the calculation, ie:

((16 - 1) << 7) | 33 = 0x7a1

Mentioning that it's company 33 (0x21) would make it a little easier to match it up with other public sources, eg openocd:

https://github.com/openocd-org/openocd/blob/1ebff3ab33c77e3f8fb4e1ddda262b606b572af1/src/helper/jep106.inc#L1935

Quoted 3 lines

Add it to the Ascalon CPU definition as the mvendorid CSR.

cheers

Quoted 27 lines
target/riscv/cpu_vendorid.h +2 -0
index f1ffc66542a0..751a13aace47 100644
@@ -8,4 +8,6 @@
 #define VEYRON_V1_MIMPID        0x111
 #define VEYRON_V1_MVENDORID     0x61f
 
+#define TENSTORRENT_VENDOR_ID   0x7a1
+
 #endif /*  TARGET_RISCV_CPU_VENDORID_H */
target/riscv/cpu.c +2 -1
index efdec49e49ed..85ce4d83a371 100644
@@ -3190,6 +3190,8 @@ static const TypeInfo riscv_cpu_type_infos[] = {
         .cfg.ext_svnapot = true,
         .cfg.ext_svpbmt = true,
 
+        .cfg.mvendorid = TENSTORRENT_VENDOR_ID,
+
         .cfg.max_satp_mode = VM_1_10_SV57,
     ),
 
--

2.47.3