TT-System-Firmware APIs 19.15.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
tt_d2d.h File Reference

Tenstorrent Grendel die-to-die (D2D) firmware loading APIs. More...

#include <stddef.h>
#include <stdint.h>
#include <zephyr/device.h>
Include dependency graph for tt_d2d.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int tt_d2d_reset_release (const struct device *dev)
 Deassert a D2D tile's subsystem resets.
int tt_d2d_load_fw (const struct device *dev, const uint8_t *img, size_t img_size)
 Load firmware into a D2D tile, leaving it halted.
int tt_d2d_start (const struct device *dev)
 Release a D2D tile's Rocket so loaded firmware begins executing.

Detailed Description

Tenstorrent Grendel die-to-die (D2D) firmware loading APIs.

Bringing a D2D link up takes three steps, kept separate because each has to be sequenced against work this driver does not own:

  1. tt_d2d_reset_release() - deassert the tile's subsystem resets. Must happen before the CCE clock switches to the PLL, because the D2D logic samples its straps at the clock rate in effect at the time.
  2. tt_d2d_load_fw() - put firmware in the Rocket's SRAM and fill in its configuration block. Leaves the Rocket in reset.
  3. tt_d2d_start() - release the Rocket so the firmware runs.

Step 3 is deliberately not folded into step 2. Both ends of a link must be started close together, and with sideband synchronisation disabled (as it is under emulation) there is nothing in hardware to make that happen: starting each Rocket as soon as its own image landed has been observed to leave Keraunos and the far Mimir unable to train. The caller is expected to load every tile first and start them as a group.

Two things have to be true before any of this works, and neither is done here because neither belongs to a single tile:

  • the SMC cold resets covering the tile and its interconnect must be lifted, and
  • the SMC inbound/outbound filters must permit the tile's address range.

Until both hold, the tile does not answer at all and tt_d2d_load_fw() will fail its reachability probe with -ENODEV rather than appearing to succeed.

Function Documentation

◆ tt_d2d_load_fw()

int tt_d2d_load_fw ( const struct device * dev,
const uint8_t * img,
size_t img_size )

Load firmware into a D2D tile, leaving it halted.

Holds the tile's Rocket in reset, clears its SRAM, copies img in, optionally reads it back to confirm it landed, and writes the configuration block the firmware reads at startup. Call tt_d2d_start() to run it.

Parameters
devD2D tile device
imgFirmware image
img_sizeSize of img in bytes. Must be a multiple of 4 and must leave the configuration block at the top of SRAM untouched.
Return values
0on success
-EINVALif img is NULL, empty, or not a multiple of 4 bytes
-ENOSPCif img would overrun the configuration block
-ENODEVif the tile does not answer a write to its SRAM
-EIOif the image read back from SRAM does not match img

◆ tt_d2d_reset_release()

int tt_d2d_reset_release ( const struct device * dev)

Deassert a D2D tile's subsystem resets.

Brings the tile's NOC, APB, system, link-layer, AXI and QNP resets out one at a time, in the order the hardware requires. Until this runs the tile does not reliably answer accesses, so it must precede tt_d2d_load_fw().

Parameters
devD2D tile device
Return values
0on success

◆ tt_d2d_start()

int tt_d2d_start ( const struct device * dev)

Release a D2D tile's Rocket so loaded firmware begins executing.

Parameters
devD2D tile device
Return values
0on success