From: "Tobias Schumacher" <ts@linux.ibm.com>
To: "Gerd Bayer" <gbayer@linux.ibm.com>,
"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 v8 2/2] s390/pci: Migrate s390 IRQ logic to IRQ domain API
Date: Thu, 04 Dec 2025 05:54:33 +0100 [thread overview]
Message-ID: <DEP5X6S6TRTK.1EM2YD3IT92B9@linux.ibm.com> (raw)
In-Reply-To: <0506645063efd6c1472c3b787b5195e96e18048e.camel@linux.ibm.com>
On Wed Dec 3, 2025 at 5:14 PM CET, Gerd Bayer wrote:
> On Wed, 2025-12-03 at 15:36 +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 ... ]
>
>> +static void zpci_msi_domain_free(struct irq_domain *domain, unsigned int virq,
>> + unsigned int nr_irqs)
>> +{
>> + struct zpci_dev *zdev;
>> + struct msi_desc *desc;
>> + struct irq_data *d;
>> + unsigned long bit;
>> + unsigned int cpu;
>> + u16 msi_index;
>> + int i;
>> +
>> + for (i = 0; i < nr_irqs; i++) {
>> + d = irq_domain_get_irq_data(domain, virq + i);
>> + msi_index = zpci_decode_hwirq_msi_index(d->hwirq);
>> + desc = irq_data_get_msi_desc(d);
>> + zdev = to_zpci_dev(desc->dev);
>> + bit = zdev->msi_first_bit + msi_index;
>>
>> + if (irq_delivery == DIRECTED) {
>> for_each_possible_cpu(cpu) {
>> - for (i = 0; i < irqs_per_msi; i++)
>> - airq_iv_set_data(zpci_ibv[cpu],
>> - hwirq + i, irq + i);
>> + airq_iv_set_ptr(zpci_ibv[cpu], bit + i, 0);
>> + airq_iv_set_data(zpci_ibv[cpu], bit + i, 0);
>> }
>> } else {
>> - msg.address_lo = zdev->msi_addr & 0xffffffff;
>> - for (i = 0; i < irqs_per_msi; i++)
>> - airq_iv_set_data(zdev->aibv, hwirq + i, irq + i);
>> + airq_iv_set_ptr(zdev->aibv, bit + i, 0);
>> + airq_iv_set_data(zdev->aibv, bit + i, 0);
>> }
>> - msg.address_hi = zdev->msi_addr >> 32;
>> - pci_write_msi_msg(irq, &msg);
>> - hwirq += irqs_per_msi;
>> +
>> + irq_domain_reset_irq_data(d);
>> }
>> +}
>
> Thanks for addressing my concern about clearing the airq data!
>
> FWIW, what you thing about abstracting out the airq clearing stuff with
> something like this diff on top, so the loop body remains somewhat
> short and zpci_msi_domain_free() keeps its working set of local
> variables.
Sounds good, will do.
> diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c
> index 5639789dc58f..3322d8c9aff1 100644
> --- a/arch/s390/pci/pci_irq.c
> +++ b/arch/s390/pci/pci_irq.c
> @@ -439,34 +439,37 @@ static int zpci_msi_domain_alloc(struct
> irq_domain *domain, unsigned int virq,
> return 0;
> }
>
> -static void zpci_msi_domain_free(struct irq_domain *domain, unsigned
> int virq,
> - unsigned int nr_irqs)
> +static void zpci_msi_clear_airq(struct irq_data *d, int i)
> {
> - struct zpci_dev *zdev;
> - struct msi_desc *desc;
> - struct irq_data *d;
> + 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;
> - int i;
>
> - for (i = 0; i < nr_irqs; i++) {
> - d = irq_domain_get_irq_data(domain, virq + i);
> - msi_index = zpci_decode_hwirq_msi_index(d->hwirq);
> - desc = irq_data_get_msi_desc(d);
> - zdev = to_zpci_dev(desc->dev);
> - bit = zdev->msi_first_bit + msi_index;
> + msi_index = zpci_decode_hwirq_msi_index(d->hwirq);
> + bit = zdev->msi_first_bit + msi_index;
>
> - 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);
> - }
> - } else {
> - airq_iv_set_ptr(zdev->aibv, bit + i, 0);
> - airq_iv_set_data(zdev->aibv, bit + i, 0);
> + 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);
> }
> + } else {
> + airq_iv_set_ptr(zdev->aibv, bit + i, 0);
> + airq_iv_set_data(zdev->aibv, bit + i, 0);
> + }
> +}
>
> +static void zpci_msi_domain_free(struct irq_domain *domain, unsigned
> int virq,
> + unsigned int nr_irqs)
> +{
> + struct irq_data *d;
> + int i;
> +
> + 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);
> }
> }
>
> Sorry for me keeping nagging...
No worries :-)
Thanks
Tobias
prev parent reply other threads:[~2025-12-04 4:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 14:36 [PATCH v8 0/2] genirq: s390/pci: Migrate MSI interrupts to irqdomain API Tobias Schumacher
2025-12-03 14:36 ` [PATCH v8 1/2] genirq: Change hwirq parameter to irq_hw_number_t Tobias Schumacher
2025-12-03 14:36 ` [PATCH v8 2/2] s390/pci: Migrate s390 IRQ logic to IRQ domain API Tobias Schumacher
2025-12-03 16:14 ` Gerd Bayer
2025-12-04 4:54 ` Tobias Schumacher [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=DEP5X6S6TRTK.1EM2YD3IT92B9@linux.ibm.com \
--to=ts@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=alifm@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=schnelle@linux.ibm.com \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
/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