Skip to content
  1. Apr 11, 2020
  2. Apr 09, 2020
    • Masahiro Yamada's avatar
      kbuild: support LLVM=1 to switch the default tools to Clang/LLVM · a0d1c951
      Masahiro Yamada authored
      
      
      As Documentation/kbuild/llvm.rst implies, building the kernel with a
      full set of LLVM tools gets very verbose and unwieldy.
      
      Provide a single switch LLVM=1 to use Clang and LLVM tools instead
      of GCC and Binutils. You can pass it from the command line or as an
      environment variable.
      
      Please note LLVM=1 does not turn on the integrated assembler. You need
      to pass LLVM_IAS=1 to use it. When the upstream kernel is ready for the
      integrated assembler, I think we can make it default.
      
      We discussed what we need, and we agreed to go with a simple boolean
      flag that switches both target and host tools:
      
        https://lkml.org/lkml/2020/3/28/494
        https://lkml.org/lkml/2020/4/3/43
      
      Some items discussed, but not adopted:
      
      - LLVM_DIR
      
        When multiple versions of LLVM are installed, I just thought supporting
        LLVM_DIR=/path/to/my/llvm/bin/ might be useful.
      
        CC      = $(LLVM_DIR)clang
        LD      = $(LLVM_DIR)ld.lld
          ...
      
        However, we can handle this by modifying PATH. So, we decided to not do
        this.
      
      - LLVM_SUFFIX
      
        Some distributions (e.g. Debian) package specific versions of LLVM with
        naming conventions that use the version as a suffix.
      
        CC      = clang$(LLVM_SUFFIX)
        LD      = ld.lld(LLVM_SUFFIX)
          ...
      
        will allow a user to pass LLVM_SUFFIX=-11 to use clang-11 etc.,
        but the suffixed versions in /usr/bin/ are symlinks to binaries in
        /usr/lib/llvm-#/bin/, so this can also be handled by PATH.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Tested-by: Nathan Chancellor <natechancellor@gmail.com> # build
      Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      a0d1c951
    • Masahiro Yamada's avatar
      kbuild: replace AS=clang with LLVM_IAS=1 · 7e20e47c
      Masahiro Yamada authored
      
      
      The 'AS' variable is unused for building the kernel. Only the remaining
      usage is to turn on the integrated assembler. A boolean flag is a better
      fit for this purpose.
      
      AS=clang was added for experts. So, I replaced it with LLVM_IAS=1,
      breaking the backward compatibility.
      
      Suggested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      7e20e47c
  3. Apr 08, 2020
    • Masahiro Yamada's avatar
      kbuild: add dummy toolchains to enable all cc-option etc. in Kconfig · 76426e23
      Masahiro Yamada authored
      
      
      Staring v4.18, Kconfig evaluates compiler capabilities, and hides CONFIG
      options your compiler does not support. This works well if you configure
      and build the kernel on the same host machine.
      
      It is inconvenient if you prepare the .config that is carried to a
      different build environment (typically this happens when you package
      the kernel for distros) because using a different compiler potentially
      produces different CONFIG options than the real build environment.
      So, you probably want to make as many options visible as possible.
      In other words, you need to create a super-set of CONFIG options that
      cover any build environment. If some of the CONFIG options turned out
      to be unsupported on the build machine, they are automatically disabled
      by the nature of Kconfig.
      
      However, it is not feasible to get a full-featured compiler for every
      arch.
      
      This issue was discussed here:
      
        https://lkml.org/lkml/2019/12/9/620
      
      Other than distros, savedefconfig is also a problem. Some arch sub-systems
      periodically resync defconfig files. If you use a less-capable compiler
      for savedefconfig, options that do not meet 'depends on $(cc-option,...)'
      will be forcibly disabled. So, 'make defconfig && make savedefconfig'
      may silently change the behavior.
      
      This commit adds a set of dummy toolchains that pretend to support any
      feature.
      
      Most of compiler features are tested by cc-option, which simply checks
      the exit code of $(CC). The dummy tools are shell scripts that always
      exit with 0. So, $(cc-option, ...) is evaluated as 'y'.
      
      There are more complicated checks such as:
      
        scripts/gcc-x86_{32,64}-has-stack-protector.sh
        scripts/gcc-plugin.sh
        scripts/tools-support-relr.sh
      
      scripts/dummy-tools/gcc passes all checks.
      
      From the top directory of the source tree, you can do:
      
         $ make CROSS_COMPILE=scripts/dummy-tools/ oldconfig
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
      Tested-by: default avatarJeremy Cline <jcline@redhat.com>
      76426e23
    • Masahiro Yamada's avatar
      kbuild: link lib-y objects to vmlinux forcibly when CONFIG_MODULES=y · 7273ad2b
      Masahiro Yamada authored
      Kbuild supports not only obj-y but also lib-y to list objects linked to
      vmlinux.
      
      The difference between them is that all the objects from obj-y are
      forcibly linked to vmlinux, whereas the objects from lib-y are linked
      as needed; if there is no user of a lib-y object, it is not linked.
      
      lib-y is intended to list utility functions that may be called from all
      over the place (and may be unused at all), but it is a problem for
      EXPORT_SYMBOL(). Even if there is no call-site in the vmlinux, we need
      to keep exported symbols for the use from loadable modules.
      
      Commit 7f2084fa
      
       ("[kbuild] handle exports in lib-y objects reliably")
      worked around it by linking a dummy object, lib-ksyms.o, which contains
      references to all the symbols exported from lib.a in that directory.
      It uses the linker script command, EXTERN. Unfortunately, the meaning of
      EXTERN of ld.lld is different from that of ld.bfd. Therefore, this does
      not work with LD=ld.lld (CBL issue #515).
      
      Anyway, the build rule of lib-ksyms.o is somewhat tricky. So, I want to
      get rid of it.
      
      At first, I was thinking of accumulating lib-y objects into obj-y
      (or even replacing lib-y with obj-y entirely), but the lib-y syntax
      is used beyond the ordinary use in lib/ and arch/*/lib/.
      
      Examples:
      
       - drivers/firmware/efi/libstub/Makefile builds lib.a, which is linked
         into vmlinux in the own way (arm64), or linked to the decompressor
         (arm, x86).
      
       - arch/alpha/lib/Makefile builds lib.a which is linked not only to
         vmlinux, but also to bootloaders in arch/alpha/boot/Makefile.
      
       - arch/xtensa/boot/lib/Makefile builds lib.a for use from
         arch/xtensa/boot/boot-redboot/Makefile.
      
      One more thing, adding everything to obj-y would increase the vmlinux
      size of allnoconfig (or tinyconfig).
      
      For less impact, I tweaked the destination of lib.a at the top Makefile;
      when CONFIG_MODULES=y, lib.a goes to KBUILD_VMLINUX_OBJS, which is
      forcibly linked to vmlinux, otherwise lib.a goes to KBUILD_VMLINUX_LIBS
      as before.
      
      The size impact for normal usecases is quite small since at lease one
      symbol in every lib-y object is eventually called by someone. In case
      you are intrested, here are the figures.
      
      x86_64_defconfig:
      
         text	   data	    bss	    dec	    hex	filename
      19566602 5422072 1589328 26578002 1958c52 vmlinux.before
      19566932 5422104 1589328 26578364 1958dbc vmlinux.after
      
      The case with the biggest impact is allnoconfig + CONFIG_MODULES=y.
      
      ARCH=x86 allnoconfig + CONFIG_MODULES=y:
      
         text	   data	    bss	    dec	    hex	filename
      1175162	 254740	1220608	2650510	 28718e	vmlinux.before
      1177974	 254836	1220608	2653418	 287cea	vmlinux.after
      
      Hopefully this is still not a big deal. The per-file trimming with the
      static library is not so effective after all.
      
      If fine-grained optimization is desired, some architectures support
      CONFIG_LD_DEAD_CODE_DATA_ELIMINATION, which trims dead code per-symbol
      basis. When LTO is supported in mainline, even better optimization will
      be possible.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/515
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      7273ad2b
    • Masahiro Yamada's avatar
      MIPS: fw: arc: add __weak to prom_meminit and prom_free_prom_memory · 2a5e5d0c
      Masahiro Yamada authored
      
      
      As far as I understood, prom_meminit() in arch/mips/fw/arc/memory.c
      is overridden by the one in arch/mips/sgi-ip32/ip32-memory.c if
      CONFIG_SGI_IP32 is enabled.
      
      The use of EXPORT_SYMBOL in static libraries potentially causes a
      problem for the llvm linker [1]. So, I want to forcibly link lib-y
      objects to vmlinux when CONFIG_MODULES=y.
      
      As a groundwork, we must fix multiple definitions that have previously
      been hidden by lib-y.
      
      The prom_cleanup() in this file is already marked as __weak (because
      it is overridden by the one in arch/mips/sgi-ip22/ip22-mc.c).
      I think it should be OK to do the same for these two.
      
      [1]: https://github.com/ClangBuiltLinux/linux/issues/515
      
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-By: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      2a5e5d0c
    • Masahiro Yamada's avatar
      kbuild: remove -I$(srctree)/tools/include from scripts/Makefile · c8bddf4f
      Masahiro Yamada authored
      I do not like to add an extra include path for every tool with no
      good reason. This should be specified per file.
      
      This line was added by commit 6520fe55
      
       ("x86, realmode: 16-bit
      real-mode code support for relocs tool"), which did not touch
      anything else in scripts/. I see no reason to add this.
      
      Also, remove the comment about kallsyms because we do not have any
      for the rest of programs.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      c8bddf4f
    • Masahiro Yamada's avatar
      kbuild: do not pass $(KBUILD_CFLAGS) to scripts/mkcompile_h · 01a6126b
      Masahiro Yamada authored
      
      
      scripts/mkcompile_h uses $(CC) only for getting the version string.
      
      I suspected there was a specific reason why the additional flags were
      needed, and dug the commit history. This code dates back to at least
      2002 [1], but I could not get any more clue.
      
      Just get rid of it.
      
      [1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=29f3df7eba8ddf91a55183f9967f76fbcc3ab742
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      01a6126b
    • Fangrui Song's avatar
      Documentation/llvm: fix the name of llvm-size · 0f44fbc1
      Fangrui Song authored
      The tool is called llvm-size, not llvm-objsize.
      
      Fixes: fcf1b6a3
      
       ("Documentation/llvm: add documentation on building w/ Clang/LLVM")
      Signed-off-by: default avatarFangrui Song <maskray@google.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      0f44fbc1
    • Kees Cook's avatar
      kbuild: mkcompile_h: Include $LD version in /proc/version · 4dcc9a88
      Kees Cook authored
      
      
      When doing Clang builds of the kernel, it is possible to link with
      either ld.bfd (binutils) or ld.lld (LLVM), but it is not possible to
      discover this from a running kernel. Add the "$LD -v" output to
      /proc/version.
      
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarFangrui Song <maskray@google.com>
      Reviewed-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      4dcc9a88
    • Mauro Carvalho Chehab's avatar
      kconfig: qconf: Fix a few alignment issues · 60969f02
      Mauro Carvalho Chehab authored
      
      
      There are a few items with wrong alignments. Solve them.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      60969f02
    • Mauro Carvalho Chehab's avatar
      kconfig: qconf: remove some old bogus TODOs · e1f7769f
      Mauro Carvalho Chehab authored
      
      
      The items described on those TODOs are already solved. So,
      remove the comments.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e1f7769f
    • Mauro Carvalho Chehab's avatar
      kconfig: qconf: fix support for the split view mode · b311142f
      Mauro Carvalho Chehab authored
      
      
      At least on my tests (building against Qt5.13), it seems to
      me that, since Kernel 3.14, the split view mode is broken.
      
      Maybe it was not a top priority during the conversion time.
      
      Anyway, this patch changes the logic in order to properly
      support the split view mode and the single view mode.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      b311142f
    • Mauro Carvalho Chehab's avatar
      kconfig: qconf: fix the content of the main widget · cce1faba
      Mauro Carvalho Chehab authored
      
      
      The port to Qt5 tried to preserve the same way as it used
      to work with Qt3 and Qt4. However, at least with newer
      versions of Qt5 (5.13), this doesn't work properly.
      
      Change the schema by adding a vertical layout, in order
      for it to start working properly again.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      cce1faba
    • Mauro Carvalho Chehab's avatar
      kconfig: qconf: Change title for the item window · 5752ff07
      Mauro Carvalho Chehab authored
      
      
      Both main config window and the item window have "Option"
      name. That sounds weird, and makes harder to debug issues
      of a window appearing at the wrong place.
      
      So, change the title to reflect the contents of each
      window.
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5752ff07
    • Mauro Carvalho Chehab's avatar
      kconfig: qconf: clean deprecated warnings · cf497b92
      Mauro Carvalho Chehab authored
      
      
      The recommended way to initialize a null string is with
      QString(). This is there at least since Qt5.5, with is
      when qconf was ported to Qt5.
      
      Fix those warnings:
      
      	scripts/kconfig/qconf.cc: In member function ‘void ConfigItem::updateMenu()’:
      	scripts/kconfig/qconf.cc:158:31: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations]
      	  158 |    setText(noColIdx, QString::null);
      	      |                               ^~~~
      	In file included from /usr/include/qt5/QtCore/qobject.h:47,
      	                 from /usr/include/qt5/QtWidgets/qwidget.h:45,
      	                 from /usr/include/qt5/QtWidgets/qmainwindow.h:44,
      	                 from /usr/include/qt5/QtWidgets/QMainWindow:1,
      	                 from scripts/kconfig/qconf.cc:9:
      
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      cf497b92
    • Masahiro Yamada's avatar
      gcc-plugins: drop support for GCC <= 4.7 · 77342a02
      Masahiro Yamada authored
      
      
      Nobody was opposed to raising minimum GCC version to 4.8 [1]
      So, we will drop GCC <= 4.7 support sooner or later.
      
      We always use C++ compiler for building plugins for GCC >= 4.8.
      
      This commit drops the plugin support for GCC <= 4.7 a bit earlier,
      which allows us to dump lots of code.
      
      [1] https://lkml.org/lkml/2020/1/23/545
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      77342a02
    • Nathan Chancellor's avatar
      kbuild: Enable -Wtautological-compare · afe956c5
      Nathan Chancellor authored
      
      
      Currently, we disable -Wtautological-compare, which in turn disables a
      bunch of more specific tautological comparison warnings that are useful
      for the kernel such as -Wtautological-bitwise-compare. See clang's
      documentation below for the other warnings that are suppressed by
      -Wtautological-compare. Now that all of the major/noisy warnings have
      been fixed, enable -Wtautological-compare so that more issues can be
      caught at build time by various continuous integration setups.
      
      -Wtautological-constant-out-of-range-compare is kept disabled under a
      normal build but visible at W=1 because there are places in the kernel
      where a constant or variable size can change based on the kernel
      configuration. These are not fixed in a clean/concise way and the ones
      I have audited so far appear to be harmless. It is not a subgroup but
      rather just one warning so we do not lose out on much coverage by
      default.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/488
      Link: http://releases.llvm.org/10.0.0/tools/clang/docs/DiagnosticsReference.html#wtautological-compare
      Link: https://bugs.llvm.org/show_bug.cgi?id=42666
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      afe956c5
    • Jason A. Donenfeld's avatar
      x86: update AS_* macros to binutils >=2.23, supporting ADX and AVX2 · e6abef61
      Jason A. Donenfeld authored
      
      
      Now that the kernel specifies binutils 2.23 as the minimum version, we
      can remove ifdefs for AVX2 and ADX throughout.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      e6abef61
    • Masahiro Yamada's avatar
      crypto: x86 - clean up poly1305-x86_64-cryptogams.S by 'make clean' · d7e40ea8
      Masahiro Yamada authored
      
      
      poly1305-x86_64-cryptogams.S is a generated file, so it should be
      cleaned up by 'make clean'.
      
      Assigning it to the variable 'targets' teaches Kbuild that it is a
      generated file. However, this line is not evaluated when cleaning
      because scripts/Makefile.clean does not include include/config/auto.conf.
      
      Remove the ifneq-conditional, so this file is correctly cleaned up.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      d7e40ea8
    • Borislav Petkov's avatar
      Documentation/changes: Raise minimum supported binutils version to 2.23 · 0aa78b10
      Borislav Petkov authored
      
      
      The currently minimum-supported binutils version 2.21 has the problem of
      promoting symbols which are defined outside of a section into absolute.
      According to Arvind:
      
        binutils-2.21 and -2.22. An x86-64 defconfig will fail with
                Invalid absolute R_X86_64_32S relocation: _etext
        and after fixing that one, with
                Invalid absolute R_X86_64_32S relocation: __end_of_kernel_reserve
      
      Those two versions of binutils have a bug when it comes to handling
      symbols defined outside of a section and binutils 2.23 has the proper
      fix, see: https://sourceware.org/legacy-ml/binutils/2012-06/msg00155.html
      
      Therefore, up to the fixed version directly, skipping the broken ones.
      
      Currently shipping distros already have the fixed binutils version so
      there should be no breakage resulting from this.
      
      For more details about the whole thing, see the thread in Link.
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Link: https://lkml.kernel.org/r/20200110202349.1881840-1-nivedita@alum.mit.edu
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Acked-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      0aa78b10
    • Jason A. Donenfeld's avatar
      crypto: curve25519 - do not pollute dispatcher based on assembler · 3f523e12
      Jason A. Donenfeld authored
      
      
      Since we're doing a static inline dispatch here, we normally branch
      based on whether or not there's an arch implementation. That would have
      been fine in general, except the crypto Makefile prior used to turn
      things off -- despite the Kconfig -- resulting in us needing to also
      hard code various assembler things into the dispatcher too. The horror!
      Now that the assembler config options are done by Kconfig, we can get
      rid of the inconsistency.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      3f523e12
    • Jason A. Donenfeld's avatar
      crypto: x86 - rework configuration based on Kconfig · 4dcbfc35
      Jason A. Donenfeld authored
      
      
      Now that assembler capabilities are probed inside of Kconfig, we can set
      up proper Kconfig-based dependencies. We also take this opportunity to
      reorder the Makefile, so that items are grouped logically by primitive.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      4dcbfc35
    • Masahiro Yamada's avatar
      x86: add comments about the binutils version to support code in as-instr · e9e070cf
      Masahiro Yamada authored
      We raise the minimal supported binutils version from time to time.
      The last bump was commit 1fb12b35
      
       ("kbuild: Raise the minimum
      required binutils version to 2.21").
      
      We have these as-instr tests because binutils 2.21 does not support
      them.
      
      When we bump the binutils version next time, this will be a good
      hint to find out which one can be dropped.
      
      As for the Clang/LLVM builds, we require very new LLVM version,
      so the LLVM integrated assembler supports all of them.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      e9e070cf
    • Jason A. Donenfeld's avatar
      x86: probe assembler capabilities via kconfig instead of makefile · 5e8ebd84
      Jason A. Donenfeld authored
      
      
      Doing this probing inside of the Makefiles means we have a maze of
      ifdefs inside the source code and child Makefiles that need to make
      proper decisions on this too. Instead, we do it at Kconfig time, like
      many other compiler and assembler options, which allows us to set up the
      dependencies normally for full compilation units. In the process, the
      ADX test changes to use %eax instead of %r10 so that it's valid in both
      32-bit and 64-bit mode.
      
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5e8ebd84
    • Masahiro Yamada's avatar
      drm/i915: remove always-defined CONFIG_AS_MOVNTDQA · 8192e551
      Masahiro Yamada authored
      CONFIG_AS_MOVNTDQA was introduced by commit 0b1de5d5 ("drm/i915:
      Use SSE4.1 movntdqa to accelerate reads from WC memory").
      
      We raise the minimal supported binutils version from time to time.
      The last bump was commit 1fb12b35
      
       ("kbuild: Raise the minimum
      required binutils version to 2.21").
      
      I confirmed the code in $(call as-instr,...) can be assembled by the
      binutils 2.21 assembler and also by LLVM integrated assembler.
      
      Remove CONFIG_AS_MOVNTDQA, which is always defined.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
      8192e551
    • Masahiro Yamada's avatar
      x86: remove always-defined CONFIG_AS_AVX · 42251572
      Masahiro Yamada authored
      CONFIG_AS_AVX was introduced by commit ea4d26ae ("raid5: add AVX
      optimized RAID5 checksumming").
      
      We raise the minimal supported binutils version from time to time.
      The last bump was commit 1fb12b35
      
       ("kbuild: Raise the minimum
      required binutils version to 2.21").
      
      I confirmed the code in $(call as-instr,...) can be assembled by the
      binutils 2.21 assembler and also by LLVM integrated assembler.
      
      Remove CONFIG_AS_AVX, which is always defined.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      42251572
    • Masahiro Yamada's avatar
      x86: remove always-defined CONFIG_AS_SSSE3 · 92203b02
      Masahiro Yamada authored
      CONFIG_AS_SSSE3 was introduced by commit 75aaf4c3 ("x86/raid6:
      correctly check for assembler capabilities").
      
      We raise the minimal supported binutils version from time to time.
      The last bump was commit 1fb12b35
      
       ("kbuild: Raise the minimum
      required binutils version to 2.21").
      
      I confirmed the code in $(call as-instr,...) can be assembled by the
      binutils 2.21 assembler and also by LLVM integrated assembler.
      
      Remove CONFIG_AS_SSSE3, which is always defined.
      
      I added ifdef CONFIG_X86 to lib/raid6/algos.c to avoid link errors
      on non-x86 architectures.
      
      lib/raid6/algos.c is built not only for the kernel but also for
      testing the library code from userspace. I added -DCONFIG_X86 to
      lib/raid6/test/Makefile to cator to this usecase.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      92203b02
    • Masahiro Yamada's avatar
      x86: remove always-defined CONFIG_AS_CFI_SECTIONS · 48e24723
      Masahiro Yamada authored
      CONFIG_AS_CFI_SECTIONS was introduced by commit 9e565292 ("x86:
      Use .cfi_sections for assembly code").
      
      We raise the minimal supported binutils version from time to time.
      The last bump was commit 1fb12b35
      
       ("kbuild: Raise the minimum
      required binutils version to 2.21").
      
      I confirmed the code in $(call as-instr,...) can be assembled by the
      binutils 2.21 assembler and also by LLVM integrated assembler.
      
      Remove CONFIG_AS_CFI_SECTIONS, which is always defined.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      48e24723
    • Masahiro Yamada's avatar
      x86: remove unneeded (CONFIG_AS_)CFI_SIGNAL_FRAME · 46427f65
      Masahiro Yamada authored
      Commit 131484c8
      
       ("x86/debug: Remove perpetually broken,
      unmaintainable dwarf annotations") removes all the users of
      CFI_SIGNAL_FRAME.
      
      Remove the CFI_SIGNAL_FRAME and CONFIG_AS_CFI_SIGNAL_FRAME.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      46427f65
    • Masahiro Yamada's avatar
      x86: remove always-defined CONFIG_AS_CFI · 0f2661c4
      Masahiro Yamada authored
      CONFIG_AS_CFI was introduced by commit e2414910 ("[PATCH] x86:
      Detect CFI support in the assembler at runtime"), and extended by
      commit f0f12d85 ("x86_64: Check for .cfi_rel_offset in CFI probe").
      
      We raise the minimal supported binutils version from time to time.
      The last bump was commit 1fb12b35
      
       ("kbuild: Raise the minimum
      required binutils version to 2.21").
      
      I confirmed the code in $(call as-instr,...) can be assembled by the
      binutils 2.21 assembler and also by LLVM integrated assembler.
      
      Remove CONFIG_AS_CFI, which is always defined.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      0f2661c4
    • Masahiro Yamada's avatar
      x86: remove unneeded defined(__ASSEMBLY__) check from asm/dwarf2.h · 418d6e29
      Masahiro Yamada authored
      
      
      This header file has the following check at the top:
      
        #ifndef __ASSEMBLY__
        #warning "asm/dwarf2.h should be only included in pure assembly files"
        #endif
      
      So, we expect defined(__ASSEMBLY__) is always true.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      418d6e29
    • Masahiro Yamada's avatar
      lib/raid6/test: fix build on distros whose /bin/sh is not bash · 06bd48b6
      Masahiro Yamada authored
      You can build a user-space test program for the raid6 library code,
      like this:
      
        $ cd lib/raid6/test
        $ make
      
      The command in $(shell ...) function is evaluated by /bin/sh by default.
      (or, you can specify the shell by passing SHELL=<shell> from command line)
      
      Currently '>&/dev/null' is used to sink both stdout and stderr. Because
      this code is bash-ism, it only works when /bin/sh is a symbolic link to
      bash (this is the case on RHEL etc.)
      
      This does not work on Ubuntu where /bin/sh is a symbolic link to dash.
      
      I see lots of
      
        /bin/sh: 1: Syntax error: Bad fd number
      
      and
      
        warning "your version of binutils lacks ... support"
      
      Replace it with portable '>/dev/null 2>&1'.
      
      Fixes: 4f8c55c5
      
       ("lib/raid6: build proper files on corresponding arch")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarH. Peter Anvin (Intel) <hpa@zytor.com>
      Reviewed-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      06bd48b6
    • Masahiro Yamada's avatar
      sh: remove unneeded uapi asm-generic wrappers · 7d538b5a
      Masahiro Yamada authored
      
      
      These are listed in include/uapi/asm-generic/Kbuild, so Kbuild will
      automatically generate them.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      7d538b5a
    • Masahiro Yamada's avatar
      h8300: move definition of __kernel_size_t etc. to posix_types.h · c9ee4bf9
      Masahiro Yamada authored
      
      
      These types should be defined in posix_types.h, not in bitsperlong.h .
      
      With these defines moved, h8300-specific bitsperlong.h is no longer
      needed since Kbuild will automatically create a wrapper of
      include/uapi/asm-generic/bitsperlong.h
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      c9ee4bf9
    • Masahiro Yamada's avatar
      sh: use __builtin_constant_p() directly instead of IS_IMMEDIATE() · e3c0f6f3
      Masahiro Yamada authored
      
      
      __builtin_constant_p(nr) is used everywhere now. It does not make
      much sense to define IS_IMMEDIATE() as its alias.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      e3c0f6f3
    • Linus Torvalds's avatar
      Merge tag 'drm-next-2020-04-08' of git://anongit.freedesktop.org/drm/drm · f5e94d10
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "This is a set of fixes that have queued up, I think I might have
        another pull with some more before rc1 but I'd like to dequeue what I
        have now just in case Easter is more eggciting that expected.
      
        The main thing in here is a fix for a longstanding nouveau power
        management issues on certain laptops, it should help runtime
        suspend/resume for a lot of people.
      
        There is also a reverted patch for some drm_mm behaviour in atomic
        contexts.
      
        Summary:
      
        core:
         - revert drm_mm atomic patch
         - dt binding fixes
      
        fbcon:
         - null ptr error fix
      
        i915:
         - GVT fixes
      
        nouveau:
         - runpm fix
         - svm fixes
      
        amdgpu:
         - HDCP fixes
         - gfx10 fix
         - Misc display fixes
         - BACO fixes
      
        amdkfd:
         - Fix memory leak
      
        vboxvideo:
         - remove conflicting fbs
      
        vc4:
         - mode validation fix
      
        xen:
         - fix PTR_ERR usage"
      
      * tag 'drm-next-2020-04-08' of git://anongit.freedesktop.org/drm/drm: (41 commits)
        drm/nouveau/kms/nv50-: wait for FIFO space on PIO channels
        drm/nouveau/nvif: protect waits against GPU falling off the bus
        drm/nouveau/nvif: access PTIMER through usermode class, if available
        drm/nouveau/gr/gp107,gp108: implement workaround for HW hanging during init
        drm/nouveau: workaround runpm fail by disabling PCI power management on certain intel bridges
        drm/nouveau/svm: remove useless SVM range check
        drm/nouveau/svm: check for SVM initialized before migrating
        drm/nouveau/svm: fix vma range check for migration
        drm/nouveau: remove checks for return value of debugfs functions
        drm/nouveau/ttm: evict other IO mappings when running out of BAR1 space
        drm/amdkfd: kfree the wrong pointer
        drm/amd/display: increase HDCP authentication delay
        drm/amd/display: Correctly cancel future watchdog and callback events
        drm/amd/display: Don't try hdcp1.4 when content_type is set to type1
        drm/amd/powerplay: move the ASIC specific nbio operation out of smu_v11_0.c
        drm/amd/powerplay: drop redundant BIF doorbell interrupt operations
        drm/amd/display: Fix dcn21 num_states
        drm/amd/display: Enable BT2020 in COLOR_ENCODING property
        drm/amd/display: LFC not working on 2.0x range monitors (v2)
        drm/amd/display: Support plane level CTM
        ...
      f5e94d10
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 9ebe5422
      Linus Torvalds authored
      Pull input updates from Dmitry Torokhov:
       "An update to the Goodix touchscreen driver to enable it work properly
        on various Bay Trail and Cherry Trail devices, and a few other
        assorted changes"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (26 commits)
        Input: update SPDX tag for input-event-codes.h
        Input: i8042 - add Acer Aspire 5738z to nomux list
        Input: goodix - fix compilation when ACPI support is disabled
        dt-bindings: touchscreen: Convert edt-ft5x06 to json-schema
        Input: of_touchscreen - explicitly choose axis
        Input: goodix - support gt9147 touchpanel
        dt-bindings: touchscreen: goodix: support of gt9147
        Input: goodix - add support for Goodix GT917S
        Input: goodix - use string-based chip ID
        dt-bindings: input: touchscreen: add compatible string for Goodix GT917S
        Input: goodix - add support for more then one touch-key
        Input: goodix - fix spurious key release events
        Input: goodix - try to reset the controller if the i2c-test fails
        Input: goodix - restore config on resume if necessary
        Input: goodix - make goodix_send_cfg() take a raw buffer as argument
        Input: goodix - add minimum firmware size check
        Input: goodix - save a copy of the config from goodix_read_config()
        Input: goodix - move defines to above struct goodix_ts_data declaration
        Input: goodix - add support for controlling the IRQ pin through ACPI methods
        Input: goodix - add support for getting IRQ + reset GPIOs on Bay Trail devices
        ...
      9ebe5422
    • Linus Torvalds's avatar
      Merge tag 'thermal-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux · 34183ddd
      Linus Torvalds authored
      Pull thermal updates from Daniel Lezcano:
      
       - Convert tsens configuration DT binding to yaml (Rajeshwari)
      
       - Add interrupt support on the rcar sensor (Niklas Söderlund)
      
       - Add a new Spreadtrum thermal driver (Baolin Wang)
      
       - Add thermal binding for the fsl scu board, a new API to retrieve the
         sensor id bound to the thermal zone and i.MX system controller sensor
         (Anson Huang))
      
       - Remove warning log when a deferred probe is requested on Exynos
         (Marek Szyprowski)
      
       - Add the thermal monitoring unit support for imx8mm with its DT
         bindings (Anson Huang)
      
       - Rephrase the Kconfig text for clarity (Linus Walleij)
      
       - Use the gpio descriptor for the ti-soc-thermal (Linus Walleij)
      
       - Align msg structure to 4 bytes for i.MX SC, fix the Kconfig
         dependency, add the __may_be unused annotation for PM functions and
         the COMPILE_TEST option for imx8mm (Anson Huang)
      
       - Fix a dependency on regmap in Kconfig for qoriq (Yuantian Tang)
      
       - Add DT binding and support for the rcar gen3 r8a77961 and improve the
         error path on the rcar init function (Niklas Söderlund)
      
       - Cleanup and improvements for the tsens Qcom sensor (Amit Kucheria)
      
       - Improve code by removing lock and caching values in the rcar thermal
         sensor (Niklas Söderlund)
      
       - Cleanup in the qoriq drivers and add a call to
         imx_thermal_unregister_legacy_cooling in the removal function (Anson
         Huang)
      
       - Remove redundant 'maxItems' in tsens and sprd DT bindings (Rob
         Herring)
      
       - Change the thermal DT bindings by making the cooling-maps optional
         (Yuantian Tang)
      
       - Add Tiger Lake support (Sumeet Pawnikar)
      
       - Use scnprintf() for avoiding potential buffer overflow (Takashi Iwai)
      
       - Make pkg_temp_lock a raw_spinlock_t(Clark Williams)
      
       - Fix incorrect data types by changing them to signed on i.MX SC (Anson
         Huang)
      
       - Replace zero-length array with flexible-array member (Gustavo A. R.
         Silva)
      
       - Add support for i.MX8MP in the driver and in the DT bindings (Anson
         Huang)
      
       - Fix return value of the cpufreq_set_cur_state() function (Willy
         Wolff)
      
       - Remove abusing and scary WARN_ON in the cpufreq cooling device
         (Daniel Lezcano)
      
       - Fix build warning of incorrect argument type reported by sparse on
         imx8mm (Anson Huang)
      
       - Fix stub for the devfreq cooling device (Martin Blumenstingl)
      
       - Fix cpu idle cooling documentation (Sergey Vidishev)
      
      * tag 'thermal-v5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux: (52 commits)
        Documentation: cpu-idle-cooling: Fix diagram for 33% duty cycle
        thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n
        thermal: imx8mm: Fix build warning of incorrect argument type
        thermal/drivers/cpufreq_cooling: Remove abusing WARN_ON
        thermal/drivers/cpufreq_cooling: Fix return of cpufreq_set_cur_state
        thermal: imx8mm: Add i.MX8MP support
        dt-bindings: thermal: imx8mm-thermal: Add support for i.MX8MP
        thermal: qcom: tsens.h: Replace zero-length array with flexible-array member
        thermal: imx_sc_thermal: Fix incorrect data type
        thermal: int340x_thermal: Use scnprintf() for avoiding potential buffer overflow
        thermal: int340x: processor_thermal: Add Tiger Lake support
        thermal/x86_pkg_temp: Make pkg_temp_lock a raw_spinlock_t
        dt-bindings: thermal: make cooling-maps property optional
        dt-bindings: thermal: qcom-tsens: Remove redundant 'maxItems'
        dt-bindings: thermal: sprd: Remove redundant 'maxItems'
        thermal: imx: Calling imx_thermal_unregister_legacy_cooling() in .remove
        thermal: qoriq: Sort includes alphabetically
        thermal: qoriq: Use devm_add_action_or_reset() to handle all cleanups
        thermal: rcar_thermal: Remove lock in rcar_thermal_get_current_temp()
        thermal: rcar_thermal: Do not store ctemp in rcar_thermal_priv
        ...
      34183ddd
    • Linus Torvalds's avatar
      Merge tag 'mfd-next-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd · 8645f09b
      Linus Torvalds authored
      Pull mfd updates from Lee Jones:
       "New Drivers:
         - Add support for IQS620A/621/622/624/625 Azoteq IQS62X Sensors
      
        New Device Support:
         - Add support for ADC, IRQ, Regulator, RTC and WDT to Ricoh RN5T618 PMIC
         - Add support for Comet Lake to Intel LPSS
      
        New Functionality:
         - Add support for Charger Detection to Spreadtrum SC27xx PMICs
         - Add support for Interrupt Polarity to Dialog Semi DA9062/61 PMIC
         - Add ACPI enumeration support to Diolan DLN2 USB Adaptor
      
        Fix-ups:
         - Device Tree; iqs62x, rn5t618, cros_ec_dev, stm32-lptimer, rohm,bd71837, rohm,bd71847
         - I2C registration; rn5t618
         - Kconfig; MFD_CPCAP, AB8500_CORE, MFD_WM8994, MFD_WM97xx, MFD_STPMIC1
         - Use flexible-array members; omap-usb-tll, qcom-pm8xxx
         - Remove unnecessary casts; omap-usb-host, omap-usb-tll
         - Power (suspend/resume/poweroff) enhancements; rk808
         - Improve error/sanity checking; dln2
         - Use snprintf(); aat2870-core
      
        Bug Fixes:
         - Fix PCI IDs in intel-lpss-pci"
      
      * tag 'mfd-next-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (33 commits)
        mfd: intel-lpss: Fix Intel Elkhart Lake LPSS I2C input clock
        mfd: aat2870: Use scnprintf() for avoiding potential buffer overflow
        mfd: dln2: Allow to be enumerated via ACPI
        mfd: da9062: Add support for interrupt polarity defined in device tree
        dt-bindings: bd718x7: Yamlify and add BD71850
        mfd: dln2: Fix sanity checking for endpoints
        mfd: intel-lpss: Add Intel Comet Lake PCH-V PCI IDs
        mfd: sc27xx: Add USB charger type detection support
        dt-bindings: mfd: Document STM32 low power timer bindings
        mfd: rk808: Convert RK805 to shutdown/suspend hooks
        mfd: rk808: Reduce shutdown duplication
        mfd: rk808: Stop using syscore ops
        mfd: rk808: Ensure suspend/resume hooks always work
        mfd: rk808: Always use poweroff when requested
        mfd: omap: Remove useless cast for driver.name
        mfd: Kconfig: Fix some misspelling of the word functionality
        mfd: pm8xxx: Replace zero-length array with flexible-array member
        mfd: omap-usb-tll: Replace zero-length array with flexible-array member
        mfd: cpcap: Fix compile if MFD_CORE is not selected
        mfd: cros_ec: Check DT node for usbpd-notify add
        ...
      8645f09b