From: Vaibhav Jain <vaibhav@linux.ibm.com>
To: Amit Machhiwal <amachhiw@linux.ibm.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Cc: Amit Machhiwal <amachhiw@linux.ibm.com>,
Shivaprasad G Bhat <sbhat@linux.ibm.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Naveen N Rao <naveen@kernel.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: Book3S HV: Fix IRQ map warnings with XICS on pSeries KVM Guest
Date: Mon, 05 May 2025 14:23:41 +0530 [thread overview]
Message-ID: <87y0vba162.fsf@vajain21.in.ibm.com> (raw)
In-Reply-To: <20250425185641.1611857-1-amachhiw@linux.ibm.com>
Thanks Amit for the patch.
Amit Machhiwal <amachhiw@linux.ibm.com> writes:
> 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>
Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com>
> ---
> arch/powerpc/kvm/book3s_hv.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 19f4d298dd17..7667563fb9ff 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -6541,10 +6541,6 @@ static struct kvmppc_ops kvm_ops_hv = {
> .fast_vcpu_kick = kvmppc_fast_vcpu_kick_hv,
> .arch_vm_ioctl = kvm_arch_vm_ioctl_hv,
> .hcall_implemented = kvmppc_hcall_impl_hv,
> -#ifdef CONFIG_KVM_XICS
> - .irq_bypass_add_producer = kvmppc_irq_bypass_add_producer_hv,
> - .irq_bypass_del_producer = kvmppc_irq_bypass_del_producer_hv,
> -#endif
> .configure_mmu = kvmhv_configure_mmu,
> .get_rmmu_info = kvmhv_get_rmmu_info,
> .set_smt_mode = kvmhv_set_smt_mode,
> @@ -6662,6 +6658,22 @@ static int kvmppc_book3s_init_hv(void)
> return r;
> }
>
> +#if defined(CONFIG_KVM_XICS)
> + /*
> + * IRQ bypass is supported only for interrupts whose EOI operations are
> + * handled via OPAL calls. Therefore, register IRQ bypass handlers
> + * exclusively for PowerNV KVM when booted with 'xive=off', indicating
> + * the use of the emulated XICS interrupt controller.
> + */
> + if (!kvmhv_on_pseries()) {
> + pr_info("KVM-HV: Enabling IRQ bypass\n");
> + kvm_ops_hv.irq_bypass_add_producer =
> + kvmppc_irq_bypass_add_producer_hv;
> + kvm_ops_hv.irq_bypass_del_producer =
> + kvmppc_irq_bypass_del_producer_hv;
> + }
> +#endif
> +
> kvm_ops_hv.owner = THIS_MODULE;
> kvmppc_hv_ops = &kvm_ops_hv;
>
>
> base-commit: 6e3597f12dce7d5041e604fec3602493e38c330a
> --
> 2.49.0
>
--
Cheers
~ Vaibhav
next prev parent reply other threads:[~2025-05-05 8:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-25 18:56 Amit Machhiwal
2025-05-05 8:53 ` Vaibhav Jain [this message]
2025-05-09 13:49 ` Gautam Menghani
2025-05-18 3:43 ` Madhavan Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y0vba162.fsf@vajain21.in.ibm.com \
--to=vaibhav@linux.ibm.com \
--cc=amachhiw@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=sbhat@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®