From patchwork Fri Apr 30 23:26:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 12234529 X-Patchwork-Delegate: bhelgaas@google.com 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, 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 ACD99C433ED for ; Fri, 30 Apr 2021 23:26:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7132161418 for ; Fri, 30 Apr 2021 23:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232784AbhD3X1j (ORCPT ); Fri, 30 Apr 2021 19:27:39 -0400 Received: from mail-eopbgr770043.outbound.protection.outlook.com ([40.107.77.43]:44708 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231462AbhD3X1i (ORCPT ); Fri, 30 Apr 2021 19:27:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PSSf2NODwsWK++Vle61P2ls+rte1Gc15BpX+y7Trp/YnT3nGk2W+DDyv2Mhnc4wYEApWZwv6rWBDxsd/5Ji5hbR3DB+OQj5OKqMrissR1gaemvAyrnuXAm4uN7dj1o9bTFYNG94PM0ZrYpk0YvMGomon52ZqktHVKpN1aVEQy2SdrqBLxyZ/HWPCKaWlsghyhDGbXJTPJU07Fa8mPMxejzRNZspsqBqQ+POF7LikpzaF6fM58bTzmaZG204sdDf8Tn5QLM66LBAeiviR5AfIGP8zFV0F6KkcdoitpbicDScIovaN2shiK4JgCo0TN1LVn4u1saAivkd2jRfQfPfb0g== 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=ZYD8zmkuXkTRZTntgEEezk0FI9TU9oRWlazn5CklR64=; b=nFaQILexp7ss5w1n3U8FTr3rm4XuuqNQHfaBF5R1WG1oOlJHNSr0AklwSJKMWakgWehOcD/gEccT1vsicCxHZXG1zJ9x4II8u46Pxeb7mn8d78E6aanj1sIqmOByNZtKdfUjvCyr/QVTvOHFLrNNM8VORSzkEvvZkMvGTLSD+u1AH4GuXP5COdXPjP77q/tHqPZC/UeJN3zIGwR7B8Mj5yhusAbeK6VkBQLOalmbPEkf/0YrRKr/gULn721hHrsSpD1ZJ8h7SsHzU5AV7PEJWclyxbXEOU7ztbhZVIkKztGT4raNuEs0xxNoFfp1P6FpiY2RVqsLB31C5Q6QsMzmrA== 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=ZYD8zmkuXkTRZTntgEEezk0FI9TU9oRWlazn5CklR64=; b=nY4yLkTxeiA5sq032G7pFTjUq00l9a5rN+++AzR3dyBKNPfKgfxugXdDn0+kHnTR/aaHWGFCSA5oKUdr+f1jXZ8XwwtWv/nYKkt4vG5ws5C5Jk4kg6czExdv8RM5wPgLo7GMlftsee0n4FfRHZzpDSuJRuZQXItp888Sss3LtguBww+/PPtEaywdY0X+3U+BVjWdhqu3aH+oQiIVYLmQ2vG7rdsiKcke/JRrrqW3G1P7VWBwKhRAPGsFcYrzIjnriAMD0F/JQdlNr/pavXSNhT34RGEuN/e89faQL7h+6L75tEdwLTaOzjEey11LSLDFa4puvV4meN0yL0ifdneSuw== Received: from BN9PR03CA0655.namprd03.prod.outlook.com (2603:10b6:408:13b::30) by MWHPR12MB1535.namprd12.prod.outlook.com (2603:10b6:301:5::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.21; Fri, 30 Apr 2021 23:26:47 +0000 Received: from BN8NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13b:cafe::5e) by BN9PR03CA0655.outlook.office365.com (2603:10b6:408:13b::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.27 via Frontend Transport; Fri, 30 Apr 2021 23:26:47 +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 BN8NAM11FT056.mail.protection.outlook.com (10.13.177.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.27 via Frontend Transport; Fri, 30 Apr 2021 23:26:47 +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; Fri, 30 Apr 2021 23:26:44 +0000 From: Shanker Donthineni To: Alex Williamson CC: Bjorn Helgaas , , , Sinan Kaya , Vikram Sethi , Amey Narkhede , "Shanker Donthineni" Subject: [PATCH v5 1/2] PCI: Add support for a function level reset based on _RST method Date: Fri, 30 Apr 2021 18:26:23 -0500 Message-ID: <20210430232624.25153-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: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81d3b72c-e77d-4626-6d87-08d90c2f6cb0 X-MS-TrafficTypeDiagnostic: MWHPR12MB1535: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SBnk62MATruWu0TnsWgbCKvbnQ6AQxnurl57xC19wJgzx3cG65Ofyk6P2klqyC08kSaRg13+SF89oLDyImKsrcCxHozZ8F1XCxYpnsXlJ09Q10vulICSqeT7X8s7KpZTTk1+0F25mje2LWhWCPNfXO8mDQKAgaueugH1X3LL0VzJDhtGE4NA3E44G372V4v86eNcVUd6MhxdphwK/BRnTTP08LWC6aERJmJoVnHcxOtBP3iDwRVGBPaUoy3sTyEy72FXsmrpaVeYRHUF9VSmNuaTRnWmLq/95z6TeqVxle5O60yJ9skNVuuFlAHGa1gVF2v1i+Zp80XmqwcPVTGvYlC42G1/YHzL7BqbSbyP+CJgNcfjZDzKaa/hiPNYEaFDI9bvm+KzpwJaTeKzXxhN9/8bDaJ10jf1eetibVP7kF3/QZVVNzgkaGFLLOWfTTQOLHdXKRz76U7IQGPmmcUorSpPkMGLcf3qWOqXL8OGmADeBVaXpgqODdiWkGkdl9tnlDnk0f7JecvScRdxhzV/WVANX8F5uBHrLzL2tjj01lFxHMpx2lTeG8cZeiLP9XHlbc9Xrw3W/IUjXbUnaCPEJWBStn3e5FDRgx0x1lpR0zZWJo6JcNp8BW78jfkPSncWinj9aV7pOd+xeqHjzJyRRQfCSobIzrsBUAd2GdMovuuMw6jZWpoKAETE9UUaS93v2K2QGkC1cQZFkGKeZiJUIbhLDXvviAh6CL490xiJsQw= 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)(39860400002)(136003)(36840700001)(46966006)(107886003)(7696005)(36860700001)(54906003)(82740400003)(47076005)(8676002)(4326008)(478600001)(6916009)(316002)(36906005)(8936002)(70586007)(36756003)(2906002)(336012)(426003)(2616005)(16526019)(5660300002)(70206006)(7636003)(82310400003)(26005)(966005)(86362001)(83380400001)(356005)(6666004)(186003)(1076003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2021 23:26:47.4464 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81d3b72c-e77d-4626-6d87-08d90c2f6cb0 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: BN8NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1535 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 binding information is available only after calling device_add(), so move pci_init_reset_methods() to end of the pci_device_add(). The default priority of the acpi reset is set to below device-specific and above hardware resets. Signed-off-by: Shanker Donthineni Reviewed-by: Sinan Kaya --- changes since v4: - change acpi reset method name from 'acpi_reset' to 'acpi' changes since v3: - rebase patch on top of https://lore.kernel.org/linux-pci/20210409192324.30080-1-ameynarkhede03@gmail.com/ changes since v2: - fix typo in the commit text drivers/pci/pci.c | 30 ++++++++++++++++++++++++++++++ drivers/pci/probe.c | 2 +- include/linux/pci.h | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 664cf2d358d6..d39dba590583 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -5076,6 +5076,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 +} + /* * The ordering for functions in pci_reset_fn_methods * is required for reset_methods byte array defined @@ -5083,6 +5112,7 @@ static void pci_dev_restore(struct pci_dev *dev) */ const struct pci_reset_fn_method pci_reset_fn_methods[] = { { .reset_fn = &pci_dev_specific_reset, .name = "device_specific" }, + { .reset_fn = &pci_dev_acpi_reset, .name = "acpi" }, { .reset_fn = &pcie_reset_flr, .name = "flr" }, { .reset_fn = &pci_af_flr, .name = "af_flr" }, { .reset_fn = &pci_pm_reset, .name = "pm" }, diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4764e031a44b..d4becd6ffb52 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2403,7 +2403,6 @@ static void pci_init_capabilities(struct pci_dev *dev) pci_rcec_init(dev); /* Root Complex Event Collector */ pcie_report_downtraining(dev); - pci_init_reset_methods(dev); } /* @@ -2494,6 +2493,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) dev->match_driver = false; ret = device_add(&dev->dev); WARN_ON(ret < 0); + pci_init_reset_methods(dev); } struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn) diff --git a/include/linux/pci.h b/include/linux/pci.h index 9f8347799634..b4a5d2146542 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -49,7 +49,7 @@ PCI_STATUS_SIG_TARGET_ABORT | \ PCI_STATUS_PARITY) -#define PCI_RESET_FN_METHODS 5 +#define PCI_RESET_FN_METHODS 6 /* * The PCI interface treats multi-function devices as independent From patchwork Fri Apr 30 23:26:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shanker Donthineni X-Patchwork-Id: 12234531 X-Patchwork-Delegate: bhelgaas@google.com 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, 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 386AFC433B4 for ; Fri, 30 Apr 2021 23:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 184B5613E8 for ; Fri, 30 Apr 2021 23:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232870AbhD3X1j (ORCPT ); Fri, 30 Apr 2021 19:27:39 -0400 Received: from mail-bn8nam12on2083.outbound.protection.outlook.com ([40.107.237.83]:64480 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232757AbhD3X1j (ORCPT ); Fri, 30 Apr 2021 19:27:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e0ONcqc9pzwn/ObKIAjN5LrVIom32Pn97q8y1LciXmrA2q54wmUM3ps6bd30+GdymaYhs1VxUutpD0mWdqFBiQjI7XeJarq7qHTuMA1nESnX4Ahn4HrVAP0FQOxEpbpg4GHIT0aHswJZizCb9xgM1mTbRgtBLiQynQKr29cBsBnV2buBghpQKF2uN/dX29U8r0KBZpMhiT4GpiTwiY21RejACBIPzDw6+7bORy1iOy25fyygQQZ+zSG/7tHKtZhUJKsYr4nuFDXeUIsv51obg7N65VxoZIKqTxYExwc7MDcKfO6P/lGAxD/xMZXueOWzQmhriM5ajHe5DEkwfyeAUA== 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=fh8GIOHiTLQe1OrexaBObUgLK7XCYWqn4hGsanqtKgk=; b=cRQuzBNnP1kgDLUg7P9mz41H334yMoNw+1NdT9qE+nAJC2SIWud/L1F9X9JQR6KEvOuKctrryWLLSms5TQHTN5MW8BTnbRsmN6e1hiHtLNgj31Und3ExkRQvrlrsA85iNTCqqJLLNK7yxRocQr4GcokQY7ois71OH5EQwvaqmxqB7gvV/0kRwP5e6JKr0X/dhrDw+TQeaaLGS++mVFMpy7zJetqwynw/gzJl6P/3jIHGMop5FFzjfMi5ZQB6mmEHhKHgBkA5ZBhZbwcsGUMfJTq/fIKC6cRR99RCk5dAlrb2JTTRgeLsuYeTvmOhWlruSghq/PLZfAFN5BMKcicJIw== 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=fh8GIOHiTLQe1OrexaBObUgLK7XCYWqn4hGsanqtKgk=; b=s5UMBr5QhGp73QlB6X1VIxQ9aACEriwakC93/Viry1PbMYJ2fDDrIlldOFoLhc6El2FyAsikHxcAR27g2mzAXTDyA7DZuceDbQcPWwvKVgiv+5qfuvD7AvlyqiqA4cc+c88pqdOrW2ZwhXE26DOu4dI9N4Gwv1z3CaVjJRd82KrOV4/UgRjSQPXBdpNexeeKuL/fPwgbboXjBVzx9BHvJ1GlKmjAfzAXTv0LHzwwARfh+LOWxigNDua7EtjoNJPLxhdF/GLnIx1MrWx5l6MgcGowT6aqdCgjZCowMiqgZNEEqyB03GpBOB6K4z/eM76fM3muQc/0HzMEdFm9GQBWrg== Received: from BN9PR03CA0659.namprd03.prod.outlook.com (2603:10b6:408:13b::34) by SA0PR12MB4525.namprd12.prod.outlook.com (2603:10b6:806:92::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.23; Fri, 30 Apr 2021 23:26:49 +0000 Received: from BN8NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13b:cafe::8e) by BN9PR03CA0659.outlook.office365.com (2603:10b6:408:13b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4087.25 via Frontend Transport; Fri, 30 Apr 2021 23:26:49 +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 BN8NAM11FT056.mail.protection.outlook.com (10.13.177.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4087.27 via Frontend Transport; Fri, 30 Apr 2021 23:26:48 +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; Fri, 30 Apr 2021 23:26:46 +0000 From: Shanker Donthineni To: Alex Williamson CC: Bjorn Helgaas , , , Sinan Kaya , Vikram Sethi , Amey Narkhede , "Shanker Donthineni" Subject: [PATCH v5 2/2] PCI: Enable NO_BUS_RESET quirk for Nvidia GPUs Date: Fri, 30 Apr 2021 18:26:24 -0500 Message-ID: <20210430232624.25153-2-sdonthineni@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210430232624.25153-1-sdonthineni@nvidia.com> References: <20210430232624.25153-1-sdonthineni@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [172.20.145.6] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 590d81fc-5e8a-49b5-b8c7-08d90c2f6d8b X-MS-TrafficTypeDiagnostic: SA0PR12MB4525: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RjaNTImz3YlSNOGWD8PAu5rXLpIyCUanozWzFAkpfejqjan00KcYz2CkceT2FypY3KsFijtFmHGi3MLaVfoMs4sUW9RPZdylPbfxk8e7oFLaxaaVDI60F7A1zJMP3yJdTWbiRfaY3Xx07EfM0wXvIcpssF8hu4Hn2YzRe2JZtDkejSlbnmEVrbZMlYDh1cQNTDYaQe/kt/b8sRSHT/UQyivPagS5rPfXEOpN0n2RcGmTcb5MvStY6/1b3AoALw/yLvVwmfm1CCJgaUIvWO3K4yCWiqEUsSjh4zZa1uARVpUNycM5U5PicrJC2pIMYt2VGWNj52ys8itiBdPmPCbvvGnRJT2vtz3kSmQpwCDAkcCGP8/7AtYQQcloOxb5tG1jq/E2OyiLvRRC08gCSX7oWuK9u9YOfAg9KsxizkOd2xHSIYzpjj1k3TijQSqH36qQf05Ug0VH88IHOwCpvNK/StKG4VMkakCigoNMd0DaGzmcRy9hu3bK/cCIjjrbV4NWJ3/DxMvpyxok/3GdlMb1x7aS7OGJGYvp5wkTDQiesYbCInyN0o/6ghkDx7+aOCuHKfUNSG+IlB3iSUQu3xn/B2a3/PGQVSLmHwZcs4WryRVHXWL3dmRcYtSw+AE4ZMSsdrorRAKFohR1ZHK58xAHEA== 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)(346002)(396003)(39860400002)(46966006)(36840700001)(107886003)(70586007)(47076005)(4326008)(2906002)(86362001)(8676002)(6916009)(5660300002)(356005)(36860700001)(7636003)(8936002)(26005)(1076003)(186003)(16526019)(70206006)(316002)(6666004)(426003)(36756003)(7696005)(82310400003)(54906003)(36906005)(82740400003)(336012)(478600001)(2616005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2021 23:26:48.8806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 590d81fc-5e8a-49b5-b8c7-08d90c2f6d8b 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: BN8NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4525 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 Reviewed-by: Sinan Kaya --- Changes since v4: - Move reset quirk next to the existing no_bus reset quirks 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 8f47d139c381..ceec67342365 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -3558,6 +3558,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev) dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET; } +/* + * 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) + quirk_no_bus_reset(dev); +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, + quirk_nvidia_no_bus_reset); + /* * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset. * The device will throw a Link Down error on AER-capable systems and