powerpc/pstore: Add pstore support for nvram partitions
Subsystems (2)
cover powerpc/pstore: Add pstore support for nvram partitions
This patch series adds pstore support on powernv platform to read different nvram partitions and write compressed data to oops-log nvram partition. As pseries platform already has pstore support, this series moves most of the common code for pseries and powernv platforms to a common file. Tested the patches successfully on both pseries and powernv platforms.
---
Hari Bathini (2):
pstore: Add pstore type id for firmware partition
pstore: add pstore support on powernv
arch/powerpc/include/asm/nvram.h | 50 ++ arch/powerpc/include/asm/rtas.h | 2 arch/powerpc/kernel/nvram_64.c | 679 +++++++++++++++++++++++++++ arch/powerpc/platforms/powernv/opal-nvram.c | 10 arch/powerpc/platforms/pseries/nvram.c | 663 -------------------------- fs/pstore/inode.c | 3 include/linux/pstore.h | 1 7 files changed, 749 insertions(+), 659 deletions(-)
--
- Hari
PATCH 1/2 pstore: Add pstore type id for firmware partition
This patch adds a pstore type id to be used for opal specific nvram partitions.
--- fs/pstore/inode.c | 3 +++ include/linux/pstore.h | 1 + 2 files changed, 4 insertions(+)
fs/pstore/inode.c +3 -0
@@ -337,6 +337,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,case PSTORE_TYPE_PPC_COMMON :sprintf (name,"powerpc-common-%s-%lld" , psname, id);break ; +case PSTORE_TYPE_PPC_OPAL : +sprintf (name,"powerpc-opal-%s-%lld" , psname, id); +break ;case PSTORE_TYPE_UNKNOWN :sprintf (name,"unknown-%s-%lld" , psname, id);break ;
include/linux/pstore.h +1 -0
@@ -39,6 +39,7 @@ enum pstore_type_id {PSTORE_TYPE_PPC_RTAS =4 ,PSTORE_TYPE_PPC_OF =5 ,PSTORE_TYPE_PPC_COMMON =6 , +PSTORE_TYPE_PPC_OPAL =7 , PSTORE_TYPE_UNKNOWN = 255 };
PATCH 2/2 pstore: add pstore support on powernv
In reply to Hari BathiniThis patch extends pstore, a generic interface to platform dependent persistent storage, support for powernv platform to capture certain useful information, during dying moments. Such support is already in place for pseries platform. This patch while adding pstore support for powernv platform, moves common code for pseries and powernv to arch/powerpc/kernel/nvram_64.c file.
--- arch/powerpc/include/asm/nvram.h | 50 ++ arch/powerpc/include/asm/rtas.h | 2 arch/powerpc/kernel/nvram_64.c | 679 +++++++++++++++++++++++++++ arch/powerpc/platforms/powernv/opal-nvram.c | 10 arch/powerpc/platforms/pseries/nvram.c | 663 -------------------------- 5 files changed, 745 insertions(+), 659 deletions(-)
arch/powerpc/include/asm/nvram.h +49 -1
@@ -9,12 +9,43 @@#ifndef _ASM_POWERPC_NVRAM_H#define _ASM_POWERPC_NVRAM_H - +#include <linux/types.h> #include <linux/errno.h> #include <linux/list.h> #include <uapi/asm/nvram.h> +/* +* Set oops header version to distinguish between old and new format header. +* lnx,oops-log partition max size is 4000, header version > 4000 will +* help in identifying new header. +*/ +#define OOPS_HDR_VERSION 5000 + +struct err_log_info { +__be32 error_type; +__be32 seq_num; +}; + +struct nvram_os_partition { +const char *name; +int req_size;/* desired size, in bytes */ +int min_size;/* minimum acceptable size (0 means req_size) */ +long size;/* size of data portion (excluding err_log_info) */ +long index;/* offset of data portion of partition */ +bool os_partition;/* partition initialized by OS, not FW */ +}; + +struct oops_log_info { +__be16 version; +__be16 report_length; +__be64 timestamp; +} __attribute__((packed)); + +extern struct nvram_os_partition oops_log_partition; +#ifdef CONFIG_PPC_PSERIES +extern struct nvram_os_partition rtas_log_partition; +extern int nvram_write_error_log (char * buff,int length,unsigned int err_type,unsigned int err_seq); extern int nvram_read_error_log(char * buff, int length,
@@ -50,6 +81,23 @@ extern void pmac_xpram_write(int xpaddr, u8 data);/* Synchronize NVRAM */ extern void nvram_sync (void ); +/* Initialize NVRAM OS partition */ +extern int __init nvram_init_os_partition (struct nvram_os_partition *part); + +/* Initialize NVRAM oops partition */ +extern void __init nvram_init_oops_partition (int rtas_partition_exists); + +/* Read a NVRAM partition */ +extern int nvram_read_partition (struct nvram_os_partition *part,char *buff, +int length,unsigned int *err_type, +unsigned int *error_log_cnt); + +/* Write to NVRAM OS partition */ +extern int nvram_write_os_partition (struct nvram_os_partition *part, +char *buff,int length, +unsigned int err_type, +unsigned int error_log_cnt); +/* Determine NVRAM size */ extern ssize_t nvram_get_size (void );
arch/powerpc/include/asm/rtas.h +2 -0
@@ -343,6 +343,8 @@ extern int early_init_dt_scan_rtas(unsigned long node,extern void pSeries_log_error (char *buf,unsigned int err_type,int fatal);#ifdef CONFIG_PPC_PSERIES +extern unsigned long last_rtas_event; +extern int clobbering_unread_rtas_event (void );extern int pseries_devicetree_update (s32 scope);extern void post_mobility_fixup (void );#endif
arch/powerpc/kernel/nvram_64.c +679 -0
691 lines not on this page · raw message
arch/powerpc/platforms/powernv/opal-nvram.c +10 -0
@@ -16,6 +16,7 @@#include <linux/of.h> #include <asm/opal.h> +#include <asm/nvram.h> #include <asm/machdep.h> static unsigned int nvram_size;
@@ -62,6 +63,15 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)return count; } +static int __init opal_nvram_init_log_partitions (void ) +{ +/* Scan nvram for partitions */ +nvram_scan_partitions (); +nvram_init_oops_partition (0 ); +return 0 ; +} +machine_arch_initcall (powernv, opal_nvram_init_log_partitions); +void __init opal_nvram_init (void ) {struct device_node *np;
arch/powerpc/platforms/pseries/nvram.c +5 -658
721 lines not on this page · raw message
Michael Ellerman
reviewerRe: [2/2] pstore: add pstore support on powernv
Quoted 6 lines · Hari Bathini
This patch extends pstore, a generic interface to platform dependent persistent storage, support for powernv platform to capture certain useful information, during dying moments. Such support is already in place for pseries platform. This patch while adding pstore support for powernv platform, moves common code for pseries and powernv to
arch/powerpc/kernel/nvram_64.cfile.
Please move the common code first in a separate patch. Unless there's some reason you absolutely can't do that.
cheers
Re: [2/2] pstore: add pstore support on powernv
Quoted 9 lines · Michael Ellerman
Quoted 6 lines · Hari Bathini
This patch extends pstore, a generic interface to platform dependent persistent storage, support for powernv platform to capture certain useful information, during dying moments. Such support is already in place for pseries platform. This patch while adding pstore support for powernv platform, moves common code for pseries and powernv to
arch/powerpc/kernel/nvram_64.cfile.Please move the common code first in a separate patch. Unless there's some reason you absolutely can't do that.
Sure, Michael. Let me make the changes as suggested and post the updated patch series.
Thanks
Hari
Quoted 5 lines
cheers
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev