powerpc: Add an inline function to update HID0

Michael Ellerman mpe at ellerman.id.au
Wed Aug 5 12:00:07 AEST 2015


On Tue, 2015-08-04 at 19:36 +0530, Madhavan Srinivasan wrote:
> 
> On Tuesday 04 August 2015 03:38 PM, Michael Ellerman wrote:
> > On Tue, 2015-04-08 at 08:30:58 UTC, "Gautham R. Shenoy" wrote:
> >> Section 3.7 of Version 1.2 of the Power8 Processor User's Manual
> >> prescribes that updates to HID0 be preceded by a SYNC instruction and
> >> followed by an ISYNC instruction (Page 91).
> >>
> >> Create a function name update_hid0() which follows this recipe and
> >> invoke it from the static split core path.
> >>
> >> Signed-off-by: Gautham R. Shenoy <ego at linux.vnet.ibm.com>
> >> ---
> >>  arch/powerpc/include/asm/kvm_ppc.h       | 11 +++++++++++
> > Why is it in there? It's not KVM related per se.
> >
> > Where should it go? I think reg.h would be best, ideally near the definition
> > for HID0, though that's probably not possible because of ASSEMBLY requirements.
> > So at the bottom of reg.h ?
> 
> just to understand, Something like this will not do?
> 
> #define update_hid0(x)  __asm__ __volatile__(   "sync\n"\
>                                                 "mtspr " __stringify(SPRN_HID0)", %0\n"\
>                                                 "isync"::"r"(x));
> 

Yeah we could do that also.

The static inline is less ugly though.

cheers




More information about the Linuxppc-dev mailing list