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

Re: Kernel build fails



Waiting for git to do it's thing, but do we need a voodoo priest(es)
here? The attached patch is building.

-Michael

On Fri, 21 Jan 2022 at 20:23, Mike <michael.heltne@gmail.com> wrote:
>
> 'stbcix' has to come from arch/powerpc/include/asm/io.h - and is already behind an ifdefs, though try changing it to #ifdef CONFIG_PPC64? I'm building now.
>
> Michael
>
> On Thu, Jan 20, 2022, 10:05 John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> wrote:
>>
>> Hi Mike!
>>
>> On 1/20/22 09:46, Mike wrote:
>> >> So, in order to fix this issue, someone needs to update the kernel to work with the new binutils version.
>> >
>> > That's what the patch does, I did a full Debian kernel build, but I'm having trouble explaining myself with my left hand.
>>
>> I still think that your patch is incomplete as the "dsall" instruction is not the only
>> instruction that is affected by this change. See the kernel build logs below.
>>
>> From [1]:
>>
>> {standard input}: Assembler messages:
>> {standard input}:1353: Error: unrecognized opcode: `ptesync'
>>
>> and [2]:
>>
>> {standard input}: Assembler messages:
>> {standard input}:2146: Error: unrecognized opcode: `stbcix'
>>
>> > [1] https://buildd.debian.org/status/fetch.php?pkg=linux&arch=powerpc&ver=5.15.15-1&stamp=1642579068&raw=0
>> > [2] https://buildd.debian.org/status/fetch.php?pkg=linux&arch=ppc64&ver=5.15.15-1&stamp=1642578946&raw=0
>>
>> Adrian
>>
>> --
>>  .''`.  John Paul Adrian Glaubitz
>> : :' :  Debian Developer - glaubitz@debian.org
>> `. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
>>   `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
>>
commit 8a6358dfdf06a35d2aa9cf171b8444a716ad0c2a
Author: threader <michael.heltne@gmail.com>
Date:   Fri Jan 21 20:36:33 2022 +0100

    arch: powerpc: fix building, 'dssall' in mmu_context.c is an altivec instruction, so build that accordingly if such is the case.
    'ptesync' is a PPC64 instruction, so dont go there for PPC32. And apparently ifdefined __powerpc64__ isnt enough in all configurations(?) and 'stbcix' sticks its head up.
    
                Signed-off-by: Micahel B Heltne <michael.heltne@gmail.com>

diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index beba4979bff9..cb09701ed114 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -334,7 +334,7 @@ static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
 }
 #define __raw_writel __raw_writel
 
-#ifdef __powerpc64__
+#ifdef CONFIG_PPC64
 static inline unsigned long __raw_readq(const volatile void __iomem *addr)
 {
 	return *(volatile unsigned long __force *)PCI_FIX_ADDR(addr);
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 86f49e3e7cf5..becbe2898e10 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -3267,9 +3267,11 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op)
 		case BARRIER_LWSYNC:
 			asm volatile("lwsync" : : : "memory");
 			break;
+#ifdef CONFIG_PPC64
 		case BARRIER_PTESYNC:
 			asm volatile("ptesync" : : : "memory");
 			break;
+#endif
 		}
 		break;
 
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index df8172da2301..2f87e7731599 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -4,6 +4,9 @@
 #
 
 ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
+ifeq ($(CONFIG_ALTIVEC),y)
+CFLAGS_mmu_context.o += $(call cc-option, -maltivec, -mabi=altivec)
+endif
 
 obj-y				:= fault.o mem.o pgtable.o mmap.o maccess.o pageattr.o \
 				   init_$(BITS).o pgtable_$(BITS).o \
diff --git a/arch/powerpc/mm/pageattr.c b/arch/powerpc/mm/pageattr.c
index edea388e9d3f..ccd04a386e28 100644
--- a/arch/powerpc/mm/pageattr.c
+++ b/arch/powerpc/mm/pageattr.c
@@ -54,11 +54,11 @@ static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
 	}
 
 	pte_update(&init_mm, addr, ptep, ~0UL, pte_val(pte), 0);
-
+#ifdef CONFIG_PPC64
 	/* See ptesync comment in radix__set_pte_at() */
 	if (radix_enabled())
 		asm volatile("ptesync": : :"memory");
-
+#endif
 	flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
 
 	spin_unlock(&init_mm.page_table_lock);

Reply to: