* [PATCH 0/8] various fixes
@ 2025-08-11 20:12 Luis Chamberlain
2025-08-11 20:12 ` [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal Luis Chamberlain
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw)
To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain
I took a GPU out for a spin for PCI passthrough and found that the
vagrant removal nuked some things for it, this fixes that and enhances
the PCI passthrough listing with sensible names.
While at it, this also includes a fix to gest us through the debian
trixie to forky transition, allowing our host and target nodes to
upgrade.
Luis Chamberlain (8):
libvirt: fix PCI-E passthrough configuration after Vagrant removal
gen-dynamic-pci: fix PCI passthrough target guest default value
gen-dynamic-pci: add GPU detection and naming support
guestfs / devconfig: allow for upgrade from Debian testing to forky
guestfs: add OVMF package for UEFI firmware support
gen_nodes: fix duplicate pcipassthrough keys in YAML output
gen_nodes: fix YAML indentation in pcipassthrough template
guestfs: fix PCIe passthrough device attachment
kconfigs/Kconfig.libvirt | 43 ++++
.../dynamic-kconfig/gen-dynamic-pci.py | 198 +++++++++++++++++-
.../tasks/install-deps/debian/main.yml | 9 +
.../gen_nodes/templates/gen_nodes_list.j2 | 14 +-
.../gen_nodes/templates/guestfs_nodes.j2 | 2 +-
playbooks/roles/gen_nodes/templates/hosts.j2 | 4 +-
.../roles/guestfs/tasks/bringup/main.yml | 2 +-
.../tasks/install-deps/debian/main.yml | 9 +
scripts/check_pciepassthrough_kconfig.sh | 15 +-
9 files changed, 275 insertions(+), 21 deletions(-)
--
2.47.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain @ 2025-08-11 20:12 ` Luis Chamberlain 2025-08-11 20:12 ` [PATCH 2/8] gen-dynamic-pci: fix PCI passthrough target guest default value Luis Chamberlain ` (7 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: 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 <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 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/8] gen-dynamic-pci: fix PCI passthrough target guest default value 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain 2025-08-11 20:12 ` [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal Luis Chamberlain @ 2025-08-11 20:12 ` Luis Chamberlain 2025-08-11 20:12 ` [PATCH 3/8] gen-dynamic-pci: add GPU detection and naming support Luis Chamberlain ` (6 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain Fix two issues preventing PCI passthrough configuration from appearing in generated nodes files: 1. Template generation was producing "None" in YAML files due to incorrect include path and missing None handling in the Jinja2 template. Fixed by correcting the include path and adding a replace filter to remove "None" values. 2. PCI passthrough target_guest field was defaulting to empty string, preventing devices from being assigned to guests. Fixed by setting the Kconfig default to reference KDEVOPS_HOSTS_PREFIX, which automatically assigns devices to the configured host prefix (e.g., "debian13"). With these fixes, PCI passthrough configuration now correctly appears in the generated guestfs/kdevops_nodes.yaml file when devices are enabled and target_guest is properly configured. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py | 4 ++-- playbooks/roles/gen_nodes/templates/guestfs_nodes.j2 | 2 +- playbooks/roles/gen_nodes/templates/hosts.j2 | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py b/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py index 107bb25..f86ce74 100755 --- a/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py +++ b/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py @@ -95,9 +95,9 @@ def add_pcie_kconfig_name(config_name, sdevice): def add_pcie_kconfig_target(config_name, sdevice): sys.stdout.write("config %s_TARGET_GUEST\n" % (config_name)) sys.stdout.write( - '\tstring "Taret guest to offload %s"\n' % (strip_kconfig_name(sdevice)) + '\tstring "Target guest to offload %s"\n' % (strip_kconfig_name(sdevice)) ) - sys.stdout.write('\tdefault ""\n') + sys.stdout.write('\tdefault KDEVOPS_HOSTS_PREFIX\n') sys.stdout.write("\tdepends on %s\n" % config_name) sys.stdout.write("\tdepends on KDEVOPS_LIBVIRT_PCIE_PASSTHROUGH_TYPE_EACH\n") sys.stdout.write("\thelp\n") diff --git a/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2 b/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2 index 5e87df3..a548f25 100644 --- a/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2 +++ b/playbooks/roles/gen_nodes/templates/guestfs_nodes.j2 @@ -1,3 +1,3 @@ --- guestfs_nodes: -{% include './templates/hosts.j2' %} +{% include 'hosts.j2' -%} diff --git a/playbooks/roles/gen_nodes/templates/hosts.j2 b/playbooks/roles/gen_nodes/templates/hosts.j2 index ca4d2cb..a7f8b82 100644 --- a/playbooks/roles/gen_nodes/templates/hosts.j2 +++ b/playbooks/roles/gen_nodes/templates/hosts.j2 @@ -1,6 +1,6 @@ -{% from "gen_nodes_list.j2" import gen_nodes_list %} +{% from "gen_nodes_list.j2" import gen_nodes_list -%} {{ gen_nodes_list( nodes, kdevops_baseline_and_dev, 100, pcie_passthrough_enable, pcie_passthrough_target_type, pcie_passthrough_target, - pcie_passthrough_devices ) }} + pcie_passthrough_devices ) | replace("None", "") }} -- 2.47.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/8] gen-dynamic-pci: add GPU detection and naming support 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain 2025-08-11 20:12 ` [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal Luis Chamberlain 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 ` Luis Chamberlain 2025-08-11 20:12 ` [PATCH 4/8] guestfs / devconfig: allow for upgrade from Debian testing to forky Luis Chamberlain ` (5 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain Add specialized detection and naming support for GPU devices in the PCI passthrough configuration generator, similar to existing NVMe support. This provides cleaner, more informative names for GPUs in the menuconfig interface. Features added: - Automatic detection of AMD, NVIDIA, and Intel GPUs based on device names and common GPU keywords - GPU memory detection from sysfs when available (via mem_info_vram_total or resource file size estimation) - Clean formatting of GPU names with vendor prefixes and memory info - Support for various GPU families: * AMD: Radeon, Instinct, FirePro, RDNA, GCN series * NVIDIA: GeForce, Quadro, Tesla, RTX/GTX series * Intel: UHD Graphics, HD Graphics, Iris, Arc series Example output: - Before: "0000:03:00.0 IOMMU group None - Device 0834" - After: "0000:03:00.0 IOMMU group None - GPU - Radeon Pro VII/Radeon Instinct MI50 32GB" This makes it much easier for users to identify and select GPUs for passthrough in the configuration menu. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- .../dynamic-kconfig/gen-dynamic-pci.py | 194 +++++++++++++++++- 1 file changed, 187 insertions(+), 7 deletions(-) diff --git a/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py b/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py index f86ce74..52824c7 100755 --- a/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py +++ b/playbooks/python/workflows/dynamic-kconfig/gen-dynamic-pci.py @@ -64,11 +64,156 @@ def get_special_device_nvme(pci_id, IOMMUGroup): ) -def get_kconfig_device_name(pci_id, sdevice, IOMMUGroup): +def get_gpu_memory_info(pci_id): + """Try to get GPU memory information from sysfs.""" + # Try to get memory info from various possible locations + mem_paths = [ + sys_bus_prefix + pci_id + "/mem_info_vram_total", + sys_bus_prefix + pci_id + "/drm/card0/mem_info_vram_total", + ] + + for mem_path in mem_paths: + if os.path.isfile(mem_path): + try: + with open(mem_path, "r") as f: + mem_bytes = int(f.read().strip()) + mem_gb = mem_bytes / (1024 * 1024 * 1024) + return f"{mem_gb:.0f}GB" + except: + pass + + # Try to get memory from resource file size (less accurate) + resource_path = sys_bus_prefix + pci_id + "/resource0" + if os.path.isfile(resource_path): + try: + size = os.path.getsize(resource_path) + if size > 0: + size_gb = size / (1024 * 1024 * 1024) + if size_gb >= 1: + return f"{size_gb:.0f}GB" + except: + pass + + return None + + +def get_special_device_gpu(pci_id, device_name, IOMMUGroup): + """Generate a nice display name for GPU devices.""" + pci_id_name = strip_kconfig_name(pci_id) + + # Clean up the device name to extract the GPU model + gpu_model = device_name + + # Common GPU name patterns to clean up + replacements = [ + ("[AMD/ATI]", "AMD"), + ("Advanced Micro Devices, Inc.", "AMD"), + ("NVIDIA Corporation", "NVIDIA"), + ("Intel Corporation", "Intel"), + ] + + for old, new in replacements: + gpu_model = gpu_model.replace(old, new).strip() + + # Try to extract specific GPU model from brackets + import re + + bracket_match = re.search(r"\[([^\]]+)\]", gpu_model) + if bracket_match: + model_name = bracket_match.group(1) + # Keep the vendor prefix if it's a clean model name + if "Radeon" in model_name or "GeForce" in model_name or "Intel" in model_name: + gpu_model = model_name + else: + # Prepend vendor if needed + if "AMD" in gpu_model and "Radeon" not in model_name: + gpu_model = f"AMD {model_name}" + elif ( + "NVIDIA" in gpu_model + and "GeForce" not in model_name + and "Quadro" not in model_name + ): + gpu_model = f"NVIDIA {model_name}" + else: + gpu_model = model_name + + # Remove any existing memory info from the model name (e.g., "32GB" at the end) + gpu_model = re.sub(r"\s+\d+GB\s*$", "", gpu_model) + + # Try to get memory info + mem_info = get_gpu_memory_info(pci_id) + + # Build the display name + if mem_info: + display_name = ( + f"{pci_id_name} IOMMU group {IOMMUGroup} - GPU - {gpu_model} {mem_info}" + ) + else: + display_name = f"{pci_id_name} IOMMU group {IOMMUGroup} - GPU - {gpu_model}" + + return display_name + + +def is_gpu_device(device_name): + """Check if a device is a GPU based on its name.""" + gpu_keywords = [ + # AMD/ATI + "Radeon", + "Vega", + "Navi", + "RDNA", + "GCN", + "Polaris", + "Fiji", + "Instinct", + "FirePro", + "FireGL", + "RX", + "AMD.*GPU", + # NVIDIA + "GeForce", + "Quadro", + "Tesla", + "NVIDIA.*GPU", + "GTX", + "RTX", + "Titan", + "NVS", + "GRID", + # Intel + "Intel.*Graphics", + "UHD Graphics", + "HD Graphics", + "Iris", + "Arc", + "Xe Graphics", + # Generic + "VGA compatible controller", + "Display controller", + "3D controller", + "Graphics", + ] + + device_lower = device_name.lower() + for keyword in gpu_keywords: + if keyword.lower() in device_lower: + return True + return False + + +def get_kconfig_device_name( + pci_id, sdevice, IOMMUGroup, vendor_name=None, device_name=None +): default_name = "%s IOMMU group %s - %s" % (pci_id, IOMMUGroup, sdevice) special_name = None + + # Check for NVMe devices if os.path.isdir(sys_bus_prefix + pci_id + "/nvme"): special_name = get_special_device_nvme(pci_id, IOMMUGroup) + # Check for GPU devices + elif device_name and is_gpu_device(device_name): + special_name = get_special_device_gpu(pci_id, device_name, IOMMUGroup) + if not special_name: return strip_kconfig_name(default_name) return strip_kconfig_name(special_name) @@ -107,10 +252,21 @@ def add_pcie_kconfig_target(config_name, sdevice): def add_pcie_kconfig_entry( - pci_id, sdevice, domain, bus, slot, function, IOMMUGroup, config_id + pci_id, + sdevice, + domain, + bus, + slot, + function, + IOMMUGroup, + config_id, + vendor_name=None, + device_name=None, ): prefix = passthrough_prefix + "_%04d" % config_id - name = get_kconfig_device_name(pci_id, sdevice, IOMMUGroup) + name = get_kconfig_device_name( + pci_id, sdevice, IOMMUGroup, vendor_name, device_name + ) add_pcie_kconfig_name(prefix, name) add_pcie_kconfig_target(prefix, sdevice) add_pcie_kconfig_string(prefix, pci_id, "pci_id") @@ -123,7 +279,9 @@ def add_pcie_kconfig_entry( add_pcie_kconfig_string(prefix, function, "function") -def add_new_device(slot, sdevice, IOMMUGroup, possible_id): +def add_new_device( + slot, sdevice, IOMMUGroup, possible_id, vendor_name=None, device_name=None +): # Example expeced format 0000:2d:00.0 m = re.match( r"^(?P<DOMAIN>\w+):" "(?P<BUS>\w+):" "(?P<MSLOT>\w+)\." "(?P<FUNCTION>\w+)$", @@ -154,7 +312,16 @@ def add_new_device(slot, sdevice, IOMMUGroup, possible_id): ) add_pcie_kconfig_entry( - slot, sdevice, domain, bus, mslot, function, IOMMUGroup, possible_id + slot, + sdevice, + domain, + bus, + mslot, + function, + IOMMUGroup, + possible_id, + vendor_name, + device_name, ) return possible_id @@ -184,6 +351,8 @@ def main(): slot = -1 sdevice = None IOMMUGroup = None + vendor_name = None + device_name = None for line in all_lines: line = line.strip() @@ -197,20 +366,31 @@ def main(): if tag == "Slot": if sdevice: num_candidate_devices = add_new_device( - slot, sdevice, IOMMUGroup, num_candidate_devices + slot, + sdevice, + IOMMUGroup, + num_candidate_devices, + vendor_name, + device_name, ) slot = data sdevice = None IOMMUGroup = None + vendor_name = None + device_name = None elif tag == "SDevice": sdevice = data elif tag == "IOMMUGroup": IOMMUGroup = data + elif tag == "Vendor": + vendor_name = data + elif tag == "Device": + device_name = data # Handle the last device if sdevice and slot: num_candidate_devices = add_new_device( - slot, sdevice, IOMMUGroup, num_candidate_devices + slot, sdevice, IOMMUGroup, num_candidate_devices, vendor_name, device_name ) add_pcie_kconfig_string(passthrough_prefix, num_candidate_devices, "NUM_DEVICES") -- 2.47.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/8] guestfs / devconfig: allow for upgrade from Debian testing to forky 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain ` (2 preceding siblings ...) 2025-08-11 20:12 ` [PATCH 3/8] gen-dynamic-pci: add GPU detection and naming support Luis Chamberlain @ 2025-08-11 20:12 ` Luis Chamberlain 2025-08-11 20:12 ` [PATCH 5/8] guestfs: add OVMF package for UEFI firmware support Luis Chamberlain ` (4 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain Debian Trixie (13) was just released as stable, and the testing repository has transitioned from codename 'trixie' to 'forky'. This causes apt-get update to fail with: E:Repository 'http://mirror.keystealth.org/debian testing InRelease' changed its 'Codename' value from 'trixie' to 'forky' Fix by adding a preliminary apt-get update with the --allow-releaseinfo-change flag to accept the repository metadata changes before installing packages. This ensures the playbook can handle Debian testing transitions gracefully. We do this for both the host through the guestfs playbook and and the target node through the devconfig playbook. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- .../roles/devconfig/tasks/install-deps/debian/main.yml | 9 +++++++++ .../roles/guestfs/tasks/install-deps/debian/main.yml | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml b/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml index 6ffe00f..140c3a1 100644 --- a/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml +++ b/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml @@ -45,6 +45,15 @@ ignore_errors: yes tags: firstconfig +- name: Update apt cache accepting release info changes + become: yes + become_method: sudo + ansible.builtin.command: + cmd: apt-get update --allow-releaseinfo-change + changed_when: false + ignore_errors: true + tags: firstconfig + - name: Upgrade Packages become: yes become_method: sudo diff --git a/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml b/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml index 0529db6..dc69c65 100644 --- a/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml +++ b/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml @@ -1,4 +1,12 @@ --- +- name: Update apt cache accepting release info changes + become: true + become_method: ansible.builtin.sudo + ansible.builtin.command: + cmd: apt-get update --allow-releaseinfo-change + changed_when: false + ignore_errors: true + - name: Install guestfs dependencies for Debian become: true become_method: ansible.builtin.sudo -- 2.47.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/8] guestfs: add OVMF package for UEFI firmware support 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain ` (3 preceding siblings ...) 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 ` Luis Chamberlain 2025-08-11 20:12 ` [PATCH 6/8] gen_nodes: fix duplicate pcipassthrough keys in YAML output Luis Chamberlain ` (3 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain The OVMF (Open Virtual Machine Firmware) package provides UEFI firmware files required by libvirt when creating VMs with UEFI support. Without this package, libvirt fails with: libvirtError: operation failed: Unable to find 'efi' firmware that is compatible with the current configuration Add ovmf to the Debian dependencies to ensure UEFI firmware is available for VM creation, particularly when guestfs_requires_uefi is enabled. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- playbooks/roles/guestfs/tasks/install-deps/debian/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml b/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml index dc69c65..1626e75 100644 --- a/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml +++ b/playbooks/roles/guestfs/tasks/install-deps/debian/main.yml @@ -17,4 +17,5 @@ - isc-dhcp-client - python3-lxml - python3-libvirt + - ovmf state: present -- 2.47.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/8] gen_nodes: fix duplicate pcipassthrough keys in YAML output 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain ` (4 preceding siblings ...) 2025-08-11 20:12 ` [PATCH 5/8] guestfs: add OVMF package for UEFI firmware support Luis Chamberlain @ 2025-08-11 20:12 ` Luis Chamberlain 2025-08-11 20:12 ` [PATCH 7/8] gen_nodes: fix YAML indentation in pcipassthrough template Luis Chamberlain ` (2 subsequent siblings) 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain The template was generating multiple 'pcipassthrough' keys for each device, causing YAML parsing warnings about duplicate mapping keys. Fixed by collecting all devices for a target guest first, then outputting a single 'pcipassthrough' key with all devices under it. This uses Jinja2's namespace feature to maintain state across loop iterations. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- .../roles/gen_nodes/templates/gen_nodes_list.j2 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 b/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 index e8f5e34..6ad2af1 100644 --- a/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 +++ b/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 @@ -1,18 +1,19 @@ {%- macro gen_pci_passthrough_each(n, device_list) -%} -{%- set found_pcie_devices_on_node = False -%} +{%- set ns = namespace(has_devices=false, device_index=1) -%} {%- for d in device_list %} {%- if n == d.target_guest -%} -{%- if not found_pcie_devices_on_node -%} -{% set found_pcie_devices_on_node = True %} +{%- if not ns.has_devices -%} +{%- set ns.has_devices = true %} pcipassthrough: -{% endif %} - passthrough{{ loop.index | string }}: +{% endif -%} + passthrough{{ ns.device_index | string }}: domain: {{ d.domain }} bus: {{ d.bus }} slot: {{ d.slot }} function: {{ d.function }} -{% endif %} -{% endfor -%} +{%- set ns.device_index = ns.device_index + 1 -%} +{%- endif %} +{%- endfor -%} {%- endmacro -%} {%- macro gen_pci_passthrough( device_list ) -%} {%- for d in device_list %} -- 2.47.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 7/8] gen_nodes: fix YAML indentation in pcipassthrough template 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain ` (5 preceding siblings ...) 2025-08-11 20:12 ` [PATCH 6/8] gen_nodes: fix duplicate pcipassthrough keys in YAML output Luis Chamberlain @ 2025-08-11 20:12 ` 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 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain The template was generating malformed YAML with improper indentation and missing newlines between passthrough entries. This caused parsing errors: "Colons in unquoted values must be followed by a non-space character." Fixed by: - Removing the trailing whitespace stripping after 'pcipassthrough:' - Ensuring proper indentation for all passthrough entries - Maintaining consistent whitespace control throughout the macro The generated YAML now correctly produces a single 'pcipassthrough' key with properly indented sub-entries for all devices. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 b/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 index 6ad2af1..bb4e053 100644 --- a/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 +++ b/playbooks/roles/gen_nodes/templates/gen_nodes_list.j2 @@ -5,14 +5,13 @@ {%- if not ns.has_devices -%} {%- set ns.has_devices = true %} pcipassthrough: -{% endif -%} - passthrough{{ ns.device_index | string }}: +{% endif %} passthrough{{ ns.device_index | string }}: domain: {{ d.domain }} bus: {{ d.bus }} slot: {{ d.slot }} function: {{ d.function }} -{%- set ns.device_index = ns.device_index + 1 -%} -{%- endif %} +{% set ns.device_index = ns.device_index + 1 -%} +{%- endif -%} {%- endfor -%} {%- endmacro -%} {%- macro gen_pci_passthrough( device_list ) -%} -- 2.47.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 8/8] guestfs: fix PCIe passthrough device attachment 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain ` (6 preceding siblings ...) 2025-08-11 20:12 ` [PATCH 7/8] gen_nodes: fix YAML indentation in pcipassthrough template Luis Chamberlain @ 2025-08-11 20:12 ` Luis Chamberlain 2025-08-11 20:38 ` [PATCH 0/8] various fixes Chuck Lever 8 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 20:12 UTC (permalink / raw) To: Chuck Lever, Daniel Gomez, kdevops; +Cc: Luis Chamberlain The virsh attach-device command was receiving the entire file information dictionary instead of just the file path, causing: error: Failed to open file '{'path': '/path/to/file.xml', ...}' Fixed by using {{ item.path }} instead of {{ item }} to extract just the file path from the find results. Generated-by: Claude AI Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- playbooks/roles/guestfs/tasks/bringup/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/roles/guestfs/tasks/bringup/main.yml b/playbooks/roles/guestfs/tasks/bringup/main.yml index af95c5d..deb0846 100644 --- a/playbooks/roles/guestfs/tasks/bringup/main.yml +++ b/playbooks/roles/guestfs/tasks/bringup/main.yml @@ -119,7 +119,7 @@ - "virsh" - "attach-device" - "{{ inventory_hostname }}" - - "{{ item }}" + - "{{ item.path }}" - "--config" loop: "{{ passthrough_devices.files }}" loop_control: -- 2.47.2 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 0/8] various fixes 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain ` (7 preceding siblings ...) 2025-08-11 20:12 ` [PATCH 8/8] guestfs: fix PCIe passthrough device attachment Luis Chamberlain @ 2025-08-11 20:38 ` Chuck Lever 2025-08-11 21:31 ` Luis Chamberlain 8 siblings, 1 reply; 11+ messages in thread From: Chuck Lever @ 2025-08-11 20:38 UTC (permalink / raw) To: Luis Chamberlain, Daniel Gomez, kdevops On 8/11/25 4:12 PM, Luis Chamberlain wrote: > I took a GPU out for a spin for PCI passthrough and found that the > vagrant removal nuked some things for it, this fixes that and enhances > the PCI passthrough listing with sensible names. Very pleased to see this! Reviewed-by: Chuck Lever <chuck.lever@oracle.com> > While at it, this also includes a fix to gest us through the debian > trixie to forky transition, allowing our host and target nodes to > upgrade. > > Luis Chamberlain (8): > libvirt: fix PCI-E passthrough configuration after Vagrant removal > gen-dynamic-pci: fix PCI passthrough target guest default value > gen-dynamic-pci: add GPU detection and naming support > guestfs / devconfig: allow for upgrade from Debian testing to forky > guestfs: add OVMF package for UEFI firmware support > gen_nodes: fix duplicate pcipassthrough keys in YAML output > gen_nodes: fix YAML indentation in pcipassthrough template > guestfs: fix PCIe passthrough device attachment > > kconfigs/Kconfig.libvirt | 43 ++++ > .../dynamic-kconfig/gen-dynamic-pci.py | 198 +++++++++++++++++- > .../tasks/install-deps/debian/main.yml | 9 + > .../gen_nodes/templates/gen_nodes_list.j2 | 14 +- > .../gen_nodes/templates/guestfs_nodes.j2 | 2 +- > playbooks/roles/gen_nodes/templates/hosts.j2 | 4 +- > .../roles/guestfs/tasks/bringup/main.yml | 2 +- > .../tasks/install-deps/debian/main.yml | 9 + > scripts/check_pciepassthrough_kconfig.sh | 15 +- > 9 files changed, 275 insertions(+), 21 deletions(-) > -- Chuck Lever ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/8] various fixes 2025-08-11 20:38 ` [PATCH 0/8] various fixes Chuck Lever @ 2025-08-11 21:31 ` Luis Chamberlain 0 siblings, 0 replies; 11+ messages in thread From: Luis Chamberlain @ 2025-08-11 21:31 UTC (permalink / raw) To: Chuck Lever; +Cc: Daniel Gomez, kdevops On Mon, Aug 11, 2025 at 04:38:10PM -0400, Chuck Lever wrote: > On 8/11/25 4:12 PM, Luis Chamberlain wrote: > > I took a GPU out for a spin for PCI passthrough and found that the > > vagrant removal nuked some things for it, this fixes that and enhances > > the PCI passthrough listing with sensible names. > > Very pleased to see this! > > Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Great thanks, pushed, I added just one more minor fix patch onto the queue for make destroy. Luis ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-08-11 21:31 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-08-11 20:12 [PATCH 0/8] various fixes Luis Chamberlain 2025-08-11 20:12 ` [PATCH 1/8] libvirt: fix PCI-E passthrough configuration after Vagrant removal Luis Chamberlain 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox