* [PATCH 2/6] powerpc: Add PVR & CPU name to dump stack arch description
2022-09-28 13:40 [PATCH 1/6] powerpc: Add ppc_md.name to dump stack arch description Michael Ellerman
@ 2022-09-28 13:40 ` Michael Ellerman
2022-09-28 13:40 ` [PATCH 3/6] powerpc/64: Add logical PVR to the " Michael Ellerman
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2022-09-28 13:40 UTC (permalink / raw)
To: linuxppc-dev
Add the PVR and CPU name to the dump stack arch description, which is
printed in case of an oops.
eg: Hardware name: ... POWER8E (raw) pvr:0x4b0201
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/prom.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 2e7a04dab2f7..7987d69f1785 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -30,6 +30,7 @@
#include <linux/libfdt.h>
#include <linux/cpu.h>
#include <linux/pgtable.h>
+#include <linux/seq_buf.h>
#include <asm/rtas.h>
#include <asm/page.h>
@@ -819,6 +820,10 @@ void __init early_init_devtree(void *params)
dt_cpu_ftrs_scan();
+ /* We can now set the CPU name & PVR for the oops output */
+ seq_buf_printf(&ppc_hw_desc, "%s pvr:0x%04lx ", cur_cpu_spec->cpu_name,
+ mfspr(SPRN_PVR));
+
/* Retrieve CPU related informations from the flat tree
* (altivec support, boot CPU ID, ...)
*/
--
2.37.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/6] powerpc/64: Add logical PVR to the dump stack arch description
2022-09-28 13:40 [PATCH 1/6] powerpc: Add ppc_md.name to dump stack arch description Michael Ellerman
2022-09-28 13:40 ` [PATCH 2/6] powerpc: Add PVR & CPU name " Michael Ellerman
@ 2022-09-28 13:40 ` Michael Ellerman
2022-09-28 13:40 ` [PATCH 4/6] powerpc: Add device-tree model to " Michael Ellerman
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2022-09-28 13:40 UTC (permalink / raw)
To: linuxppc-dev
If we detect a logical PVR add that to the dump stack arch
description, which is printed in case of an oops.
eg: Hardware name: ... lpvr:0xf000004
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/prom.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 7987d69f1785..dca06ef7fcde 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -390,8 +390,10 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
*/
if (!dt_cpu_ftrs_in_use()) {
prop = of_get_flat_dt_prop(node, "cpu-version", NULL);
- if (prop && (be32_to_cpup(prop) & 0xff000000) == 0x0f000000)
+ if (prop && (be32_to_cpup(prop) & 0xff000000) == 0x0f000000) {
identify_cpu(0, be32_to_cpup(prop));
+ seq_buf_printf(&ppc_hw_desc, "lpvr:0x%04x ", be32_to_cpup(prop));
+ }
check_cpu_feature_properties(node);
check_cpu_features(node, "ibm,pa-features", ibm_pa_features,
--
2.37.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/6] powerpc: Add device-tree model to dump stack arch description
2022-09-28 13:40 [PATCH 1/6] powerpc: Add ppc_md.name to dump stack arch description Michael Ellerman
2022-09-28 13:40 ` [PATCH 2/6] powerpc: Add PVR & CPU name " Michael Ellerman
2022-09-28 13:40 ` [PATCH 3/6] powerpc/64: Add logical PVR to the " Michael Ellerman
@ 2022-09-28 13:40 ` Michael Ellerman
2022-09-28 13:40 ` [PATCH 5/6] powerpc/powernv: Add opal details " Michael Ellerman
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2022-09-28 13:40 UTC (permalink / raw)
To: linuxppc-dev
Add the model of the machine we're on to the dump stack arch
description, which is printed in case of an oops.
eg: Hardware name: model:'IBM,8247-22L'
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/prom.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index dca06ef7fcde..605e4ad8a4c2 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -715,6 +715,23 @@ static void __init tm_init(void)
static void tm_init(void) { }
#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
+static int __init
+early_init_dt_scan_model(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ const char *prop;
+
+ if (depth != 0)
+ return 0;
+
+ prop = of_get_flat_dt_prop(node, "model", NULL);
+ if (prop)
+ seq_buf_printf(&ppc_hw_desc, "model:'%s' ", prop);
+
+ /* break now */
+ return 1;
+}
+
#ifdef CONFIG_PPC64
static void __init save_fscr_to_task(void)
{
@@ -743,6 +760,8 @@ void __init early_init_devtree(void *params)
if (!early_init_dt_verify(params))
panic("BUG: Failed verifying flat device tree, bad version?");
+ of_scan_flat_dt(early_init_dt_scan_model, NULL);
+
#ifdef CONFIG_PPC_RTAS
/* Some machines might need RTAS info for debugging, grab it now. */
of_scan_flat_dt(early_init_dt_scan_rtas, NULL);
--
2.37.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/6] powerpc/powernv: Add opal details to dump stack arch description
2022-09-28 13:40 [PATCH 1/6] powerpc: Add ppc_md.name to dump stack arch description Michael Ellerman
` (2 preceding siblings ...)
2022-09-28 13:40 ` [PATCH 4/6] powerpc: Add device-tree model to " Michael Ellerman
@ 2022-09-28 13:40 ` Michael Ellerman
2022-09-28 13:40 ` [PATCH 6/6] powerpc/pseries: Add firmware " Michael Ellerman
2022-09-28 20:35 ` [PATCH 1/6] powerpc: Add ppc_md.name " Nathan Lynch
5 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2022-09-28 13:40 UTC (permalink / raw)
To: linuxppc-dev
Add OPAL version details to the dump stack arch description, which is
printed in case of an oops.
eg: Hardware name: ... opal:v6.2
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/platforms/powernv/setup.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index dac545aa0308..fddc61ec1d5b 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -17,6 +17,7 @@
#include <linux/console.h>
#include <linux/delay.h>
#include <linux/irq.h>
+#include <linux/seq_buf.h>
#include <linux/seq_file.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
@@ -207,8 +208,33 @@ static void __init pnv_setup_arch(void)
pnv_rng_init();
}
+static void __init pnv_add_dump_stack_arch_desc(void)
+{
+ struct device_node *dn;
+ const char *version;
+
+ dn = of_find_node_by_path("/ibm,opal/firmware");
+ if (!dn)
+ return;
+
+ version = of_get_property(dn, "version", NULL);
+ if (!version)
+ version = of_get_property(dn, "git-id", NULL);
+
+ if (version)
+ seq_buf_printf(&ppc_hw_desc, "opal:%s", version);
+
+ version = of_get_property(dn, "mi-version", NULL);
+ if (version)
+ seq_buf_printf(&ppc_hw_desc, "mi:%s", version);
+
+ of_node_put(dn);
+}
+
static void __init pnv_init(void)
{
+ pnv_add_dump_stack_arch_desc();
+
/*
* Initialize the LPC bus now so that legacy serial
* ports can be found on it
--
2.37.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/6] powerpc/pseries: Add firmware details to dump stack arch description
2022-09-28 13:40 [PATCH 1/6] powerpc: Add ppc_md.name to dump stack arch description Michael Ellerman
` (3 preceding siblings ...)
2022-09-28 13:40 ` [PATCH 5/6] powerpc/powernv: Add opal details " Michael Ellerman
@ 2022-09-28 13:40 ` Michael Ellerman
2022-09-28 20:14 ` Nathan Lynch
2022-09-28 20:35 ` [PATCH 1/6] powerpc: Add ppc_md.name " Nathan Lynch
5 siblings, 1 reply; 9+ messages in thread
From: Michael Ellerman @ 2022-09-28 13:40 UTC (permalink / raw)
To: linuxppc-dev
Add firmware version details to the dump stack arch description, which
is printed in case of an oops.
Currently /hypervisor only exists on KVM, so if we don't find that
look for something that suggests we're on phyp and if so that's
probably a good guess. The actual content of the ibm,fw-net-version
seems to be a full path so is too long to add to the description.
eg: Hardware name: ... of:'IBM,FW860.42 (SV860_138)' hv:phyp
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/platforms/pseries/setup.c | 36 ++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 5e44c65a032c..f0ce8256ebb8 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -41,6 +41,7 @@
#include <linux/of_pci.h>
#include <linux/memblock.h>
#include <linux/swiotlb.h>
+#include <linux/seq_buf.h>
#include <asm/mmu.h>
#include <asm/processor.h>
@@ -1011,6 +1012,39 @@ static void __init pSeries_cmo_feature_init(void)
pr_debug(" <- fw_cmo_feature_init()\n");
}
+static void __init pseries_add_dump_stack_arch_desc(void)
+{
+ struct device_node *dn;
+ const char *prop;
+
+ dn = of_find_node_by_path("/openprom");
+ if (dn) {
+ prop = of_get_property(dn, "model", NULL);
+ if (prop)
+ seq_buf_printf(&ppc_hw_desc, "of:'%s' ", prop);
+
+ of_node_put(dn);
+ }
+
+ dn = of_find_node_by_path("/hypervisor");
+ if (dn) {
+ prop = of_get_property(dn, "compatible", NULL);
+ if (prop)
+ seq_buf_printf(&ppc_hw_desc, "hv:%s ", prop);
+
+ of_node_put(dn);
+ } else {
+ dn = of_find_node_by_path("/");
+ if (dn) {
+ prop = of_get_property(dn, "ibm,fw-net-version", NULL);
+ if (prop)
+ seq_buf_printf(&ppc_hw_desc, "hv:phyp ");
+
+ of_node_put(dn);
+ }
+ }
+}
+
/*
* Early initialization. Relocation is on but do not reference unbolted pages
*/
@@ -1018,6 +1052,8 @@ static void __init pseries_init(void)
{
pr_debug(" -> pseries_init()\n");
+ pseries_add_dump_stack_arch_desc();
+
#ifdef CONFIG_HVC_CONSOLE
if (firmware_has_feature(FW_FEATURE_LPAR))
hvc_vio_init_early();
--
2.37.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 6/6] powerpc/pseries: Add firmware details to dump stack arch description
2022-09-28 13:40 ` [PATCH 6/6] powerpc/pseries: Add firmware " Michael Ellerman
@ 2022-09-28 20:14 ` Nathan Lynch
2022-09-30 4:28 ` Michael Ellerman
0 siblings, 1 reply; 9+ messages in thread
From: Nathan Lynch @ 2022-09-28 20:14 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev
Michael Ellerman <mpe@ellerman.id.au> writes:
> Add firmware version details to the dump stack arch description, which
> is printed in case of an oops.
>
> Currently /hypervisor only exists on KVM, so if we don't find that
> look for something that suggests we're on phyp and if so that's
> probably a good guess. The actual content of the ibm,fw-net-version
> seems to be a full path so is too long to add to the description.
My only reservation is that ibm,fw-net-version seems to be unspecified
and could disappear in future firmware versions.
/ibm,powervm-partition would be the best PAPR-specified property for
this purpose, but I don't see it on a P8/860 partition I checked,
unfortunately. I do see it on a P9. Presumably it's present in device
trees on PowerVM P9 systems and later, but it's probably too new to use
for this.
/ibm,lpar-capable "indicates that the platform is capable of supporting
logical partitioning and is only present on such systems." This one is
present on the P8.
So consider this a weak suggestion to replace the ibm,fw-net-version
check with ibm,lpar-capable. But I don't want to bikeshed it, overall
the series looks good.
>
> eg: Hardware name: ... of:'IBM,FW860.42 (SV860_138)' hv:phyp
Will this info get printed during boot as well? There are many times it
would have been useful to me when looking at logs from non-oopsed
kernels.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 6/6] powerpc/pseries: Add firmware details to dump stack arch description
2022-09-28 20:14 ` Nathan Lynch
@ 2022-09-30 4:28 ` Michael Ellerman
0 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2022-09-30 4:28 UTC (permalink / raw)
To: Nathan Lynch, linuxppc-dev
Nathan Lynch <nathanl@linux.ibm.com> writes:
> Michael Ellerman <mpe@ellerman.id.au> writes:
>
>> Add firmware version details to the dump stack arch description, which
>> is printed in case of an oops.
>>
>> Currently /hypervisor only exists on KVM, so if we don't find that
>> look for something that suggests we're on phyp and if so that's
>> probably a good guess. The actual content of the ibm,fw-net-version
>> seems to be a full path so is too long to add to the description.
>
> My only reservation is that ibm,fw-net-version seems to be unspecified
> and could disappear in future firmware versions.
Yeah good point.
> /ibm,powervm-partition would be the best PAPR-specified property for
> this purpose, but I don't see it on a P8/860 partition I checked,
> unfortunately. I do see it on a P9. Presumably it's present in device
> trees on PowerVM P9 systems and later, but it's probably too new to use
> for this.
I'll look for both, it's easy enough.
> /ibm,lpar-capable "indicates that the platform is capable of supporting
> logical partitioning and is only present on such systems." This one is
> present on the P8.
But conceivably qemu/KVM could provide that property, which would defeat
the purpose here which is to differentiate which actual hypervisor we're
under.
>> eg: Hardware name: ... of:'IBM,FW860.42 (SV860_138)' hv:phyp
>
> Will this info get printed during boot as well? There are many times it
> would have been useful to me when looking at logs from non-oopsed
> kernels.
No it's not. But you're right that would often be useful.
I think we can print it at the end of probe_machine().
I'll send a v2.
cheers
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/6] powerpc: Add ppc_md.name to dump stack arch description
2022-09-28 13:40 [PATCH 1/6] powerpc: Add ppc_md.name to dump stack arch description Michael Ellerman
` (4 preceding siblings ...)
2022-09-28 13:40 ` [PATCH 6/6] powerpc/pseries: Add firmware " Michael Ellerman
@ 2022-09-28 20:35 ` Nathan Lynch
5 siblings, 0 replies; 9+ messages in thread
From: Nathan Lynch @ 2022-09-28 20:35 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev
Michael Ellerman <mpe@ellerman.id.au> writes:
> @@ -588,6 +590,15 @@ static __init int add_pcspkr(void)
> device_initcall(add_pcspkr);
> #endif /* CONFIG_PCSPKR_PLATFORM */
>
> +static char ppc_hw_desc_buf[128] __initdata;
> +
> +struct seq_buf ppc_hw_desc __initdata = {
> + .buffer = ppc_hw_desc_buf,
> + .size = sizeof(ppc_hw_desc_buf),
> + .len = 0,
> + .readpos = 0,
> +};
> +
> static __init void probe_machine(void)
> {
> extern struct machdep_calls __machine_desc_start;
> @@ -628,6 +639,9 @@ static __init void probe_machine(void)
> for (;;);
> }
>
> + seq_buf_printf(&ppc_hw_desc,"machine:%s ", ppc_md.name);
> + dump_stack_set_arch_desc(ppc_hw_desc.buffer);
At first I was confused by the seemingly unnecessary use of the seq_buf,
but after reading the rest of the series I see that this is the final
addition to a temporary buffer before setting the arch description
string. Looks OK to me.
^ permalink raw reply [flat|nested] 9+ messages in thread