1. 28 May, 2018 27 commits
    • Masahiro Yamada's avatar
      kconfig: add basic helper macros to scripts/Kconfig.include · e1cfdc0e
      Masahiro Yamada authored
      Kconfig got text processing tools like we see in Make.  Add Kconfig
      helper macros to scripts/Kconfig.include like we collect Makefile
      macros in scripts/Kbuild.include.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarUlf Magnusson <ulfalizer@gmail.com>
      e1cfdc0e
    • Masahiro Yamada's avatar
      kconfig: show compiler version text in the top comment · 21c54b77
      Masahiro Yamada authored
      The kernel configuration phase is now tightly coupled with the compiler
      in use.  It will be nice to show the compiler information in Kconfig.
      
      The compiler information will be displayed like this:
      
        $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- config
        scripts/kconfig/conf  --oldaskconfig Kconfig
        *
        * Linux/arm64 4.16.0-rc1 Kernel Configuration
        *
        *
        * Compiler: aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011
        *
        *
        * General setup
        *
        Compile also drivers which will not load (COMPILE_TEST) [N/y/?]
      
      If you use GUI methods such as menuconfig, it will be displayed in the
      top menu.
      
      This is simply implemented by using the 'comment' statement.  So, it
      will be saved into the .config file as well.
      
      This commit has a very important meaning.  If the compiler is upgraded,
      Kconfig must be re-run since different compilers have different sets
      of supported options.
      
      All referenced environments are written to include/config/auto.conf.cmd
      so that any environment change triggers syncconfig, and prompt the user
      to input new values if needed.
      
      With this commit, something like follows will be added to
      include/config/auto.conf.cmd
      
        ifneq "$(CC_VERSION_TEXT)" "aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011"
        include/config/auto.conf: FORCE
        endif
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      21c54b77
    • Masahiro Yamada's avatar
      kconfig: test: add Kconfig macro language tests · 2bece88f
      Masahiro Yamada authored
      Here are the test cases I used for developing the text expansion
      feature.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      2bece88f
    • Masahiro Yamada's avatar
      Documentation: kconfig: document a new Kconfig macro language · 316d55d5
      Masahiro Yamada authored
      Add a document for the macro language introduced to Kconfig.
      
      The motivation of this work is to move the compiler option tests to
      Kconfig from Makefile.  A number of kernel features require the
      compiler support.  Enabling such features blindly in Kconfig ends up
      with a lot of nasty build-time testing in Makefiles.  If a chosen
      feature turns out unsupported by the compiler, what the build system
      can do is either to disable it (silently!) or to forcibly break the
      build, despite Kconfig has let the user to enable it.  By moving the
      compiler capability tests to Kconfig, features unsupported by the
      compiler will be hidden automatically.
      
      This change was strongly prompted by Linus Torvalds.  You can find
      his suggestions [1] [2] in ML.  The original idea was to add a new
      attribute with 'option shell=...', but I found more generalized text
      expansion would make Kconfig more powerful and lovely.  The basic
      ideas are from Make, but there are some differences.
      
      [1]: https://lkml.org/lkml/2016/12/9/577
      [2]: https://lkml.org/lkml/2018/2/7/527Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      316d55d5
    • Masahiro Yamada's avatar
      kconfig: error out if a recursive variable references itself · 915f6490
      Masahiro Yamada authored
      When using a recursively expanded variable, it is a common mistake
      to make circular reference.
      
      For example, Make terminates the following code:
      
        X = $(X)
        Y := $(X)
      
      Let's detect the circular expansion in Kconfig, too.
      
      On the other hand, a function that recurses itself is a commonly-used
      programming technique.  So, Make does not check recursion in the
      reference with 'call'.  For example, the following code continues
      running eternally:
      
        X = $(call X)
        Y := $(X)
      
      Kconfig allows circular expansion if one or more arguments are given,
      but terminates when the same function is recursively invoked 1000 times,
      assuming it is a programming mistake.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      915f6490
    • Masahiro Yamada's avatar
      kconfig: add 'filename' and 'lineno' built-in variables · a702a617
      Masahiro Yamada authored
      The special variables, $(filename) and $(lineno), are expanded to a
      file name and its line number being parsed, respectively.
      Suggested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      a702a617
    • Masahiro Yamada's avatar
      kconfig: add 'info', 'warning-if', and 'error-if' built-in functions · 1d6272e6
      Masahiro Yamada authored
      Syntax:
        $(info,<text>)
        $(warning-if,<condition>,<text>)
        $(error-if,<condition>,<text)
      
      The 'info' function prints a message to stdout as in Make.
      
      The 'warning-if' and 'error-if' are similar to 'warning' and 'error'
      in Make, but take the condition parameter.  They are effective only
      when the <condition> part is y.
      
      Kconfig does not implement the lazy expansion as used in the 'if'
      'and, 'or' functions in Make.  In other words, Kconfig does not
      support conditional expansion.  The unconditional 'error' function
      would always terminate the parsing, hence would be useless in Kconfig.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      1d6272e6
    • Masahiro Yamada's avatar
      kconfig: expand lefthand side of assignment statement · 82bc8bd8
      Masahiro Yamada authored
      Make expands the lefthand side of assignment statements.  In fact,
      Kbuild relies on it since kernel makefiles mostly look like this:
      
        obj-$(CONFIG_FOO) += foo.o
      
      Do likewise in Kconfig.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      82bc8bd8
    • Masahiro Yamada's avatar
      kconfig: support append assignment operator · ed2a22f2
      Masahiro Yamada authored
      Support += operator.  This appends a space and the text on the
      righthand side to a variable.
      
      The timing of the evaluation of the righthand side depends on the
      flavor of the variable.  If the lefthand side was originally defined
      as a simple variable, the righthand side is expanded immediately.
      Otherwise, the expansion is deferred.  Appending something to an
      undefined variable results in a recursive variable.
      
      To implement this, we need to remember the flavor of variables.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      ed2a22f2
    • Masahiro Yamada's avatar
      kconfig: support simply expanded variable · 1175c025
      Masahiro Yamada authored
      The previous commit added variable and user-defined function.  They
      work similarly in the sense that the evaluation is deferred until
      they are used.
      
      This commit adds another type of variable, simply expanded variable,
      as we see in Make.
      
      The := operator defines a simply expanded variable, expanding the
      righthand side immediately.  This works like traditional programming
      language variables.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      1175c025
    • Masahiro Yamada's avatar
      kconfig: support user-defined function and recursively expanded variable · 9ced3bdd
      Masahiro Yamada authored
      Now, we got a basic ability to test compiler capability in Kconfig.
      
      config CC_HAS_STACKPROTECTOR
              def_bool $(shell,($(CC) -Werror -fstack-protector -E -x c /dev/null -o /dev/null 2>/dev/null) && echo y || echo n)
      
      This works, but it is ugly to repeat this long boilerplate.
      
      We want to describe like this:
      
      config CC_HAS_STACKPROTECTOR
              bool
              default $(cc-option,-fstack-protector)
      
      It is straight-forward to add a new function, but I do not like to
      hard-code specialized functions like that.  Hence, here is another
      feature, user-defined function.  This works as a textual shorthand
      with parameterization.
      
      A user-defined function is defined by using the = operator, and can
      be referenced in the same way as built-in functions.  A user-defined
      function in Make is referenced like $(call my-func,arg1,arg2), but I
      omitted the 'call' to make the syntax shorter.
      
      The definition of a user-defined function contains $(1), $(2), etc.
      in its body to reference the parameters.  It is grammatically valid
      to pass more or fewer arguments when calling it.  We already exploit
      this feature in our makefiles; scripts/Kbuild.include defines cc-option
      which takes two arguments at most, but most of the callers pass only
      one argument.
      
      By the way, a variable is supported as a subset of this feature since
      a variable is "a user-defined function with zero argument".  In this
      context, I mean "variable" as recursively expanded variable.  I will
      add a different flavored variable in the next commit.
      
      The code above can be written as follows:
      
      [Example Code]
      
        success = $(shell,($(1)) >/dev/null 2>&1 && echo y || echo n)
        cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
      
        config CC_HAS_STACKPROTECTOR
                def_bool $(cc-option,-fstack-protector)
      
      [Result]
        $ make -s alldefconfig && tail -n 1 .config
        CONFIG_CC_HAS_STACKPROTECTOR=y
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      9ced3bdd
    • Masahiro Yamada's avatar
      kconfig: begin PARAM state only when seeing a command keyword · 9de07153
      Masahiro Yamada authored
      Currently, any statement line starts with a keyword with TF_COMMAND
      flag.  So, the following three lines are dead code.
      
              alloc_string(yytext, yyleng);
              zconflval.string = text;
              return T_WORD;
      
      If a T_WORD token is returned in this context, it will cause syntax
      error in the parser anyway.
      
      The next commit will support the assignment statement where a line
      starts with an arbitrary identifier.  So, I want the lexer to switch
      to the PARAM state only when it sees a command keyword.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      9de07153
    • Masahiro Yamada's avatar
      kconfig: replace $(UNAME_RELEASE) with function call · 2972666a
      Masahiro Yamada authored
      Now that 'shell' function is supported, this can be self-contained in
      Kconfig.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarUlf Magnusson <ulfalizer@gmail.com>
      2972666a
    • Masahiro Yamada's avatar
      kconfig: add 'shell' built-in function · 2fd5b09c
      Masahiro Yamada authored
      This accepts a single command to execute.  It returns the standard
      output from it.
      
      [Example code]
      
        config HELLO
                string
                default "$(shell,echo hello world)"
      
        config Y
                def_bool $(shell,echo y)
      
      [Result]
      
        $ make -s alldefconfig && tail -n 2 .config
        CONFIG_HELLO="hello world"
        CONFIG_Y=y
      
      Caveat:
      Like environments, functions are expanded in the lexer.  You cannot
      pass symbols to function arguments.  This is a limitation to simplify
      the implementation.  I want to avoid the dynamic function evaluation,
      which would introduce much more complexity.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      2fd5b09c
    • Masahiro Yamada's avatar
      kconfig: add built-in function support · e298f3b4
      Masahiro Yamada authored
      This commit adds a new concept 'function' to do more text processing
      in Kconfig.
      
      A function call looks like this:
      
        $(function,arg1,arg2,arg3,...)
      
      This commit adds the basic infrastructure to expand functions.
      Change the text expansion helpers to take arguments.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      e298f3b4
    • Masahiro Yamada's avatar
      kconfig: make default prompt of mainmenu less specific · 137c0118
      Masahiro Yamada authored
      If "mainmenu" is not specified, "Linux Kernel Configuration" is used
      as a default prompt.
      
      Given that Kconfig is used in other projects than Linux, let's use
      a more generic prompt, "Main menu".
      Suggested-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      137c0118
    • Masahiro Yamada's avatar
      kconfig: remove sym_expand_string_value() · 5b31a974
      Masahiro Yamada authored
      There is no more caller of sym_expand_string_value().
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      5b31a974
    • Masahiro Yamada's avatar
      kconfig: remove string expansion for mainmenu after yyparse() · 96d8e48d
      Masahiro Yamada authored
      Now that environments are expanded in the lexer, conf_parse() does
      not need to expand them explicitly.
      
      The hack introduced by commit 0724a7c3 ("kconfig: Don't leak
      main menus during parsing") can go away.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarUlf Magnusson <ulfalizer@gmail.com>
      96d8e48d
    • Masahiro Yamada's avatar
      kconfig: remove string expansion in file_lookup() · bb222cee
      Masahiro Yamada authored
      There are two callers of file_lookup(), but there is no more reason
      to expand the given path.
      
      [1] zconf_initscan()
          This is used to open the first Kconfig.  sym_expand_string_value()
          has never been used in a useful way here; before opening the first
          Kconfig file, obviously there is no symbol to expand.  If you use
          expand_string_value() instead, environments in KBUILD_KCONFIG would
          be expanded, but I do not see practical benefits for that.
      
      [2] zconf_nextfile()
          This is used to open the next file from 'source' statement.
          Symbols in the path like "arch/$SRCARCH/Kconfig" needed expanding,
          but it was replaced with the direct environment expansion.  The
          environment has already been expanded before the token is passed
          to the parser.
      
      By the way, file_lookup() was already buggy; it expanded a given path,
      but it used the path before expansion for look-up:
              if (!strcmp(name, file->name)) {
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarUlf Magnusson <ulfalizer@gmail.com>
      bb222cee
    • Masahiro Yamada's avatar
      kconfig: reference environment variables directly and remove 'option env=' · 104daea1
      Masahiro Yamada authored
      To get access to environment variables, Kconfig needs to define a
      symbol using "option env=" syntax.  It is tedious to add a symbol entry
      for each environment variable given that we need to define much more
      such as 'CC', 'AS', 'srctree' etc. to evaluate the compiler capability
      in Kconfig.
      
      Adding '$' for symbol references is grammatically inconsistent.
      Looking at the code, the symbols prefixed with 'S' are expanded by:
       - conf_expand_value()
         This is used to expand 'arch/$ARCH/defconfig' and 'defconfig_list'
       - sym_expand_string_value()
         This is used to expand strings in 'source' and 'mainmenu'
      
      All of them are fixed values independent of user configuration.  So,
      they can be changed into the direct expansion instead of symbols.
      
      This change makes the code much cleaner.  The bounce symbols 'SRCARCH',
      'ARCH', 'SUBARCH', 'KERNELVERSION' are gone.
      
      sym_init() hard-coding 'UNAME_RELEASE' is also gone.  'UNAME_RELEASE'
      should be replaced with an environment variable.
      
      ARCH_DEFCONFIG is a normal symbol, so it should be simply referenced
      without '$' prefix.
      
      The new syntax is addicted by Make.  The variable reference needs
      parentheses, like $(FOO), but you can omit them for single-letter
      variables, like $F.  Yet, in Makefiles, people tend to use the
      parenthetical form for consistency / clarification.
      
      At this moment, only the environment variable is supported, but I will
      extend the concept of 'variable' later on.
      
      The variables are expanded in the lexer so we can simplify the token
      handling on the parser side.
      
      For example, the following code works.
      
      [Example code]
      
        config MY_TOOLCHAIN_LIST
                string
                default "My tools: CC=$(CC), AS=$(AS), CPP=$(CPP)"
      
      [Result]
      
        $ make -s alldefconfig && tail -n 1 .config
        CONFIG_MY_TOOLCHAIN_LIST="My tools: CC=gcc, AS=as, CPP=gcc -E"
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      104daea1
    • Masahiro Yamada's avatar
      kbuild: remove CONFIG_CROSS_COMPILE support · f1089c92
      Masahiro Yamada authored
      Kbuild provides a couple of ways to specify CROSS_COMPILE:
      
      [1] Command line
      [2] Environment
      [3] arch/*/Makefile (only some architectures)
      [4] CONFIG_CROSS_COMPILE
      
      [4] is problematic for the compiler capability tests in Kconfig.
      CONFIG_CROSS_COMPILE allows users to change the compiler prefix from
      'make menuconfig', etc.  It means, the compiler options would have
      to be all re-calculated everytime CONFIG_CROSS_COMPILE is changed.
      
      To avoid complexity and performance issues, I'd like to evaluate
      the shell commands statically, i.e. only parsing Kconfig files.
      
      I guess the majority is [1] or [2].  Currently, there are only
      5 defconfig files that specify CONFIG_CROSS_COMPILE.
        arch/arm/configs/lpc18xx_defconfig
        arch/hexagon/configs/comet_defconfig
        arch/nds32/configs/defconfig
        arch/openrisc/configs/or1ksim_defconfig
        arch/openrisc/configs/simple_smp_defconfig
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      f1089c92
    • Masahiro Yamada's avatar
      kbuild: remove kbuild cache · e08d6de4
      Masahiro Yamada authored
      The kbuild cache was introduced to remember the result of shell
      commands, some of which are expensive to compute, such as
      $(call cc-option,...).
      
      However, this turned out not so clever as I had first expected.
      Actually, it is problematic.  For example, "$(CC) -print-file-name"
      is cached.  If the compiler is updated, the stale search path causes
      build error, which is difficult to figure out.  Another problem
      scenario is cache files could be touched while install targets are
      running under the root permission.  We can patch them if desired,
      but the build infrastructure is getting uglier and uglier.
      
      Now, we are going to move compiler flag tests to the configuration
      phase.  If this is completed, the result of compiler tests will be
      naturally cached in the .config file.  We will not have performance
      issues of incremental building since this testing only happens at
      Kconfig time.
      
      To start this work with a cleaner code base, remove the kbuild
      cache first.
      
      Revert the following commits:
      Commit 9a234a2e ("kbuild: create directory for make cache only when necessary")
      Commit e17c400a ("kbuild: shrink .cache.mk when it exceeds 1000 lines")
      Commit 4e562071 ("kbuild: Cache a few more calls to the compiler")
      Commit 3298b690 ("kbuild: Add a cache for generated variables")
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      e08d6de4
    • Sam Ravnborg's avatar
      kconfig: drop localization support · 694c49a7
      Sam Ravnborg authored
      The localization support is broken and appears unused.
      There is no google hits on the update-po-config target.
      And there is no recent (5 years) activity related to the localization.
      
      So lets just drop this as it is no longer used.
      Suggested-by: default avatarUlf Magnusson <ulfalizer@gmail.com>
      Suggested-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      694c49a7
    • Masahiro Yamada's avatar
      kconfig: refactor ncurses package checks for building mconf and nconf · 1c5af5cf
      Masahiro Yamada authored
      The mconf (or its infrastructure, lxdiaglog) depends on the ncurses.
      Move and rename check-lxdialog.sh to mconf-cfg.sh to make it work in
      the same way as for qconf and gconf.
      
      This commit fixes some more weirdnesses.
      
      The nconf also needs ncurses packages.  HOSTLOADLIBES_nconf is set
      to the libraries needed for nconf, but the cflags is not explicitly
      set.  Actually, nconf relies on the check-lxdialog.sh for the proper
      cflags:
      
      HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
                          -DLOCALE
      
      The code above passes the ncurses flags to all objects, even for conf,
      qconf, gconf.  Let's pass the ncurses flags only to mconf and nconf.
      
      Currently, the presence of ncurses is not checked for nconf.  Let's
      show a prompt like the mconf case.
      
      According to Randy's report, the shell scripts still need to carry
      the fallback code in case the pkg-config fails to find the ncurses
      packages.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      1c5af5cf
    • Masahiro Yamada's avatar
      kconfig: refactor GTK+ package checks for building gconf · b464ef58
      Masahiro Yamada authored
      Refactor the package checks for gconf in the same way as for qconf.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      b464ef58
    • Masahiro Yamada's avatar
      kconfig: refactor Qt package checks for building qconf · 0b669a50
      Masahiro Yamada authored
      Currently, the necessary package checks for building qconf is
      surrounded by ifeq ($(MAKECMDGOALS),xconfig) ... endif.
      Then, Make will restart when .tmp_qtcheck is generated.
      
      To simplify the Makefile, move the scripting to a separate file,
      and use filechk.  The shell script is executed everytime xconfig
      is run, but it is not a costly script.
      
      In the old code, 'pkg-config --exists' only checked Qt5Core / QtCore,
      but the set of necessary packages should be checked.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      0b669a50
    • Masahiro Yamada's avatar
      kbuild: do not display CHK for filechk · e6ecfb45
      Masahiro Yamada authored
      filechk displays two short logs; CHK for creating a temporary file,
      and UPD for really updating the target.
      
      IMHO, the build system can be quiet when the target file has not
      been updated.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      e6ecfb45
  2. 27 May, 2018 2 commits
  3. 26 May, 2018 11 commits
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 7fbb6157
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A few more fixes for v4.17:
      
         - a fix for a crash in scm_call_atomic on qcom platforms
      
         - display fix for Allwinner A10
      
         - a fix that re-enables ethernet on Allwinner H3 (C.H.I.P et al)
      
         - a fix for eMMC corruption on hikey
      
         - i2c-gpio descriptor tables for ixp4xx
      
        ... plus a small typo fix"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        ARM: Fix i2c-gpio GPIO descriptor tables
        arm64: dts: hikey: Fix eMMC corruption regression
        firmware: qcom: scm: Fix crash in qcom_scm_call_atomic1()
        ARM: sun8i: v3s: fix spelling mistake: "disbaled" -> "disabled"
        ARM: dts: sun4i: Fix incorrect clocks for displays
        ARM: dts: sun8i: h3: Re-enable EMAC on Orange Pi One
      7fbb6157
    • Linus Torvalds's avatar
      Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b2096a5e
      Linus Torvalds authored
      Pull x86 store buffer fixes from Thomas Gleixner:
       "Two fixes for the SSBD mitigation code:
      
         - expose SSBD properly to guests. This got broken when the CPU
           feature flags got reshuffled.
      
         - simplify the CPU detection logic to avoid duplicate entries in the
           tables"
      
      * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/speculation: Simplify the CPU bug detection logic
        KVM/VMX: Expose SSBD properly to guests
      b2096a5e
    • Linus Torvalds's avatar
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · cc71efda
      Linus Torvalds authored
      Pull scheduler fixes from Thomas Gleixner:
       "Three fixes for scheduler and kthread code:
      
         - allow calling kthread_park() on an already parked thread
      
         - restore the sched_pi_setprio() tracepoint behaviour
      
         - clarify the unclear string for the scheduling domain debug output"
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched, tracing: Fix trace_sched_pi_setprio() for deboosting
        kthread: Allow kthread_park() on a parked kthread
        sched/topology: Clarify root domain(s) debug string
      cc71efda
    • Olof Johansson's avatar
      Merge tag 'hisi-fixes-for-4.17v2' of git://github.com/hisilicon/linux-hisi into fixes · e5dd6154
      Olof Johansson authored
      ARM64: hisi fixes for 4.17
      
      - Remove eMMC max-frequency property to fix eMMC corruption on hikey board
      
      * tag 'hisi-fixes-for-4.17v2' of git://github.com/hisilicon/linux-hisi:
        arm64: dts: hikey: Fix eMMC corruption regression
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      e5dd6154
    • Linus Walleij's avatar
      ARM: Fix i2c-gpio GPIO descriptor tables · f59c303b
      Linus Walleij authored
      I used bad names in my clumsiness when rewriting many board
      files to use GPIO descriptors instead of platform data. A few
      had the platform_device ID set to -1 which would indeed give
      the device name "i2c-gpio".
      
      But several had it set to >=0 which gives the names
      "i2c-gpio.0", "i2c-gpio.1" ...
      
      Fix the offending instances in the ARM tree. Sorry for the
      mess.
      
      Fixes: b2e63555 ("i2c: gpio: Convert to use descriptors")
      Cc: Wolfram Sang <wsa@the-dreams.de>
      Cc: Simon Guinot <simon.guinot@sequanux.org>
      Reported-by: default avatarSimon Guinot <simon.guinot@sequanux.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      f59c303b
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · ec30dcf7
      Linus Torvalds authored
      Pull KVM fixes from Radim Krčmář:
       "PPC:
      
         - Close a hole which could possibly lead to the host timebase getting
           out of sync.
      
         - Three fixes relating to PTEs and TLB entries for radix guests.
      
         - Fix a bug which could lead to an interrupt never getting delivered
           to the guest, if it is pending for a guest vCPU when the vCPU gets
           offlined.
      
        s390:
      
         - Fix false negatives in VSIE validity check (Cc stable)
      
        x86:
      
         - Fix time drift of VMX preemption timer when a guest uses LAPIC
           timer in periodic mode (Cc stable)
      
         - Unconditionally expose CPUID.IA32_ARCH_CAPABILITIES to allow
           migration from hosts that don't need retpoline mitigation (Cc
           stable)
      
         - Fix guest crashes on reboot by properly coupling CR4.OSXSAVE and
           CPUID.OSXSAVE (Cc stable)
      
         - Report correct RIP after Hyper-V hypercall #UD (introduced in
           -rc6)"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: x86: fix #UD address of failed Hyper-V hypercalls
        kvm: x86: IA32_ARCH_CAPABILITIES is always supported
        KVM: x86: Update cpuid properly when CR4.OSXAVE or CR4.PKE is changed
        x86/kvm: fix LAPIC timer drift when guest uses periodic mode
        KVM: s390: vsie: fix < 8k check for the itdba
        KVM: PPC: Book 3S HV: Do ptesync in radix guest exit path
        KVM: PPC: Book3S HV: XIVE: Resend re-routed interrupts on CPU priority change
        KVM: PPC: Book3S HV: Make radix clear pte when unmapping
        KVM: PPC: Book3S HV: Make radix use correct tlbie sequence in kvmppc_radix_tlbie_page
        KVM: PPC: Book3S HV: Snapshot timebase offset on guest entry
      ec30dcf7
    • John Stultz's avatar
      arm64: dts: hikey: Fix eMMC corruption regression · 9c6d26df
      John Stultz authored
      This patch is a partial revert of
      commit abd7d097 ("arm64: dts: hikey: Enable HS200 mode on eMMC")
      
      which has been causing eMMC corruption on my HiKey board.
      
      Symptoms usually looked like:
      
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      ...
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      mmc0: new HS200 MMC card at address 0001
      ...
      dwmmc_k3 f723d000.dwmmc0: Unexpected command timeout, state 3
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      print_req_error: I/O error, dev mmcblk0, sector 8810504
      Aborting journal on device mmcblk0p10-8.
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      mmc_host mmc0: Bus speed (slot 0) = 24800000Hz (slot req 400000Hz, actual 400000HZ div = 31)
      mmc_host mmc0: Bus speed (slot 0) = 148800000Hz (slot req 150000000Hz, actual 148800000HZ div = 0)
      EXT4-fs error (device mmcblk0p10): ext4_journal_check_start:61: Detected aborted journal
      EXT4-fs (mmcblk0p10): Remounting filesystem read-only
      
      And quite often this would result in a disk that wouldn't properly
      boot even with older kernels.
      
      It seems the max-frequency property added by the above patch is
      causing the problem, so remove it.
      
      Cc: Ryan Grachek <ryan@edited.us>
      Cc: Wei Xu <xuwei5@hisilicon.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: YongQin Liu <yongqin.liu@linaro.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Tested-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarWei Xu <xuwei04@gmail.com>
      9c6d26df
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · bc2dbc54
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "16 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        kasan: fix memory hotplug during boot
        kasan: free allocated shadow memory on MEM_CANCEL_ONLINE
        checkpatch: fix macro argument precedence test
        init/main.c: include <linux/mem_encrypt.h>
        kernel/sys.c: fix potential Spectre v1 issue
        mm/memory_hotplug: fix leftover use of struct page during hotplug
        proc: fix smaps and meminfo alignment
        mm: do not warn on offline nodes unless the specific node is explicitly requested
        mm, memory_hotplug: make has_unmovable_pages more robust
        mm/kasan: don't vfree() nonexistent vm_area
        MAINTAINERS: change hugetlbfs maintainer and update files
        ipc/shm: fix shmat() nil address after round-down when remapping
        Revert "ipc/shm: Fix shmat mmap nil-page protection"
        idr: fix invalid ptr dereference on item delete
        ocfs2: revert "ocfs2/o2hb: check len for bio_add_page() to avoid getting incorrect bio"
        mm: fix nr_rotate_swap leak in swapon() error case
      bc2dbc54
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 03250e10
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "Let's begin the holiday weekend with some networking fixes:
      
         1) Whoops need to restrict cfg80211 wiphy names even more to 64
            bytes. From Eric Biggers.
      
         2) Fix flags being ignored when using kernel_connect() with SCTP,
            from Xin Long.
      
         3) Use after free in DCCP, from Alexey Kodanev.
      
         4) Need to check rhltable_init() return value in ipmr code, from Eric
            Dumazet.
      
         5) XDP handling fixes in virtio_net from Jason Wang.
      
         6) Missing RTA_TABLE in rtm_ipv4_policy[], from Roopa Prabhu.
      
         7) Need to use IRQ disabling spinlocks in mlx4_qp_lookup(), from Jack
            Morgenstein.
      
         8) Prevent out-of-bounds speculation using indexes in BPF, from
            Daniel Borkmann.
      
         9) Fix regression added by AF_PACKET link layer cure, from Willem de
            Bruijn.
      
        10) Correct ENIC dma mask, from Govindarajulu Varadarajan.
      
        11) Missing config options for PMTU tests, from Stefano Brivio"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (48 commits)
        ibmvnic: Fix partial success login retries
        selftests/net: Add missing config options for PMTU tests
        mlx4_core: allocate ICM memory in page size chunks
        enic: set DMA mask to 47 bit
        ppp: remove the PPPIOCDETACH ioctl
        ipv4: remove warning in ip_recv_error
        net : sched: cls_api: deal with egdev path only if needed
        vhost: synchronize IOTLB message with dev cleanup
        packet: fix reserve calculation
        net/mlx5: IPSec, Fix a race between concurrent sandbox QP commands
        net/mlx5e: When RXFCS is set, add FCS data into checksum calculation
        bpf: properly enforce index mask to prevent out-of-bounds speculation
        net/mlx4: Fix irq-unsafe spinlock usage
        net: phy: broadcom: Fix bcm_write_exp()
        net: phy: broadcom: Fix auxiliary control register reads
        net: ipv4: add missing RTA_TABLE to rtm_ipv4_policy
        net/mlx4: fix spelling mistake: "Inrerface" -> "Interface" and rephrase message
        ibmvnic: Only do H_EOI for mobility events
        tuntap: correctly set SOCKWQ_ASYNC_NOSPACE
        virtio-net: fix leaking page for gso packet during mergeable XDP
        ...
      03250e10
    • David Hildenbrand's avatar
      kasan: fix memory hotplug during boot · 3f195972
      David Hildenbrand authored
      Using module_init() is wrong.  E.g.  ACPI adds and onlines memory before
      our memory notifier gets registered.
      
      This makes sure that ACPI memory detected during boot up will not result
      in a kernel crash.
      
      Easily reproducible with QEMU, just specify a DIMM when starting up.
      
      Link: http://lkml.kernel.org/r/20180522100756.18478-3-david@redhat.com
      Fixes: 786a8959 ("kasan: disable memory hotplug")
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3f195972
    • David Hildenbrand's avatar
      kasan: free allocated shadow memory on MEM_CANCEL_ONLINE · ed1596f9
      David Hildenbrand authored
      We have to free memory again when we cancel onlining, otherwise a later
      onlining attempt will fail.
      
      Link: http://lkml.kernel.org/r/20180522100756.18478-2-david@redhat.com
      Fixes: fa69b598 ("mm/kasan: add support for memory hotplug")
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ed1596f9