linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com>
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	[thread overview]
Message-ID: <20171012222153.24905-1-gpiccoli@linux.vnet.ibm.com> (raw)

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 <gpiccoli@linux.vnet.ibm.com>
---
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

             reply	other threads:[~2017-10-12 22:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 22:21 Guilherme G. Piccoli [this message]
2017-10-13  8:37 ` [PATCH] powerpc/powernv: Enable reset_devices parameter to issue a PHB reset Michael Ellerman
2017-10-13 13:02   ` Guilherme G. Piccoli
2017-10-14  9:13   ` Benjamin Herrenschmidt
2017-10-15 21:51     ` Guilherme G. Piccoli
2017-10-25 15:30 ` Guilherme G. Piccoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171012222153.24905-1-gpiccoli@linux.vnet.ibm.com \
    --to=gpiccoli@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maurosr@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).