Re: [PATCH v9 2/2] s390/pci: Migrate s390 IRQ logic to IRQ domain API
From: Gerd Bayer
Date: Thu Dec 04 2025 - 04:59:33 EST
On Thu, 2025-12-04 at 06:05 +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@xxxxxxxxxxxxx
>
[ ... snip ... ]
>
> Reviewed-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
> Reviewed-by: Farhan Ali <alifm@xxxxxxxxxxxxx>
> Signed-off-by: Tobias Schumacher <ts@xxxxxxxxxxxxx>
> ---
> arch/s390/Kconfig | 1 +
> arch/s390/include/asm/pci.h | 5 +
> arch/s390/pci/pci.c | 6 +
> arch/s390/pci/pci_bus.c | 18 ++-
> arch/s390/pci/pci_irq.c | 332 +++++++++++++++++++++++++++++---------------
> 5 files changed, 247 insertions(+), 115 deletions(-)
>
[ ... snip ... ]
> +static void zpci_msi_clear_airq(struct irq_data *d, int i)
> {
> - struct zpci_dev *zdev = to_zpci(pdev);
> - struct msi_desc *msi;
> - unsigned int i;
> - int rc;
> + struct msi_desc *desc = irq_data_get_msi_desc(d);
> + struct zpci_dev *zdev = to_zpci_dev(desc->dev);
> + unsigned long bit;
> + unsigned int cpu;
> + u16 msi_index;
>
> - /* Disable interrupts */
> - rc = zpci_clear_irq(zdev);
> - if (rc)
> - return;
> + msi_index = zpci_decode_hwirq_msi_index(d->hwirq);
> + bit = zdev->msi_first_bit + msi_index;
>
> - /* Release MSI interrupts */
> - msi_for_each_desc(msi, &pdev->dev, MSI_DESC_ASSOCIATED) {
> - for (i = 0; i < msi->nvec_used; i++) {
> - irq_set_msi_desc(msi->irq + i, NULL);
> - irq_free_desc(msi->irq + i);
> + if (irq_delivery == DIRECTED) {
> + for_each_possible_cpu(cpu) {
> + airq_iv_set_ptr(zpci_ibv[cpu], bit + i, 0);
> + airq_iv_set_data(zpci_ibv[cpu], bit + i, 0);
> }
> - msi->msg.address_lo = 0;
> - msi->msg.address_hi = 0;
> - msi->msg.data = 0;
> - msi->irq = 0;
> + } else {
> + airq_iv_set_ptr(zdev->aibv, bit + i, 0);
> + airq_iv_set_data(zdev->aibv, bit + i, 0);
> }
> +}
>
> - if (zdev->aisb != -1UL) {
> - zpci_ibv[zdev->aisb] = NULL;
> - airq_iv_free_bit(zpci_sbv, zdev->aisb);
> - zdev->aisb = -1UL;
> - }
> - if (zdev->aibv) {
> - airq_iv_release(zdev->aibv);
> - zdev->aibv = NULL;
> - }
> +static void zpci_msi_domain_free(struct irq_domain *domain, unsigned int virq,
> + unsigned int nr_irqs)
> +{
> + struct irq_data *d;
> + int i;
>
> - if ((irq_delivery == DIRECTED) && zdev->msi_first_bit != -1U)
> - airq_iv_free(zpci_ibv[0], zdev->msi_first_bit, zdev->msi_nr_irqs);
> + for (i = 0; i < nr_irqs; i++) {
> + d = irq_domain_get_irq_data(domain, virq + i);
> + zpci_msi_clear_airq(d, i);
> + irq_domain_reset_irq_data(d);
> + }
> }
>
Thanks for your great work and for addressing all my issues!
Feel free to add
Reviewed-by: Gerd Bayer <gbayer@xxxxxxxxxxxxx>