[PATCH] powerpc: fixup lwsync at runtime

Kumar Gala galak at kernel.crashing.org
Wed Jul 2 00:48:36 EST 2008


On Jul 1, 2008, at 1:29 AM, Michael Ellerman wrote:

> On Tue, 2008-07-01 at 00:32 -0500, Kumar Gala wrote:
>> To allow for a single kernel image on e500 v1/v2/mc we need to  
>> fixup lwsync
>> at runtime.  On e500v1/v2 lwsync causes an illop so we need to  
>> patch up
>> the code.  We default to 'sync' since that is always safe and if  
>> the cpu
>> is capable we will replace 'sync' with 'lwsync'.
>>
>> We introduce CPU_FTR_LWSYNC as a way to determine at runtime if  
>> this is
>> needed.  This flag could be moved elsewhere since we dont really  
>> use it
>> for the normal CPU_FTR purpose.
>>
>> Finally we only store the relative offset in the fixup section to  
>> keep it
>> as small as possible rather than using a full fixup_entry.
>
> How many entries are we talking? I guess it's not much bother to  
> have a
> separate section.

On the order of 1000 entries for an SMP build.

>> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/ 
>> setup_32.c
>> index 9e83add..0109e7f 100644
>> --- a/arch/powerpc/kernel/setup_32.c
>> +++ b/arch/powerpc/kernel/setup_32.c
>> @@ -101,6 +101,10 @@ unsigned long __init early_init(unsigned long  
>> dt_ptr)
>> 			  PTRRELOC(&__start___ftr_fixup),
>> 			  PTRRELOC(&__stop___ftr_fixup));
>>
>> +	do_lwsync_fixups(spec->cpu_features,
>> +			 PTRRELOC(&__start___lwsync_fixup),
>> +			 PTRRELOC(&__stop___lwsync_fixup));
>> +
>
> This could be changed to use cur_cpu_spec->cpu_features, and then all
> the call sites would be passing that, which would mean
> do_lwsync_fixups() could just check cur_cpu_spec->cpu_features  
> directly.

cur_cpu_spec and spec at this point arent the same thing.

will post a new version w/fixes.

- k




More information about the Linuxppc-dev mailing list