From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Tobias Schumacher <ts@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Gerd Bayer <gbayer@linux.ibm.com>,
Halil Pasic <pasic@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH 2/2] s390/pci: Migrate s390 IRQ logic to IRQ domain API
Date: Thu, 13 Nov 2025 13:19:01 +0100 [thread overview]
Message-ID: <5a87fee183963db08fd848f9d9ad7cf351d04f95.camel@linux.ibm.com> (raw)
In-Reply-To: <20251112-implement-msi-domain-v1-2-103dd123de14@linux.ibm.com>
On Wed, 2025-11-12 at 16:40 +0100, Tobias Schumacher wrote:
> s390 is one of the last architectures using the legacy API for setup and
> teardown of PCI MSI IRQs. Migrate the s390 IRQ allocation and teardown
> to the MSI parent domain API. For details, see:
>
> https://lore.kernel.org/lkml/20221111120501.026511281@linutronix.de
>
> In detail, create an MSI parent domain for zpci which is used by
> all PCI devices. When a PCI device sets up MSI or MSI-X IRQs, the
> library creates a per-device IRQ domain for this device, which is
> be used by the device for allocating and freeing IRQs.
Nit: superfluous word "be"
>
> The per-device domain delegates this allocation and freeing to the
> parent-domain. In the end, the corresponding callbacks of the parent
> domain are responsible for allocating and freeing the IRQs.
--- snip ---
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index df22b10d91415e1ed183cc8add9ad0ac4293c50e..739a9a9a86a277be1ba750cb2e98af0547df89fd 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -251,6 +251,7 @@ config S390
> select HOTPLUG_SMT
> select IOMMU_HELPER if PCI
> select IOMMU_SUPPORT if PCI
> + select IRQ_MSI_LIB if PCI
The indentation is wrong here, instead of two spaces you want one tab
to match the context.
> select KASAN_VMALLOC if KASAN
> select LOCK_MM_AND_FIND_VMA
> select MMU_GATHER_MERGE_VMAS
--- snip ---
> +
> +static int zpci_msi_prepare(struct irq_domain *domain,
> + struct device *dev, int nvec,
> + msi_alloc_info_t *info)
> +{
--- snip ---
> -
> - msg.data = hwirq - bit;
> + zdev->msi_first_bit = bit;
> + rc = zpci_set_irq(zdev);
> + if (rc) {
> + pr_err("Registering floating adapter interruptions for %s failed\n",
> + pci_name(pdev));
The error message is misleading as this could also happen for directed.
I'd just drop the "floating" in there. Also the wording is inconsistent
with the error message for allocation. I don't really have a preference
between "AIRQ" and "adapter interruptions" but from a Linux point of
view I think IRQ would be what I'd be grepping for which finds the
former.
> if (irq_delivery == DIRECTED) {
> - if (msi->affinity)
--- snip ---
>
> +static int __init zpci_create_parent_msi_domain(void)
> +{
> + struct irq_domain_info info = {
> + .fwnode = irq_domain_alloc_named_fwnode("zpci_msi"),
> + .ops = &zpci_msi_domain_ops
> + };
Nit: Missing empty line as the above is a variable definition
> + if (!info.fwnode) {
> + pr_err("Failed to allocate fwnode for MSI IRQ domain\n");
> + return -ENOMEM;
> + }
> +
> + zpci_msi_parent_domain = msi_create_parent_irq_domain(&info, &zpci_msi_parent_ops);
> + if (!zpci_msi_parent_domain) {
> + irq_domain_free_fwnode(info.fwnode);
> + pr_err("Failed to create MSI IRQ domain\n");
> + return -ENOMEM;
> + }
> +
> + return 0;
> +}
> +
>
>
--- snip ---
> @@ -549,6 +625,7 @@ void __init zpci_irq_exit(void)
> }
> }
> kfree(zpci_ibv);
> + irq_domain_remove(zpci_msi_parent_domain);
> if (zpci_sbv)
> airq_iv_release(zpci_sbv);
> unregister_adapter_interrupt(&zpci_airq);
Shouldn't zpci_irq_exit() also call irq_domain_free_fwnode() with
zpci_msi_parent_domain->fwnode? Otherwise I think a potential
subsequent zpci_irq_init() would fail because the fwnode already
exists. Not that we currently ever do that but still it should be all
undone.
Overall this looks great to me. I did run into an issue with my
experimental directed IRQ setup, we can work off list to solve this
before v2.
Thanks,
Niklas
prev parent reply other threads:[~2025-11-13 12:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 15:40 [PATCH 0/2] genirq: s390/pci: Migrate MSI interrupts to irqdomain API Tobias Schumacher
2025-11-12 15:40 ` [PATCH 1/2] genirq: Change hwirq parameter to irq_hw_number_t Tobias Schumacher
2025-11-13 7:46 ` Thomas Gleixner
2025-11-12 15:40 ` [PATCH 2/2] s390/pci: Migrate s390 IRQ logic to IRQ domain API Tobias Schumacher
2025-11-13 12:19 ` Niklas Schnelle [this message]
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=5a87fee183963db08fd848f9d9ad7cf351d04f95.camel@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gbayer@linux.ibm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=ts@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