Skip to content

Commit a1bedce

Browse files
committed
libvirt: fix PCI-E passthrough configuration after Vagrant removal
The PCI-E passthrough functionality was broken when Vagrant support was removed. Two issues prevented the passthrough options from appearing in menuconfig: 1. The check_pciepassthrough_kconfig.sh script was gutted during the Vagrant removal and always returned "n", preventing the passthrough Kconfig from being detected. 2. The source line for including the generated passthrough Kconfig was removed but never updated to the new location. This commit fixes both issues and additionally improves the user interface by: - Restoring the check script to properly detect if the passthrough Kconfig file exists - Adding a proper menu structure with "Enable PCI-E passthrough support" boolean option - Creating a dedicated "Configure PCI-E passthrough" submenu for device selection - Including the assignment strategy choice (manual vs round-robin) Now users can properly enable and configure PCI-E passthrough through a clean menu interface instead of having all device options scattered in the main libvirt menu. Fixes: 89b7ef8 ("kconfigs: fix Kconfig references after vagrant removal") Generated-by: Claude AI Reviewed-by: Chuck Lever <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 7f25db7 commit a1bedce

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

kconfigs/Kconfig.libvirt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,49 @@ config HAVE_LIBVIRT_PCIE_PASSTHROUGH
462462
bool
463463
default $(shell, scripts/check_pciepassthrough_kconfig.sh passthrough_libvirt.generated)
464464

465+
config KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH
466+
bool "Enable PCI-E passthrough support"
467+
depends on HAVE_LIBVIRT_PCIE_PASSTHROUGH
468+
depends on LIBVIRT
469+
depends on LIBVIRT_MACHINE_TYPE_Q35
470+
default n
471+
help
472+
Enable this to configure PCI-E passthrough of devices from the host
473+
to guest VMs. This requires the q35 machine type and proper IOMMU
474+
configuration on the host.
475+
476+
If enabled, you can select which PCI devices to pass through to
477+
which guests in the passthrough configuration menu.
478+
479+
if KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH
480+
481+
menu "Configure PCI-E passthrough"
482+
483+
choice
484+
prompt "PCI-E passthrough assignment strategy"
485+
default KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_EACH
486+
487+
config KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_EACH
488+
bool "Manually assign devices to specific guests"
489+
help
490+
This lets you manually specify which PCI device gets assigned to
491+
which specific guest. Each device can be assigned to exactly one
492+
guest.
493+
494+
config KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_ROUNDROBIN
495+
bool "Round-robin device assignment"
496+
help
497+
Automatically distribute PCI devices among guests in a round-robin
498+
fashion. This is useful when you have multiple similar devices
499+
(like NVMe drives) and want to distribute them evenly.
500+
501+
endchoice
502+
503+
source "Kconfig.passthrough_libvirt.generated"
504+
505+
endmenu
506+
507+
endif # KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH
465508

466509
choice
467510
prompt "Machine type to use"
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: copyleft-next-0.3.1
33

4-
echo n
4+
# Check if the PCI passthrough Kconfig file exists
5+
KCONFIG_FILE="$1"
6+
7+
if [ -z "$KCONFIG_FILE" ]; then
8+
echo n
9+
exit 0
10+
fi
11+
12+
# Check both with and without Kconfig. prefix
13+
if [ -f "Kconfig.${KCONFIG_FILE}" ] || [ -f "${KCONFIG_FILE}" ]; then
14+
echo y
15+
else
16+
echo n
17+
fi

0 commit comments

Comments
 (0)