[PATCH 1/2] ARM: add diagnostic register access helpers

Shawn Guo shawn.guo at linaro.org
Tue Apr 16 11:11:32 EDT 2013


On Tue, Apr 16, 2013 at 03:48:53PM +0100, Will Deacon wrote:
> > +static inline unsigned int get_diag_reg(void)
> > +{
> > +	unsigned int val;
> > +	asm("mrc p15, 0, %0, c15, c0, 1" : "=r" (val) : : "cc");
> > +	return val;
> > +}
> > +
> > +static inline void set_diag_reg(unsigned int val)
> > +{
> > +	asm volatile("mcr p15, 0, %0, c15, c0, 1" : : "r" (val) : "cc");
> > +	isb();
> > +}
> > +
> 
> You don't want to poke this register with the MMU on, so I don't think this
> patch is a very good idea.

If you are worrying about that the helpers could be abused by people, I
can certainly make them local in arch/arm/mach-imx/platsmp.c.  But I do
not understand why diagnostic register shouldn't be accessed when MMU is
on.  I'm doing that in patch #2 to get my problem fixed, and not seeing
anything broken there.

Shawn




More information about the linux-arm-kernel mailing list