From: Greg Kroah-Hartman Date: Sun, 18 Aug 2024 09:17:44 +0000 (+0200) Subject: drop more s390 changes from 5.10 and 5.15 X-Git-Tag: v4.19.320~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16c4e6c594a3d93e12b2442023108efac8168d11;p=thirdparty%2Fkernel%2Fstable-queue.git drop more s390 changes from 5.10 and 5.15 fixing the build... --- diff --git a/queue-5.10/s390-pci-allow-allocation-of-more-than-1-msi-interru.patch b/queue-5.10/s390-pci-allow-allocation-of-more-than-1-msi-interru.patch deleted file mode 100644 index 1e8df0ebb4e..00000000000 --- a/queue-5.10/s390-pci-allow-allocation-of-more-than-1-msi-interru.patch +++ /dev/null @@ -1,170 +0,0 @@ -From c26c953fc6df0ce006d600b53b9bee728af3be83 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 11 Jul 2024 15:45:27 +0200 -Subject: s390/pci: Allow allocation of more than 1 MSI interrupt - -From: Gerd Bayer - -[ Upstream commit ab42fcb511fd9d241bbab7cc3ca04e34e9fc0666 ] - -On a PCI adapter that provides up to 8 MSI interrupt sources the s390 -implementation of PCI interrupts rejected to accommodate them, although -the underlying hardware is able to support that. - -For MSI-X it is sufficient to allocate a single irq_desc per msi_desc, -but for MSI multiple irq descriptors are attached to and controlled by -a single msi descriptor. Add the appropriate loops to maintain multiple -irq descriptors and tie/untie them to/from the appropriate AIBV bit, if -a device driver allocates more than 1 MSI interrupt. - -Common PCI code passes on requests to allocate a number of interrupt -vectors based on the device drivers' demand and the PCI functions' -capabilities. However, the root-complex of s390 systems support just a -limited number of interrupt vectors per PCI function. -Produce a kernel log message to inform about any architecture-specific -capping that might be done. - -With this change, we had a PCI adapter successfully raising -interrupts to its device driver via all 8 sources. - -Fixes: a384c8924a8b ("s390/PCI: Fix single MSI only check") -Signed-off-by: Gerd Bayer -Reviewed-by: Niklas Schnelle -Signed-off-by: Vasily Gorbik -Signed-off-by: Sasha Levin ---- - arch/s390/pci/pci_irq.c | 62 ++++++++++++++++++++++++++++------------- - 1 file changed, 42 insertions(+), 20 deletions(-) - -diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c -index b36f5ef34a6c1..690f6999287bc 100644 ---- a/arch/s390/pci/pci_irq.c -+++ b/arch/s390/pci/pci_irq.c -@@ -262,8 +262,8 @@ static int __alloc_airq(struct zpci_dev *zdev, int msi_vecs, - - int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - { -+ unsigned int hwirq, msi_vecs, irqs_per_msi, i, cpu; - struct zpci_dev *zdev = to_zpci(pdev); -- unsigned int hwirq, msi_vecs, cpu; - struct msi_desc *msi; - struct msi_msg msg; - unsigned long bit; -@@ -273,30 +273,46 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - zdev->aisb = -1UL; - zdev->msi_first_bit = -1U; - -- if (type == PCI_CAP_ID_MSI && nvec > 1) -- return 1; - msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); -+ if (msi_vecs < nvec) { -+ pr_info("%s requested %d irqs, allocate system limit of %d", -+ pci_name(pdev), nvec, zdev->max_msi); -+ } - - rc = __alloc_airq(zdev, msi_vecs, &bit); - if (rc < 0) - return rc; - -- /* Request MSI interrupts */ -+ /* -+ * Request MSI interrupts: -+ * When using MSI, nvec_used interrupt sources and their irq -+ * descriptors are controlled through one msi descriptor. -+ * Thus the outer loop over msi descriptors shall run only once, -+ * while two inner loops iterate over the interrupt vectors. -+ * When using MSI-X, each interrupt vector/irq descriptor -+ * is bound to exactly one msi descriptor (nvec_used is one). -+ * So the inner loops are executed once, while the outer iterates -+ * over the MSI-X descriptors. -+ */ - hwirq = bit; - msi_for_each_desc(msi, &pdev->dev, MSI_DESC_NOTASSOCIATED) { -- rc = -EIO; - if (hwirq - bit >= msi_vecs) - break; -- irq = __irq_alloc_descs(-1, 0, 1, 0, THIS_MODULE, -- (irq_delivery == DIRECTED) ? -- msi->affinity : NULL); -+ irqs_per_msi = min_t(unsigned int, msi_vecs, msi->nvec_used); -+ irq = __irq_alloc_descs(-1, 0, irqs_per_msi, 0, THIS_MODULE, -+ (irq_delivery == DIRECTED) ? -+ msi->affinity : NULL); - if (irq < 0) - return -ENOMEM; -- rc = irq_set_msi_desc(irq, msi); -- if (rc) -- return rc; -- irq_set_chip_and_handler(irq, &zpci_irq_chip, -- handle_percpu_irq); -+ -+ for (i = 0; i < irqs_per_msi; i++) { -+ rc = irq_set_msi_desc_off(irq, i, msi); -+ if (rc) -+ return rc; -+ irq_set_chip_and_handler(irq + i, &zpci_irq_chip, -+ handle_percpu_irq); -+ } -+ - msg.data = hwirq - bit; - if (irq_delivery == DIRECTED) { - if (msi->affinity) -@@ -309,19 +325,22 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - msg.address_lo |= (cpu_addr << 8); - - for_each_possible_cpu(cpu) { -- airq_iv_set_data(zpci_ibv[cpu], hwirq, irq); -+ for (i = 0; i < irqs_per_msi; i++) -+ airq_iv_set_data(zpci_ibv[cpu], -+ hwirq + i, irq + i); - } - } else { - msg.address_lo = zdev->msi_addr & 0xffffffff; -- airq_iv_set_data(zdev->aibv, hwirq, irq); -+ for (i = 0; i < irqs_per_msi; i++) -+ airq_iv_set_data(zdev->aibv, hwirq + i, irq + i); - } - msg.address_hi = zdev->msi_addr >> 32; - pci_write_msi_msg(irq, &msg); -- hwirq++; -+ hwirq += irqs_per_msi; - } - - zdev->msi_first_bit = bit; -- zdev->msi_nr_irqs = msi_vecs; -+ zdev->msi_nr_irqs = hwirq - bit; - - if (irq_delivery == DIRECTED) - rc = zpci_set_directed_irq(zdev); -@@ -330,13 +349,14 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - if (rc) - return rc; - -- return (msi_vecs == nvec) ? 0 : msi_vecs; -+ return (zdev->msi_nr_irqs == nvec) ? 0 : zdev->msi_nr_irqs; - } - - void arch_teardown_msi_irqs(struct pci_dev *pdev) - { - struct zpci_dev *zdev = to_zpci(pdev); - struct msi_desc *msi; -+ unsigned int i; - int rc; - - /* Disable interrupts */ -@@ -349,8 +369,10 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) - - /* Release MSI interrupts */ - msi_for_each_desc(msi, &pdev->dev, MSI_DESC_ASSOCIATED) { -- irq_set_msi_desc(msi->irq, NULL); -- irq_free_desc(msi->irq); -+ for (i = 0; i < msi->nvec_used; i++) { -+ irq_set_msi_desc(msi->irq + i, NULL); -+ irq_free_desc(msi->irq + i); -+ } - msi->msg.address_lo = 0; - msi->msg.address_hi = 0; - msi->msg.data = 0; --- -2.43.0 - diff --git a/queue-5.10/s390-pci-do-not-mask-msi-x-entries-on-teardown.patch b/queue-5.10/s390-pci-do-not-mask-msi-x-entries-on-teardown.patch deleted file mode 100644 index 290abf2d0e2..00000000000 --- a/queue-5.10/s390-pci-do-not-mask-msi-x-entries-on-teardown.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 7cbb9a9ab70f146b53b00446a761930c412745a1 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 29 Jul 2021 23:51:51 +0200 -Subject: s390/pci: Do not mask MSI[-X] entries on teardown - -From: Thomas Gleixner - -[ Upstream commit 3998527d2e3ee2bfdf710a45b7b90968ff87babc ] - -The PCI core already ensures that the MSI[-X] state is correct when MSI[-X] -is disabled. For MSI the reset state is all entries unmasked and for MSI-X -all vectors are masked. - -S390 masks all MSI entries and masks the already masked MSI-X entries -again. Remove it and let the device in the correct state. - -Signed-off-by: Thomas Gleixner -Tested-by: Niklas Schnelle -Tested-by: Marc Zyngier -Reviewed-by: Marc Zyngier -Acked-by: Niklas Schnelle -Link: https://lore.kernel.org/r/20210729222542.939798136@linutronix.de -Stable-dep-of: ab42fcb511fd ("s390/pci: Allow allocation of more than 1 MSI interrupt") -Signed-off-by: Sasha Levin ---- - arch/s390/pci/pci_irq.c | 4 ---- - drivers/pci/msi.c | 4 ++-- - include/linux/msi.h | 2 -- - 3 files changed, 2 insertions(+), 8 deletions(-) - -diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c -index 75217fb63d7b3..5036e00b7ec1b 100644 ---- a/arch/s390/pci/pci_irq.c -+++ b/arch/s390/pci/pci_irq.c -@@ -341,10 +341,6 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) - for_each_pci_msi_entry(msi, pdev) { - if (!msi->irq) - continue; -- if (msi->msi_attrib.is_msix) -- __pci_msix_desc_mask_irq(msi, 1); -- else -- __pci_msi_desc_mask_irq(msi, 1, 1); - irq_set_msi_desc(msi->irq, NULL); - irq_free_desc(msi->irq); - msi->msg.address_lo = 0; -diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c -index 27377f2f9e84b..935969ea3ea07 100644 ---- a/drivers/pci/msi.c -+++ b/drivers/pci/msi.c -@@ -171,7 +171,7 @@ static inline __attribute_const__ u32 msi_mask(unsigned x) - * reliably as devices without an INTx disable bit will then generate a - * level IRQ which will never be cleared. - */ --void __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) -+static void __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) - { - raw_spinlock_t *lock = &desc->dev->msi_lock; - unsigned long flags; -@@ -208,7 +208,7 @@ static void __iomem *pci_msix_desc_addr(struct msi_desc *desc) - * file. This saves a few milliseconds when initialising devices with lots - * of MSI-X interrupts. - */ --u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag) -+static u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag) - { - u32 mask_bits = desc->masked; - void __iomem *desc_addr; -diff --git a/include/linux/msi.h b/include/linux/msi.h -index 70c910b23e131..8647f5f214297 100644 ---- a/include/linux/msi.h -+++ b/include/linux/msi.h -@@ -193,8 +193,6 @@ void free_msi_entry(struct msi_desc *entry); - void __pci_read_msi_msg(struct msi_desc *entry, struct msi_msg *msg); - void __pci_write_msi_msg(struct msi_desc *entry, struct msi_msg *msg); - --u32 __pci_msix_desc_mask_irq(struct msi_desc *desc, u32 flag); --void __pci_msi_desc_mask_irq(struct msi_desc *desc, u32 mask, u32 flag); - void pci_msi_mask_irq(struct irq_data *data); - void pci_msi_unmask_irq(struct irq_data *data); - --- -2.43.0 - diff --git a/queue-5.10/s390-pci-refactor-arch_setup_msi_irqs.patch b/queue-5.10/s390-pci-refactor-arch_setup_msi_irqs.patch deleted file mode 100644 index 595efb25ee7..00000000000 --- a/queue-5.10/s390-pci-refactor-arch_setup_msi_irqs.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 3cfd2896b57bc84076e6027d9bb481a6356f4066 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 11 Jul 2024 15:45:26 +0200 -Subject: s390/pci: Refactor arch_setup_msi_irqs() - -From: Gerd Bayer - -[ Upstream commit 5fd11b96b43708f2f6e3964412c301c1bd20ec0f ] - -Factor out adapter interrupt allocation from arch_setup_msi_irqs() in -preparation for enabling registration of multiple MSIs. Code movement -only, no change of functionality intended. - -Signed-off-by: Gerd Bayer -Reviewed-by: Niklas Schnelle -Signed-off-by: Vasily Gorbik -Stable-dep-of: ab42fcb511fd ("s390/pci: Allow allocation of more than 1 MSI interrupt") -Signed-off-by: Sasha Levin ---- - arch/s390/pci/pci_irq.c | 54 ++++++++++++++++++++++++----------------- - 1 file changed, 32 insertions(+), 22 deletions(-) - -diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c -index 9ed76fa9391cb..b36f5ef34a6c1 100644 ---- a/arch/s390/pci/pci_irq.c -+++ b/arch/s390/pci/pci_irq.c -@@ -232,33 +232,20 @@ static void zpci_floating_irq_handler(struct airq_struct *airq, bool floating) - } - } - --int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) -+static int __alloc_airq(struct zpci_dev *zdev, int msi_vecs, -+ unsigned long *bit) - { -- struct zpci_dev *zdev = to_zpci(pdev); -- unsigned int hwirq, msi_vecs, cpu; -- unsigned long bit; -- struct msi_desc *msi; -- struct msi_msg msg; -- int cpu_addr; -- int rc, irq; -- -- zdev->aisb = -1UL; -- zdev->msi_first_bit = -1U; -- if (type == PCI_CAP_ID_MSI && nvec > 1) -- return 1; -- msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); -- - if (irq_delivery == DIRECTED) { - /* Allocate cpu vector bits */ -- bit = airq_iv_alloc(zpci_ibv[0], msi_vecs); -- if (bit == -1UL) -+ *bit = airq_iv_alloc(zpci_ibv[0], msi_vecs); -+ if (*bit == -1UL) - return -EIO; - } else { - /* Allocate adapter summary indicator bit */ -- bit = airq_iv_alloc_bit(zpci_sbv); -- if (bit == -1UL) -+ *bit = airq_iv_alloc_bit(zpci_sbv); -+ if (*bit == -1UL) - return -EIO; -- zdev->aisb = bit; -+ zdev->aisb = *bit; - - /* Create adapter interrupt vector */ - zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK); -@@ -266,10 +253,33 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - return -ENOMEM; - - /* Wire up shortcut pointer */ -- zpci_ibv[bit] = zdev->aibv; -+ zpci_ibv[*bit] = zdev->aibv; - /* Each function has its own interrupt vector */ -- bit = 0; -+ *bit = 0; - } -+ return 0; -+} -+ -+int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) -+{ -+ struct zpci_dev *zdev = to_zpci(pdev); -+ unsigned int hwirq, msi_vecs, cpu; -+ struct msi_desc *msi; -+ struct msi_msg msg; -+ unsigned long bit; -+ int cpu_addr; -+ int rc, irq; -+ -+ zdev->aisb = -1UL; -+ zdev->msi_first_bit = -1U; -+ -+ if (type == PCI_CAP_ID_MSI && nvec > 1) -+ return 1; -+ msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); -+ -+ rc = __alloc_airq(zdev, msi_vecs, &bit); -+ if (rc < 0) -+ return rc; - - /* Request MSI interrupts */ - hwirq = bit; --- -2.43.0 - diff --git a/queue-5.10/s390-pci-rework-msi-descriptor-walk.patch b/queue-5.10/s390-pci-rework-msi-descriptor-walk.patch deleted file mode 100644 index c4b5402b823..00000000000 --- a/queue-5.10/s390-pci-rework-msi-descriptor-walk.patch +++ /dev/null @@ -1,49 +0,0 @@ -From f0f721e12908a17446ff1fcb546c6516d06b6ba8 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 6 Dec 2021 23:51:23 +0100 -Subject: s390/pci: Rework MSI descriptor walk - -From: Thomas Gleixner - -[ Upstream commit 2ca5e908d0f4cde61d9d3595e8314adca5d914a1 ] - -Replace the about to vanish iterators and make use of the filtering. - -Signed-off-by: Thomas Gleixner -Tested-by: Niklas Schnelle -Reviewed-by: Jason Gunthorpe -Acked-by: Niklas Schnelle -Link: https://lore.kernel.org/r/20211206210748.305656158@linutronix.de -Stable-dep-of: ab42fcb511fd ("s390/pci: Allow allocation of more than 1 MSI interrupt") -Signed-off-by: Sasha Levin ---- - arch/s390/pci/pci_irq.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c -index 5036e00b7ec1b..9ed76fa9391cb 100644 ---- a/arch/s390/pci/pci_irq.c -+++ b/arch/s390/pci/pci_irq.c -@@ -273,7 +273,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - - /* Request MSI interrupts */ - hwirq = bit; -- for_each_pci_msi_entry(msi, pdev) { -+ msi_for_each_desc(msi, &pdev->dev, MSI_DESC_NOTASSOCIATED) { - rc = -EIO; - if (hwirq - bit >= msi_vecs) - break; -@@ -338,9 +338,7 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) - return; - - /* Release MSI interrupts */ -- for_each_pci_msi_entry(msi, pdev) { -- if (!msi->irq) -- continue; -+ msi_for_each_desc(msi, &pdev->dev, MSI_DESC_ASSOCIATED) { - irq_set_msi_desc(msi->irq, NULL); - irq_free_desc(msi->irq); - msi->msg.address_lo = 0; --- -2.43.0 - diff --git a/queue-5.10/series b/queue-5.10/series index c48fc5b2cf6..83e56c690a7 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -198,10 +198,6 @@ powerpc-fix-a-file-leak-in-kvm_vcpu_ioctl_enable_cap.patch lirc-rc_dev_get_from_fd-fix-file-leak.patch asoc-intel-use-soc_intel_is_byt_cr-only-when-iosf_mb.patch ceph-fix-incorrect-kmalloc-size-of-pagevec-mempool.patch -s390-pci-do-not-mask-msi-x-entries-on-teardown.patch -s390-pci-rework-msi-descriptor-walk.patch -s390-pci-refactor-arch_setup_msi_irqs.patch -s390-pci-allow-allocation-of-more-than-1-msi-interru.patch nvme-split-command-copy-into-a-helper.patch nvme-pci-add-missing-condition-check-for-existence-o.patch fs-don-t-allow-non-init-s_user_ns-for-filesystems-wi.patch diff --git a/queue-5.15/s390-dasd-fix-error-checks-in-dasd_copy_pair_store.patch b/queue-5.15/s390-dasd-fix-error-checks-in-dasd_copy_pair_store.patch deleted file mode 100644 index 0d666d17e47..00000000000 --- a/queue-5.15/s390-dasd-fix-error-checks-in-dasd_copy_pair_store.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 588080dc71b3546ffab356540eb647d5b88b7616 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 15 Jul 2024 13:24:34 +0200 -Subject: s390/dasd: fix error checks in dasd_copy_pair_store() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Carlos López - -[ Upstream commit 8e64d2356cbc800b4cd0e3e614797f76bcf0cdb8 ] - -dasd_add_busid() can return an error via ERR_PTR() if an allocation -fails. However, two callsites in dasd_copy_pair_store() do not check -the result, potentially resulting in a NULL pointer dereference. Fix -this by checking the result with IS_ERR() and returning the error up -the stack. - -Fixes: a91ff09d39f9b ("s390/dasd: add copy pair setup") -Signed-off-by: Carlos López -Signed-off-by: Stefan Haberland -Link: https://lore.kernel.org/r/20240715112434.2111291-3-sth@linux.ibm.com -Signed-off-by: Jens Axboe -Signed-off-by: Sasha Levin ---- - drivers/s390/block/dasd_devmap.c | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c -index 6f9f7a0723128..7447dec5ce221 100644 ---- a/drivers/s390/block/dasd_devmap.c -+++ b/drivers/s390/block/dasd_devmap.c -@@ -2141,13 +2141,19 @@ static ssize_t dasd_copy_pair_store(struct device *dev, - - /* allocate primary devmap if needed */ - prim_devmap = dasd_find_busid(prim_busid); -- if (IS_ERR(prim_devmap)) -+ if (IS_ERR(prim_devmap)) { - prim_devmap = dasd_add_busid(prim_busid, DASD_FEATURE_DEFAULT); -+ if (IS_ERR(prim_devmap)) -+ return PTR_ERR(prim_devmap); -+ } - - /* allocate secondary devmap if needed */ - sec_devmap = dasd_find_busid(sec_busid); -- if (IS_ERR(sec_devmap)) -+ if (IS_ERR(sec_devmap)) { - sec_devmap = dasd_add_busid(sec_busid, DASD_FEATURE_DEFAULT); -+ if (IS_ERR(sec_devmap)) -+ return PTR_ERR(sec_devmap); -+ } - - /* setting copy relation is only allowed for offline secondary */ - if (sec_devmap->device) --- -2.43.0 - diff --git a/queue-5.15/s390-pci-allow-allocation-of-more-than-1-msi-interru.patch b/queue-5.15/s390-pci-allow-allocation-of-more-than-1-msi-interru.patch deleted file mode 100644 index 9dece9d367e..00000000000 --- a/queue-5.15/s390-pci-allow-allocation-of-more-than-1-msi-interru.patch +++ /dev/null @@ -1,168 +0,0 @@ -From c4239ed4790c311bd555c9b36c94840f55c1a8a7 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 11 Jul 2024 15:45:27 +0200 -Subject: s390/pci: Allow allocation of more than 1 MSI interrupt - -From: Gerd Bayer - -[ Upstream commit ab42fcb511fd9d241bbab7cc3ca04e34e9fc0666 ] - -On a PCI adapter that provides up to 8 MSI interrupt sources the s390 -implementation of PCI interrupts rejected to accommodate them, although -the underlying hardware is able to support that. - -For MSI-X it is sufficient to allocate a single irq_desc per msi_desc, -but for MSI multiple irq descriptors are attached to and controlled by -a single msi descriptor. Add the appropriate loops to maintain multiple -irq descriptors and tie/untie them to/from the appropriate AIBV bit, if -a device driver allocates more than 1 MSI interrupt. - -Common PCI code passes on requests to allocate a number of interrupt -vectors based on the device drivers' demand and the PCI functions' -capabilities. However, the root-complex of s390 systems support just a -limited number of interrupt vectors per PCI function. -Produce a kernel log message to inform about any architecture-specific -capping that might be done. - -With this change, we had a PCI adapter successfully raising -interrupts to its device driver via all 8 sources. - -Fixes: a384c8924a8b ("s390/PCI: Fix single MSI only check") -Signed-off-by: Gerd Bayer -Reviewed-by: Niklas Schnelle -Signed-off-by: Vasily Gorbik -Signed-off-by: Sasha Levin ---- - arch/s390/pci/pci_irq.c | 62 ++++++++++++++++++++++++++++------------- - 1 file changed, 42 insertions(+), 20 deletions(-) - -diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c -index 39c3c29f0d1d3..4a1dfce1a5cd2 100644 ---- a/arch/s390/pci/pci_irq.c -+++ b/arch/s390/pci/pci_irq.c -@@ -292,8 +292,8 @@ static int __alloc_airq(struct zpci_dev *zdev, int msi_vecs, - - int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - { -+ unsigned int hwirq, msi_vecs, irqs_per_msi, i, cpu; - struct zpci_dev *zdev = to_zpci(pdev); -- unsigned int hwirq, msi_vecs, cpu; - struct msi_desc *msi; - struct msi_msg msg; - unsigned long bit; -@@ -303,30 +303,46 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - zdev->aisb = -1UL; - zdev->msi_first_bit = -1U; - -- if (type == PCI_CAP_ID_MSI && nvec > 1) -- return 1; - msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); -+ if (msi_vecs < nvec) { -+ pr_info("%s requested %d irqs, allocate system limit of %d", -+ pci_name(pdev), nvec, zdev->max_msi); -+ } - - rc = __alloc_airq(zdev, msi_vecs, &bit); - if (rc < 0) - return rc; - -- /* Request MSI interrupts */ -+ /* -+ * Request MSI interrupts: -+ * When using MSI, nvec_used interrupt sources and their irq -+ * descriptors are controlled through one msi descriptor. -+ * Thus the outer loop over msi descriptors shall run only once, -+ * while two inner loops iterate over the interrupt vectors. -+ * When using MSI-X, each interrupt vector/irq descriptor -+ * is bound to exactly one msi descriptor (nvec_used is one). -+ * So the inner loops are executed once, while the outer iterates -+ * over the MSI-X descriptors. -+ */ - hwirq = bit; - msi_for_each_desc(msi, &pdev->dev, MSI_DESC_NOTASSOCIATED) { -- rc = -EIO; - if (hwirq - bit >= msi_vecs) - break; -- irq = __irq_alloc_descs(-1, 0, 1, 0, THIS_MODULE, -- (irq_delivery == DIRECTED) ? -- msi->affinity : NULL); -+ irqs_per_msi = min_t(unsigned int, msi_vecs, msi->nvec_used); -+ irq = __irq_alloc_descs(-1, 0, irqs_per_msi, 0, THIS_MODULE, -+ (irq_delivery == DIRECTED) ? -+ msi->affinity : NULL); - if (irq < 0) - return -ENOMEM; -- rc = irq_set_msi_desc(irq, msi); -- if (rc) -- return rc; -- irq_set_chip_and_handler(irq, &zpci_irq_chip, -- handle_percpu_irq); -+ -+ for (i = 0; i < irqs_per_msi; i++) { -+ rc = irq_set_msi_desc_off(irq, i, msi); -+ if (rc) -+ return rc; -+ irq_set_chip_and_handler(irq + i, &zpci_irq_chip, -+ handle_percpu_irq); -+ } -+ - msg.data = hwirq - bit; - if (irq_delivery == DIRECTED) { - if (msi->affinity) -@@ -339,31 +355,35 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - msg.address_lo |= (cpu_addr << 8); - - for_each_possible_cpu(cpu) { -- airq_iv_set_data(zpci_ibv[cpu], hwirq, irq); -+ for (i = 0; i < irqs_per_msi; i++) -+ airq_iv_set_data(zpci_ibv[cpu], -+ hwirq + i, irq + i); - } - } else { - msg.address_lo = zdev->msi_addr & 0xffffffff; -- airq_iv_set_data(zdev->aibv, hwirq, irq); -+ for (i = 0; i < irqs_per_msi; i++) -+ airq_iv_set_data(zdev->aibv, hwirq + i, irq + i); - } - msg.address_hi = zdev->msi_addr >> 32; - pci_write_msi_msg(irq, &msg); -- hwirq++; -+ hwirq += irqs_per_msi; - } - - zdev->msi_first_bit = bit; -- zdev->msi_nr_irqs = msi_vecs; -+ zdev->msi_nr_irqs = hwirq - bit; - - rc = zpci_set_irq(zdev); - if (rc) - return rc; - -- return (msi_vecs == nvec) ? 0 : msi_vecs; -+ return (zdev->msi_nr_irqs == nvec) ? 0 : zdev->msi_nr_irqs; - } - - void arch_teardown_msi_irqs(struct pci_dev *pdev) - { - struct zpci_dev *zdev = to_zpci(pdev); - struct msi_desc *msi; -+ unsigned int i; - int rc; - - /* Disable interrupts */ -@@ -373,8 +393,10 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) - - /* Release MSI interrupts */ - msi_for_each_desc(msi, &pdev->dev, MSI_DESC_ASSOCIATED) { -- irq_set_msi_desc(msi->irq, NULL); -- irq_free_desc(msi->irq); -+ for (i = 0; i < msi->nvec_used; i++) { -+ irq_set_msi_desc(msi->irq + i, NULL); -+ irq_free_desc(msi->irq + i); -+ } - msi->msg.address_lo = 0; - msi->msg.address_hi = 0; - msi->msg.data = 0; --- -2.43.0 - diff --git a/queue-5.15/s390-pci-refactor-arch_setup_msi_irqs.patch b/queue-5.15/s390-pci-refactor-arch_setup_msi_irqs.patch deleted file mode 100644 index f0ef494ce9a..00000000000 --- a/queue-5.15/s390-pci-refactor-arch_setup_msi_irqs.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 6ab27cbbf08e1d33b1754c864437e6be59db6569 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Thu, 11 Jul 2024 15:45:26 +0200 -Subject: s390/pci: Refactor arch_setup_msi_irqs() - -From: Gerd Bayer - -[ Upstream commit 5fd11b96b43708f2f6e3964412c301c1bd20ec0f ] - -Factor out adapter interrupt allocation from arch_setup_msi_irqs() in -preparation for enabling registration of multiple MSIs. Code movement -only, no change of functionality intended. - -Signed-off-by: Gerd Bayer -Reviewed-by: Niklas Schnelle -Signed-off-by: Vasily Gorbik -Stable-dep-of: ab42fcb511fd ("s390/pci: Allow allocation of more than 1 MSI interrupt") -Signed-off-by: Sasha Levin ---- - arch/s390/pci/pci_irq.c | 54 ++++++++++++++++++++++++----------------- - 1 file changed, 32 insertions(+), 22 deletions(-) - -diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c -index 49e404c3e987a..39c3c29f0d1d3 100644 ---- a/arch/s390/pci/pci_irq.c -+++ b/arch/s390/pci/pci_irq.c -@@ -262,33 +262,20 @@ static void zpci_floating_irq_handler(struct airq_struct *airq, bool floating) - } - } - --int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) -+static int __alloc_airq(struct zpci_dev *zdev, int msi_vecs, -+ unsigned long *bit) - { -- struct zpci_dev *zdev = to_zpci(pdev); -- unsigned int hwirq, msi_vecs, cpu; -- unsigned long bit; -- struct msi_desc *msi; -- struct msi_msg msg; -- int cpu_addr; -- int rc, irq; -- -- zdev->aisb = -1UL; -- zdev->msi_first_bit = -1U; -- if (type == PCI_CAP_ID_MSI && nvec > 1) -- return 1; -- msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); -- - if (irq_delivery == DIRECTED) { - /* Allocate cpu vector bits */ -- bit = airq_iv_alloc(zpci_ibv[0], msi_vecs); -- if (bit == -1UL) -+ *bit = airq_iv_alloc(zpci_ibv[0], msi_vecs); -+ if (*bit == -1UL) - return -EIO; - } else { - /* Allocate adapter summary indicator bit */ -- bit = airq_iv_alloc_bit(zpci_sbv); -- if (bit == -1UL) -+ *bit = airq_iv_alloc_bit(zpci_sbv); -+ if (*bit == -1UL) - return -EIO; -- zdev->aisb = bit; -+ zdev->aisb = *bit; - - /* Create adapter interrupt vector */ - zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK); -@@ -296,10 +283,33 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - return -ENOMEM; - - /* Wire up shortcut pointer */ -- zpci_ibv[bit] = zdev->aibv; -+ zpci_ibv[*bit] = zdev->aibv; - /* Each function has its own interrupt vector */ -- bit = 0; -+ *bit = 0; - } -+ return 0; -+} -+ -+int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) -+{ -+ struct zpci_dev *zdev = to_zpci(pdev); -+ unsigned int hwirq, msi_vecs, cpu; -+ struct msi_desc *msi; -+ struct msi_msg msg; -+ unsigned long bit; -+ int cpu_addr; -+ int rc, irq; -+ -+ zdev->aisb = -1UL; -+ zdev->msi_first_bit = -1U; -+ -+ if (type == PCI_CAP_ID_MSI && nvec > 1) -+ return 1; -+ msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); -+ -+ rc = __alloc_airq(zdev, msi_vecs, &bit); -+ if (rc < 0) -+ return rc; - - /* Request MSI interrupts */ - hwirq = bit; --- -2.43.0 - diff --git a/queue-5.15/s390-pci-rework-msi-descriptor-walk.patch b/queue-5.15/s390-pci-rework-msi-descriptor-walk.patch deleted file mode 100644 index 5b0599f173e..00000000000 --- a/queue-5.15/s390-pci-rework-msi-descriptor-walk.patch +++ /dev/null @@ -1,49 +0,0 @@ -From b1970baad93425f383a8774a33b126a5b1c276df Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 6 Dec 2021 23:51:23 +0100 -Subject: s390/pci: Rework MSI descriptor walk - -From: Thomas Gleixner - -[ Upstream commit 2ca5e908d0f4cde61d9d3595e8314adca5d914a1 ] - -Replace the about to vanish iterators and make use of the filtering. - -Signed-off-by: Thomas Gleixner -Tested-by: Niklas Schnelle -Reviewed-by: Jason Gunthorpe -Acked-by: Niklas Schnelle -Link: https://lore.kernel.org/r/20211206210748.305656158@linutronix.de -Stable-dep-of: ab42fcb511fd ("s390/pci: Allow allocation of more than 1 MSI interrupt") -Signed-off-by: Sasha Levin ---- - arch/s390/pci/pci_irq.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/arch/s390/pci/pci_irq.c b/arch/s390/pci/pci_irq.c -index 3823e159bf749..49e404c3e987a 100644 ---- a/arch/s390/pci/pci_irq.c -+++ b/arch/s390/pci/pci_irq.c -@@ -303,7 +303,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) - - /* Request MSI interrupts */ - hwirq = bit; -- for_each_pci_msi_entry(msi, pdev) { -+ msi_for_each_desc(msi, &pdev->dev, MSI_DESC_NOTASSOCIATED) { - rc = -EIO; - if (hwirq - bit >= msi_vecs) - break; -@@ -362,9 +362,7 @@ void arch_teardown_msi_irqs(struct pci_dev *pdev) - return; - - /* Release MSI interrupts */ -- for_each_pci_msi_entry(msi, pdev) { -- if (!msi->irq) -- continue; -+ msi_for_each_desc(msi, &pdev->dev, MSI_DESC_ASSOCIATED) { - irq_set_msi_desc(msi->irq, NULL); - irq_free_desc(msi->irq); - msi->msg.address_lo = 0; --- -2.43.0 - diff --git a/queue-5.15/series b/queue-5.15/series index 72dc04ebbac..380df9108c5 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -156,7 +156,6 @@ fs-proc-task_mmu-indicate-pm_file-for-pmd-mapped-fil.patch nilfs2-avoid-undefined-behavior-in-nilfs_cnt32_ge-ma.patch rtc-interface-add-rtc-offset-to-alarm-after-fix-up.patch fs-ntfs3-missed-error-return.patch -s390-dasd-fix-error-checks-in-dasd_copy_pair_store.patch landlock-don-t-lose-track-of-restrictions-on-cred_transfer.patch mm-hugetlb-fix-possible-recursive-locking-detected-warning.patch mm-mmap_lock-replace-get_memcg_path_buf-with-on-stack-buffer.patch @@ -280,9 +279,6 @@ spi-spidev-order-compatibles-alphabetically.patch spi-spidev-add-correct-compatible-for-rohm-bh2228fv.patch asoc-intel-use-soc_intel_is_byt_cr-only-when-iosf_mb.patch ceph-fix-incorrect-kmalloc-size-of-pagevec-mempool.patch -s390-pci-rework-msi-descriptor-walk.patch -s390-pci-refactor-arch_setup_msi_irqs.patch -s390-pci-allow-allocation-of-more-than-1-msi-interru.patch iommu-sprd-avoid-null-deref-in-sprd_iommu_hw_en.patch nvme-split-command-copy-into-a-helper.patch nvme-separate-command-prep-and-issue.patch