GithubHelp home page GithubHelp logo

jamestiotio / thunderbolt-utils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jannau/thunderbolt-utils

0.0 0.0 0.0 653 KB

Thunderbolt/USB4 Linux user-space utilities

C 99.70% Makefile 0.30%

thunderbolt-utils's Introduction

thunderbolt-utils

Thunderbolt/USB4 utilities

This software is a collection of various user-space functionalities for the thunderbolt/USB4 subsystem, along with a library (lstbt) to query the TBT/USB4 devices present in the system.

Utilities included:

  1. lstbt
  2. Framework abstractions to provide the user wrappers to configure the TBT/USB4 subsystem via porting the DMA layer from kernel-space to user-space, paving way for independent software around it.

Building and installing lstbt

lstbt is present in the ./lib subdirectory of the software.

Steps:

  1. cd ./lib
  2. make

Uninstalling lstbt and cleaning up the build

Steps:

  1. cd ./lib
  2. make clean

Note: The library installs itself in the /usr/bin filesystem path, hence pertinent permissions are required for the user to alter it.

TBT/USB4 user-space functionalities

This software serves as the first prefatory abstraction of various functionalities of the TBT/USB4 subsystem a user can utilize to perform a myriad of operations pertinent to the config. space access of the routers and setting up paths to facilitate DMA transactions.

Thunderbolt/USB4 host routers (with PCIe host interface layer) inherently have host interface registers, which are made accessible to the host via the PCI BARs.
These registers incorporate various functionalities including, but not limited to:

  1. Control (reset/CLx)
  2. TX ring 0
    • Base address (IO virtual address for IOMMU mapping)
    • Ring size/control
    • Producer/consumer indexes
  3. RX ring 0
    • Base address (IO virtual address for IOMMU mapping)
    • Ring size/control
    • Producer/consumer indexes
  4. Interrupts

The host essentially needs to communicate with these registers to access the config. space and incorporate the framework needed to facilitate DMA transactions.

Control path of the thunderbolt/USB4 subsystem is routed with the hop ID of 0, which the transport layer prepends in the control packet received.
The descriptors which house such control packets reside in TX ring-0 and RX ring-0, which the software uses.

To provide user better controllability of the TBT/USB4 subsystem, the DMA needs to be ported from kernel-space to the user-space, which would then conspicuously provide the user with all the operations needed to regulate the subsystem (in an IOMMU-protected environment).

This software incorporates the DMA porting with the help of VFIO.
For more details on VFIO, refer to the kernel documentation:
https://docs.kernel.org/driver-api/vfio.html

In its rudimentary form, the software incorporates a VFIO-driven way to faciliate the DMA transmission. Please refer 'example.c' to understand more on how its been done.

Ameliorations are being made consistently for the software to abstract all the functionalities needed for the user to drive the subsystem including interrupts, router notifications, and possibly the inter-domain packets sometime later.

thunderbolt-utils's People

Contributors

rajatkha avatar rdower avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.