** Description changed: + [Impact] + + KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest + + The commit 9576730d0e6e ("KVM: PPC: select IRQ_BYPASS_MANAGER") enabled + IRQ_BYPASS_MANAGER when CONFIG_KVM was set. Subsequently, commit + c57875f5f9be ("KVM: PPC: Book3S HV: Enable IRQ bypass") enabled IRQ + bypass and added the necessary callbacks to create/remove the mappings + between host real IRQ and the guest GSI. + + The availability of IRQ bypass is determined by the arch-specific + function kvm_arch_has_irq_bypass(), which invokes + kvmppc_irq_bypass_add_producer_hv(). This function, in turn, calls + kvmppc_set_passthru_irq_hv() to create a mapping in the passthrough IRQ + map, associating a host IRQ to a guest GSI. + + However, when a pSeries KVM guest (L2) is booted within an LPAR (L1) + with the kernel boot parameter `xive=off`, it defaults to using emulated + XICS controller. As an attempt to establish host IRQ to guest GSI + mappings via kvmppc_set_passthru_irq() on a PCI device hotplug + (passhthrough) operation fail, returning -ENOENT. This failure occurs + because only interrupts with EOI operations handled through OPAL calls + (verified via is_pnv_opal_msi()) are currently supported. + + These mapping failures lead to below repeated warnings in the L1 host: + + [ 509.220349] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (58,4970) + [ 509.220368] kvmppc_set_passthru_irq (irq 58, gsi 4970) fails: -2 + [ 509.220376] vfio-pci 0015:01:00.0: irq bypass producer (token 0000000090bc635b) registration fails: -2 + ... + [ 509.291781] vfio-pci 0015:01:00.0: irq bypass producer (token 000000003822eed8) registration fails: -2 + + Fix this by restricting IRQ bypass enablement on pSeries systems by + making the IRQ bypass callbacks unavailable when running on pSeries + platform. + + [Fix] + + Backport from mainline: + - ccdb36cbe65f KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest + + [Test Plan] + + The issue can be tested executing the following steps: + + 1. Start a guest with kernel + 2. unbind the pci device from host using below command + + root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_0 + Device pci_0028_01_00_0 detached + root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_1 + Device pci_0028_01_00_1 detached + + 3. Now attach the pci device to guest using virsh attach-device command. + The xml snippet used is given below + + root@ltcrain8og-lp6:~/NET# vi pci2.xml + <hostdev mode='subsystem' type='pci' managed='yes'> + <source> + <address domain='0x0028' bus='0x01' slot='0x00' function='0x0'/> + </source> + </hostdev> + + root@ltcrain8og-lp6:~/NET# virsh attach-device vm pci2.xml + Device attached successfully + + 4. Verify that on guest side the pci device gets attached successfully, + and the interface comes up. Moreover, check that the kernel ring buffer + does not show any error of the following type: + + [57906.347794] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) + [57906.347812] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 + [57906.347817] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 + + [Where Problems Could Occur] + + The fix affects the IRQ bypass infrastructure in the PowerPC KVM hypervisor, + specifically the initialization of architecture-specific callback handlers for IRQ passthrough. An issue with this fix may introduce problems such as the VFIO subsystem failing to handle IRQ bypass even on capable PowerNV systems. + + --- + ---Problem Description--- kvmppc_set_passthru_irq_hv: Could not assign IRQ map traces are seen when pci device is attached to kvm guest when "xive=off" is set root@ltcrain8og-lp6:~# lspci 0028:01:00.0 Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] 0028:01:00.1 Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] root@ltcrain8og-lp6:~/NET# lspci -nnk -s 0028:01:00.0 0028:01:00.0 Ethernet controller [0200]: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] [15b3:1015] - Subsystem: IBM Device [1014:061e] - Kernel driver in use: vfio-pci - Kernel modules: mlx5_core + Subsystem: IBM Device [1014:061e] + Kernel driver in use: vfio-pci + Kernel modules: mlx5_core root@ltcrain8og-lp6:~/NET# lspci -nnk -s 0028:01:00.1 0028:01:00.1 Ethernet controller [0200]: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] [15b3:1015] - Subsystem: IBM Device [1014:061e] - Kernel driver in use: vfio-pci - Kernel modules: mlx5_core - - + Subsystem: IBM Device [1014:061e] + Kernel driver in use: vfio-pci + Kernel modules: mlx5_core --- Steps to reproduce --- 1. Start a guest with kernel 2. unbind the pci device from host using below command root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_0 Device pci_0028_01_00_0 detached root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_1 Device pci_0028_01_00_1 detached 3. Now attach the pci device to guest using virsh attach-device command. The xml snippet used is given below root@ltcrain8og-lp6:~/NET# vi pci2.xml <hostdev mode='subsystem' type='pci' managed='yes'> - <source> - <address domain='0x0028' bus='0x01' slot='0x00' function='0x0'/> - </source> + <source> + <address domain='0x0028' bus='0x01' slot='0x00' function='0x0'/> + </source> </hostdev> - root@ltcrain8og-lp6:~/NET# virsh attach-device vm pci2.xml + root@ltcrain8og-lp6:~/NET# virsh attach-device vm pci2.xml Device attached successfully 4. On guest side the pci device gets attached successfully, and interface comes up. But the following traces are seen every time the device is attached [57906.347794] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.347812] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.347817] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.357879] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.357885] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.357889] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.357983] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (101,4901) [57906.357986] kvmppc_set_passthru_irq (irq 101, gsi 4901) fails: -2 [57906.357989] vfio-pci 0028:01:00.0: irq bypass producer (token 0000000024362fe0) registration fails: -2 [57906.368181] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.368187] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.368190] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.368283] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (101,4901) [57906.368288] kvmppc_set_passthru_irq (irq 101, gsi 4901) fails: -2 [57906.368292] vfio-pci 0028:01:00.0: irq bypass producer (token 0000000024362fe0) registration fails: -2 [57906.368384] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (102,4902) [57906.368389] kvmppc_set_passthru_irq (irq 102, gsi 4902) fails: -2 [57906.368392] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000f9dfc684) registration fails: -2 [57906.378034] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.378039] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.378042] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.378135] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (101,4901) [57906.378140] kvmppc_set_passthru_irq (irq 101, gsi 4901) fails: -2 [57906.378143] vfio-pci 0028:01:00.0: irq bypass producer (token 0000000024362fe0) registration fails: -2 [57906.378234] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (102,4902) [57906.378238] kvmppc_set_passthru_irq (irq 102, gsi 4902) fails: -2 + Contact Information = sthou...@in.ibm.com - Contact Information = sthou...@in.ibm.com - ---uname output--- na - - Machine Type = NA - + + Machine Type = NA + ---Debugger--- A debugger is not configured - Posted v1 upstream: - https://lore.kernel.org/all/20250425185641.1611857-1-amach...@linux.ibm.com/ + https://lore.kernel.org/all/20250425185641.1611857-1-amach...@linux.ibm.com/ ~Amit mirorring to distro for awareness.
-- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux in Ubuntu. https://bugs.launchpad.net/bugs/2109951 Title: kvmppc_set_passthru_irq_hv: Could not assign IRQ map traces are seen when pci device is attached to kvm guest when "xive=off" is set Status in The Ubuntu-power-systems project: Triaged Status in linux package in Ubuntu: Invalid Status in linux source package in Noble: In Progress Status in linux source package in Plucky: In Progress Status in linux source package in Questing: Invalid Bug description: [Impact] KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest The commit 9576730d0e6e ("KVM: PPC: select IRQ_BYPASS_MANAGER") enabled IRQ_BYPASS_MANAGER when CONFIG_KVM was set. Subsequently, commit c57875f5f9be ("KVM: PPC: Book3S HV: Enable IRQ bypass") enabled IRQ bypass and added the necessary callbacks to create/remove the mappings between host real IRQ and the guest GSI. The availability of IRQ bypass is determined by the arch-specific function kvm_arch_has_irq_bypass(), which invokes kvmppc_irq_bypass_add_producer_hv(). This function, in turn, calls kvmppc_set_passthru_irq_hv() to create a mapping in the passthrough IRQ map, associating a host IRQ to a guest GSI. However, when a pSeries KVM guest (L2) is booted within an LPAR (L1) with the kernel boot parameter `xive=off`, it defaults to using emulated XICS controller. As an attempt to establish host IRQ to guest GSI mappings via kvmppc_set_passthru_irq() on a PCI device hotplug (passhthrough) operation fail, returning -ENOENT. This failure occurs because only interrupts with EOI operations handled through OPAL calls (verified via is_pnv_opal_msi()) are currently supported. These mapping failures lead to below repeated warnings in the L1 host: [ 509.220349] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (58,4970) [ 509.220368] kvmppc_set_passthru_irq (irq 58, gsi 4970) fails: -2 [ 509.220376] vfio-pci 0015:01:00.0: irq bypass producer (token 0000000090bc635b) registration fails: -2 ... [ 509.291781] vfio-pci 0015:01:00.0: irq bypass producer (token 000000003822eed8) registration fails: -2 Fix this by restricting IRQ bypass enablement on pSeries systems by making the IRQ bypass callbacks unavailable when running on pSeries platform. [Fix] Backport from mainline: - ccdb36cbe65f KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest [Test Plan] The issue can be tested executing the following steps: 1. Start a guest with kernel 2. unbind the pci device from host using below command root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_0 Device pci_0028_01_00_0 detached root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_1 Device pci_0028_01_00_1 detached 3. Now attach the pci device to guest using virsh attach-device command. The xml snippet used is given below root@ltcrain8og-lp6:~/NET# vi pci2.xml <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0028' bus='0x01' slot='0x00' function='0x0'/> </source> </hostdev> root@ltcrain8og-lp6:~/NET# virsh attach-device vm pci2.xml Device attached successfully 4. Verify that on guest side the pci device gets attached successfully, and the interface comes up. Moreover, check that the kernel ring buffer does not show any error of the following type: [57906.347794] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.347812] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.347817] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [Where Problems Could Occur] The fix affects the IRQ bypass infrastructure in the PowerPC KVM hypervisor, specifically the initialization of architecture-specific callback handlers for IRQ passthrough. An issue with this fix may introduce problems such as the VFIO subsystem failing to handle IRQ bypass even on capable PowerNV systems. --- ---Problem Description--- kvmppc_set_passthru_irq_hv: Could not assign IRQ map traces are seen when pci device is attached to kvm guest when "xive=off" is set root@ltcrain8og-lp6:~# lspci 0028:01:00.0 Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] 0028:01:00.1 Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] root@ltcrain8og-lp6:~/NET# lspci -nnk -s 0028:01:00.0 0028:01:00.0 Ethernet controller [0200]: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] [15b3:1015] Subsystem: IBM Device [1014:061e] Kernel driver in use: vfio-pci Kernel modules: mlx5_core root@ltcrain8og-lp6:~/NET# lspci -nnk -s 0028:01:00.1 0028:01:00.1 Ethernet controller [0200]: Mellanox Technologies MT27710 Family [ConnectX-4 Lx] [15b3:1015] Subsystem: IBM Device [1014:061e] Kernel driver in use: vfio-pci Kernel modules: mlx5_core --- Steps to reproduce --- 1. Start a guest with kernel 2. unbind the pci device from host using below command root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_0 Device pci_0028_01_00_0 detached root@ltcrain8og-lp6:~/NET# virsh nodedev-detach pci_0028_01_00_1 Device pci_0028_01_00_1 detached 3. Now attach the pci device to guest using virsh attach-device command. The xml snippet used is given below root@ltcrain8og-lp6:~/NET# vi pci2.xml <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0028' bus='0x01' slot='0x00' function='0x0'/> </source> </hostdev> root@ltcrain8og-lp6:~/NET# virsh attach-device vm pci2.xml Device attached successfully 4. On guest side the pci device gets attached successfully, and interface comes up. But the following traces are seen every time the device is attached [57906.347794] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.347812] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.347817] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.357879] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.357885] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.357889] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.357983] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (101,4901) [57906.357986] kvmppc_set_passthru_irq (irq 101, gsi 4901) fails: -2 [57906.357989] vfio-pci 0028:01:00.0: irq bypass producer (token 0000000024362fe0) registration fails: -2 [57906.368181] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.368187] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.368190] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.368283] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (101,4901) [57906.368288] kvmppc_set_passthru_irq (irq 101, gsi 4901) fails: -2 [57906.368292] vfio-pci 0028:01:00.0: irq bypass producer (token 0000000024362fe0) registration fails: -2 [57906.368384] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (102,4902) [57906.368389] kvmppc_set_passthru_irq (irq 102, gsi 4902) fails: -2 [57906.368392] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000f9dfc684) registration fails: -2 [57906.378034] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (100,4900) [57906.378039] kvmppc_set_passthru_irq (irq 100, gsi 4900) fails: -2 [57906.378042] vfio-pci 0028:01:00.0: irq bypass producer (token 00000000c84b35a9) registration fails: -2 [57906.378135] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (101,4901) [57906.378140] kvmppc_set_passthru_irq (irq 101, gsi 4901) fails: -2 [57906.378143] vfio-pci 0028:01:00.0: irq bypass producer (token 0000000024362fe0) registration fails: -2 [57906.378234] kvmppc_set_passthru_irq_hv: Could not assign IRQ map for (102,4902) [57906.378238] kvmppc_set_passthru_irq (irq 102, gsi 4902) fails: -2 Contact Information = sthou...@in.ibm.com ---uname output--- na Machine Type = NA ---Debugger--- A debugger is not configured Posted v1 upstream: https://lore.kernel.org/all/20250425185641.1611857-1-amach...@linux.ibm.com/ ~Amit mirorring to distro for awareness. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu-power-systems/+bug/2109951/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp