From patchwork Wed Nov 9 14:05:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 9419299 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0770C601C0 for ; Wed, 9 Nov 2016 14:05:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEB31289BD for ; Wed, 9 Nov 2016 14:05:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E363628F99; Wed, 9 Nov 2016 14:05:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88CBB289BD for ; Wed, 9 Nov 2016 14:05:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754080AbcKIOF0 (ORCPT ); Wed, 9 Nov 2016 09:05:26 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49930 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751537AbcKIOFZ (ORCPT ); Wed, 9 Nov 2016 09:05:25 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uA9E4T9Z071632 for ; Wed, 9 Nov 2016 09:05:24 -0500 Received: from e24smtp05.br.ibm.com (e24smtp05.br.ibm.com [32.104.18.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 26m2kkmw18-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 09 Nov 2016 09:05:24 -0500 Received: from localhost by e24smtp05.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 Nov 2016 12:05:22 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp05.br.ibm.com (10.172.0.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 Nov 2016 12:05:18 -0200 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 5EA2F1DC0070; Wed, 9 Nov 2016 09:05:18 -0500 (EST) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uA9E5IDe39125108; Wed, 9 Nov 2016 12:05:18 -0200 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uA9E5HvE010758; Wed, 9 Nov 2016 12:05:18 -0200 Received: from localhost ([9.85.139.228]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uA9E5GNF010719; Wed, 9 Nov 2016 12:05:17 -0200 From: "Guilherme G. Piccoli" To: devicetree@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, frowand.list@gmail.com, robh+dt@kernel.org, gpiccoli@linux.vnet.ibm.com Subject: [PATCH] of/irq: improve error message on irq discovery process failure Date: Wed, 9 Nov 2016 12:05:08 -0200 X-Mailer: git-send-email 2.1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16110914-0032-0000-0000-000002ACB549 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16110914-0033-0000-0000-00000F2C2771 Message-Id: <1478700308-25481-1-git-send-email-gpiccoli@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-09_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611090264 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On PowerPC machines some PCI slots might not have Level-triggered interrupts capability (also know as Level Signaled Interrupts - LSI), leading of_irq_parse_pci() to complain by presenting error messages on the kernel log - in this case, the properties "interrupt-map" and "interrupt-map-mask" are not present on the device's node on device tree. This patch introduces a different message for this specific case, and it also reduces the level of the message from error to warning. Before this patch, when an adapter was plugged in a slot without Level interrupts capabilities, we saw generic error messages like this: [54.239] pci 002d:70:00.0: of_irq_parse_pci() failed with rc=-22 Now, with this applied, we see the following specific message: [19.947] pci 0014:60:00.0: of_irq_parse_pci() gave up. The slot of this device has no Level-triggered Interrupts capability. No functional changes were introduced. Signed-off-by: Guilherme G. Piccoli --- drivers/of/irq.c | 5 ++++- drivers/of/of_pci_irq.c | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 393fea8..1ad6882 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -275,7 +275,10 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) of_node_put(ipar); of_node_put(newpar); - return -EINVAL; + /* Positive non-zero return means no Level-triggered Interrupts + * capability was found. + */ + return ENOENT; } EXPORT_SYMBOL_GPL(of_irq_parse_raw); diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c index 2306313..9b6f387 100644 --- a/drivers/of/of_pci_irq.c +++ b/drivers/of/of_pci_irq.c @@ -89,8 +89,14 @@ int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); laddr[1] = laddr[2] = cpu_to_be32(0); rc = of_irq_parse_raw(laddr, out_irq); - if (rc) + + if (rc < 0) { goto err; + } else if (rc > 0) { + dev_warn(&pdev->dev, + "of_irq_parse_pci() gave up. The slot of this device has no Level-triggered Interrupts capability.\n"); + return -rc; + } return 0; err: dev_err(&pdev->dev, "of_irq_parse_pci() failed with rc=%d\n", rc);