fix-qemu-ppce500-with-binutils-2.38
authorVagrant Cascadian <vagrant@debian.org>
Sun, 10 Apr 2022 23:28:14 +0000 (00:28 +0100)
committerVagrant Cascadian <vagrant@debian.org>
Sun, 10 Apr 2022 23:28:14 +0000 (00:28 +0100)
Fix building qemu-ppce500 target with binutils ~2.38.

https://bugs.debian.org/1003490

The incompatibility was introduced in binutils commit:

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b25f942e18d6ecd7ec3e2d2e9930eb4f996c258a

Gbp-Pq: Name fix-qemu-ppce500-with-binutils-2.38.patch

arch/powerpc/cpu/mpc85xx/tlb.c

index 550d45da0efa961ac674d215e92bcc818bfd138a..3158cbe6dad6a47290c2806d359669eb211c1f1e 100644 (file)
@@ -51,7 +51,10 @@ void read_tlbcam_entry(int idx, u32 *valid, u32 *tsize, unsigned long *epn,
        u32 _mas1;
 
        mtspr(MAS0, FSL_BOOKE_MAS0(1, idx, 0));
-       asm volatile("tlbre;isync");
+       asm volatile(".machine push;\n"
+                    ".machine e500;\n"
+                    "tlbre;isync;\n"
+                    ".machine pop;\n");
        _mas1 = mfspr(MAS1);
 
        *valid = (_mas1 & MAS1_VALID);
@@ -110,7 +113,10 @@ void init_used_tlb_cams(void)
        /* walk all the entries */
        for (i = 0; i < num_cam; i++) {
                mtspr(MAS0, FSL_BOOKE_MAS0(1, i, 0));
-               asm volatile("tlbre;isync");
+               asm volatile(".machine push;\n"
+                            ".machine e500;\n"
+                            "tlbre;isync;\n"
+                            ".machine pop;");
                if (mfspr(MAS1) & MAS1_VALID)
                        use_tlb_cam(i);
        }
@@ -184,7 +190,10 @@ void disable_tlb(u8 esel)
 #ifdef CONFIG_ENABLE_36BIT_PHYS
        mtspr(MAS7, 0);
 #endif
-       asm volatile("isync;msync;tlbwe;isync");
+       asm volatile(".machine push;\n"
+                    ".machine e500;\n"
+                    "isync;msync;tlbwe;isync;\n"
+                    ".machine pop;\n");
 
 #ifdef CONFIG_ADDR_MAP
        if (gd->flags & GD_FLG_RELOC)
@@ -194,7 +203,11 @@ void disable_tlb(u8 esel)
 
 static void tlbsx (const volatile unsigned *addr)
 {
-       __asm__ __volatile__ ("tlbsx 0,%0" : : "r" (addr), "m" (*addr));
+       __asm__ __volatile__ (".machine push;\n"
+                             ".machine e500;\n"
+                             "tlbsx 0,%0;\n"
+                             ".machine pop;\n"
+                             : : "r" (addr), "m" (*addr));
 }
 
 /* return -1 if we didn't find anything */