From: Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>
To: Hari Bathini <hbathini@linux.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.ibm.com>,
Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
Vasant Hegde <hegdevasant@linux.ibm.com>,
linuxppc-dev <linuxppc-dev@ozlabs.org>,
Nicholas Piggin <npiggin@gmail.com>,
Stewart Smith <stewart@linux.ibm.com>,
Daniel Axtens <dja@axtens.net>
Subject: Re: [PATCH v2 09/16] powernv/fadump: process architected register state data provided by firmware
Date: Tue, 7 May 2019 19:43:56 +0530 [thread overview]
Message-ID: <20190507141356.saug5kjhntwozu76@in.ibm.com> (raw)
In-Reply-To: <155541089317.812.14447001298006010972.stgit@hbathini.in.ibm.com>
On 2019-04-16 16:05:06 Tue, Hari Bathini wrote:
> From: Hari Bathini <hbathini@linux.vnet.ibm.com>
>
> Firmware provides architected register state data at the time of crash.
> Process this data and build CPU notes to append to ELF core.
>
> Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
>
> Changes in v2:
> * Updated reg type values according to recent OPAL changes
>
>
> arch/powerpc/include/asm/opal-api.h | 23 +++
> arch/powerpc/kernel/fadump-common.h | 3
> arch/powerpc/platforms/powernv/opal-fadump.c | 187 ++++++++++++++++++++++++--
> arch/powerpc/platforms/powernv/opal-fadump.h | 4 +
> 4 files changed, 206 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
> index 75471c2..91f2735 100644
> --- a/arch/powerpc/include/asm/opal-api.h
> +++ b/arch/powerpc/include/asm/opal-api.h
> @@ -976,6 +976,29 @@ struct opal_sg_list {
> * Firmware-Assisted Dump (FADump)
> */
>
> +/* FADump thread header for register entries */
> +struct opal_fadump_thread_hdr {
> + __be32 pir;
> + /* 0x00 - 0x0F - The corresponding stop state of the core */
> + u8 core_state;
> + u8 reserved[3];
> +
> + __be32 offset; /* Offset to Register Entries array */
> + __be32 ecnt; /* Number of entries */
> + __be32 esize; /* Alloc size of each array entry in bytes */
> + __be32 eactsz; /* Actual size of each array entry in bytes */
> +} __packed;
> +
> +#define OPAL_REG_TYPE_GPR 0x01
> +#define OPAL_REG_TYPE_SPR 0x02
> +
> +/* FADump register entry. */
> +struct opal_fadump_reg_entry {
> + __be32 reg_type;
> + __be32 reg_num;
> + __be64 reg_val;
> +};
> +
> /* The maximum number of dump sections supported by OPAL */
> #define OPAL_FADUMP_NR_SECTIONS 64
>
> diff --git a/arch/powerpc/kernel/fadump-common.h b/arch/powerpc/kernel/fadump-common.h
> index ff764d4..8d47382 100644
> --- a/arch/powerpc/kernel/fadump-common.h
> +++ b/arch/powerpc/kernel/fadump-common.h
> @@ -117,6 +117,9 @@ struct fadump_memory_range {
>
> /* Firmware-assisted dump configuration details. */
> struct fw_dump {
> + unsigned long cpu_state_destination_addr;
> + unsigned long cpu_state_data_version;
> + unsigned long cpu_state_entry_size;
> unsigned long cpu_state_data_size;
> unsigned long hpte_region_size;
> unsigned long boot_memory_size;
> diff --git a/arch/powerpc/platforms/powernv/opal-fadump.c b/arch/powerpc/platforms/powernv/opal-fadump.c
> index da8480d..853f663 100644
> --- a/arch/powerpc/platforms/powernv/opal-fadump.c
> +++ b/arch/powerpc/platforms/powernv/opal-fadump.c
> @@ -94,6 +94,12 @@ static void update_fadump_config(struct fw_dump *fadump_conf,
>
> last_end = base + size;
> j++;
> + } else if (fdm->section[i].src_type ==
> + OPAL_FADUMP_CPU_STATE_DATA) {
> + fadump_conf->cpu_state_destination_addr =
> + be64_to_cpu(fdm->section[i].dest_addr);
> + fadump_conf->cpu_state_data_size =
> + be64_to_cpu(fdm->section[i].dest_size);
> }
> }
> fadump_conf->rmr_regions_cnt = j;
> @@ -199,6 +205,75 @@ static int opal_invalidate_fadump(struct fw_dump *fadump_conf)
> return 0;
> }
>
> +static inline void fadump_set_regval_regnum(struct pt_regs *regs, u32 reg_type,
> + u32 reg_num, u64 reg_val)
> +{
> + if (reg_type == OPAL_REG_TYPE_GPR) {
> + if (reg_num < 32)
> + regs->gpr[reg_num] = reg_val;
> + return;
> + }
> +
> + switch (reg_num) {
> + case 2000:
> + regs->nip = reg_val;
> + break;
> + case 2001:
> + regs->msr = reg_val;
> + break;
> + case 9:
> + regs->ctr = reg_val;
> + break;
> + case 8:
> + regs->link = reg_val;
> + break;
> + case 1:
> + regs->xer = reg_val;
> + break;
> + case 2002:
> + regs->ccr = reg_val;
> + break;
> + case 19:
> + regs->dar = reg_val;
> + break;
> + case 18:
> + regs->dsisr = reg_val;
> + break;
Can we use SPRN_* #defines which are already present in asm/reg.h instead of
hard coding numbers for switch cases ? You may want to add new #defines
for NIP, MSR and CCR.
Thanks,
-Mahesh.
next prev parent reply other threads:[~2019-05-07 14:17 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-16 10:32 [PATCH v2 00/16] Add FADump support on PowerNV platform Hari Bathini
2019-04-16 10:33 ` [PATCH v2 01/16] powerpc/fadump: move internal fadump code to a new file Hari Bathini
2019-04-16 10:33 ` [PATCH v2 02/16] powerpc/fadump: Improve fadump documentation Hari Bathini
2019-04-16 10:33 ` [PATCH v2 03/16] pseries/fadump: move out platform specific support from generic code Hari Bathini
2019-04-16 10:33 ` [PATCH v2 04/16] powerpc/fadump: use FADump instead of fadump for how it is pronounced Hari Bathini
2019-04-16 10:34 ` [PATCH v2 05/16] powerpc/fadump: enable fadump support on OPAL based POWER platform Hari Bathini
2019-04-16 10:34 ` [PATCH v2 06/16] powerpc/fadump: Update documentation about OPAL platform support Hari Bathini
2019-04-16 10:34 ` [PATCH v2 07/16] powerpc/fadump: consider reserved ranges while reserving memory Hari Bathini
2019-04-16 10:34 ` [PATCH v2 08/16] powerpc/fadump: consider reserved ranges while releasing memory Hari Bathini
2019-04-16 10:35 ` [PATCH v2 09/16] powernv/fadump: process architected register state data provided by firmware Hari Bathini
2019-05-07 14:13 ` Mahesh J Salgaonkar [this message]
2019-05-07 16:00 ` Segher Boessenkool
2019-05-09 4:42 ` Hari Bathini
2019-04-16 10:35 ` [PATCH v2 10/16] powernv/fadump: add support to preserve crash data on FADUMP disabled kernel Hari Bathini
2019-04-16 10:35 ` [PATCH v2 11/16] powerpc/fadump: update documentation about CONFIG_PRESERVE_FA_DUMP Hari Bathini
2019-04-16 10:35 ` [PATCH v2 12/16] powerpc/powernv: export /proc/opalcore for analysing opal crashes Hari Bathini
2019-05-08 0:25 ` Nicholas Piggin
2019-05-09 4:46 ` Hari Bathini
2019-04-16 10:35 ` [PATCH v2 13/16] powernv/fadump: Skip processing /proc/vmcore when only OPAL core exists Hari Bathini
2019-04-16 10:36 ` [PATCH v2 14/16] powernv/opalcore: provide an option to invalidate /proc/opalcore file Hari Bathini
2019-04-16 10:36 ` [PATCH v2 15/16] powernv/fadump: consider f/w load area Hari Bathini
2019-05-07 17:13 ` Mahesh J Salgaonkar
2019-05-09 4:50 ` Hari Bathini
2019-04-16 10:36 ` [PATCH v2 16/16] powernv/fadump: update documentation about option to release opalcore Hari Bathini
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=20190507141356.saug5kjhntwozu76@in.ibm.com \
--to=mahesh@linux.vnet.ibm.com \
--cc=ananth@linux.ibm.com \
--cc=dja@axtens.net \
--cc=hbathini@linux.ibm.com \
--cc=hegdevasant@linux.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=mahesh@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=stewart@linux.ibm.com \
/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).