Skip to content

Commit ccdb36c

Browse files
Amit Machhiwalmaddy-kerneldev
authored andcommitted
KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest
The commit 9576730 ("KVM: PPC: select IRQ_BYPASS_MANAGER") enabled IRQ_BYPASS_MANAGER when CONFIG_KVM was set. Subsequently, commit c57875f ("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 <[email protected]> Tested-by: Gautam Menghani <[email protected]> Reviewed-by: Vaibhav Jain <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent f9cb147 commit ccdb36c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

arch/powerpc/kvm/book3s_hv.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6541,10 +6541,6 @@ static struct kvmppc_ops kvm_ops_hv = {
65416541
.fast_vcpu_kick = kvmppc_fast_vcpu_kick_hv,
65426542
.arch_vm_ioctl = kvm_arch_vm_ioctl_hv,
65436543
.hcall_implemented = kvmppc_hcall_impl_hv,
6544-
#ifdef CONFIG_KVM_XICS
6545-
.irq_bypass_add_producer = kvmppc_irq_bypass_add_producer_hv,
6546-
.irq_bypass_del_producer = kvmppc_irq_bypass_del_producer_hv,
6547-
#endif
65486544
.configure_mmu = kvmhv_configure_mmu,
65496545
.get_rmmu_info = kvmhv_get_rmmu_info,
65506546
.set_smt_mode = kvmhv_set_smt_mode,
@@ -6662,6 +6658,22 @@ static int kvmppc_book3s_init_hv(void)
66626658
return r;
66636659
}
66646660

6661+
#if defined(CONFIG_KVM_XICS)
6662+
/*
6663+
* IRQ bypass is supported only for interrupts whose EOI operations are
6664+
* handled via OPAL calls. Therefore, register IRQ bypass handlers
6665+
* exclusively for PowerNV KVM when booted with 'xive=off', indicating
6666+
* the use of the emulated XICS interrupt controller.
6667+
*/
6668+
if (!kvmhv_on_pseries()) {
6669+
pr_info("KVM-HV: Enabling IRQ bypass\n");
6670+
kvm_ops_hv.irq_bypass_add_producer =
6671+
kvmppc_irq_bypass_add_producer_hv;
6672+
kvm_ops_hv.irq_bypass_del_producer =
6673+
kvmppc_irq_bypass_del_producer_hv;
6674+
}
6675+
#endif
6676+
66656677
kvm_ops_hv.owner = THIS_MODULE;
66666678
kvmppc_hv_ops = &kvm_ops_hv;
66676679

0 commit comments

Comments
 (0)