17 Jul, 2019

1 commit

  • The mpi library contains some rather old inline assembly statements that
    produce a lot of warnings for 32-bit x86, such as:

    lib/mpi/mpih-div.c:76:16: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions
    udiv_qrnnd(qp[i], n1, n1, np[i], d);
    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
    lib/mpi/longlong.h:423:20: note: expanded from macro 'udiv_qrnnd'
    : "=a" ((USItype)(q)), \
    ~~~~~~~~~~^~

    There is no point in doing a type cast for the output of an inline
    assembler statement, so just remove the cast here, as we have done for
    other architectures in the past.

    See also dea632cadd12 ("lib/mpi: fix build with clang").

    Link: http://lkml.kernel.org/r/20190712090740.340186-1-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Nick Desaulniers
    Cc: Stefan Agner
    Cc: Dmitry Kasatkin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arnd Bergmann
     

22 Dec, 2017

1 commit

  • Current MIPS64r6 toolchains aren't able to generate efficient
    DMULU/DMUHU based code for the C implementation of umul_ppmm(), which
    performs an unsigned 64 x 64 bit multiply and returns the upper and
    lower 64-bit halves of the 128-bit result. Instead it widens the 64-bit
    inputs to 128-bits and emits a __multi3 intrinsic call to perform a 128
    x 128 multiply. This is both inefficient, and it results in a link error
    since we don't include __multi3 in MIPS linux.

    For example commit 90a53e4432b1 ("cfg80211: implement regdb signature
    checking") merged in v4.15-rc1 recently broke the 64r6_defconfig and
    64r6el_defconfig builds by indirectly selecting MPILIB. The same build
    errors can be reproduced on older kernels by enabling e.g. CRYPTO_RSA:

    lib/mpi/generic_mpih-mul1.o: In function `mpihelp_mul_1':
    lib/mpi/generic_mpih-mul1.c:50: undefined reference to `__multi3'
    lib/mpi/generic_mpih-mul2.o: In function `mpihelp_addmul_1':
    lib/mpi/generic_mpih-mul2.c:49: undefined reference to `__multi3'
    lib/mpi/generic_mpih-mul3.o: In function `mpihelp_submul_1':
    lib/mpi/generic_mpih-mul3.c:49: undefined reference to `__multi3'
    lib/mpi/mpih-div.o In function `mpihelp_divrem':
    lib/mpi/mpih-div.c:205: undefined reference to `__multi3'
    lib/mpi/mpih-div.c:142: undefined reference to `__multi3'

    Therefore add an efficient MIPS64r6 implementation of umul_ppmm() using
    inline assembly and the DMULU/DMUHU instructions, to prevent __multi3
    calls being emitted.

    Fixes: 7fd08ca58ae6 ("MIPS: Add build support for the MIPS R6 ISA")
    Signed-off-by: James Hogan
    Cc: Ralf Baechle
    Cc: Herbert Xu
    Cc: "David S. Miller"
    Cc: linux-mips@linux-mips.org
    Cc: linux-crypto@vger.kernel.org
    Signed-off-by: Herbert Xu

    James Hogan
     

17 Aug, 2017

1 commit

  • Use just @ to denote comments which works with gcc and clang.
    Otherwise clang reports an escape sequence error:
    error: invalid % escape in inline assembly string

    Use %0-%3 as operand references, this avoids:
    error: invalid operand in inline asm: 'umull ${1:r}, ${0:r}, ${2:r}, ${3:r}'

    Also remove superfluous casts on output operands to avoid warnings
    such as:
    warning: invalid use of a cast in an inline asm context requiring an l-value

    Signed-off-by: Stefan Agner
    Acked-by: Arnd Bergmann
    Signed-off-by: Herbert Xu

    Stefan Agner
     

28 Feb, 2016

1 commit

  • A wrapper around the umull assembly instruction might reuse
    the input register as an output, which is undefined on
    some ARM machines, as pointed out by this assembler warning:

    CC lib/mpi/generic_mpih-mul1.o
    /tmp/ccxJuxIy.s: Assembler messages:
    /tmp/ccxJuxIy.s:53: rdhi, rdlo and rm must all be different
    CC lib/mpi/generic_mpih-mul2.o
    /tmp/ccI0scAD.s: Assembler messages:
    /tmp/ccI0scAD.s:53: rdhi, rdlo and rm must all be different
    CC lib/mpi/generic_mpih-mul3.o
    /tmp/ccMvVQcp.s: Assembler messages:
    /tmp/ccMvVQcp.s:53: rdhi, rdlo and rm must all be different

    This changes the constraints to force different registers to
    be used as output.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Herbert Xu

    Arnd Bergmann
     

15 Oct, 2015

1 commit


13 Jun, 2015

1 commit

  • This patch fixes mips compilation error:

    lib/mpi/generic_mpih-mul1.c: In function 'mpihelp_mul_1':
    lib/mpi/longlong.h:651:2: error: impossible constraint in 'asm'

    Signed-off-by: Jaedon Shin
    Cc: Linux-MIPS
    Patchwork: https://patchwork.linux-mips.org/patch/10546/
    Signed-off-by: Ralf Baechle

    Jaedon Shin