Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806293/?format=api
{ "id": 806293, "url": "http://patchwork.ozlabs.org/api/patches/806293/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/1503855651-17409-2-git-send-email-okaya@codeaurora.org/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1503855651-17409-2-git-send-email-okaya@codeaurora.org>", "list_archive_url": null, "date": "2017-08-27T17:40:49", "name": "[V13,2/4] PCI: Factor out pci_bus_wait_crs()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0d452c8607b2e00546128e4106c0b3ac64827e59", "submitter": { "id": 67496, "url": "http://patchwork.ozlabs.org/api/people/67496/?format=api", "name": "Sinan Kaya", "email": "okaya@codeaurora.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/1503855651-17409-2-git-send-email-okaya@codeaurora.org/mbox/", "series": [ { "id": 36, "url": "http://patchwork.ozlabs.org/api/series/36/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=36", "date": "2017-08-27T17:40:51", "name": "[V13,1/4] PCI: Don't ignore valid response before CRS timeout", "version": 13, "mbox": "http://patchwork.ozlabs.org/series/36/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806293/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806293/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-pci-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=codeaurora.org header.i=@codeaurora.org\n\theader.b=\"lS8cOqGf\"; \n\tdkim=pass (1024-bit key) header.d=codeaurora.org\n\theader.i=@codeaurora.org header.b=\"lS8cOqGf\"; \n\tdkim-atps=neutral", "pdx-caf-mail.web.codeaurora.org;\n\tdmarc=none (p=none dis=none)\n\theader.from=codeaurora.org", "pdx-caf-mail.web.codeaurora.org;\n\tspf=none smtp.mailfrom=okaya@codeaurora.org" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgMfJ1MVsz9s8w\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 03:42:00 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751302AbdH0Rlp (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 27 Aug 2017 13:41:45 -0400", "from smtp.codeaurora.org ([198.145.29.96]:42596 \"EHLO\n\tsmtp.codeaurora.org\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751263AbdH0RlD (ORCPT\n\t<rfc822; linux-pci@vger.kernel.org>); Sun, 27 Aug 2017 13:41:03 -0400", "by smtp.codeaurora.org (Postfix, from userid 1000)\n\tid B343B6072E; Sun, 27 Aug 2017 17:41:02 +0000 (UTC)", "from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com\n\t[129.46.232.65])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\t(Authenticated sender: okaya@smtp.codeaurora.org)\n\tby smtp.codeaurora.org (Postfix) with ESMTPSA id 4443860722;\n\tSun, 27 Aug 2017 17:41:01 +0000 (UTC)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1503855662;\n\tbh=TLw3rtfuszzlvFKE3SUS/SjOdbkWChwBYPp1zwM6gZo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=lS8cOqGfUkN5jWbF077SgE2aeYcRs0VXBoO2/HGATdebgCzuLSgF0kfPZ52AaRJ23\n\tKLhNh/c2nCZDa+IvGhhIgcq1fd1nHa8oW2D8EPUgmwH1lKJtVvkz9t3ukxFcuw93OQ\n\tb6gfchH5fyaRCKd5OY0jihQvr2ikhgxgtjUJxQBQ=", "v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org;\n\ts=default; t=1503855662;\n\tbh=TLw3rtfuszzlvFKE3SUS/SjOdbkWChwBYPp1zwM6gZo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=lS8cOqGfUkN5jWbF077SgE2aeYcRs0VXBoO2/HGATdebgCzuLSgF0kfPZ52AaRJ23\n\tKLhNh/c2nCZDa+IvGhhIgcq1fd1nHa8oW2D8EPUgmwH1lKJtVvkz9t3ukxFcuw93OQ\n\tb6gfchH5fyaRCKd5OY0jihQvr2ikhgxgtjUJxQBQ=" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.0 (2014-02-07) on\n\tpdx-caf-mail.web.codeaurora.org", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00,\n\tDKIM_SIGNED,\n\tT_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0", "DMARC-Filter": "OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4443860722", "From": "Sinan Kaya <okaya@codeaurora.org>", "To": "linux-pci@vger.kernel.org, timur@codeaurora.org,\n\talex.williamson@redhat.com", "Cc": "linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tSinan Kaya <okaya@codeaurora.org>, Bjorn Helgaas <bhelgaas@google.com>,\n\tlinux-kernel@vger.kernel.org", "Subject": "[PATCH V13 2/4] PCI: Factor out pci_bus_wait_crs()", "Date": "Sun, 27 Aug 2017 13:40:49 -0400", "Message-Id": "<1503855651-17409-2-git-send-email-okaya@codeaurora.org>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1503855651-17409-1-git-send-email-okaya@codeaurora.org>", "References": "<1503855651-17409-1-git-send-email-okaya@codeaurora.org>", "Sender": "linux-pci-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-pci.vger.kernel.org>", "X-Mailing-List": "linux-pci@vger.kernel.org" }, "content": "Configuration Request Retry Status (CRS) was previously hidden inside\npci_bus_read_dev_vendor_id(). We want to add support for CRS in other\nsituations, such as waiting for a device to become ready after a Function\nLevel Reset.\n\nMove CRS handling into pci_bus_wait_crs() so it can be called from other\nplaces and also introduce pci_bus_crs_visibility_pending() to determine\nwhen we should wait.\n\nSigned-off-by: Sinan Kaya <okaya@codeaurora.org>\n---\n drivers/pci/probe.c | 52 ++++++++++++++++++++++++++++++++++------------------\n 1 file changed, 34 insertions(+), 18 deletions(-)", "diff": "diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c\nindex 2849e0e..d834a20 100644\n--- a/drivers/pci/probe.c\n+++ b/drivers/pci/probe.c\n@@ -1824,30 +1824,29 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus)\n }\n EXPORT_SYMBOL(pci_alloc_dev);\n \n-bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,\n-\t\t\t\tint crs_timeout)\n+static inline bool pci_bus_crs_visibility_pending(u32 l)\n+{\n+\treturn (l & 0xffff) == 0x0001;\n+}\n+\n+static bool pci_bus_wait_crs(struct pci_bus *bus, int devfn, u32 l,\n+\t\t\t int timeout)\n {\n \tint delay = 1;\n \n-\tif (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))\n-\t\treturn false;\n+\tif ((l & 0xffff) != 0x0001)\n+\t\treturn true;\t/* not a CRS completion */\n \n-\t/* some broken boards return 0 or ~0 if a slot is empty: */\n-\tif (*l == 0xffffffff || *l == 0x00000000 ||\n-\t *l == 0x0000ffff || *l == 0xffff0000)\n-\t\treturn false;\n+\tif (!timeout)\n+\t\treturn false;\t/* CRS, but caller doesn't want to wait */\n \n \t/*\n-\t * Configuration Request Retry Status. Some root ports return the\n-\t * actual device ID instead of the synthetic ID (0xFFFF) required\n-\t * by the PCIe spec. Ignore the device ID and only check for\n-\t * (vendor id == 1).\n+\t * We got the reserved Vendor ID that indicates a completion with\n+\t * Configuration Request Retry Status (CRS). Retry until we get a\n+\t * valid Vendor ID or we time out.\n \t */\n-\twhile ((*l & 0xffff) == 0x0001) {\n-\t\tif (!crs_timeout)\n-\t\t\treturn false;\n-\n-\t\tif (delay > crs_timeout) {\n+\twhile ((l & 0xffff) == 0x0001) {\n+\t\tif (delay > timeout) {\n \t\t\tprintk(KERN_WARNING \"pci %04x:%02x:%02x.%d: not responding\\n\",\n \t\t\t pci_domain_nr(bus), bus->number, PCI_SLOT(devfn),\n \t\t\t PCI_FUNC(devfn));\n@@ -1857,12 +1856,29 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,\n \t\tmsleep(delay);\n \t\tdelay *= 2;\n \n-\t\tif (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))\n+\t\tif (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, &l))\n \t\t\treturn false;\n \t}\n \n \treturn true;\n }\n+\n+bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,\n+\t\t\t\tint timeout)\n+{\n+\tif (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l))\n+\t\treturn false;\n+\n+\t/* some broken boards return 0 or ~0 if a slot is empty: */\n+\tif (*l == 0xffffffff || *l == 0x00000000 ||\n+\t *l == 0x0000ffff || *l == 0xffff0000)\n+\t\treturn false;\n+\n+\tif (pci_bus_crs_visibility_pending(*l))\n+\t\treturn pci_bus_wait_crs(bus, devfn, *l, timeout);\n+\n+\treturn true;\n+}\n EXPORT_SYMBOL(pci_bus_read_dev_vendor_id);\n \n /*\n", "prefixes": [ "V13", "2/4" ] }