From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756573AbdJLWWI (ORCPT ); Thu, 12 Oct 2017 18:22:08 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48318 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750990AbdJLWWH (ORCPT ); Thu, 12 Oct 2017 18:22:07 -0400 From: "Guilherme G. Piccoli" To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Cc: gpiccoli@linux.vnet.ibm.com, benh@kernel.crashing.org, mpe@ellerman.id.au, paulus@samba.org, maurosr@linux.vnet.ibm.com 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, }; -- 2.14.2