diff mbox series

[1/2] pci: Make the pci-eeh-verbose nvram option generic

Message ID 20190625234834.8199-1-oohall@gmail.com
State Accepted
Headers show
Series [1/2] pci: Make the pci-eeh-verbose nvram option generic | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (b904cb733750de1bb0e04e5012c391a9c3094d11)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot fail Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Oliver O'Halloran June 25, 2019, 11:48 p.m. UTC
We currently have the "pci-eeh-verbose" NVRAM flag that causes phb4 to
print a register dump when it detects the PHB has been fenced. This is
useful for debugging most EEH issues since the kernel may not be ready
to handle EEH events when the problem is first detected.

There's no real reason this needs to be specific to PHB4 so this patch
moves the nvram flag handling into the generic init path (along with the
pcie_max_link_speed flag) so we can add a similar function for PHB3.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/init.c   |  5 +++++
 hw/phb4.c     | 10 +++-------
 include/pci.h |  3 +++
 3 files changed, 11 insertions(+), 7 deletions(-)

Comments

Stewart Smith June 27, 2019, 4:56 a.m. UTC | #1
"Oliver O'Halloran" <oohall@gmail.com> writes:
> We currently have the "pci-eeh-verbose" NVRAM flag that causes phb4 to
> print a register dump when it detects the PHB has been fenced. This is
> useful for debugging most EEH issues since the kernel may not be ready
> to handle EEH events when the problem is first detected.
>
> There's no real reason this needs to be specific to PHB4 so this patch
> moves the nvram flag handling into the generic init path (along with the
> pcie_max_link_speed flag) so we can add a similar function for PHB3.

All looks reasonable. Series merged to master as of
6e049e3c4fc5a046fc50bc38a2ea0826b18a173c
diff mbox series

Patch

diff --git a/core/init.c b/core/init.c
index 3db9df314292..cde1dd3d367d 100644
--- a/core/init.c
+++ b/core/init.c
@@ -58,6 +58,7 @@ 
 
 enum proc_gen proc_gen;
 unsigned int pcie_max_link_speed;
+bool verbose_eeh;
 
 static uint64_t kernel_entry;
 static size_t kernel_size;
@@ -866,6 +867,10 @@  static void pci_nvram_init(void)
 {
 	const char *nvram_speed;
 
+	verbose_eeh = nvram_query_eq_safe("pci-eeh-verbose", "true");
+	if (verbose_eeh)
+		prlog(PR_INFO, "PHB: Verbose EEH enabled\n");
+
 	pcie_max_link_speed = 0;
 
 	nvram_speed = nvram_query_dangerous("pcie-max-link-speed");
diff --git a/hw/phb4.c b/hw/phb4.c
index 9a38dc7525ef..20809c878418 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -151,7 +151,6 @@  static void phb4_init_hw(struct phb4 *p);
 
 #define PHB4_CAN_STORE_EOI(p) XIVE_STORE_EOI_ENABLED
 
-static bool verbose_eeh;
 static bool pci_tracing;
 static bool pci_eeh_mmio;
 static bool pci_retry_all;
@@ -5934,6 +5933,9 @@  static void phb4_probe_pbcq(struct dt_node *pbcq)
 	uint32_t nest_base, pci_base, pec_index;
 	struct dt_node *stk;
 
+	/* REMOVEME: force this for now until we stabalise PCIe */
+	verbose_eeh = 1;
+
 	nest_base = dt_get_address(pbcq, 0, NULL);
 	pci_base = dt_get_address(pbcq, 1, NULL);
 	pec_index = dt_prop_get_u32(pbcq, "ibm,pec-index");
@@ -5949,12 +5951,6 @@  void probe_phb4(void)
 	struct dt_node *np;
 	const char *s;
 
-	verbose_eeh = nvram_query_eq_safe("pci-eeh-verbose", "true");
-	/* REMOVEME: force this for now until we stabalise PCIe */
-	verbose_eeh = 1;
-	if (verbose_eeh)
-		prlog(PR_INFO, "PHB4: Verbose EEH enabled\n");
-
 	pci_tracing = nvram_query_eq_safe("pci-tracing", "true");
 	pci_eeh_mmio = !nvram_query_eq_dangerous("pci-eeh-mmio", "disabled");
 	pci_retry_all = nvram_query_eq_dangerous("pci-retry-all", "true");
diff --git a/include/pci.h b/include/pci.h
index 2b7a3c2893d5..c10d79418e70 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -368,6 +368,9 @@  enum phb_type {
 	phb_type_npu_v2_opencapi,
 };
 
+
+extern bool verbose_eeh;
+
 struct phb {
 	struct dt_node		*dt_node;
 	int			opal_id;