lkml.org 
[lkml]   [2020]   [Aug]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] arm64: tlb: fix ARM64_TLB_RANGE with LLVM's integrated assembler
    On Wed, Aug 5, 2020 at 11:19 AM Sami Tolvanen <samitolvanen@google.com> wrote:
    >
    > Commit 7c78f67e9bd9 ("arm64: enable tlbi range instructions") breaks
    > LLVM's integrated assembler, because -Wa,-march is only passed to
    > external assemblers and therefore, the new instructions are not enabled
    > when IAS is used.
    >
    > As binutils doesn't support .arch_extension tlb-rmi, this change adds
    > .arch armv8.4-a to __TLBI_0 and __TLBI_1 to fix the issue with both LLVM
    > IAS and binutils.
    >
    > Fixes: 7c78f67e9bd9 ("arm64: enable tlbi range instructions")
    > Link: https://github.com/ClangBuiltLinux/linux/issues/1106
    > Signed-off-by: Sami Tolvanen <samitolvanen@google.com>

    I've filed https://sourceware.org/bugzilla/show_bug.cgi?id=26339 to
    discuss more with ARM binutils devs about some of the compat issues
    around these assembler directives.

    > ---
    > arch/arm64/include/asm/tlbflush.h | 16 ++++++++++++++--
    > 1 file changed, 14 insertions(+), 2 deletions(-)
    >
    > diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h
    > index d493174415db..66c2aab5e9cb 100644
    > --- a/arch/arm64/include/asm/tlbflush.h
    > +++ b/arch/arm64/include/asm/tlbflush.h
    > @@ -16,6 +16,16 @@
    > #include <asm/cputype.h>
    > #include <asm/mmu.h>
    >
    > +/*
    > + * Enable ARMv8.4-TLBI instructions with ARM64_TLB_RANGE. Note that binutils
    > + * doesn't support .arch_extension tlb-rmi, so use .arch armv8.4-a instead.
    > + */
    > +#ifdef CONFIG_ARM64_TLB_RANGE
    > +#define __TLBI_PREAMBLE ".arch armv8.4-a\n"
    > +#else
    > +#define __TLBI_PREAMBLE
    > +#endif
    > +
    > /*
    > * Raw TLBI operations.
    > *
    > @@ -28,14 +38,16 @@
    > * not. The macros handles invoking the asm with or without the
    > * register argument as appropriate.
    > */
    > -#define __TLBI_0(op, arg) asm ("tlbi " #op "\n" \
    > +#define __TLBI_0(op, arg) asm (__TLBI_PREAMBLE \
    > + "tlbi " #op "\n" \
    > ALTERNATIVE("nop\n nop", \
    > "dsb ish\n tlbi " #op, \
    > ARM64_WORKAROUND_REPEAT_TLBI, \
    > CONFIG_ARM64_WORKAROUND_REPEAT_TLBI) \
    > : : )
    >
    > -#define __TLBI_1(op, arg) asm ("tlbi " #op ", %0\n" \
    > +#define __TLBI_1(op, arg) asm (__TLBI_PREAMBLE \
    > + "tlbi " #op ", %0\n" \
    > ALTERNATIVE("nop\n nop", \
    > "dsb ish\n tlbi " #op ", %0", \
    > ARM64_WORKAROUND_REPEAT_TLBI, \
    >
    > base-commit: 4834ce9d8e074bb7ae197632e0708219b9f389b5
    > --
    > 2.28.0.163.g6104cc2f0b6-goog
    >


    --
    Thanks,
    ~Nick Desaulniers

    \
     
     \ /
      Last update: 2020-08-05 21:18    [W:4.165 / U:0.052 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site