TT-System-Firmware APIs 19.15.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
dvfs.c File Reference
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/util.h>
#include <zephyr/drivers/misc/bh_fwtable.h>
#include <tenstorrent/msgqueue.h>
#include <tenstorrent/sys_init_defines.h>
#include "vf_curve.h"
#include "throttler.h"
#include "aiclk_ppm.h"
#include "voltage.h"
#include "init.h"
#include "reg.h"
#include "status_reg.h"
Include dependency graph for dvfs.c:

Macros

#define DVFS_MSEC   1
#define DVFS_TICKS   (CONFIG_SYS_CLOCK_TICKS_PER_SEC * DVFS_MSEC / MSEC_PER_SEC)
#define DVFS_ADJUSTMENT_THRESHOLD   (DVFS_TICKS * 10 / 100) /* 10% of DVFS interval */
#define DVFS_ADJUSTMENT_STEP   (DVFS_TICKS * 1 / 100) /* 1% of DVFS interval */

Functions

 LOG_MODULE_REGISTER (dvfs, CONFIG_TT_APP_LOG_LEVEL)
static void atomic_max_u32 (atomic_t *target, uint32_t value)
void DVFSChange (void)
static void dvfs_work_handler (struct k_work *work)
static K_WORK_DEFINE (dvfs_worker, dvfs_work_handler)
static void dvfs_timer_handler (struct k_timer *timer)
static K_TIMER_DEFINE (dvfs_timer, dvfs_timer_handler, NULL)
static int InitDVFS (void)
 SYS_INIT_APP (InitDVFS)
int StartDVFSTimer (void)
 SYS_INIT_APP (StartDVFSTimer)
void AdjustDVFSTimer (void)
uint8_t dvfs_counter_handler (const union request *request, struct response *response)

Variables

static const struct device *const fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable))
bool dvfs_enabled
static atomic_t dvfs_dropped_ticks
static atomic_t dvfs_max_period_us
static atomic_t dvfs_max_pass_us
static atomic_t *const dvfs_counters [DVFS_COUNTER_COUNT]

Macro Definition Documentation

◆ DVFS_ADJUSTMENT_STEP

#define DVFS_ADJUSTMENT_STEP   (DVFS_TICKS * 1 / 100) /* 1% of DVFS interval */

◆ DVFS_ADJUSTMENT_THRESHOLD

#define DVFS_ADJUSTMENT_THRESHOLD   (DVFS_TICKS * 10 / 100) /* 10% of DVFS interval */

◆ DVFS_MSEC

#define DVFS_MSEC   1

◆ DVFS_TICKS

#define DVFS_TICKS   (CONFIG_SYS_CLOCK_TICKS_PER_SEC * DVFS_MSEC / MSEC_PER_SEC)

Function Documentation

◆ AdjustDVFSTimer()

void AdjustDVFSTimer ( void )

◆ atomic_max_u32()

void atomic_max_u32 ( atomic_t * target,
uint32_t value )
static

◆ dvfs_counter_handler()

uint8_t dvfs_counter_handler ( const union request * request,
struct response * response )

◆ dvfs_timer_handler()

void dvfs_timer_handler ( struct k_timer * timer)
static

◆ dvfs_work_handler()

void dvfs_work_handler ( struct k_work * work)
static

◆ DVFSChange()

void DVFSChange ( void )

◆ InitDVFS()

int InitDVFS ( void )
static

◆ K_TIMER_DEFINE()

K_TIMER_DEFINE ( dvfs_timer ,
dvfs_timer_handler ,
NULL  )
static

◆ K_WORK_DEFINE()

K_WORK_DEFINE ( dvfs_worker ,
dvfs_work_handler  )
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( dvfs ,
CONFIG_TT_APP_LOG_LEVEL  )

◆ StartDVFSTimer()

int StartDVFSTimer ( void )

◆ SYS_INIT_APP() [1/2]

SYS_INIT_APP ( InitDVFS )

◆ SYS_INIT_APP() [2/2]

SYS_INIT_APP ( StartDVFSTimer )

Variable Documentation

◆ dvfs_counters

atomic_t* const dvfs_counters[DVFS_COUNTER_COUNT]
static
Initial value:
= {
}
static atomic_t dvfs_max_period_us
Definition dvfs.c:38
static atomic_t dvfs_max_pass_us
Definition dvfs.c:39
static atomic_t dvfs_dropped_ticks
Definition dvfs.c:32
@ DVFS_COUNTER_MAX_PASS_US
Longest duration of a single DVFS pass, in microseconds.
Definition msgqueue.h:105
@ DVFS_COUNTER_DROPPED_TICKS
DVFS timer ticks that expired while the previous pass was still queued.
Definition msgqueue.h:91
@ DVFS_COUNTER_MAX_PERIOD_US
Longest gap between consecutive DVFS passes, in microseconds.
Definition msgqueue.h:98

◆ dvfs_dropped_ticks

atomic_t dvfs_dropped_ticks
static

◆ dvfs_enabled

bool dvfs_enabled

◆ dvfs_max_pass_us

atomic_t dvfs_max_pass_us
static

◆ dvfs_max_period_us

atomic_t dvfs_max_period_us
static

◆ fwtable_dev

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