From 1fdca1a892054036c9661351d9740ce9e35eb2b3 Mon Sep 17 00:00:00 2001 From: Igor Rzegocki Date: Sat, 22 Jul 2023 16:29:46 +0200 Subject: [PATCH] feat: add thunderbolt/USB4 module Support for Thunderbolt/USB4 enables access to many new devices, including USB4 networking or Thunderbolt<=>RJ45 adapters. Closes #165 Signed-off-by: Igor Rzegocki Signed-off-by: Noel Georgi --- Makefile | 3 +- README.md | 3 +- drivers/thunderbolt/README.md | 66 +++++++++++++++++++++++++++++++ drivers/thunderbolt/manifest.yaml | 11 ++++++ drivers/thunderbolt/pkg.yaml | 22 +++++++++++ drivers/thunderbolt/vars.yaml | 1 + hack/release.toml | 6 +++ 7 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 drivers/thunderbolt/README.md create mode 100644 drivers/thunderbolt/manifest.yaml create mode 100644 drivers/thunderbolt/pkg.yaml create mode 100644 drivers/thunderbolt/vars.yaml diff --git a/Makefile b/Makefile index 0ab60176..817c6666 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ endif # keep in sync with Pkgfile BLDR_RELEASE ?= v0.2.0 -PKGS ?= v1.5.0-alpha.0-38-g84cdfb6 +PKGS ?= v1.5.0-alpha.0-40-gfedfafa BUILD := docker buildx build PLATFORM ?= linux/amd64,linux/arm64 @@ -54,6 +54,7 @@ TARGETS = \ nvidia-open-gpu-kernel-modules \ qemu-guest-agent \ tailscale \ + thunderbolt \ usb-modem-drivers \ zfs diff --git a/README.md b/README.md index f4981655..7407c5e5 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ All system extensions provided by Sidero Labs can be found in the [ghcr.io regis | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | ----------------------------------------------------- | | [gasket](drivers/gasket/) | [ghcr.io/siderolabs/gasket-driver](https://github.com/siderolabs/extensions/pkgs/container/gasket-driver) | Driver for Google Coral PCIe devices | `gasket driver upstream short commit`-`talos version` | | [nvidia](nvidia-gpu/nvidia-modules/) | [ghcr.io/siderolabs/nvidia-open-gpu-kernel-modules](https://github.com/siderolabs/extensions/pkgs/container/nvidia-open-gpu-kernel-modules) | NVIDIA OSS Driver | `nvidia driver upstream version`-`talos version` | -| [usb-modem](drivers/usb-modem) | [ghcr.io/siderolabs/usb-modem-drivers](https://github.com/siderolabs/extensions/pkgs/container/usb-modem-drivers) | USB Modem drivers | `talos version` | +| [thunderbolt](drivers/thunderbolt/) | [ghcr.io/siderolabs/thunderbolt](https://github.com/siderolabs/extensions/pkgs/container/thunderbolt) | Thunderbolt drivers | `talos version` | +| [usb-modem](drivers/usb-modem/) | [ghcr.io/siderolabs/usb-modem-drivers](https://github.com/siderolabs/extensions/pkgs/container/usb-modem-drivers) | USB Modem drivers | `talos version` | ### Network diff --git a/drivers/thunderbolt/README.md b/drivers/thunderbolt/README.md new file mode 100644 index 00000000..b968b8ef --- /dev/null +++ b/drivers/thunderbolt/README.md @@ -0,0 +1,66 @@ +# thunderbolt-drivers extension + +## Installation + +Add the extension to your machine config and enable the `thunderbolt` module. If you need Thunderbolt/USB4 networking, +enable `thunderbolt_net` module as well. + +```yaml +machine: + install: + extensions: + - image: ghcr.io/siderolabs/thunderbolt: + kernel: + modules: + - name: thunderbolt + - name: thunderbolt_net +``` + +## Verifiying + +You can verify the modules are enabled by reading the `/proc/modules` where it _should_ show the module is live. + +For example: + +``` +❯ talosctl -n 192.168.42.15 read /proc/modules +thunderbolt_net 24576 - - Live 0xffffffffc0414000 +thunderbolt 299008 - - Live 0xffffffffc03ca00 +``` + +In addition, if you're using networking, you should be able to verify presence of the network interfaces, checking `/sys/class/net` directory. + +For example: + +``` +❯ talosctl -n 192.168.42.15 ls /sys/class/net/ | grep -E 'NODE|thunderbolt' +NODE NAME +192.168.42.15 thunderbolt0 +192.168.42.15 thunderbolt1 +``` + +You can also verify everything in dmesg: + +``` +❯ talosctl -n 192.168.42.15 dmesg +# look for lines like these: +10.100.52.1: kern: info: [2023-07-23T16:47:28.22083266Z]: ACPI: bus type thunderbolt registered +10.100.52.1: kern: info: [2023-07-23T16:47:30.48512066Z]: thunderbolt 0-0:1.1: new retimer found, vendor=0x8087 device=0x15ee + SUBSYSTEM=thunderbolt + DEVICE=+thunderbolt:0-0:1.1 +10.100.52.1: kern: info: [2023-07-23T16:47:32.76328066Z]: thunderbolt 1-0:1.1: new retimer found, vendor=0x8087 device=0x15ee + SUBSYSTEM=thunderbolt + DEVICE=+thunderbolt:1-0:1.1 +10.100.52.1: kern: info: [2023-07-23T16:47:37.34770966Z]: thunderbolt 0-1: new host found, vendor=0x8086 device=0x1 + SUBSYSTEM=thunderbolt + DEVICE=+thunderbolt:0-1 +10.100.52.1: kern: info: [2023-07-23T16:47:37.34917566Z]: thunderbolt 0-1: Intel Corp. talos-node-2 + SUBSYSTEM=thunderbolt + DEVICE=+thunderbolt:0-1 +10.100.52.1: kern: info: [2023-07-23T16:47:39.74636466Z]: thunderbolt 1-1: new host found, vendor=0x8086 device=0x1 + SUBSYSTEM=thunderbolt + DEVICE=+thunderbolt:1-1 +10.100.52.1: kern: info: [2023-07-23T16:47:39.74767966Z]: thunderbolt 1-1: Intel Corp. talos-node-3 + SUBSYSTEM=thunderbolt + DEVICE=+thunderbolt:1-1 +``` diff --git a/drivers/thunderbolt/manifest.yaml b/drivers/thunderbolt/manifest.yaml new file mode 100644 index 00000000..20a17320 --- /dev/null +++ b/drivers/thunderbolt/manifest.yaml @@ -0,0 +1,11 @@ +version: v1alpha1 +metadata: + name: thunderbolt + version: "$VERSION" + author: Igor Rzegocki + description: | + This system extension provides Thunderbolt/USB4 drivers kernel modules built against a specific Talos version. + This driver enables Thunderbolg/USB4 devices, including networking. + compatibility: + talos: + version: ">= v1.5.0" diff --git a/drivers/thunderbolt/pkg.yaml b/drivers/thunderbolt/pkg.yaml new file mode 100644 index 00000000..e23c5296 --- /dev/null +++ b/drivers/thunderbolt/pkg.yaml @@ -0,0 +1,22 @@ +name: thunderbolt +variant: scratch +shell: /toolchain/bin/bash +dependencies: + - stage: base + # The pkgs version for a particular release of Talos as defined in + # https://github.com/siderolabs/talos/blob//pkg/machinery/gendata/data/pkgs + - image: "{{ .PKGS_PREFIX }}/thunderbolt-pkg:{{ .BUILD_ARG_PKGS }}" +steps: + - prepare: + - | + sed -i 's#$VERSION#{{ .VERSION }}#' /pkg/manifest.yaml + - install: + - | + mkdir -p /rootfs/lib/modules + + cp -R /lib/modules/* /rootfs/lib/modules +finalize: + - from: /rootfs + to: /rootfs + - from: /pkg/manifest.yaml + to: / diff --git a/drivers/thunderbolt/vars.yaml b/drivers/thunderbolt/vars.yaml new file mode 100644 index 00000000..f380ba71 --- /dev/null +++ b/drivers/thunderbolt/vars.yaml @@ -0,0 +1 @@ +VERSION: "{{ .BUILD_ARG_TAG }}" diff --git a/hack/release.toml b/hack/release.toml index c2d8353b..c0d522b7 100644 --- a/hack/release.toml +++ b/hack/release.toml @@ -31,6 +31,12 @@ Tailscale is now supported as Talos System Extension. Requires Talos v1.5.0 or l title = "ZFS" description = """\ ZFS is now supported as Talos System Extension. Requires Talos v1.5.0 or later. +""" + + [notes.thunderbolt] + title = "Thunderbolt" + description = """\ +Thunderbolt drivers is now supported as Talos System Extension. Requires Talos v1.5.0 or later. """ [notes.updates]