Received: by 10.223.185.116 with SMTP id b49csp2301470wrg; Thu, 22 Feb 2018 11:25:16 -0800 (PST) X-Google-Smtp-Source: AH8x226Y6fTaoxLGl/maRqEn/G4pCuL7ulssxWvPXZJo3HAl4+OgRyL4bcx+tvO6zwStKuu65oQK X-Received: by 2002:a17:902:8289:: with SMTP id y9-v6mr1180734pln.242.1519327516547; Thu, 22 Feb 2018 11:25:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519327516; cv=none; d=google.com; s=arc-20160816; b=V4hPeWTyjf8dhtGgXGyCarBK+u0tq6cxL9l5vHEpqOHJjpIO/wU1qOfDT4Acvjwxht WrqL6e+vGm1IwakY8BO2+hwhKalTLW6Pqw8/A2AKMgjE2QbQdPKmS+woVGcxkdOx0UAy Fo8H8xFD83R8EeHc5vZhQystI6dbvvqluAa3kgIUUtj365xJY51kNeMWGo7BwjpEYp71 kQaOZ2PqlOiANJROk4VkgNSYLnsFY6sUek0p15aI5mkq7fki+Fs0TFbm8T2PHhJiWhDR IBl/R/AX3QtFIfMOZ+FVc0CeoWm2ZO/kt8NgzrxCei0j0au/eSE9UwzOQNkTrlBlOhMV 1Jag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature :arc-authentication-results; bh=5cxyGfsZrurJEeQgMIhCYxBkY2R90RgL01hKbAuFOpw=; b=IEn2lnU41Dgkx80qr7Tgc/F3VLETwONIbXxk2UV+lYPh/HvCcobJ+EDCZM+8l+nqbb l+XkAOgnNYJeMhLuF4P5BJAN+dc2SKE3TMhPy+kokHTBDD+MeGC0VwSwMQjD40C7Gkby p87mvjMaChLlYXWe5gcvJBuIC2ZOxtxqzpWNqcZkisJjFzFUYT4AXPoc1nsEWR7ZMb5Z SHeWhEu5U16UtF13a+vuDKXJcKNbC0znHk2NhT4XCrH9LrnI0KEVwabLKals9u5EOhho QdRo9MKR7N0BCV8zBjkdYrGu5Qnt8kmfamnpo0pPa6RgO/rb0IR5J65Vbi5fh8jqG86v AkZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=IvJnuaC9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k66si461464pfa.415.2018.02.22.11.25.02; Thu, 22 Feb 2018 11:25:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=IvJnuaC9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751385AbeBVTXu (ORCPT + 99 others); Thu, 22 Feb 2018 14:23:50 -0500 Received: from merlin.infradead.org ([205.233.59.134]:56496 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821AbeBVTXq (ORCPT ); Thu, 22 Feb 2018 14:23:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5cxyGfsZrurJEeQgMIhCYxBkY2R90RgL01hKbAuFOpw=; b=IvJnuaC9gSKe92SJ1sqvJi79fo f++ZDR/zNRBdN9VtdwXPXRB3BWRbvuzDGYUDehUyU6Dxq8MMV5KcIrkyLvkYxQgf5fqb6BAJvVU+E 6lGPlC7HjOum0LbhhiK4o/GHSY5x5FXLOFZ+HhMq0Bv3Ji3o6eX+AdMOsKb3LQsueMSIX1G91ae5W qT95oM7BzEMP1yf5TvO5E/sJtAHqRyDRzuEZvMMSsZPP0zi+FmILppK1D9MoOsfbwdcWQENcPXmq3 /9MTxYYSAPlQe4oJnyOXd6dMC9GvqApJ2x8IFN4fKSmNJdQalyUM4/Vr94i5MjTGcQIYN/joVA4Xj tzpk8PKA==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eowSo-0000NB-4d; Thu, 22 Feb 2018 19:23:30 +0000 Subject: Re: [PATCH v9 7/7] PCI/DPC: Enumerate the devices after DPC trigger event To: Oza Pawandeep , Bjorn Helgaas , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Dongdong Liu , Keith Busch , Wei Zhang , Sinan Kaya , Timur Tabi References: <1519285571-5634-1-git-send-email-poza@codeaurora.org> <1519285571-5634-8-git-send-email-poza@codeaurora.org> From: Randy Dunlap Message-ID: Date: Thu, 22 Feb 2018 11:23:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519285571-5634-8-git-send-email-poza@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/21/2018 11:46 PM, Oza Pawandeep wrote: > Implement error_resume callback in DPC so, after DPC trigger event > enumerates the devices beneath. > > Signed-off-by: Oza Pawandeep > > diff --git a/drivers/pci/pcie/pcie-dpc.c b/drivers/pci/pcie/pcie-dpc.c > index fce4518..59c01c7 100644 > --- a/drivers/pci/pcie/pcie-dpc.c > +++ b/drivers/pci/pcie/pcie-dpc.c > @@ -129,6 +129,23 @@ static void dpc_wait_link_inactive(struct dpc_dev *dpc) > } > > /** > + * dpc_error_resume - enumerate the devices beneath > + * @dev: pointer to Root Port's pci_dev data structure * @pdev: ... > + * > + * Invoked by Port Bus driver during nonfatal recovery. > + */ > +static void dpc_error_resume(struct pci_dev *pdev) > +{ > + bool active = true; > + > + if (pci_wait_for_link(pdev, active)) { > + pci_lock_rescan_remove(); > + pci_rescan_bus(pdev->bus); > + pci_unlock_rescan_remove(); > + } > +} > + > +/** > * dpc_reset_link - reset link DPC routine > * @dev: pointer to Root Port's pci_dev data structure > * > diff --git a/drivers/pci/pcie/pcie-err.c b/drivers/pci/pcie/pcie-err.c > index 6844347..4950f49 100644 > --- a/drivers/pci/pcie/pcie-err.c > +++ b/drivers/pci/pcie/pcie-err.c > @@ -256,6 +258,15 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, > result_data.result = PCI_ERS_RESULT_RECOVERED; > > if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { > + /* If DPC is triggered, call resume error hanlder handler Kernel multi-line comment style is: /* * Begin comment here. * foo bar blah */ > + * because, at this point we can safely assume that > + * link recovery has happened. > + */ > + if ((severity == DPC_FATAL) && > + (cb == report_resume)) { > + cb(dev, NULL); > + return PCI_ERS_RESULT_RECOVERED; > + } > /* > * If the error is reported by a bridge, we think this error > * is related to the downstream link of the bridge, so we thanks, -- ~Randy