]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest
authorAmit Machhiwal <amachhiw@linux.ibm.com>
Fri, 25 Apr 2025 18:56:41 +0000 (00:26 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Mon, 12 May 2025 04:49:29 +0000 (10:19 +0530)
commitccdb36cbe65fe05fd5349c7ee5a59e53be7fe195
tree66130ecdfed17ba10a7fd775956cabc2bcaab701
parentf9cb1476ade41ba859e6f41323e76284b297d7c2
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.

Signed-off-by: Amit Machhiwal <amachhiw@linux.ibm.com>
Tested-by: Gautam Menghani <gautam@linux.ibm.com>
Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250425185641.1611857-1-amachhiw@linux.ibm.com
arch/powerpc/kvm/book3s_hv.c