From patchwork Thu Oct 12 22:21:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 825133 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yCljr01bYz9sNV for ; Fri, 13 Oct 2017 09:23:28 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yCljq5kWWzDrGr for ; Fri, 13 Oct 2017 09:23:27 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=gpiccoli@linux.vnet.ibm.com; receiver=) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yClhL1D3zzDqlv for ; Fri, 13 Oct 2017 09:22:09 +1100 (AEDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9CMJ9QS089265 for ; Thu, 12 Oct 2017 18:22:07 -0400 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0a-001b2d01.pphosted.com with ESMTP id 2djbjwcruk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 12 Oct 2017 18:22:07 -0400 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Oct 2017 18:22:06 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Oct 2017 18:22:02 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9CMM2mt33685726; Thu, 12 Oct 2017 22:22:02 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55CFA112054; Thu, 12 Oct 2017 18:21:36 -0400 (EDT) Received: from localhost (unknown [9.85.162.25]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP id 5DB86112056; Thu, 12 Oct 2017 18:21:35 -0400 (EDT) From: "Guilherme G. Piccoli" To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc/powernv: Enable reset_devices parameter to issue a PHB reset Date: Thu, 12 Oct 2017 19:21:53 -0300 X-Mailer: git-send-email 2.14.2 X-TM-AS-GCONF: 00 x-cbid: 17101222-0024-0000-0000-000002E22594 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007887; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000236; SDB=6.00930257; UDB=6.00468275; IPR=6.00710523; BA=6.00005635; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017513; XFM=3.00000015; UTC=2017-10-12 22:22:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101222-0025-0000-0000-000045B63F76 Message-Id: <20171012222153.24905-1-gpiccoli@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-12_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710120315 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maurosr@linux.vnet.ibm.com, paulus@samba.org, gpiccoli@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" During a kdump kernel boot in PowerPC, we request a reset of the PHBs to the FW. It makes sense, since if we are booting a kdump kernel it means we had some trouble before and we cannot rely in the adapters' health; they could be in a bad state, hence the reset is needed. But not only in a kdump kernel we could use this reset - there are situations, specially when debugging drivers, that we could break an adapter in a way it requires such reset. One can tell to just go ahead and reboot the machine, but happens that many times doing kexec is much faster, and so preferable than a full power cycle. Also, we could have situations in which adapters are in bad state due to adapter's FW issue, and only a PHB Fundamental Reset could revive them. This patch enables the reset_devices parameter to perform such reset. The parameter is barely used - only few drivers make use of it. This is a PowerPC-only change. Signed-off-by: Guilherme G. Piccoli --- This patch was built/tested against powerpc/next branch. We recently had a situation in which i40e driver couldn't start, even after a full power cycle, due to a bug in its FW triggered by a DCB condition in switch (thanks Mauro for narrowing this). This patch enabled us to revive the adapter and use network while debugging. Documentation/admin-guide/kernel-parameters.txt | 3 ++- arch/powerpc/platforms/powernv/pci-ioda.c | 7 +++++-- init/main.c | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 05496622b4ef..e75cf4a9345d 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3656,7 +3656,8 @@ the bottom of the address space. reset_devices [KNL] Force drivers to reset the underlying device - during initialization. + during initialization. In PowerPC bare-metal (aka + PowerNV), it also issues a Fundamental Reset on PHBs. resume= [SWSUSP] Specify the partition device for software suspend diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index fb5cd7511189..0a5f2a221a09 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -4014,9 +4014,12 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, * If we're running in kdump kernel, the previous kernel never * shutdown PCI devices correctly. We already got IODA table * cleaned out. So we have to issue PHB reset to stop all PCI - * transactions from previous kernel. + * transactions from previous kernel. Also, reset_devices + * parameter will force the issue of reset (useful in debug + * scenarios). */ - if (is_kdump_kernel()) { + + if (is_kdump_kernel() || reset_devices) { pr_info(" Issue PHB reset ...\n"); pnv_eeh_phb_reset(hose, EEH_RESET_FUNDAMENTAL); pnv_eeh_phb_reset(hose, EEH_RESET_DEACTIVATE); diff --git a/init/main.c b/init/main.c index 0ee9c6866ada..9d3dc50fadfe 100644 --- a/init/main.c +++ b/init/main.c @@ -157,10 +157,10 @@ EXPORT_SYMBOL(reset_devices); static int __init set_reset_devices(char *str) { reset_devices = 1; - return 1; + return 0; } -__setup("reset_devices", set_reset_devices); +early_param("reset_devices", set_reset_devices); static const char *argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; const char *envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };