Re: powerpc: Add an inline function to update HID0

From: Michael Ellerman
Date: Tue Aug 04 2015 - 22:00:15 EST


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@xxxxxxxxxxxxxxxxxx>
> >> ---
> >> 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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/