From patchwork Tue Apr 27 14:55:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 12226793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23BB4C433B4 for ; Tue, 27 Apr 2021 14:55:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E730261040 for ; Tue, 27 Apr 2021 14:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236512AbhD0O4h (ORCPT ); Tue, 27 Apr 2021 10:56:37 -0400 Received: from mail-mw2nam12on2089.outbound.protection.outlook.com ([40.107.244.89]:38496 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236173AbhD0O4g (ORCPT ); Tue, 27 Apr 2021 10:56:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EN4AyQa9k+8ZrBbcdjZ38QQVVPf0gRbih4FXPFlBxfeAM0mQ6kq24e0Q46f5iq5A+ydGamU8m8Y7uzCfer8Xn3tGs395Qfh0mLnbjCD/yoEtUzTiI95POTXucKt/tnO4DSDyTbsxKlJwizcOImpZN+Zobqzy/ExaHWKjiZnPeH1j4tEUytOh02ONWPOW67JR4WpEz8piRvs4jdrflMAhjOQ2c58Asm5MjWSKJCj2dVFfF7ucya/5hqbBu4GmcKDuqSBQRVWxQt9/EeHHTaXpZukayQjRUOF6TPNoQk7lsjDNwPoh6Rb/Dt02ApZn1VnG7rSueNL5rwi53HkeORmYpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jm2yugh45ZDctOa6WgoSy543SDn0vGE8d0CvSAbFwRQ=; b=LH13K33sAeV5ux1TbTTn3HjA4MNEnMXkCzN0/8n0yMCQ4caqNzMSK+WH1kJ16yWw8jRsLojpFaNoZSS1vqp2Tkev4SqFUifoLOBGFcvA8EFB23DFM8a+YrwrKtMlWi9+TNTY9P3/jFS2cPfFDDDd1o1il1Fb+J4GdLfhvR5GoEI4hwRuKmMMyXcBdPnr1b640uHjp1qAtJPkCEry+ZD25CH6B54tsvXN+Kp369sH8geF3HG/TUyykvANDP15FNkdu3R9ptJ6sOrY6dHHLir24x/LXJV2kIj+J0W/AS+MnatWPE35evzjdwUbBA18eTc/wHE5g1fu7lJ7e5pr86BGhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jm2yugh45ZDctOa6WgoSy543SDn0vGE8d0CvSAbFwRQ=; b=fwvdIQsOz1UnRQ0bjCEk9+aFj5tCQJLnSLiSdnankkwFou9rGy5AnUQFC6g5tqn1MgLQl3n+54c5NBR0TScFsbvhIT3Ue/o3FOfpotx0Q5jBajX+nF9no5bOf7UVhYY+JSp+G9u0x+HwABi+QyWZUo0Y6sm5CJCJ5qfNOtBIqKfWFld1heJLZ7xegqSMRgypb9Wb9suTJ7u6qvkc2yBUJ2ifCZQuD4PNBFkSu1OUben+DOnqm45J55RTuuRU2HZ2RlbFyZV6NAMSnhZIZm8Wx0cKA7nSKVtt3Ki5OvLDvIoq76YSSm3Fe9iM5RcPRw6Eo6MEHqW+YhCMP+DlmXYlvA== Received: from MW4PR03CA0034.namprd03.prod.outlook.com (2603:10b6:303:8e::9) by BL0PR12MB4913.namprd12.prod.outlook.com (2603:10b6:208:1c7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.20; Tue, 27 Apr 2021 14:55:51 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8e:cafe::e) by MW4PR03CA0034.outlook.office365.com (2603:10b6:303:8e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 14:55:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 14:55:51 +0000 Received: from SDONTHINENI-DESKTOP.nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 27 Apr 2021 14:55:50 +0000 From: Shanker Donthineni To: Alex Williamson CC: Bjorn Helgaas , , , Sinan Kaya , Vikram Sethi , Shanker Donthineni Subject: [PATCH v3 1/2] PCI: Add support for a function level reset based on _RST method Date: Tue, 27 Apr 2021 09:55:34 -0500 Message-ID: <20210427145535.4034-1-sdonthineni@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b25a730c-3252-4d85-0802-08d9098c8d12 X-MS-TrafficTypeDiagnostic: BL0PR12MB4913: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RepwdBzjkrl0wu3fuMt/t9BHGrH4uSy7qgO7SBGsebbx2pdd/tT/Dq1htyzzqKh/AqItGKiG85P0kCqotKFx2hj0JgVX0Duvudt3uTmU9nO5f9EfVAHFP9N9GRWHu7ubeUGUDGNjOXadzOCcr51Uc9lNMf1nyK3C52oilAhnOCgXPwMKbFv4A9ILdZXLO6WQTQa7fDGkYnTD1WAUTw+O/1m9TPRj7cSLewbgcbluYPHT9qb1sNlnE82vMrp28cNiGSc3BqLDuPZZx71nypOc3O149seRi+59H+tqP0RrBHZsD5MhHhg782WL4FEr5iXLW6CzJp30XidBn1SPqJ65pEcjKMe+ve18IRL+2T37KODqLYWKA92YyJa/P4ZZVwi73JuebYCTo4kmLEgs2LRHpvoeBWj7ucFzcCodvaNK8yhEPVwbGab7SextMcL9dwJKAP8rzGsMPbdxpHVWu3D7GLEkzN8nTYzEPugFCwSq3b2yQShFhZ4WJI5idBLFSscormgvMF4HVlRfig2jbj68k0f70ApNSNHEspLirDbiuk+uH5+yLqeSnfJaTkSDlBOwU1YmPeDHNo5tQAulxWYU3ozjp//X6ZcXGufm3VoPjGBMdmqWW+T1Ut0kx1KbuQqQaZW0xW5X5m/4hVxs+qwEhwZ4DmA+4MfuDkOvN9/3CDo= X-Forefront-Antispam-Report: CIP:216.228.112.34;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid03.nvidia.com;CAT:NONE;SFS:(4636009)(376002)(396003)(346002)(136003)(39860400002)(46966006)(36840700001)(2906002)(36756003)(83380400001)(478600001)(426003)(336012)(6916009)(70586007)(6666004)(8676002)(54906003)(4326008)(26005)(16526019)(2616005)(8936002)(36906005)(107886003)(316002)(186003)(36860700001)(1076003)(7636003)(70206006)(82740400003)(82310400003)(47076005)(7696005)(356005)(86362001)(5660300002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 14:55:51.5327 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b25a730c-3252-4d85-0802-08d9098c8d12 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.34];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4913 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The _RST is a standard method specified in the ACPI specification. It provides a function level reset when it is described in the acpi_device context associated with PCI-device. Implement a new reset function pci_dev_acpi_reset() for probing RST method and execute if it is defined in the firmware. The ACPI based reset is called after the device-specific reset and before standard PCI hardware resets. Signed-off-by: Shanker Donthineni --- - Fix typo in the commit text drivers/pci/pci.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 16a17215f633..6dadb19848c2 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5054,6 +5054,35 @@ static void pci_dev_restore(struct pci_dev *dev) err_handler->reset_done(dev); } +/** + * pci_dev_acpi_reset - do a function level reset using _RST method + * @dev: device to reset + * @probe: check if _RST method is included in the acpi_device context. + */ +static int pci_dev_acpi_reset(struct pci_dev *dev, int probe) +{ +#ifdef CONFIG_ACPI + acpi_handle handle = ACPI_HANDLE(&dev->dev); + + /* Return -ENOTTY if _RST method is not included in the dev context */ + if (!handle || !acpi_has_method(handle, "_RST")) + return -ENOTTY; + + /* Return 0 for probe phase indicating that we can reset this device */ + if (probe) + return 0; + + /* Invoke _RST() method to perform a function level reset */ + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_RST", NULL, NULL))) { + pci_warn(dev, "Failed to reset the device\n"); + return -EINVAL; + } + return 0; +#else + return -ENOTTY; +#endif +} + /** * __pci_reset_function_locked - reset a PCI device function while holding * the @dev mutex lock. @@ -5089,6 +5118,9 @@ int __pci_reset_function_locked(struct pci_dev *dev) * reset mechanisms might be broken on the device. */ rc = pci_dev_specific_reset(dev, 0); + if (rc != -ENOTTY) + return rc; + rc = pci_dev_acpi_reset(dev, 0); if (rc != -ENOTTY) return rc; if (pcie_has_flr(dev)) { @@ -5127,6 +5159,9 @@ int pci_probe_reset_function(struct pci_dev *dev) might_sleep(); rc = pci_dev_specific_reset(dev, 1); + if (rc != -ENOTTY) + return rc; + rc = pci_dev_acpi_reset(dev, 1); if (rc != -ENOTTY) return rc; if (pcie_has_flr(dev)) From patchwork Tue Apr 27 14:55:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 12226795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFC0FC433ED for ; Tue, 27 Apr 2021 14:55:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3180613DC for ; Tue, 27 Apr 2021 14:55:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238533AbhD0O4i (ORCPT ); Tue, 27 Apr 2021 10:56:38 -0400 Received: from mail-bn8nam11on2045.outbound.protection.outlook.com ([40.107.236.45]:31488 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S236368AbhD0O4h (ORCPT ); Tue, 27 Apr 2021 10:56:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AELwFj+RUMgVsxL+9YxMgEBYFY3Pn0x2cjd5O+Rqq72kGIwCEzqLll6xbyHRWGQxBrS7j+9eYwT5jQAPKXijGP3dnD/eTuqk+/oL2OqmI/p8/iPLlDUWDOnvq0FcLyjGdr8M2dlwjykCDYIyHJ6zaZBYuH24OX59uooN6CguCSiE3838EzZTSaMT8EGna7Of694KLnHPP6ZvJrd9ki0mJD8n+JcF/0jBxULPt7lBw3PqfRWeARzoEBORtdJa4xrHgCuEFuTYulJOxb5c8N9O0h4X/7VI9nbw+AN9rxhUBn+qfFZvqRyMRxKIbhDRhqLosVvF1nYDknYeJr0OkY8vbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RNm2ODLdbWIlzfCihzUgQ7QJjbWZbrti0ZEUhppWpFQ=; b=iaWlKCelyQDOxmNnmlJlltLViiodS4Op79bBpM2RFuXO/38Smt5JgqRwPqHyLBMd5XCeZtvX9OTKIBhNL1+ZtbXeKft9kYda7XEfdIVBp0ApqkPCEiuqOf6STtF8plStfRxCM8aZuhOP9Gkg9EbqKHjA3gA3uwXlWuepGsWtlmTDRqbmFV5Y1y0UiIQD7K44c/VKpGJ2YGU14Kxv+f4A/OP/U3OEpYKVS2ER+8rgRhwxtM/LGl5HySAxz71+OWq8Z6p5JWHGZKWZoI6VFaZOL6z72OvrqfKor6KZHOyCJMZPk7FgFMRuOO5ySep8ypv8uyGCBMBRG4XYr/GLA95UFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RNm2ODLdbWIlzfCihzUgQ7QJjbWZbrti0ZEUhppWpFQ=; b=rah6El62CtY9LU/4/whsoiJgl8K8GHJ5ta5+1IU4tg/72XBgIWlymD6ubX5buO9O+VGmbHt9iFIIiyAhcogVf2QHpPLdDPmQoMjM31/EMRf/LmqKwaLFkumVYXkBDkWL354U/XWyliI2K68TAah/eDXoAmSe/K0S/q2tf/sN7CVUF20SwpnqSBGneJdBjXy2n+VWCE5f86MHF16A450RST+aCNcjTwr+d8SDPltdhJR+7rtHvMpRTQK3bFss6rFN9PIx5KM40f0JauAeXEc/9DjlX4X+t0QvxCW0PH2CTIc6+SUqOTmI7CLVvB1+/2/pH9QwE2QPjk9VonTy0oX1UQ== Received: from MWHPR13CA0017.namprd13.prod.outlook.com (2603:10b6:300:16::27) by BN7PR12MB2643.namprd12.prod.outlook.com (2603:10b6:408:29::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.23; Tue, 27 Apr 2021 14:55:53 +0000 Received: from CO1NAM11FT013.eop-nam11.prod.protection.outlook.com (2603:10b6:300:16:cafe::6a) by MWHPR13CA0017.outlook.office365.com (2603:10b6:300:16::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.17 via Frontend Transport; Tue, 27 Apr 2021 14:55:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT013.mail.protection.outlook.com (10.13.174.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 27 Apr 2021 14:55:52 +0000 Received: from SDONTHINENI-DESKTOP.nvidia.com (172.20.145.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 27 Apr 2021 14:55:51 +0000 From: Shanker Donthineni To: Alex Williamson CC: Bjorn Helgaas , , , Sinan Kaya , Vikram Sethi , Shanker Donthineni Subject: [PATCH v3 2/2] PCI: Enable NO_BUS_RESET quirk for Nvidia GPUs Date: Tue, 27 Apr 2021 09:55:35 -0500 Message-ID: <20210427145535.4034-2-sdonthineni@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427145535.4034-1-sdonthineni@nvidia.com> References: <20210427145535.4034-1-sdonthineni@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dc11e3c4-2730-43ad-4f8b-08d9098c8dd8 X-MS-TrafficTypeDiagnostic: BN7PR12MB2643: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yG/10LUIYWiyj/l5s7xs+Hx0PV4w8KmD1Wbd6bUnpk/ahLigPYtKRm0Irtl1/8j0/wLxkA/u2KzKRPl9HfiETPpiCdIfkSC5EbAGH8cQ1UK/IhuGWfIRhJlZN6SRA5cGxG4LeoEFmQsnLQsK+NIa9Vy8SgzllapKblRDIzBblMYy9uEK/LtMvVljQzLdf8QC3Ebh9zM66ustIL6ld4rT4R4oJm7uRc33dURPMMh0RENofR3yW/TsBIAXWTA02PVlWHtJLjmErJVces5MrzkjEMlj1E1X/Rc3hqkkDG3S62Ao+xWvw83z3VLVebn3BYoBPBUIc4QeTn7QeKiQJNnKbD8GHoI8YoyO5RJXsehdTNIWI1BVZ78eBitNgNmTsRDpwALvCEwHUcPF2h80JWykLRu+4313lvxVmpKK6q4Qymp6C3n49UOsa8hqYnEijX+k3Ev+hJ07Ecua/IAd2zJrOJfe0tf/GMLixAq1r1F5AYKAD880ZlflqYmKSQgEjEt+EH5AYr7n0ck43d52zJPMeAooaQqLJz5+G1E9QsSLwwPXeAzewRoZZXAMe2PvyRu4kqO+d359NgYNdArNlQvSmtN4t+c+c8uqZ0EVA6vnyj/mWP7jtsPa1gi4MD4bbhC5IZJooBcIX6zkvW/xwRXnnxM98pRhvhhzgySA9irUbkU= X-Forefront-Antispam-Report: CIP:216.228.112.34;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid03.nvidia.com;CAT:NONE;SFS:(4636009)(136003)(376002)(396003)(39860400002)(346002)(36840700001)(46966006)(107886003)(8936002)(2906002)(8676002)(356005)(4326008)(82310400003)(2616005)(5660300002)(70586007)(6916009)(36860700001)(47076005)(16526019)(316002)(26005)(82740400003)(36756003)(7696005)(426003)(478600001)(7636003)(336012)(54906003)(70206006)(86362001)(1076003)(36906005)(6666004)(186003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2021 14:55:52.8381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dc11e3c4-2730-43ad-4f8b-08d9098c8dd8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.34];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT013.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2643 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On select platforms, some Nvidia GPU devices do not work with SBR. Triggering SBR would leave the device inoperable for the current system boot. It requires a system hard-reboot to get the GPU device back to normal operating condition post-SBR. For the affected devices, enable NO_BUS_RESET quirk to fix the issue. This issue will be fixed in the next generation of hardware. Signed-off-by: Shanker Donthineni --- Changes since v1: - Split patch into 2, code for handling _RST and SBR specific quirk - The RST based reset is called as a first-class mechanism in the reset code path drivers/pci/quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 653660e3ba9e..1da80e772ee1 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -3913,6 +3913,18 @@ static int delay_250ms_after_flr(struct pci_dev *dev, int probe) return 0; } +/* + * Some Nvidia GPU devices do not work with bus reset, SBR needs to be + * prevented for those affected devices. + */ +static void quirk_nvidia_no_bus_reset(struct pci_dev *dev) +{ + if ((dev->device & 0xffc0) == 0x2340) + dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, + quirk_nvidia_no_bus_reset); + static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF, reset_intel_82599_sfp_virtfn },