From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C286426B770 for ; Mon, 11 Aug 2025 20:12:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754943154; cv=none; b=Vw5z5IOA4uMPZWdE7lFt5kYjw+DLMwwn90fFWKphSmk/aZulLtcU3+y0CJ+yQGLFAS+cPtpL+Rb99jbryQB047Z53pJF3P03Cya5P1vC4OcQIOdc3uGCZ8p9u81b+uH2ak78UtNCArj53rr6/5hQr8CtDKlANNIm5eGnFWZ+R2A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754943154; c=relaxed/simple; bh=/FZTspYYWvEWCEtiOFDE2A4NxweVDPbSCXf66s2+wKg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lxi3zL3dxpbYINM7IYdQywohoNb+TB0a0mJ2r9fGYePpzJhKGrHgoMe8z8oZA3DrSWwU2sFeQwNeso2uAKLJqsU5Kc6MgVL/f+/R/REjpbGPqzDL3zleks2olmsTgeXEHAwMjOIkj1TyUOOyl7u11HLPUjH0dyxOQc+WNh0QNUc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=eMDrHaZP; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="eMDrHaZP" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=DJsZ8HmGlACpafOGpwfWcntpMhJ9UTgasDXNrQFwyzo=; b=eMDrHaZPy4/LByrrZv+zoY7dON xU8+nZHFsNStHu504if/XrmFpg5WWmQnA0PbZgP566wc0pSwlPX3KRp11NBBEBV2o0sS+LdNQkFDh 8F/D//+HRhM/GmsxE2KaRzGdxbwXEQ1dkywf3nYNq/NtBbMLbKx7zQUePbGXuxJbzDx1youx7AzjR ZFCaYbflXKTeI1WyUIYi3MAaWzRSm3Dj9zeGBL/DiypVT9/8gcwOEdGlX1Ze2kArgvuOMSjI+8Aqc ZOjLGOwabFAoM/doyXmOMYANJmo1ugJ2drfgdS53tAx/EQjlS0U+0XCRGoa3qk4eyOMIAclIOrk+O GPKLNIBw==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1ulYsh-0000000903r-1U1j; Mon, 11 Aug 2025 20:12:31 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal Date: Mon, 11 Aug 2025 13:12:23 -0700 Message-ID: <20250811201230.2145164-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250811201230.2145164-1-mcgrof@kernel.org> References: <20250811201230.2145164-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain 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 --- 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