powerpc: Avoid bad relocations in iSeries code
authorPaul Mackerras <paulus@samba.org>
Thu, 6 May 2010 19:46:50 +0000 (19:46 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 21 May 2010 07:31:08 +0000 (17:31 +1000)
Subrata Modak reported that building a CONFIG_RELOCATABLE kernel with
CONFIG_ISERIES enabled gives the following warnings:

WARNING: 4 bad relocations
c00000000007216e R_PPC64_ADDR16_HIGHEST  __ksymtab+0x00000000009dcec8
c000000000072172 R_PPC64_ADDR16_HIGHER  __ksymtab+0x00000000009dcec8
c00000000007217a R_PPC64_ADDR16_HI  __ksymtab+0x00000000009dcec8
c00000000007217e R_PPC64_ADDR16_LO  __ksymtab+0x00000000009dcec8

The reason is that decrementer_iSeries_masked is using
LOAD_REG_IMMEDIATE to get the address of a kernel symbol, which
creates relocations that aren't handled by the kernel relocator code.

Instead of reading the tb_ticks_per_jiffy variable, we can just set
the decrementer to its maximum value (0x7fffffff) and that will work
just as well.  In fact timer_interrupt sets the decrementer to that
value initially anyway, and we are sure to get into timer_interrupt
once interrupts are reenabled because we store 1 to the decrementer
interrupt flag in the lppaca (LPPACADECRINT(r12) here).

Reported-by: Subrata Modak <subrata@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/iseries/exception.S

index fba5bf915073cb4b704853220ffd0bdddac47c56..32a56c6dfa72b03c1e5c51b3b5680e92f1315c6d 100644 (file)
@@ -252,8 +252,8 @@ decrementer_iSeries_masked:
        li      r11,1
        ld      r12,PACALPPACAPTR(r13)
        stb     r11,LPPACADECRINT(r12)
-       LOAD_REG_IMMEDIATE(r12, tb_ticks_per_jiffy)
-       lwz     r12,0(r12)
+       li      r12,-1
+       clrldi  r12,r12,33      /* set DEC to 0x7fffffff */
        mtspr   SPRN_DEC,r12
        /* fall through */