* [PATCH -next] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"
@ 2020-10-14 18:28 Qian Cai
2020-10-14 23:00 ` Oliver O'Halloran
2020-10-16 11:02 ` Michael Ellerman
0 siblings, 2 replies; 4+ messages in thread
From: Qian Cai @ 2020-10-14 18:28 UTC (permalink / raw)
To: Michael Ellerman
Cc: Stephen Rothwell, Alexey Kardashevskiy, linux-kernel, linux-next,
Oliver O'Halloran, Cédric Le Goater, linuxppc-dev
This reverts commit 3a3181e16fbde752007759f8759d25e0ff1fc425 which
causes memory corruptions on POWER9 NV.
Signed-off-by: Qian Cai <cai@lca.pw>
---
arch/powerpc/include/asm/pci-bridge.h | 6 --
arch/powerpc/kernel/pci-common.c | 114 --------------------------
2 files changed, 120 deletions(-)
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index d21e070352dc..d2a2a14e56f9 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -48,9 +48,6 @@ struct pci_controller_ops {
/*
* Structure of a PCI controller (host bridge)
- *
- * @irq_count: number of interrupt mappings
- * @irq_map: interrupt mappings
*/
struct pci_controller {
struct pci_bus *bus;
@@ -130,9 +127,6 @@ struct pci_controller {
void *private_data;
struct npu *npu;
-
- unsigned int irq_count;
- unsigned int *irq_map;
};
/* These are used for config access before all the PCI probing
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index deb831f0ae13..be108616a721 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -353,115 +353,6 @@ struct pci_controller *pci_find_controller_for_domain(int domain_nr)
return NULL;
}
-/*
- * Assumption is made on the interrupt parent. All interrupt-map
- * entries are considered to have the same parent.
- */
-static int pcibios_irq_map_count(struct pci_controller *phb)
-{
- const __be32 *imap;
- int imaplen;
- struct device_node *parent;
- u32 intsize, addrsize, parintsize, paraddrsize;
-
- if (of_property_read_u32(phb->dn, "#interrupt-cells", &intsize))
- return 0;
- if (of_property_read_u32(phb->dn, "#address-cells", &addrsize))
- return 0;
-
- imap = of_get_property(phb->dn, "interrupt-map", &imaplen);
- if (!imap) {
- pr_debug("%pOF : no interrupt-map\n", phb->dn);
- return 0;
- }
- imaplen /= sizeof(u32);
- pr_debug("%pOF : imaplen=%d\n", phb->dn, imaplen);
-
- if (imaplen < (addrsize + intsize + 1))
- return 0;
-
- imap += intsize + addrsize;
- parent = of_find_node_by_phandle(be32_to_cpup(imap));
- if (!parent) {
- pr_debug("%pOF : no imap parent found !\n", phb->dn);
- return 0;
- }
-
- if (of_property_read_u32(parent, "#interrupt-cells", &parintsize)) {
- pr_debug("%pOF : parent lacks #interrupt-cells!\n", phb->dn);
- return 0;
- }
-
- if (of_property_read_u32(parent, "#address-cells", ¶ddrsize))
- paraddrsize = 0;
-
- return imaplen / (addrsize + intsize + 1 + paraddrsize + parintsize);
-}
-
-static void pcibios_irq_map_init(struct pci_controller *phb)
-{
- phb->irq_count = pcibios_irq_map_count(phb);
- if (phb->irq_count < PCI_NUM_INTX)
- phb->irq_count = PCI_NUM_INTX;
-
- pr_debug("%pOF : interrupt map #%d\n", phb->dn, phb->irq_count);
-
- phb->irq_map = kcalloc(phb->irq_count, sizeof(unsigned int),
- GFP_KERNEL);
-}
-
-static void pci_irq_map_register(struct pci_dev *pdev, unsigned int virq)
-{
- struct pci_controller *phb = pci_bus_to_host(pdev->bus);
- int i;
-
- if (!phb->irq_map)
- return;
-
- for (i = 0; i < phb->irq_count; i++) {
- /*
- * Look for an empty or an equivalent slot, as INTx
- * interrupts can be shared between adapters.
- */
- if (phb->irq_map[i] == virq || !phb->irq_map[i]) {
- phb->irq_map[i] = virq;
- break;
- }
- }
-
- if (i == phb->irq_count)
- pr_err("PCI:%s all platform interrupts mapped\n",
- pci_name(pdev));
-}
-
-/*
- * Clearing the mapped interrupts will also clear the underlying
- * mappings of the ESB pages of the interrupts when under XIVE. It is
- * a requirement of PowerVM to clear all memory mappings before
- * removing a PHB.
- */
-static void pci_irq_map_dispose(struct pci_bus *bus)
-{
- struct pci_controller *phb = pci_bus_to_host(bus);
- int i;
-
- if (!phb->irq_map)
- return;
-
- pr_debug("PCI: Clearing interrupt mappings for PHB %04x:%02x...\n",
- pci_domain_nr(bus), bus->number);
- for (i = 0; i < phb->irq_count; i++)
- irq_dispose_mapping(phb->irq_map[i]);
-
- kfree(phb->irq_map);
-}
-
-void pcibios_remove_bus(struct pci_bus *bus)
-{
- pci_irq_map_dispose(bus);
-}
-EXPORT_SYMBOL_GPL(pcibios_remove_bus);
-
/*
* Reads the interrupt pin to determine if interrupt is use by card.
* If the interrupt is used, then gets the interrupt line from the
@@ -510,8 +401,6 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
pci_dev->irq = virq;
- /* Record all interrut mappings for later removal of a PHB */
- pci_irq_map_register(pci_dev, virq);
return 0;
}
@@ -1665,9 +1554,6 @@ void pcibios_scan_phb(struct pci_controller *hose)
pr_debug("PCI: Scanning PHB %pOF\n", node);
- /* Allocate interrupt mappings array */
- pcibios_irq_map_init(hose);
-
/* Get some IO space for the new PHB */
pcibios_setup_phb_io_space(hose);
--
2.28.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"
2020-10-14 18:28 [PATCH -next] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed" Qian Cai
@ 2020-10-14 23:00 ` Oliver O'Halloran
2020-10-15 0:18 ` Stephen Rothwell
2020-10-16 11:02 ` Michael Ellerman
1 sibling, 1 reply; 4+ messages in thread
From: Oliver O'Halloran @ 2020-10-14 23:00 UTC (permalink / raw)
To: Qian Cai
Cc: Stephen Rothwell, Alexey Kardashevskiy,
Linux Kernel Mailing List, Linux-Next Mailing List,
Cédric Le Goater, linuxppc-dev
On Thu, Oct 15, 2020 at 5:28 AM Qian Cai <cai@lca.pw> wrote:
>
> This reverts commit 3a3181e16fbde752007759f8759d25e0ff1fc425 which
> causes memory corruptions on POWER9 NV.
I was going to post this along with a fix for Cedric's original bug,
but I can do that separately so:
Acked-by: Oliver O'Halloran <oohall@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"
2020-10-14 23:00 ` Oliver O'Halloran
@ 2020-10-15 0:18 ` Stephen Rothwell
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2020-10-15 0:18 UTC (permalink / raw)
To: Oliver O'Halloran
Cc: Alexey Kardashevskiy, Linux Kernel Mailing List,
Linux-Next Mailing List, Qian Cai, Cédric Le Goater,
linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 524 bytes --]
Hi Oliver,
On Thu, 15 Oct 2020 10:00:49 +1100 "Oliver O'Halloran" <oohall@gmail.com> wrote:
>
> On Thu, Oct 15, 2020 at 5:28 AM Qian Cai <cai@lca.pw> wrote:
> >
> > This reverts commit 3a3181e16fbde752007759f8759d25e0ff1fc425 which
> > causes memory corruptions on POWER9 NV.
>
> I was going to post this along with a fix for Cedric's original bug,
> but I can do that separately so:
>
> Acked-by: Oliver O'Halloran <oohall@gmail.com>
I added that to linux-next today.
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"
2020-10-14 18:28 [PATCH -next] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed" Qian Cai
2020-10-14 23:00 ` Oliver O'Halloran
@ 2020-10-16 11:02 ` Michael Ellerman
1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2020-10-16 11:02 UTC (permalink / raw)
To: Michael Ellerman, Qian Cai
Cc: Stephen Rothwell, Alexey Kardashevskiy, linux-kernel, linux-next,
Oliver O'Halloran, Cédric Le Goater, linuxppc-dev
On Wed, 14 Oct 2020 14:28:11 -0400, Qian Cai wrote:
> This reverts commit 3a3181e16fbde752007759f8759d25e0ff1fc425 which
> causes memory corruptions on POWER9 NV.
Applied to powerpc/next.
[1/1] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"
https://git.kernel.org/powerpc/c/ffd0b25ca049a477cb757e5bcf2d5e1664d12e5d
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-16 11:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 18:28 [PATCH -next] Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed" Qian Cai
2020-10-14 23:00 ` Oliver O'Halloran
2020-10-15 0:18 ` Stephen Rothwell
2020-10-16 11:02 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).