TT-System-Firmware APIs 19.10.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
noc_init.c File Reference
#include "bh_reset.h"
#include "harvesting.h"
#include "noc_init.h"
#include "noc.h"
#include "noc2axi.h"
#include "reg.h"
#include "telemetry.h"
#include "gddr.h"
#include "tensix_state_msg.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tenstorrent/msgqueue.h>
#include <tenstorrent/smc_msg.h>
#include <tenstorrent/sys_init_defines.h>
#include <zephyr/drivers/misc/bh_fwtable.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>
#include <zephyr/zbus/zbus.h>
Include dependency graph for noc_init.c:

Data Structures

struct  NocTranslation

Macros

#define NIU_CFG_0   0x0
#define ROUTER_CFG(n)
#define NOC_X_ID_TRANSLATE_TABLE(n)
#define NOC_Y_ID_TRANSLATE_TABLE(n)
#define NOC_ID_LOGICAL   0x12
#define NOC_ID_TRANSLATE_COL_MASK   0x14
#define NOC_ID_TRANSLATE_ROW_MASK   0x15
#define DDR_COORD_TRANSLATE_TABLE(n)
#define NIU_CFG_0_TILE_CLK_OFF   12
#define NIU_CFG_0_TILE_HEADER_STORE_OFF   13 /* NOC2AXI only */
#define NIU_CFG_0_NOC_ID_TRANSLATE_EN   14
#define NIU_CFG_0_AXI_SLAVE_ENABLE   15
#define NOC_TRANSLATE_ID_WIDTH   5
#define NOC_TRANSLATE_TABLE_XY_SIZE   (32 / NOC_TRANSLATE_ID_WIDTH)
#define STREAM_PERF_CONFIG_REG_INDEX   35
#define CLOCK_GATING_EN   0
#define PRE_TRANSLATION_SIZE   32

Functions

static volatile void * SetupNiuTlbPhys (uint8_t tlb_index, uint8_t px, uint8_t py, uint8_t noc_id)
static volatile void * SetupNiuTlb (uint8_t tlb_index, uint8_t nx, uint8_t ny, uint8_t noc_id)
static uint32_t ReadNocCfgReg (volatile void *regs, uint32_t cfg_reg_index)
static void WriteNocCfgReg (volatile void *regs, uint32_t cfg_reg_index, uint32_t value)
static void EnableOverlayCg (uint8_t tlb_index, uint8_t px, uint8_t py)
static void ProgramBroadcastExclusion (uint16_t disabled_tensix_columns)
static bool GetTileClkDisable (uint8_t px, uint8_t py)
 ZBUS_CHAN_DEFINE (tensix_state_chan, struct tensix_state_msg, NULL, NULL, ZBUS_OBSERVERS_EMPTY,)
int32_t set_tensix_enable (bool enable)
void SetSingleTileClockGate (uint8_t phys_x, uint8_t phys_y, bool gate)
int NocInit (void)
 SYS_INIT_APP (NocInit)
void NocInitSingleTile (uint8_t noc0_x, uint8_t noc0_y)
static void SetLogicalCoord (struct NocTranslation *nt, uint8_t post_x, uint8_t post_y, uint8_t logical_x, uint8_t logical_y)
static void MakeIdentity (struct NocTranslation *nt)
static void CopyNoc0ToNoc1 (const struct NocTranslation *noc0, struct NocTranslation *noc1)
static void CopyBytesSkipIndices (uint8_t *out, const uint8_t *in, size_t count, uint32_t skip_mask)
static void ApplyLogicalCoords (struct NocTranslation *nt, uint8_t post_x_start, uint8_t post_y_start, uint8_t post_x_end, uint8_t post_y_end, uint8_t pre_x_start, uint8_t pre_y_start, uint8_t pre_x_end, uint8_t pre_y_end)
static void ProgramNocTranslation (void)
static struct NocTranslation ComputeNocTranslation (unsigned int pcie_instance, uint16_t bad_tensix_cols, uint8_t bad_gddr, uint16_t skip_eth)
void InitNocTranslation (unsigned int pcie_instance, uint16_t bad_tensix_cols, uint8_t bad_gddr, uint16_t skip_eth)
int InitNocTranslationFromHarvesting (void)
 SYS_INIT_APP (InitNocTranslationFromHarvesting)
void ProgramNocTranslationSingleTile (uint8_t noc0_x, uint8_t noc0_y)
void DisableArcNocTranslation (void)
void EnableArcNocTranslation (void)
void RestoreArcNocTranslation (void)
void ClearNocTranslation (void)
static uint8_t debug_noc_translation_handler (const union request *req, struct response *rsp)
 Handler for TT_SMC_MSG_DEBUG_NOC_TRANSLATION messages.
 REGISTER_MESSAGE (TT_SMC_MSG_DEBUG_NOC_TRANSLATION, debug_noc_translation_handler)
void GetEnabledTensix (uint8_t *x, uint8_t *y)
bool IsNocTranslationEnabled (void)
void NocLogicalToPhysical (uint8_t logical_x, uint8_t logical_y, uint8_t *phys_x, uint8_t *phys_y)

Variables

static const uint32_t kNoc0RegBase = 0x80050000
static const uint32_t kNoc1RegBase = 0x80058000
static const uint32_t kNiuCfg0Offset = 0x100 + 4 * 0x0
static const uint8_t kTlbIndex
static const uint32_t kFirstCfgRegIndex = 0x100 / sizeof(uint32_t)
static const struct device *const fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable))
static bool noc_translation_enabled
static struct NocTranslation translation [2]
static const uint8_t kTensixEthNoc0X [] = {1, 16, 2, 15, 3, 14, 4, 13, 5, 12, 6, 11, 7, 10}
static const uint8_t kL2CpuNoc0Y [] = {3, 9, 5, 7}
static const uint8_t kGddrY [][3] = {{0, 1, 11}, {2, 10, 3}, {9, 4, 8}, {5, 7, 6}}

Macro Definition Documentation

◆ CLOCK_GATING_EN

#define CLOCK_GATING_EN   0

◆ DDR_COORD_TRANSLATE_TABLE

#define DDR_COORD_TRANSLATE_TABLE ( n)
Value:
((n) + 0x16)

◆ NIU_CFG_0

#define NIU_CFG_0   0x0

◆ NIU_CFG_0_AXI_SLAVE_ENABLE

#define NIU_CFG_0_AXI_SLAVE_ENABLE   15

◆ NIU_CFG_0_NOC_ID_TRANSLATE_EN

#define NIU_CFG_0_NOC_ID_TRANSLATE_EN   14

◆ NIU_CFG_0_TILE_CLK_OFF

#define NIU_CFG_0_TILE_CLK_OFF   12

◆ NIU_CFG_0_TILE_HEADER_STORE_OFF

#define NIU_CFG_0_TILE_HEADER_STORE_OFF   13 /* NOC2AXI only */

◆ NOC_ID_LOGICAL

#define NOC_ID_LOGICAL   0x12

◆ NOC_ID_TRANSLATE_COL_MASK

#define NOC_ID_TRANSLATE_COL_MASK   0x14

◆ NOC_ID_TRANSLATE_ROW_MASK

#define NOC_ID_TRANSLATE_ROW_MASK   0x15

◆ NOC_TRANSLATE_ID_WIDTH

#define NOC_TRANSLATE_ID_WIDTH   5

◆ NOC_TRANSLATE_TABLE_XY_SIZE

#define NOC_TRANSLATE_TABLE_XY_SIZE   (32 / NOC_TRANSLATE_ID_WIDTH)

◆ NOC_X_ID_TRANSLATE_TABLE

#define NOC_X_ID_TRANSLATE_TABLE ( n)
Value:
((n) + 0x6)

◆ NOC_Y_ID_TRANSLATE_TABLE

#define NOC_Y_ID_TRANSLATE_TABLE ( n)
Value:
((n) + 0xC)

◆ PRE_TRANSLATION_SIZE

#define PRE_TRANSLATION_SIZE   32

◆ ROUTER_CFG

#define ROUTER_CFG ( n)
Value:
((n) + 1)

◆ STREAM_PERF_CONFIG_REG_INDEX

#define STREAM_PERF_CONFIG_REG_INDEX   35

Function Documentation

◆ ApplyLogicalCoords()

void ApplyLogicalCoords ( struct NocTranslation * nt,
uint8_t post_x_start,
uint8_t post_y_start,
uint8_t post_x_end,
uint8_t post_y_end,
uint8_t pre_x_start,
uint8_t pre_y_start,
uint8_t pre_x_end,
uint8_t pre_y_end )
static

◆ ClearNocTranslation()

void ClearNocTranslation ( void )

◆ ComputeNocTranslation()

struct NocTranslation ComputeNocTranslation ( unsigned int pcie_instance,
uint16_t bad_tensix_cols,
uint8_t bad_gddr,
uint16_t skip_eth )
static

◆ CopyBytesSkipIndices()

void CopyBytesSkipIndices ( uint8_t * out,
const uint8_t * in,
size_t count,
uint32_t skip_mask )
static

◆ CopyNoc0ToNoc1()

void CopyNoc0ToNoc1 ( const struct NocTranslation * noc0,
struct NocTranslation * noc1 )
static

◆ debug_noc_translation_handler()

uint8_t debug_noc_translation_handler ( const union request * req,
struct response * rsp )
static

Handler for TT_SMC_MSG_DEBUG_NOC_TRANSLATION messages.

Re-programs NOC (Network on Chip) coordinate translation for debug and testing purposes. NOC translation is used to route around defective tiles (e.g. Tensix columns, ETH tiles, GDDR tiles).

Parameters
reqPointer to the host request message. use request::debug_noc_translation for structured access
rspPointer to the response message to be sent back to host
Returns
0 on success
non-zero on error
See also
debug_noc_translation_rqst

◆ DisableArcNocTranslation()

void DisableArcNocTranslation ( void )

◆ EnableArcNocTranslation()

void EnableArcNocTranslation ( void )

◆ EnableOverlayCg()

void EnableOverlayCg ( uint8_t tlb_index,
uint8_t px,
uint8_t py )
static

◆ GetEnabledTensix()

void GetEnabledTensix ( uint8_t * x,
uint8_t * y )

◆ GetTileClkDisable()

bool GetTileClkDisable ( uint8_t px,
uint8_t py )
static

◆ InitNocTranslation()

void InitNocTranslation ( unsigned int pcie_instance,
uint16_t bad_tensix_cols,
uint8_t bad_gddr,
uint16_t skip_eth )

◆ InitNocTranslationFromHarvesting()

int InitNocTranslationFromHarvesting ( void )

◆ IsNocTranslationEnabled()

bool IsNocTranslationEnabled ( void )

◆ MakeIdentity()

void MakeIdentity ( struct NocTranslation * nt)
static

◆ NocInit()

int NocInit ( void )

◆ NocInitSingleTile()

void NocInitSingleTile ( uint8_t noc0_x,
uint8_t noc0_y )

◆ NocLogicalToPhysical()

void NocLogicalToPhysical ( uint8_t logical_x,
uint8_t logical_y,
uint8_t * phys_x,
uint8_t * phys_y )

◆ ProgramBroadcastExclusion()

void ProgramBroadcastExclusion ( uint16_t disabled_tensix_columns)
static

◆ ProgramNocTranslation()

void ProgramNocTranslation ( void )
static

◆ ProgramNocTranslationSingleTile()

void ProgramNocTranslationSingleTile ( uint8_t noc0_x,
uint8_t noc0_y )

◆ ReadNocCfgReg()

uint32_t ReadNocCfgReg ( volatile void * regs,
uint32_t cfg_reg_index )
static

◆ REGISTER_MESSAGE()

◆ RestoreArcNocTranslation()

void RestoreArcNocTranslation ( void )

◆ set_tensix_enable()

int32_t set_tensix_enable ( bool enable)

◆ SetLogicalCoord()

void SetLogicalCoord ( struct NocTranslation * nt,
uint8_t post_x,
uint8_t post_y,
uint8_t logical_x,
uint8_t logical_y )
static

◆ SetSingleTileClockGate()

void SetSingleTileClockGate ( uint8_t phys_x,
uint8_t phys_y,
bool gate )

◆ SetupNiuTlb()

volatile void * SetupNiuTlb ( uint8_t tlb_index,
uint8_t nx,
uint8_t ny,
uint8_t noc_id )
static

◆ SetupNiuTlbPhys()

volatile void * SetupNiuTlbPhys ( uint8_t tlb_index,
uint8_t px,
uint8_t py,
uint8_t noc_id )
static

◆ SYS_INIT_APP() [1/2]

◆ SYS_INIT_APP() [2/2]

SYS_INIT_APP ( NocInit )

◆ WriteNocCfgReg()

void WriteNocCfgReg ( volatile void * regs,
uint32_t cfg_reg_index,
uint32_t value )
static

◆ ZBUS_CHAN_DEFINE()

ZBUS_CHAN_DEFINE ( tensix_state_chan ,
struct tensix_state_msg ,
NULL ,
NULL ,
ZBUS_OBSERVERS_EMPTY  )

Variable Documentation

◆ fwtable_dev

const struct device* const fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable))
static

◆ kFirstCfgRegIndex

const uint32_t kFirstCfgRegIndex = 0x100 / sizeof(uint32_t)
static

◆ kGddrY

const uint8_t kGddrY[][3] = {{0, 1, 11}, {2, 10, 3}, {9, 4, 8}, {5, 7, 6}}
static

◆ kL2CpuNoc0Y

const uint8_t kL2CpuNoc0Y[] = {3, 9, 5, 7}
static

◆ kNiuCfg0Offset

const uint32_t kNiuCfg0Offset = 0x100 + 4 * 0x0
static

◆ kNoc0RegBase

const uint32_t kNoc0RegBase = 0x80050000
static

◆ kNoc1RegBase

const uint32_t kNoc1RegBase = 0x80058000
static

◆ kTensixEthNoc0X

const uint8_t kTensixEthNoc0X[] = {1, 16, 2, 15, 3, 14, 4, 13, 5, 12, 6, 11, 7, 10}
static

◆ kTlbIndex

const uint8_t kTlbIndex
static

◆ noc_translation_enabled

bool noc_translation_enabled
static

◆ translation

struct NocTranslation translation[2]
static