Patch "powerpc/4xx: Fix build errors from mfdcr()" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    powerpc/4xx: Fix build errors from mfdcr()

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     powerpc-4xx-fix-build-errors-from-mfdcr.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b27d21974700740fd4c07a1225f3e6ccd9c03b91
Author: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Date:   Thu Feb 18 23:30:58 2021 +1100

    powerpc/4xx: Fix build errors from mfdcr()
    
    [ Upstream commit eead089311f4d935ab5d1d8fbb0c42ad44699ada ]
    
    lkp reported a build error in fsp2.o:
    
      CC      arch/powerpc/platforms/44x/fsp2.o
      {standard input}:577: Error: unsupported relocation against base
    
    Which comes from:
    
      pr_err("GESR0: 0x%08x\n", mfdcr(base + PLB4OPB_GESR0));
    
    Where our mfdcr() macro is stringifying "base + PLB4OPB_GESR0", and
    passing that to the assembler, which obviously doesn't work.
    
    The mfdcr() macro already checks that the argument is constant using
    __builtin_constant_p(), and if not calls the out-of-line version of
    mfdcr(). But in this case GCC is smart enough to notice that "base +
    PLB4OPB_GESR0" will be constant, even though it's not something we can
    immediately stringify into a register number.
    
    Segher pointed out that passing the register number to the inline asm
    as a constant would be better, and in fact it fixes the build error,
    presumably because it gives GCC a chance to resolve the value.
    
    While we're at it, change mtdcr() similarly.
    
    Reported-by: kernel test robot <lkp@xxxxxxxxx>
    Suggested-by: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
    Acked-by: Feng Tang <feng.tang@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20210218123058.748882-1-mpe@xxxxxxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/powerpc/include/asm/dcr-native.h b/arch/powerpc/include/asm/dcr-native.h
index 7141ccea8c94..a92059964579 100644
--- a/arch/powerpc/include/asm/dcr-native.h
+++ b/arch/powerpc/include/asm/dcr-native.h
@@ -53,8 +53,8 @@ static inline void mtdcrx(unsigned int reg, unsigned int val)
 #define mfdcr(rn)						\
 	({unsigned int rval;					\
 	if (__builtin_constant_p(rn) && rn < 1024)		\
-		asm volatile("mfdcr %0," __stringify(rn)	\
-		              : "=r" (rval));			\
+		asm volatile("mfdcr %0, %1" : "=r" (rval)	\
+			      : "n" (rn));			\
 	else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR)))	\
 		rval = mfdcrx(rn);				\
 	else							\
@@ -64,8 +64,8 @@ static inline void mtdcrx(unsigned int reg, unsigned int val)
 #define mtdcr(rn, v)						\
 do {								\
 	if (__builtin_constant_p(rn) && rn < 1024)		\
-		asm volatile("mtdcr " __stringify(rn) ",%0"	\
-			      : : "r" (v)); 			\
+		asm volatile("mtdcr %0, %1"			\
+			      : : "n" (rn), "r" (v));		\
 	else if (likely(cpu_has_feature(CPU_FTR_INDEXED_DCR)))	\
 		mtdcrx(rn, v);					\
 	else							\



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux