26 Aug, 2019

1 commit

  • The Thunderbolt controller is integrated into the Ice Lake CPU itself
    and requires special flows to power it on and off using force power bit
    in NHI VSEC registers. Runtime PM (RTD3) and Sx flows also differ from
    the discrete solutions. Now the firmware notifies the driver whether
    RTD3 entry or exit are possible. The driver is responsible of sending
    Go2Sx command through link controller mailbox when system enters Sx
    states (suspend-to-mem/disk). Rest of the ICM firwmare flows follow
    Titan Ridge.

    Signed-off-by: Raanan Avargil
    Signed-off-by: Mika Westerberg
    Reviewed-by: Yehezkel Bernat
    Tested-by: Mario Limonciello

    Mika Westerberg
     

21 May, 2019

1 commit


18 Apr, 2019

2 commits


03 Oct, 2017

2 commits

  • When two hosts are connected over a Thunderbolt cable, there is a
    protocol they can use to communicate capabilities supported by the host.
    The discovery protocol uses automatically configured control channel
    (ring 0) and is build on top of request/response transactions using
    special XDomain primitives provided by the Thunderbolt base protocol.

    The capabilities consists of a root directory block of basic properties
    used for identification of the host, and then there can be zero or more
    directories each describing a Thunderbolt service and its capabilities.

    Once both sides have discovered what is supported the two hosts can
    setup high-speed DMA paths and transfer data to the other side using
    whatever protocol was agreed based on the properties. The software
    protocol used to communicate which DMA paths to enable is service
    specific.

    This patch adds support for the XDomain discovery protocol to the
    Thunderbolt bus. We model each remote host connection as a Linux XDomain
    device. For each Thunderbolt service found supported on the XDomain
    device, we create Linux Thunderbolt service device which Thunderbolt
    service drivers can then bind to based on the protocol identification
    information retrieved from the property directory describing the
    service.

    This code is based on the work done by Amir Levy and Michael Jamet.

    Signed-off-by: Michael Jamet
    Signed-off-by: Mika Westerberg
    Reviewed-by: Yehezkel Bernat
    Reviewed-by: Andy Shevchenko
    Signed-off-by: David S. Miller

    Mika Westerberg
     
  • Thunderbolt XDomain discovery protocol uses directories which contain
    properties and other directories to exchange information about what
    capabilities the remote host supports. This also includes identification
    information like device ID and name.

    This adds support for parsing and formatting these properties and
    establishes an API drivers can use in addition to the core Thunderbolt
    driver. This API is exposed in a new header: include/linux/thunderbolt.h.

    This code is based on the work done by Amir Levy and Michael Jamet.

    Signed-off-by: Michael Jamet
    Signed-off-by: Mika Westerberg
    Reviewed-by: Yehezkel Bernat
    Reviewed-by: Andy Shevchenko
    Signed-off-by: David S. Miller

    Mika Westerberg
     

09 Jun, 2017

3 commits

  • Starting from Intel Falcon Ridge the internal connection manager running
    on the Thunderbolt host controller has been supporting 4 security
    levels. One reason for this is to prevent DMA attacks and only allow
    connecting devices the user trusts.

    The internal connection manager (ICM) is the preferred way of connecting
    Thunderbolt devices over software only implementation typically used on
    Macs. The driver communicates with ICM using special Thunderbolt ring 0
    (control channel) messages. In order to handle these messages we add
    support for the ICM messages to the control channel.

    The security levels are as follows:

    none - No security, all tunnels are created automatically
    user - User needs to approve the device before tunnels are created
    secure - User need to approve the device before tunnels are created.
    The device is sent a challenge on future connects to be able
    to verify it is actually the approved device.
    dponly - Only Display Port and USB tunnels can be created and those
    are created automatically.

    The security levels are typically configurable from the system BIOS and
    by default it is set to "user" on many systems.

    In this patch each Thunderbolt device will have either one or two new
    sysfs attributes: authorized and key. The latter appears for devices
    that support secure connect.

    In order to identify the device the user can read identication
    information, including UUID and name of the device from sysfs and based
    on that make a decision to authorize the device. The device is
    authorized by simply writing 1 to the "authorized" sysfs attribute. This
    is following the USB bus device authorization mechanism. The secure
    connect requires an additional challenge step (writing 2 to the
    "authorized" attribute) in future connects when the key has already been
    stored to the NVM of the device.

    Non-ICM systems (before Alpine Ridge) continue to use the existing
    functionality and the security level is set to none. For systems with
    Alpine Ridge, even on Apple hardware, we will use ICM.

    This code is based on the work done by Amir Levy and Michael Jamet.

    Signed-off-by: Michael Jamet
    Signed-off-by: Mika Westerberg
    Reviewed-by: Yehezkel Bernat
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     
  • The DMA (NHI) port of a switch provides access to the NVM of the host
    controller (and devices starting from Intel Alpine Ridge). The NVM
    contains also more complete DROM for the root switch including vendor
    and device identification strings.

    This will look for the DMA port capability for each switch and if found
    populates sw->dma_port. We then teach tb_drom_read() to read the DROM
    information from NVM if available for the root switch.

    The DMA port capability also supports upgrading the NVM for both host
    controller and devices which will be added in subsequent patches.

    This code is based on the work done by Amir Levy and Michael Jamet.

    Signed-off-by: Michael Jamet
    Signed-off-by: Mika Westerberg
    Reviewed-by: Yehezkel Bernat
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     
  • Thunderbolt fabric consists of one or more switches. This fabric is
    called domain and it is controlled by an entity called connection
    manager. The connection manager can be either internal (driven by a
    firmware running on the host controller) or external (software driver).
    This driver currently implements support for the latter.

    In order to manage switches and their properties more easily we model
    this domain structure as a Linux bus. Each host controller adds a domain
    device to this bus, and these devices are named as domainN where N
    stands for index or id of the current domain.

    We then abstract connection manager specific operations into a new
    structure tb_cm_ops and convert the existing tb.c to fill those
    accordingly. This makes it easier to add support for the internal
    connection manager in subsequent patches.

    Signed-off-by: Mika Westerberg
    Reviewed-by: Yehezkel Bernat
    Reviewed-by: Michael Jamet
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Mika Westerberg
     

20 Jun, 2014

8 commits

  • Add eeprom access code and read the uid during switch initialization.
    The UID will be used to check device identity after suspend.

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever
     
  • A pci downstream and pci upstream port can be connected through a
    tunnel. To establish the tunnel we have to setup two unidirectional
    paths between the two ports.

    Right now we only support paths with two hops (i.e. no chaining) and at
    most one pci device per thunderbolt device.

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever
     
  • A thunderbolt path is a unidirectional channel between two thunderbolt
    ports. Two such paths are needed to establish a pci tunnel.

    This patch introduces struct tb_path as well as a set of tb_path_*
    methods which are used to activate & deactivate paths.

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever
     
  • Thunderbolt config areas contain capability lists similar to those found
    on pci devices. This patch introduces a tb_find_cap utility method to
    search for capabilities.

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever
     
  • This patch adds the structures tb_switch and tb_port as well as code to
    initialize the root switch.

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever
     
  • Add struct tb which will contain our view of the thunderbolt bus. For
    now it just contains a pointer to the control channel and a workqueue
    for hotplug events.

    Add thunderbolt_alloc_and_start() and thunderbolt_shutdown_and_free()
    which are responsible for setup and teardown of struct tb.

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever
     
  • Thunderbolt devices are configured by reading/writing into their
    configuration space (similar to pci). This is done by sending packets
    through the NHI (native host interface) onto the control channel.

    This patch handles the low level packet based protocol and exposes
    higher level operations like tb_cfg_read/tb_cfg_write.

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever
     
  • Thunderbolt hotplug is supposed to be handled by the firmware. But Apple
    decided to implement thunderbolt at the operating system level. The
    firmare only initializes thunderbolt devices that are present at boot
    time. This driver enables hotplug of thunderbolt of non-chained
    thunderbolt devices on Apple systems with a cactus ridge controller.

    This first patch adds the Kconfig file as well the parts of the driver
    which talk directly to the hardware (that is pci device setup, interrupt
    handling and RX/TX ring management).

    Signed-off-by: Andreas Noever
    Signed-off-by: Greg Kroah-Hartman

    Andreas Noever