Skip to main content

Inspect and control PCI device-driver binding in Linux

Project description

devbind: inspect and control PCI device-driver binding in Linux

devbind

PyPI Python Test

Inspect and control PCI device-driver binding in Linux.

Install

pipx install devbind

Or standalone (single-file, stdlib only, no pip needed):

curl -fsSL https://raw.githubusercontent.com/xnvme/devbind/main/src/devbind/devbind.py \
  -o ~/.local/bin/devbind && chmod +x ~/.local/bin/devbind

Shell completion

devbind --print-completion bash > ~/.local/share/bash-completion/completions/devbind

Open a new shell (or source the file) and tab-completion is live: devbind --bind <TAB> lists nvme vfio-pci vfio-noiommu uio_pci_generic.

Usage

$ devbind --help
usage: devbind [-h] [--version] [--classcode CLASSCODE] [--device DEVICE]
               [--list] [--unbind] [--bind BIND] [--verbose]
               [--print-completion SHELL]

Inspect and control PCI device-driver binding in Linux

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --classcode CLASSCODE
                        The class of PCIe devices to scan for
  --device DEVICE       Instead of all; then only the given PCI address.
  --list                Print PCIe device(s); such as their 'bdf' and driver-
                        association.
  --unbind              Unbind if bound.
  --bind BIND           Unbind if bound; then bind to the given driver-name
                        [nvme, vfio-pci, uio_pci_generic] or to a .ko driver
                        file (path)
  --verbose             Enable verbose logging
  --print-completion SHELL
                        Print shell completion script to stdout and exit

A few common invocations:

devbind --list                                       # list NVMe devices and their drivers
sudo devbind --bind vfio-pci --device 0000:01:00.0   # bind one device to vfio-pci
sudo devbind --bind nvme --device 0000:01:00.0       # rebind to the native driver
sudo devbind --unbind --device 0000:01:00.0          # unbind without rebinding

devbind --list sample output (stock WSL host, no NVMe devices visible):

system:
  drivers:
  - uio_pci_generic: {'available': False}
  - vfio-noiommu: {'available': False}
  - vfio-pci: {'available': False}
  - nvme: {'available': True}
  limits:
    memlock_soft: 64 MB
    memlock_hard: 64 MB

On a host with NVMe devices visible, a props: block is also printed per device with bdf, vendor, device, classcode, driver, iommugroup, handles, and is_used.

Related

  • iommu: inspect and configure the IOMMU isolation level in Linux.
  • hugepages: inspect and manage Linux hugepages.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devbind-0.3.8.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devbind-0.3.8-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file devbind-0.3.8.tar.gz.

File metadata

  • Download URL: devbind-0.3.8.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for devbind-0.3.8.tar.gz
Algorithm Hash digest
SHA256 745ccc3b9e53a9bb7574c234dc282b060d140e07c80fa44cbb91d51abb42f397
MD5 ff666bbd380ff690a2bddaddc45237d9
BLAKE2b-256 e1d3e33176c3e7dcac7a508c230e2f6ee6c151369f89a3aa94533b2934526442

See more details on using hashes here.

Provenance

The following attestation bundles were made for devbind-0.3.8.tar.gz:

Publisher: publish.yml on xnvme/devbind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file devbind-0.3.8-py3-none-any.whl.

File metadata

  • Download URL: devbind-0.3.8-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for devbind-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 906fcf59f7c4e48d370c75a71a78cfec74830fc90c864397a53102b0c8130ea1
MD5 5b4e7f4f00ba024b964b4cd11bf055ee
BLAKE2b-256 3e868993e1b5944471a382852280197daa12e1b81b618da2d2fa38832246a42a

See more details on using hashes here.

Provenance

The following attestation bundles were made for devbind-0.3.8-py3-none-any.whl:

Publisher: publish.yml on xnvme/devbind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page