cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

hte.rst (3070B)


      1.. SPDX-License-Identifier: GPL-2.0+
      2
      3============================================
      4The Linux Hardware Timestamping Engine (HTE)
      5============================================
      6
      7:Author: Dipen Patel
      8
      9Introduction
     10------------
     11
     12Certain devices have built in hardware timestamping engines which can
     13monitor sets of system signals, lines, buses etc... in realtime for state
     14change; upon detecting the change they can automatically store the timestamp at
     15the moment of occurrence. Such functionality may help achieve better accuracy
     16in obtaining timestamps than using software counterparts i.e. ktime and
     17friends.
     18
     19This document describes the API that can be used by hardware timestamping
     20engine provider and consumer drivers that want to use the hardware timestamping
     21engine (HTE) framework. Both consumers and providers must include
     22``#include <linux/hte.h>``.
     23
     24The HTE framework APIs for the providers
     25----------------------------------------
     26
     27.. kernel-doc:: drivers/hte/hte.c
     28   :functions: devm_hte_register_chip hte_push_ts_ns
     29
     30The HTE framework APIs for the consumers
     31----------------------------------------
     32
     33.. kernel-doc:: drivers/hte/hte.c
     34   :functions: hte_init_line_attr hte_ts_get hte_ts_put devm_hte_request_ts_ns hte_request_ts_ns hte_enable_ts hte_disable_ts of_hte_req_count hte_get_clk_src_info
     35
     36The HTE framework public structures
     37-----------------------------------
     38.. kernel-doc:: include/linux/hte.h
     39
     40More on the HTE timestamp data
     41------------------------------
     42The ``struct hte_ts_data`` is used to pass timestamp details between the
     43consumers and the providers. It expresses timestamp data in nanoseconds in
     44u64. An example of the typical timestamp data life cycle, for the GPIO line is
     45as follows::
     46
     47 - Monitors GPIO line change.
     48 - Detects the state change on GPIO line.
     49 - Converts timestamps in nanoseconds.
     50 - Stores GPIO raw level in raw_level variable if the provider has that
     51 hardware capability.
     52 - Pushes this hte_ts_data object to HTE subsystem.
     53 - HTE subsystem increments seq counter and invokes consumer provided callback.
     54 Based on callback return value, the HTE core invokes secondary callback in
     55 the thread context.
     56
     57HTE subsystem debugfs attributes
     58--------------------------------
     59HTE subsystem creates debugfs attributes at ``/sys/kernel/debug/hte/``.
     60It also creates line/signal-related debugfs attributes at
     61``/sys/kernel/debug/hte/<provider>/<label or line id>/``. Note that these
     62attributes are read-only.
     63
     64`ts_requested`
     65		The total number of entities requested from the given provider,
     66		where entity is specified by the provider and could represent
     67		lines, GPIO, chip signals, buses etc...
     68                The attribute will be available at
     69		``/sys/kernel/debug/hte/<provider>/``.
     70
     71`total_ts`
     72		The total number of entities supported by the provider.
     73                The attribute will be available at
     74		``/sys/kernel/debug/hte/<provider>/``.
     75
     76`dropped_timestamps`
     77		The dropped timestamps for a given line.
     78                The attribute will be available at
     79		``/sys/kernel/debug/hte/<provider>/<label or line id>/``.