{"id":804934,"url":"http://patchwork.ozlabs.org/api/patches/804934/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170823101901.33961-6-aik@ozlabs.ru/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170823101901.33961-6-aik@ozlabs.ru>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170823101901.33961-6-aik@ozlabs.ru/","date":"2017-08-23T10:19:01","name":"[kernel,5/5] powerpc/eeh: Remove unnecessary node from pci_dn","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"bb8231a0d8196bd9d7cdd18840217f899f5510d4","submitter":{"id":7621,"url":"http://patchwork.ozlabs.org/api/people/7621/?format=json","name":"Alexey Kardashevskiy","email":"aik@ozlabs.ru"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170823101901.33961-6-aik@ozlabs.ru/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/804934/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/804934/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xck9T0gk1z9sCZ\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 23 Aug 2017 20:26:21 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xck9S6q01zDrbl\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed, 23 Aug 2017 20:26:20 +1000 (AEST)","from ozlabs.ru (ozlabs.ru [107.173.13.209])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xck1H3GbkzDrJw\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tWed, 23 Aug 2017 20:19:15 +1000 (AEST)","from vpl1.ozlabs.ibm.com (localhost [IPv6:::1])\n\tby ozlabs.ru (Postfix) with ESMTP id 9EFB43A60056;\n\tWed, 23 Aug 2017 06:20:19 -0400 (EDT)"],"From":"Alexey Kardashevskiy <aik@ozlabs.ru>","To":"linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH kernel 5/5] powerpc/eeh: Remove unnecessary node from pci_dn","Date":"Wed, 23 Aug 2017 20:19:01 +1000","Message-Id":"<20170823101901.33961-6-aik@ozlabs.ru>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170823101901.33961-1-aik@ozlabs.ru>","References":"<20170823101901.33961-1-aik@ozlabs.ru>","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"Alexey Kardashevskiy <aik@ozlabs.ru>,\n\tAlistair Popple <alistair@popple.id.au>,\n\tDavid Gibson <david@gibson.dropbear.id.au>","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"The pci_dn struct caches a OF device node pointer in order to access\nthe \"ibm,loc-code\" property when EEH is recovering.\n\nHowever, when this happens in eeh_dev_check_failure(), we also have\na pci_dev pointer which should have a valid pointer to the device node\nwhen pci_dn has one (both pointers are not NULL for physical functions\nand are NULL for virtual functions).\n\nThis removes the node pointer from the pci_dn struct and used pdev\nin eeh_dev_check_failure() instead.\n\nThis changes pci_remove_device_node_info() to look for a parent of\nthe node being removed, just like pci_add_device_node_info() does when it\nreferences the parent node.\n\nSigned-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>\n---\n arch/powerpc/include/asm/pci-bridge.h | 1 -\n arch/powerpc/kernel/eeh.c             | 9 +++++----\n arch/powerpc/kernel/pci_dn.c          | 8 +++++---\n 3 files changed, 10 insertions(+), 8 deletions(-)","diff":"diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h\nindex 56c67d3f0108..0b8aa1fe2d5f 100644\n--- a/arch/powerpc/include/asm/pci-bridge.h\n+++ b/arch/powerpc/include/asm/pci-bridge.h\n@@ -195,7 +195,6 @@ struct pci_dn {\n \tstruct  pci_dn *parent;\n \tstruct  pci_controller *phb;\t/* for pci devices */\n \tstruct\tiommu_table_group *table_group;\t/* for phb's or bridges */\n-\tstruct\tdevice_node *node;\t/* back-pointer to the device_node */\n \n \tint\tpci_ext_config_space;\t/* for pci devices */\n \ndiff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c\nindex c877014d11ce..2c926029adbe 100644\n--- a/arch/powerpc/kernel/eeh.c\n+++ b/arch/powerpc/kernel/eeh.c\n@@ -435,7 +435,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev)\n \tint ret;\n \tint active_flags = (EEH_STATE_MMIO_ACTIVE | EEH_STATE_DMA_ACTIVE);\n \tunsigned long flags;\n-\tstruct pci_dn *pdn;\n+\tstruct device_node *dn;\n \tstruct pci_dev *dev;\n \tstruct eeh_pe *pe, *parent_pe, *phb_pe;\n \tint rc = 0;\n@@ -493,9 +493,10 @@ int eeh_dev_check_failure(struct eeh_dev *edev)\n \tif (pe->state & EEH_PE_ISOLATED) {\n \t\tpe->check_count++;\n \t\tif (pe->check_count % EEH_MAX_FAILS == 0) {\n-\t\t\tpdn = eeh_dev_to_pdn(edev);\n-\t\t\tif (pdn->node)\n-\t\t\t\tlocation = of_get_property(pdn->node, \"ibm,loc-code\", NULL);\n+\t\t\tdn = pci_device_to_OF_node(dev);\n+\t\t\tif (dn)\n+\t\t\t\tlocation = of_get_property(dn, \"ibm,loc-code\",\n+\t\t\t\t\t\tNULL);\n \t\t\tprintk(KERN_ERR \"EEH: %d reads ignored for recovering device at \"\n \t\t\t\t\"location=%s driver=%s pci addr=%s\\n\",\n \t\t\t\tpe->check_count,\ndiff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c\nindex 0256372b72de..0e395afbf0f4 100644\n--- a/arch/powerpc/kernel/pci_dn.c\n+++ b/arch/powerpc/kernel/pci_dn.c\n@@ -293,7 +293,6 @@ struct pci_dn *pci_add_device_node_info(struct pci_controller *hose,\n \tif (pdn == NULL)\n \t\treturn NULL;\n \tdn->data = pdn;\n-\tpdn->node = dn;\n \tpdn->phb = hose;\n #ifdef CONFIG_PPC_POWERNV\n \tpdn->pe_number = IODA_INVALID_PE;\n@@ -342,6 +341,7 @@ EXPORT_SYMBOL_GPL(pci_add_device_node_info);\n void pci_remove_device_node_info(struct device_node *dn)\n {\n \tstruct pci_dn *pdn = dn ? PCI_DN(dn) : NULL;\n+\tstruct device_node *parent;\n #ifdef CONFIG_EEH\n \tstruct eeh_dev *edev = pdn_to_eeh_dev(pdn);\n \n@@ -354,8 +354,10 @@ void pci_remove_device_node_info(struct device_node *dn)\n \n \tWARN_ON(!list_empty(&pdn->child_list));\n \tlist_del(&pdn->list);\n-\tif (pdn->parent)\n-\t\tof_node_put(pdn->parent->node);\n+\n+\tparent = of_get_parent(dn);\n+\tif (parent)\n+\t\tof_node_put(parent);\n \n \tdn->data = NULL;\n \tkfree(pdn);\n","prefixes":["kernel","5/5"]}