Subject: Re: [PATCH v2 1/3] powerpc/nvram: move generic code for nvram and pstore

From: Hari Bathini <[email-masked]>
Date: Wed, 17 Dec 2014 16:40:45 +0530

On 12/17/2014 05:33 AM, Michael Ellerman wrote:
> On Tue, 2014-12-16 at 23:35 +0530, Hari Bathini wrote:
>> With minor checks, we can move most of the code for nvram
>> under pseries to a common place to be re-used by other
>> powerpc platforms like powernv. This patch moves such
>> common code to arch/powerpc/kernel/nvram_64.c file.
> Sharing the code is great.
>
> But, you need to keep in mind that it is very common for us to build kernels
> with both POWERNV=y and PSERIES=y.
>
> So you need to make sure you're only using CONFIG_PPC_PSERIES to protect things
> that are optional on pseries. Not things that we *shouldn't* be doing on
> powernv.
>
> For example the logic in nvram_init_oops_partition() looks like it might do the
> wrong thing for PSERIES=y POWERNV=y.

True. It might do wrong thing when an incorrect value is passed by the 
caller.
But since the caller is platform specific code 
[pseries_nvram_init_log_partitions() or
opal_nvram_init_log_partitions() routine], with appropriate parameter 
passed,
I haven't seen any issues while testing.

>> diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
>> index b390f55..a033fe9 100644
>> --- a/arch/powerpc/include/asm/rtas.h
>> +++ b/arch/powerpc/include/asm/rtas.h
>> @@ -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);
> You should add an empty version of this for !PSERIES, so you don't have to
> ifdef all the call sites.

Sure. Will update accordingly..

Thanks
Hari

> cheers