mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gerd Bayer <gbayer@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>,
	Niklas Schnelle <schnelle@linux.ibm.com>,
	Gerald Schaefer <gerald.schaefer@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,
	Farhan Ali <alifm@linux.ibm.com>
Subject: Re: [PATCH v9 2/2] s390/pci: Migrate s390 IRQ logic to IRQ domain API
Date: Thu, 04 Dec 2025 10:59:25 +0100	[thread overview]
Message-ID: <5e1e50a004a7faf758872380db66876371b32631.camel@linux.ibm.com> (raw)
In-Reply-To: <20251204-implement-msi-domain-v9-2-d2152235701b@linux.ibm.com>

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@linutronix.de
> 

  [ ... snip ... ]
> 
> Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com>
> Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
> Signed-off-by: Tobias Schumacher <ts@linux.ibm.com>
> ---
>  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@linux.ibm.com>

  reply	other threads:[~2025-12-04  9:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  5:05 [PATCH v9 0/2] genirq: s390/pci: Migrate MSI interrupts to irqdomain API Tobias Schumacher
2025-12-04  5:05 ` [PATCH v9 1/2] genirq: Change hwirq parameter to irq_hw_number_t Tobias Schumacher
2025-12-04  5:05 ` [PATCH v9 2/2] s390/pci: Migrate s390 IRQ logic to IRQ domain API Tobias Schumacher
2025-12-04  9:59   ` Gerd Bayer [this message]
2025-12-04 11:20 ` [PATCH v9 0/2] genirq: s390/pci: Migrate MSI interrupts to irqdomain API Heiko Carstens
2025-12-04 11:46   ` Niklas Schnelle

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=5e1e50a004a7faf758872380db66876371b32631.camel@linux.ibm.com \
    --to=gbayer@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=alifm@linux.ibm.com \
    --cc=borntraeger@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=schnelle@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

all inboxes | Powered by JetHome®