public inbox for kdevops@lists.linux.dev
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Chuck Lever <cel@kernel.org>, Daniel Gomez <da.gomez@kruces.com>,
	kdevops@lists.linux.dev
Cc: Luis Chamberlain <mcgrof@kernel.org>
Subject: [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal
Date: Mon, 11 Aug 2025 13:12:23 -0700	[thread overview]
Message-ID: <20250811201230.2145164-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20250811201230.2145164-1-mcgrof@kernel.org>

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: 89b7ef82fd91 ("kconfigs: fix Kconfig references after vagrant removal")
Generated-by: Claude AI
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 kconfigs/Kconfig.libvirt                 | 43 ++++++++++++++++++++++++
 scripts/check_pciepassthrough_kconfig.sh | 15 ++++++++-
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/kconfigs/Kconfig.libvirt b/kconfigs/Kconfig.libvirt
index 0f26699..61502c1 100644
--- a/kconfigs/Kconfig.libvirt
+++ b/kconfigs/Kconfig.libvirt
@@ -462,6 +462,49 @@ config HAVE_LIBVIRT_PCIE_PASSTHROUGH
 	bool
 	default $(shell, scripts/check_pciepassthrough_kconfig.sh passthrough_libvirt.generated)
 
+config KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH
+	bool "Enable PCI-E passthrough support"
+	depends on HAVE_LIBVIRT_PCIE_PASSTHROUGH
+	depends on LIBVIRT
+	depends on LIBVIRT_MACHINE_TYPE_Q35
+	default n
+	help
+	  Enable this to configure PCI-E passthrough of devices from the host
+	  to guest VMs. This requires the q35 machine type and proper IOMMU
+	  configuration on the host.
+
+	  If enabled, you can select which PCI devices to pass through to
+	  which guests in the passthrough configuration menu.
+
+if KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH
+
+menu "Configure PCI-E passthrough"
+
+choice
+	prompt "PCI-E passthrough assignment strategy"
+	default KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_EACH
+
+config KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_EACH
+	bool "Manually assign devices to specific guests"
+	help
+	  This lets you manually specify which PCI device gets assigned to
+	  which specific guest. Each device can be assigned to exactly one
+	  guest.
+
+config KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_ROUNDROBIN
+	bool "Round-robin device assignment"
+	help
+	  Automatically distribute PCI devices among guests in a round-robin
+	  fashion. This is useful when you have multiple similar devices
+	  (like NVMe drives) and want to distribute them evenly.
+
+endchoice
+
+source "Kconfig.passthrough_libvirt.generated"
+
+endmenu
+
+endif # KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH
 
 choice
 	prompt "Machine type to use"
diff --git a/scripts/check_pciepassthrough_kconfig.sh b/scripts/check_pciepassthrough_kconfig.sh
index 5d83ecf..e631085 100755
--- a/scripts/check_pciepassthrough_kconfig.sh
+++ b/scripts/check_pciepassthrough_kconfig.sh
@@ -1,4 +1,17 @@
 #!/bin/bash
 # SPDX-License-Identifier: copyleft-next-0.3.1
 
-echo n
+# Check if the PCI passthrough Kconfig file exists
+KCONFIG_FILE="$1"
+
+if [ -z "$KCONFIG_FILE" ]; then
+    echo n
+    exit 0
+fi
+
+# Check both with and without Kconfig. prefix
+if [ -f "Kconfig.${KCONFIG_FILE}" ] || [ -f "${KCONFIG_FILE}" ]; then
+    echo y
+else
+    echo n
+fi
-- 
2.47.2


  reply	other threads:[~2025-08-11 20:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain
2025-08-11 20:12 ` Luis Chamberlain [this message]
2025-08-11 20:12 ` [PATCH 2/8] gen-dynamic-pci: fix PCI passthrough target guest default value Luis Chamberlain
2025-08-11 20:12 ` [PATCH 3/8] gen-dynamic-pci: add GPU detection and naming support Luis Chamberlain
2025-08-11 20:12 ` [PATCH 4/8] guestfs / devconfig: allow for upgrade from Debian testing to forky Luis Chamberlain
2025-08-11 20:12 ` [PATCH 5/8] guestfs: add OVMF package for UEFI firmware support Luis Chamberlain
2025-08-11 20:12 ` [PATCH 6/8] gen_nodes: fix duplicate pcipassthrough keys in YAML output Luis Chamberlain
2025-08-11 20:12 ` [PATCH 7/8] gen_nodes: fix YAML indentation in pcipassthrough template Luis Chamberlain
2025-08-11 20:12 ` [PATCH 8/8] guestfs: fix PCIe passthrough device attachment Luis Chamberlain
2025-08-11 20:38 ` [PATCH 0/8] various fixes Chuck Lever
2025-08-11 21:31   ` Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250811201230.2145164-2-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=cel@kernel.org \
    --cc=da.gomez@kruces.com \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox