Patchwork [v3,8/8] powerpc/pseries: Read common partition via pstore

login
register
mail settings
Submitter Aruna Balakrishnaiah
Date April 25, 2013, 10:19 a.m.
Message ID <20130425101908.21017.32553.stgit@aruna-ThinkPad-T420>
Download mbox | patch
Permalink /patch/239464/
State Superseded
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Aruna Balakrishnaiah - April 25, 2013, 10:19 a.m.
This patch exploits pstore subsystem to read details of common partition
in NVRAM to a separate file in /dev/pstore. For instance, common partition
details will be stored in a file named [common-nvram-6].

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Reviewed-by: Jim Keniston <jkenisto@us.ibm.com>
---
 arch/powerpc/platforms/pseries/nvram.c |   17 ++++++++++++++++-
 fs/pstore/inode.c                      |    3 +++
 include/linux/pstore.h                 |    1 +
 3 files changed, 20 insertions(+), 1 deletion(-)
Benjamin Herrenschmidt - June 1, 2013, 4:52 a.m.
On Thu, 2013-04-25 at 15:49 +0530, Aruna Balakrishnaiah wrote:

> diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
> index 8d4fb65..88cc050 100644
> --- a/fs/pstore/inode.c
> +++ b/fs/pstore/inode.c
> @@ -330,6 +330,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
>  	case PSTORE_TYPE_PPC_OF:
>  		sprintf(name, "of-%s-%lld", psname, id);
>  		break;

Call this powerpc-ofw-... Does it even contain something we use in Linux
at all ? Last I looked we only used the common one right ? Also it's
format afaik is defined in the CHRP bindings so it's not generic OFW
stuff, hence the powerpc prefix.

> +	case PSTORE_TYPE_PPC_COMMON:
> +		sprintf(name, "common-%s-%lld", psname, id);
> +		break;

Same deal, call that powerpc-common

>  	case PSTORE_TYPE_UNKNOWN:
>  		sprintf(name, "unknown-%s-%lld", psname, id);
>  		break;
> diff --git a/include/linux/pstore.h b/include/linux/pstore.h
> index 615dc18..656699f 100644
> --- a/include/linux/pstore.h
> +++ b/include/linux/pstore.h
> @@ -38,6 +38,7 @@ enum pstore_type_id {
>  	/* PPC64 partition types */
>  	PSTORE_TYPE_PPC_RTAS	= 4,
>  	PSTORE_TYPE_PPC_OF	= 5,
> +	PSTORE_TYPE_PPC_COMMON	= 6,
>  	PSTORE_TYPE_UNKNOWN	= 255
>  };

Do we expose anything else or keep it hidden ?

Cheers,
Ben.
Aruna Balakrishnaiah - June 4, 2013, 9:02 a.m.
On Saturday 01 June 2013 10:22 AM, Benjamin Herrenschmidt wrote:
> On Thu, 2013-04-25 at 15:49 +0530, Aruna Balakrishnaiah wrote:
>
>> diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
>> index 8d4fb65..88cc050 100644
>> --- a/fs/pstore/inode.c
>> +++ b/fs/pstore/inode.c
>> @@ -330,6 +330,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
>>   	case PSTORE_TYPE_PPC_OF:
>>   		sprintf(name, "of-%s-%lld", psname, id);
>>   		break;
> Call this powerpc-ofw-... Does it even contain something we use in Linux
> at all ? Last I looked we only used the common one right ? Also it's
> format afaik is defined in the CHRP bindings so it's not generic OFW
> stuff, hence the powerpc prefix.
>
>> +	case PSTORE_TYPE_PPC_COMMON:
>> +		sprintf(name, "common-%s-%lld", psname, id);
>> +		break;
> Same deal, call that powerpc-common

Sure. Will change it to powerpc prefix.

>>   	case PSTORE_TYPE_UNKNOWN:
>>   		sprintf(name, "unknown-%s-%lld", psname, id);
>>   		break;
>> diff --git a/include/linux/pstore.h b/include/linux/pstore.h
>> index 615dc18..656699f 100644
>> --- a/include/linux/pstore.h
>> +++ b/include/linux/pstore.h
>> @@ -38,6 +38,7 @@ enum pstore_type_id {
>>   	/* PPC64 partition types */
>>   	PSTORE_TYPE_PPC_RTAS	= 4,
>>   	PSTORE_TYPE_PPC_OF	= 5,
>> +	PSTORE_TYPE_PPC_COMMON	= 6,
>>   	PSTORE_TYPE_UNKNOWN	= 255
>>   };
> Do we expose anything else or keep it hidden ?

We are exposing oops, rtas, of-config and common partition of nvram.

> Cheers,
> Ben.
>
>

Patch

diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index f7392f6..14cc486 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -138,10 +138,17 @@  static struct nvram_os_partition of_config_partition = {
 	.os_partition = false
 };
 
+static struct nvram_os_partition common_partition = {
+	.name = "common",
+	.index = -1,
+	.os_partition = false
+};
+
 static enum pstore_type_id nvram_type_ids[] = {
 	PSTORE_TYPE_DMESG,
 	PSTORE_TYPE_PPC_RTAS,
 	PSTORE_TYPE_PPC_OF,
+	PSTORE_TYPE_PPC_COMMON,
 	-1
 };
 static int read_type;
@@ -530,7 +537,7 @@  static int nvram_pstore_write(enum pstore_type_id type,
 }
 
 /*
- * Reads the oops/panic report, rtas and of-config partition.
+ * Reads the oops/panic report, rtas, of-config and common partition.
  * Returns the length of the data we read from each partition.
  * Returns 0 if we've been called before.
  */
@@ -566,6 +573,14 @@  static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
 		time->tv_sec = 0;
 		time->tv_nsec = 0;
 		break;
+	case PSTORE_TYPE_PPC_COMMON:
+		sig = NVRAM_SIG_SYS;
+		part = &common_partition;
+		*type = PSTORE_TYPE_PPC_COMMON;
+		*id = PSTORE_TYPE_PPC_COMMON;
+		time->tv_sec = 0;
+		time->tv_nsec = 0;
+		break;
 	default:
 		return 0;
 	}
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 8d4fb65..88cc050 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -330,6 +330,9 @@  int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
 	case PSTORE_TYPE_PPC_OF:
 		sprintf(name, "of-%s-%lld", psname, id);
 		break;
+	case PSTORE_TYPE_PPC_COMMON:
+		sprintf(name, "common-%s-%lld", psname, id);
+		break;
 	case PSTORE_TYPE_UNKNOWN:
 		sprintf(name, "unknown-%s-%lld", psname, id);
 		break;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 615dc18..656699f 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -38,6 +38,7 @@  enum pstore_type_id {
 	/* PPC64 partition types */
 	PSTORE_TYPE_PPC_RTAS	= 4,
 	PSTORE_TYPE_PPC_OF	= 5,
+	PSTORE_TYPE_PPC_COMMON	= 6,
 	PSTORE_TYPE_UNKNOWN	= 255
 };