mirror of
https://github.com/AlbrechtL/openwrt-docker.git
synced 2026-10-19 00:01:28 +00:00
Improve PCI pass-through error handling
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ services:
|
||||
|
||||
# PCI and PCIe pass-through
|
||||
# Host system requirements
|
||||
# - IOMMU CPU feature has to enabled in bios
|
||||
# - IOMMU CPU virtualization feature (e.g. Intel VT-d) has to enabled in bios
|
||||
# - Host kernel has to switch on intel_iommu=on or amd_iommu=on
|
||||
# - Host kernel module 'vfio-pci' has to exists
|
||||
# - Ubuntu 24.04 is working by default
|
||||
|
||||
+4
-7
@@ -143,7 +143,7 @@ attach_pci_device () {
|
||||
info "Preparing PCI pass-through for device $PCI_DEVICE ..."
|
||||
|
||||
if [ ! -e "$PCI_PATH" ]; then
|
||||
echo "Error: PCI device $PCI_DEVICE not found"
|
||||
error "Error: PCI device $PCI_DEVICE not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -162,12 +162,9 @@ attach_pci_device () {
|
||||
|
||||
# Bind to vfio-pci
|
||||
echo "vfio-pci" > "$PCI_PATH/driver_override"
|
||||
echo "$PCI_DEVICE" > /sys/bus/pci/drivers/vfio-pci/bind
|
||||
|
||||
# Verify binding
|
||||
if [ "$(basename "$(readlink "$PCI_PATH/driver" 2>/dev/null)")" != "vfio-pci" ]; then
|
||||
echo "Failed to bind $PCI_DEVICE to vfio-pci"
|
||||
exit 1
|
||||
if ! echo "$PCI_DEVICE" > /sys/bus/pci/drivers/vfio-pci/bind 2>/dev/null; then
|
||||
error "Failed to bind PCI device $PCI_DEVICE to vfio-pci. Please double check if your system supports IOMMU and if CPU virtualization features (e.g. Intel VT-d) is enabled in your bios."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Successfully bound $PCI_DEVICE to vfio-pci"
|
||||
|
||||
Reference in New Issue
Block a user