Commit graph

781668 commits

Author SHA1 Message Date
Sean Christopherson 0b665d3040 KVM: vmx: Inject #UD for SGX ENCLS instruction in guest
Virtualization of Intel SGX depends on Enclave Page Cache (EPC)
management that is not yet available in the kernel, i.e. KVM support
for exposing SGX to a guest cannot be added until basic support
for SGX is upstreamed, which is a WIP[1].

Until SGX is properly supported in KVM, ensure a guest sees expected
behavior for ENCLS, i.e. all ENCLS #UD.  Because SGX does not have a
true software enable bit, e.g. there is no CR4.SGXE bit, the ENCLS
instruction can be executed[1] by the guest if SGX is supported by the
system.  Intercept all ENCLS leafs (via the ENCLS- exiting control and
field) and unconditionally inject #UD.

[1] https://www.spinics.net/lists/kvm/msg171333.html or
    https://lkml.org/lkml/2018/7/3/879

[2] A guest can execute ENCLS in the sense that ENCLS will not take
    an immediate #UD, but no ENCLS will ever succeed in a guest
    without explicit support from KVM (map EPC memory into the guest),
    unless KVM has a *very* egregious bug, e.g. accidentally mapped
    EPC memory into the guest SPTEs.  In other words this patch is
    needed only to prevent the guest from seeing inconsistent behavior,
    e.g. #GP (SGX not enabled in Feature Control MSR) or #PF (leaf
    operand(s) does not point at EPC memory) instead of #UD on ENCLS.
    Intercepting ENCLS is not required to prevent the guest from truly
    utilizing SGX.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20180814163334.25724-3-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-08-22 16:48:35 +02:00
Sean Christopherson 802ec46167 KVM: vmx: Add defines for SGX ENCLS exiting
Hardware support for basic SGX virtualization adds a new execution
control (ENCLS_EXITING), VMCS field (ENCLS_EXITING_BITMAP) and exit
reason (ENCLS), that enables a VMM to intercept specific ENCLS leaf
functions, e.g. to inject faults when the VMM isn't exposing SGX to
a VM.  When ENCLS_EXITING is enabled, the VMM can set/clear bits in
the bitmap to intercept/allow ENCLS leaf functions in non-root, e.g.
setting bit 2 in the ENCLS_EXITING_BITMAP will cause ENCLS[EINIT]
to VMExit(ENCLS).

Note: EXIT_REASON_ENCLS was previously added by commit 1f51999270
("KVM: VMX: add missing exit reasons").

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20180814163334.25724-2-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-08-22 16:48:35 +02:00
Yi Wang d806afa495 x86/kvm/vmx: Fix coding style in vmx_setup_l1d_flush()
Substitute spaces with tab. No functional changes.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
Message-Id: <1534398159-48509-1-git-send-email-wang.yi59@zte.com.cn>
Cc: stable@vger.kernel.org # L1TF
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-08-22 16:48:34 +02:00
Arnd Bergmann 7288bde1f9 x86: kvm: avoid unused variable warning
Removing one of the two accesses of the maxphyaddr variable led to
a harmless warning:

arch/x86/kvm/x86.c: In function 'kvm_set_mmio_spte_mask':
arch/x86/kvm/x86.c:6563:6: error: unused variable 'maxphyaddr' [-Werror=unused-variable]

Removing the #ifdef seems to be the nicest workaround, as it
makes the code look cleaner than adding another #ifdef.

Fixes: 28a1f3ac1d ("kvm: x86: Set highest physical address bits in non-present/reserved SPTEs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: stable@vger.kernel.org # L1TF
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-08-22 16:48:26 +02:00
Linus Torvalds df2def49c5 More ACPI updates for 4.19-rc1
- Update the ACPICA code in the kernel to upstream revision 20180810
    including:
    * Fix for AML parser regression causing it to mishandle opcodes
      that open a scope upon parse failures (Erik Schmauss).
    * Fix for a reference counting issue on large systems (Erik
      Schmauss).
    * Fix to discard values coming from register reads that have
      failed (Erik Schmauss).
    * Two acpiexec fixes (Bob Moore, Erik Schmauss).
    * Debugger cleanup (Bob Moore).
    * Cleanup of duplicate table error message (Bob Moore).
    * Cleanup of hex detection in the utilities (Erik Schmauss).
 
  - Make ACPICA clear the status of all ACPI events when entering
    sleep states again to avoid functional regressions (Rafael Wysocki).
 
  - Update the ACPI operation region driver for the CrystalCove PMIC
    to cover all of the known operation region fields (Hans de Goede).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJbfSp2AAoJEILEb/54YlRxH1cQAJax3bEtxG9IK6kuQW1jvwde
 TIIvmVR2U45Wz5t69njKp9zetNzIwSU6vkjenimUJa8EuajclJx3ucfIV6dqWFbr
 0efJO4wmo+3/ElGzXHU4xSF1z09xx4PBcZaOtoEzX/5zLNdy2sFY7T8iwlmAPNOs
 vCbvBcCSffkciP6e22og9i1+p73JKNYA75S2Fb2rQZDdidN1q2iGlq5B2ToKvCas
 +BJmqCuwStR1/gAYAdWC940s/rkzi5Kig6xum/EtIz1dgWVkwxIHUe6FZ0BSsv8c
 VBINqhLgEix2Rrnd+pRYdB8klrP3GmPEELQykV9qkpCKNKUgU4t0wBxjw8uW27sv
 ovrCULlrRYckIOSp/D+M1z7NRB3kekCKg340kz2cGdRo8xf1Dxj8w+P6Ca1yfAWt
 HBBBgb2utJWG4vm7raLjAlnHKi15MN8J01wz0cjmLRB/+mGPMwzQ6Jxon9SwjWBD
 qn7uGpIDDS3DjMwBxHXS4Vr4Fx8BftXeK6MB72vOXN4n0f+zArCqTLAf6+t9aASq
 50VaSDfc8PJO8wl9GvyHaTedci6/iqORDTR9XHK3njfEr1j2uRhtfHUVUIvLDILT
 HqfYbFqq63qaaFLiUhB3UBfsr6BL4sSUmuY31kL9xXLzZGmTvkoB6P+ysjTvF18V
 +mcZdZ62o18NA1BXO8iH
 =g8r+
 -----END PGP SIGNATURE-----

Merge tag 'acpi-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more ACPI updates from Rafael Wysocki:
 "These update the ACPICA code in the kernel to the most recent upstream
  revision (which includes a regression fix and other improvements),
  make ACPICA clear the status of all ACPI events when entering sleep
  states (to restore the previous behavior) and update the ACPI
  operation region driver for the CrystalCove PMIC.

  Specifics:

   - Update the ACPICA code in the kernel to upstream revision 20180810
     including:
      * Fix for AML parser regression causing it to mishandle opcodes
        that open a scope upon parse failures (Erik Schmauss)
      * Fix for a reference counting issue on large systems (Erik
        Schmauss)
      * Fix to discard values coming from register reads that have
        failed (Erik Schmauss)
      * Two acpiexec fixes (Bob Moore, Erik Schmauss)
      * Debugger cleanup (Bob Moore)
      * Cleanup of duplicate table error message (Bob Moore)
      * Cleanup of hex detection in the utilities (Erik Schmauss)

   - Make ACPICA clear the status of all ACPI events when entering sleep
     states again to avoid functional regressions (Rafael Wysocki)

   - Update the ACPI operation region driver for the CrystalCove PMIC to
     cover all of the known operation region fields (Hans de Goede)"

* tag 'acpi-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / PMIC: CrystalCove: Extend PMOP support to support all possible fields
  ACPICA: Clear status of all events when entering sleep states
  ACPICA: Update version to 20180810
  ACPICA: acpiexec: fix a small memory leak regression
  ACPICA: Reference Counts: increase max to 0x4000 for large servers
  ACPICA: Reference count: add additional debugging details
  ACPICA: acpi_exec: fixing -fi option
  ACPICA: Debugger: Cleanup interface to the AML disassembler
  ACPICA: AML Parser: skip opcodes that open a scope upon parse failure
  ACPICA: Utilities: split hex detection into smaller functions
  ACPICA: Update an error message for a duplicate table
  ACPICA: ACPICA: add status check for acpi_hw_read before assigning return value
  ACPICA: AML Parser: ignore all exceptions resulting from incorrect AML during table load
2018-08-22 07:44:50 -07:00
Linus Torvalds dfec4a8478 More power management updates for 4.19-rc1
- Make the idle loop handle stopped scheduler tick correctly (Rafael
    Wysocki).
 
  - Prevent the menu cpuidle governor from letting CPUs spend too much
    time in shallow idle states when it is invoked with scheduler tick
    stopped and clean it up somewhat (Rafael Wysocki).
 
  - Avoid invoking the platform firmware to make the platform enter
    the ACPI S3 sleep state with suspended PCIe root ports which may
    confuse the firmware and cause it to crash (Rafael Wysocki).
 
  - Fix sysfs-related race in the ondemand and conservative cpufreq
    governors which may cause the system to crash if the governor
    module is removed during an update of CPU frequency limits (Henry
    Willard).
 
  - Select SRCU when building the system wakeup framework to avoid a
    build issue in it (zhangyi).
 
  - Make the descriptions of ACPI C-states vendor-neutral to avoid
    confusion (Prarit Bhargava).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJbfSnVAAoJEILEb/54YlRxBn4QAKQ8PqkSYkBby+1hb90ET4dk
 VaLkbCYXuzLK5rIDvnbYOALhVKo4B29Ex5GdCLN7cWkZMkrVKe7oX8QQTnp3/7lF
 URjTKgTNec5uJG652PrE3ESAa3X/kYggj6aeQOxDR4iYKzcpJEQ92ekFW+SoJTNp
 Jc2kZh3qkC2On64GB3ibsZaKnmHfPvLg0t4agwzuYq/Gff8NRJFk7kMwAPzqGzZo
 b2UVRcYFWIRkJjgmU9iInoeHIY8mBdT3IiKwTemZP1dOhb5T1AHOXwGTk6/cS+RH
 A9qx4eg7I3R00KmnYvO8WytYJeOu2qb83GIUx4fIJGOqfvevm5xkxB9F+nfE+ouj
 ROBqO4+X4XfQGPw8slayg0rJjI9JSkXLnLdl0Qw2WRlbc4/fVWntra1C57EeKFBR
 EG9UAF9+7nUUx0bOCLsfFF3+r9R3SDUjk7b4thyhYncyQRsYC+FL7ztlxnMzVtzW
 M5SF2sPrpcQzqmcszdUdbESI10n5X8m/crJW4rsbTxBpAM+coO+uLcvHWOY4MpkW
 BgBsR6bMDAlG/VlTFgeeP/tkCRd5zNlJi7yBFItXuOoVKXpnHCJuxq2WkZ1Rb74M
 Gk1d3TduekHJm8VsLEdCJR/tEk1cMc0zVUD/a1yzI4Z21QxvXUCqMDdws4/Ey184
 qmKgNR9R94vSC5xIPRhM
 =9GrU
 -----END PGP SIGNATURE-----

Merge tag 'pm-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more power management updates from Rafael Wysocki:
 "These fix the main idle loop and the menu cpuidle governor, clean up
  the latter, fix a mistake in the PCI bus type's support for system
  suspend and resume, fix the ondemand and conservative cpufreq
  governors, address a build issue in the system wakeup framework and
  make the ACPI C-states desciptions less confusing.

  Specifics:

   - Make the idle loop handle stopped scheduler tick correctly (Rafael
     Wysocki).

   - Prevent the menu cpuidle governor from letting CPUs spend too much
     time in shallow idle states when it is invoked with scheduler tick
     stopped and clean it up somewhat (Rafael Wysocki).

   - Avoid invoking the platform firmware to make the platform enter the
     ACPI S3 sleep state with suspended PCIe root ports which may
     confuse the firmware and cause it to crash (Rafael Wysocki).

   - Fix sysfs-related race in the ondemand and conservative cpufreq
     governors which may cause the system to crash if the governor
     module is removed during an update of CPU frequency limits (Henry
     Willard).

   - Select SRCU when building the system wakeup framework to avoid a
     build issue in it (zhangyi).

   - Make the descriptions of ACPI C-states vendor-neutral to avoid
     confusion (Prarit Bhargava)"

* tag 'pm-4.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpuidle: menu: Handle stopped tick more aggressively
  sched: idle: Avoid retaining the tick when it has been stopped
  PCI / ACPI / PM: Resume all bridges on suspend-to-RAM
  cpuidle: menu: Update stale polling override comment
  cpufreq: governor: Avoid accessing invalid governor_data
  x86/ACPI/cstate: Make APCI C1 FFH MWAIT C-state description vendor-neutral
  cpuidle: menu: Fix white space
  PM / sleep: wakeup: Fix build error caused by missing SRCU support
2018-08-22 07:42:36 -07:00
Linus Torvalds 159127ea83 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide
Pull IDE updates from David Miller:

 - Remove redundant variables (Colin Ian King)

 - Expected switch fall-through annotations (Gustavo A. R. Silva)

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide:
  ide: mark expected switch fall-throughs
  ide-tape: remove redundant variable buffer_size
  ide: remove redundant variables queue_run_ms and left
2018-08-22 07:40:33 -07:00
Linus Torvalds 9617ba395f Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Pull sparc updates from David Miller:
 "Nothing super serious:

   - Convert sparc32 over to NO_BOOTMEM (Mike Rapoport)

   - Use dma_noncoherent_ops on sparc32 (Christoph Hellwig)

   - Fix kbuild defconfig handling on sparc32 (Masahiro Yamada)"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc:
  sparc: fix KBUILD_DEFCONFIG for ARCH=sparc32
  sparc32: split ramdisk detection and reservation to a helper function
  sparc32: switch to NO_BOOTMEM
  sparc: mm/init_32: kill trailing whitespace
  sparc: use generic dma_noncoherent_ops
2018-08-22 07:38:21 -07:00
Masahiro Yamada f6f57a4643 initramfs: move gen_initramfs_list.sh from scripts/ to usr/
scripts/gen_initramfs_list.sh is only invoked from usr/Makefile.
Move it so that all tools to create initramfs are self-contained
in the usr/ directory.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:44 +09:00
Masahiro Yamada 7953002a7c vmlinux.lds.h: remove stale <linux/export.h> include
This is unneeded since commit a621438500 ("vmlinux.lds.h: remove
no-op macro VMLINUX_SYMBOL()").

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:44 +09:00
Masahiro Yamada c4df32c80d export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR()
With the special case handling for Blackfin and Metag was removed by
commit 94e58e0ac3 ("export.h: remove code for prefixing symbols with
underscore"), VMLINUX_SYMBOL() is no-op.

Replace the remaining usages, then remove the definition of
VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:44 +09:00
zhong jiang 6fbd856950 Coccinelle: remove pci_alloc_consistent semantic to detect in zalloc-simple.cocci
Because pci_alloc_consistent has been deprecated. We prefer to use
dma_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent
to increase the confidence.

Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:43 +09:00
Andrzej Pietrasiewicz f55f2328bb kbuild: make sorting initramfs contents independent of locale
Some LANG values (e.g. pl_PL.UTF-8) cause the sort command to output
files before their parent directories, which makes them inaccessible for
the kernel. In other words, when the kernel populates the rootfs, it is
unable to create files whose parent directories have not been yet created.

This patch makes sorting use the default (LANG=C) locale, which results in
correctly laid out initramfs images (parent directories before files).

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:43 +09:00
Masahiro Yamada dd5806ede3 kbuild: remove "rpm" target, which is alias of "rpm-pkg"
As commit ebaad7d364 ("kbuild: rpm: prompt to use "rpm-pkg" if "rpm"
target is used") noticed, the "rpm" target is now removed.
I assume people have already migrated to "rpm-pkg".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:42 +09:00
Michal Suchanek c86b1f9342 kbuild: Fix LOADLIBES rename in Documentation/kbuild/makefiles.txt
Fixes: 8377bd2b9e ("kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:42 +09:00
Masahiro Yamada 9a9ddcf478 kconfig: suppress "configuration written to .config" for syncconfig
The top-level Makefile invokes "make syncconfig" when necessary.
Then, Kconfig displays the following message when .config is updated.

  #
  # configuration written to .config
  #

It is distracting because "make syncconfig" happens during the build
stage, and does nothing important in most cases.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:41 +09:00
Masahiro Yamada 98a4afbfaf kconfig: fix "Can't open ..." in parallel build
If you run "make menuconfig" or "make nconfig" with -j<N> option in a
fresh source tree, you will see several "Can't open ..." messages:

  $ make -j8 menuconfig
    HOSTCC  scripts/basic/fixdep
    YACC    scripts/kconfig/zconf.tab.c
    LEX     scripts/kconfig/zconf.lex.c
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .:   HOSTCC  scripts/kconfig/lxdialog/checklist.o
  Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
    HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
    UPD     scripts/kconfig/.mconf-cfg
  /bin/sh: 1: .: Can't open scripts/kconfig/.mconf-cfg
    HOSTCC  scripts/kconfig/lxdialog/menubox.o
    HOSTCC  scripts/kconfig/lxdialog/textbox.o
    HOSTCC  scripts/kconfig/lxdialog/util.o
    HOSTCC  scripts/kconfig/lxdialog/yesno.o
    HOSTCC  scripts/kconfig/mconf.o
    HOSTCC  scripts/kconfig/zconf.tab.o
    HOSTLD  scripts/kconfig/mconf

Correct dependencies to fix this problem.

Fixes: 1c5af5cf93 ("kconfig: refactor ncurses package checks for building mconf and nconf")
Cc: linux-stable <stable@vger.kernel.org> # v4.18
Reported-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Borislav Petkov <bp@suse.de>
2018-08-22 23:21:41 +09:00
Michael Forney b5f8cb9e90 kbuild: Add a space after ! to prevent parsing as file pattern
Some shells use !(pattern|...|pattern) to match file names not
containing the specified patterns. This may result in output like

  $ ./scripts/clang-version.sh gcc
  ./scripts/clang-version.sh[18]: COPYING: not found
  printf: %d __clang_major__: conversion error
  printf: %d __clang_minor__: conversion error
  printf: %d __clang_patchlevel__: conversion error
  00000
  $

and set CONFIG_CLANG_VERSION to the invalid value '00000'.

POSIX says[0]

  If the pipeline begins with the reserved word ! and command1 is a
  subshell command, the application shall ensure that the ( operator at
  the beginning of command1 is separated from the ! by one or more
  <blank> characters. The behavior of the reserved word ! immediately
  followed by the ( operator is unspecified.

So, just add a <blank> to prevent this.

[0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_02

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:40 +09:00
Randy Dunlap 1f3aa9002d scripts: modpost: check memory allocation results
Fix missing error check for memory allocation functions in
scripts/mod/modpost.c.

Fixes kernel bugzilla #200319:
https://bugzilla.kernel.org/show_bug.cgi?id=200319

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yuexing Wang <wangyxlandq@gmail.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:40 +09:00
Masahiro Yamada f498926c47 kconfig: improve the recursive dependency report
This commit improves the messages of the recursive dependency.
Currently, sym->dir_dep.expr is not checked.  Hence, any dependency
in property visibility is regarded as the dependency of the symbol.

[Test Code 1]

  config A
          bool "a"
          depends on B

  config B
          bool "b"
          depends on A

[Test Code 2]

  config A
          bool "a" if B

  config B
          bool "b"
          depends on A

For both cases above, the same message is displayed:

        symbol B depends on A
        symbol A depends on B

This commit changes the message for the latter, like this:

        symbol B depends on A
        symbol A prompt is visible depending on B

Also, 'select' and 'imply' are distinguished.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Dirk Gouders <dirk@gouders.net>
2018-08-22 23:21:39 +09:00
Masahiro Yamada 5e8c5299d3 kconfig: report recursive dependency involving 'imply'
Currently, Kconfig does not complain about the recursive dependency
where 'imply' keywords are involved.

[Test Code]

  config A
          bool "a"

  config B
          bool "b"
          imply A
          depends on A

In the code above, Kconfig cannot calculate the symbol values correctly
due to the circular dependency.  For example, allyesconfig followed by
syncconfig results in an odd behavior because CONFIG_B becomes visible
in syncconfig.

  $ make allyesconfig
  scripts/kconfig/conf  --allyesconfig Kconfig
  #
  # configuration written to .config
  #
  $ cat .config
  #
  # Automatically generated file; DO NOT EDIT.
  # Main menu
  #
  CONFIG_A=y
  $ make syncconfig
  scripts/kconfig/conf  --syncconfig Kconfig
  *
  * Restart config...
  *
  *
  * Main menu
  *
  a (A) [Y/n/?] y
    b (B) [N/y/?] (NEW)

To detect this correctly, sym_check_expr_deps() should recurse to
not only sym->rev_dep.expr but also sym->implied.expr .

At this moment, sym_check_print_recursive() cannot distinguish
'select' and 'imply' since it does not know the precise context
where the recursive dependency has been hit.  This will be solved
by the next commit.

In fact, even the document and the unit-test are confused.  Using
'imply' does not solve recursive dependency since 'imply' addresses
the unmet direct dependency, which 'select' could cause.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Dirk Gouders <dirk@gouders.net>
2018-08-22 23:21:39 +09:00
Masahiro Yamada f1575595d1 kconfig: error out when seeing recursive dependency
Originally, recursive dependency was a fatal error for Kconfig
because Kconfig cannot compute symbol values in such a situation.

Commit d595cea624 ("kconfig: print more info when we see a recursive
dependency") changed it to a warning, which I guess was not intentional.

Get it back to an error again.

Also, rename the unit test directory "warn_recursive_dep" to
"err_recursive_dep" so that it matches to the behavior.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Tested-by: Dirk Gouders <dirk@gouders.net>
2018-08-22 23:21:38 +09:00
Randy Dunlap 4bf6a9af0e kconfig: add build-only configurator targets
Add build-only targets for build_menuconfig, build_nconfig,
build_xconfig, and build_gconfig.
(targets must end in "config" to qualify in top-level Makefile)

This allows these target to be built without execution (e.g., to
look for errors or warnings) and/or to be built and checked by sparse.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-22 23:21:37 +09:00
Masahiro Yamada e3fd9b5384 scripts/dtc: consolidate include path options in Makefile
It is tedious to specify extra compiler options for every file.
HOST_EXTRACFLAGS is useful to add options to all files in a
directory.

-I$(src)/libfdt is needed for all the files in this directory
to include libfdt_env.h etc. from scripts/dtc/libfdt/.

On the other hand, -I$(src) is used to include check-in headers
from generated C files.  Thus, I added it only to dtc-lexer.lex.o
and dtc-parser.tab.o .

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2018-08-22 23:21:36 +09:00
Linus Torvalds 20a9e57a09 arch/h8300 update.
-----BEGIN PGP SIGNATURE-----
 
 iHkEABECADkWIQSgYnFi3j8cJth9/dOC7L743CGq0QUCW31aihsceXNhdG9AdXNl
 cnMuc291cmNlZm9yZ2UuanAACgkQguy++NwhqtGezQCdG6IcJORiacpzVVw5AsTv
 fsRTS8EAniU8F/lw0LlF77eyJzGP9Fa5ZJ8y
 =TN4Q
 -----END PGP SIGNATURE-----

Merge tag 'for-4.19' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux

Pull arch/h8300 updates from Yoshinori Sato.

* tag 'for-4.19' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux:
  h8300: fix IRQ no
  arch/h8300: add a defconfig target
  arch/h8300: eliminate kgbd.c warning
  arch/h8300: eliminate ptrace.h warnings
  h8300:let the checker know that size_t is ulong
  h8300: Don't include linux/kernel.h in asm/atomic.h
  h8300: remove unnecessary of_platform_populate call
  h8300: Correct signature of test_bit()
  h8300: irqchip: fix warning
  h8300: switch to NO_BOOTMEM
  h8300: gcc-8.1 fix
  h8300: Add missing output register.
2018-08-22 06:24:26 -07:00
Arnd Bergmann fd991a23c8 y2038: Provide aliases for compat helpers
As part of the system call rework for 64-bit time_t, we are restructuring
the way that compat syscalls deal with 32-bit time_t, reusing the
implementation for 32-bit architectures. Christoph Hellwig suggested a
rename of the associated types and interfaces to avoid the confusing usage
of the 'compat' prefix for 32-bit architectures.

To prepare for doing that in linux-4.20, add a set of macros that allows to
convert subsystems separately to the new names and avoids some of the
nastier merge conflicts.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: y2038@lists.linaro.org
Cc: John Stultz <john.stultz@linaro.org>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Link: https://lkml.kernel.org/r/20180821203329.2089473-1-arnd@arndb.de
2018-08-22 15:11:35 +02:00
Dongjiu Geng 688e0581db KVM: Documentation: rename the capability of KVM_CAP_ARM_SET_SERROR_ESR
In the documentation description, this capability's name is
KVM_CAP_ARM_SET_SERROR_ESR, but in the header file this
capability's name is KVM_CAP_ARM_INJECT_SERROR_ESR, so change
the documentation description to make it same.

Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
Reported-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-08-22 14:08:05 +02:00
Paolo Bonzini 631989303b KVM/arm updates for 4.19
- Support for Group0 interrupts in guests
 - Cache management optimizations for ARMv8.4 systems
 - Userspace interface for RAS, allowing error retrival and injection
 - Fault path optimization
 - Emulated physical timer fixes
 - Random cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCAAzFiEEn9UcU+C1Yxj9lZw9I9DQutE9ekMFAltxmb4VHG1hcmMuenlu
 Z2llckBhcm0uY29tAAoJECPQ0LrRPXpD7E0P/0qn1IMtskaC7EglFCm72+NXe1CW
 ZAtxTHzetjf7977dA3bVsg4gEKvVx5b3YuRT76u4hBoSa0rFJ8Q9iSC8wL4u9Idf
 JUQjwVIUxMeGW5fR0VFDkd9SkDYtNGdjQcVl2I8UpV+lnLC/2Vfr4xR5qBad2pAQ
 zjthdpQMjZWClyhPkOv6WjVsW0lNw0xDkZWgCViBY+TdT7Gmw/q8hmvj9TEwbMGT
 7tmQl9MupQ2bLY8WuTiGA6eNiEZld9esJGthI43xGQDJl4Y3FeciIZWcBru20+wu
 GnC3QS3FlmYlp2WuWcKU9lEGXhmoX/7/1WVhZkoMsIvi05c2JCxSxstK7QNfUaAH
 8q2/Wc0fYIGm2owH+b1Mpn0w37GZtgl7Bxxzakg7B7Ko0q/EnO7z6XVup1/abKRU
 NtUKlWIL7NDiHjHO6j0hBb3rGi7B3wo86P7GTPJb12Dg9EBF5DVhekXeGI/ChzE9
 WIV1PxR0seSapzlJ92HHmWLAtcRLtXXesqcctmN4d2URBtsx9DEwo0Upiz//reYE
 TBncQbtniVt2xXEl7sqNEYei75IxC3Dg1AgDL/zVQDl8PW0UvKo8Qb0cW7EnF9Vg
 AcjD6R72dAgbqUMYOP0nriKxzXwa0Jls9aF3zBgcikKMGeyD6Z/Exlq4LexhSeuw
 cWKsrQUYcLGKZPRN
 =b6+A
 -----END PGP SIGNATURE-----

Merge tag 'kvmarm-for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD

KVM/arm updates for 4.19

- Support for Group0 interrupts in guests
- Cache management optimizations for ARMv8.4 systems
- Userspace interface for RAS, allowing error retrival and injection
- Fault path optimization
- Emulated physical timer fixes
- Random cleanups
2018-08-22 14:07:56 +02:00
Benjamin Herrenschmidt 9bd5196e5c platform/x86: acer-wmi: Silence "unsupported" message a bit
This driver prints that "Unsupported machine..." message on every boot on
ThinkPad X1 Carbon laptops (and I assume a number of other systems), which
causes graphical boots to "glitch" a bit and is rather annoying ...

Make it a pr_debug instead.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-08-22 13:40:24 +03:00
Yoshinori Sato 4bdf61ccbe h8300: fix IRQ no
Old timer handler use 24 (Compare match A).
But current timer handler use 26 (Overflow).

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:23 +09:00
Randy Dunlap 7b291be81f arch/h8300: add a defconfig target
Make the "defconfig" target valid for arch/h8300.  Currently
"make ARCH=h8300 defconfig" produces:

*** Can't find default configuration "arch/h8300/defconfig"!
../scripts/kconfig/Makefile:87: recipe for target 'defconfig' failed

By adding a value for KBUILD_DEFCONFIG, "make ARCH=h8300 defconfig"
successfully produces a kernel .config file:

*** Default configuration is based on 'edosk2674_defconfig'

This is useful for Kconfig editing/testing.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp (moderated for non-subscribers)
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:22 +09:00
Randy Dunlap ce156febee arch/h8300: eliminate kgbd.c warning
Drop the "const" qualifier from arch_kgdb_ops to eliminate the gcc
warning (gcc version is 8.1.0).

arch/h8300/kernel/kgdb.c:132:24: error: conflicting type qualifiers for 'arch_kgdb_ops'
 const struct kgdb_arch arch_kgdb_ops = {
In file included from ../arch/h8300/kernel/kgdb.c:12:
../include/linux/kgdb.h:284:26: note: previous declaration of 'arch_kgdb_ops' was here
 extern struct kgdb_arch  arch_kgdb_ops;

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:22 +09:00
Randy Dunlap cfa2d688e2 arch/h8300: eliminate ptrace.h warnings
Add a "struct task_struct;" stub to arch/h8300's ptrace.h header to
eliminate gcc warnings (gcc version is 8.1.0).

../arch/h8300/include/asm/ptrace.h:32:34: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
 extern long h8300_get_reg(struct task_struct *task, int regno);
../arch/h8300/include/asm/ptrace.h:33:33: warning: 'struct task_struct' declared inside parameter list will not be visible outside of this definition or declaration
 extern int h8300_put_reg(struct task_struct *task, int regno,

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:21 +09:00
Luc Van Oostenryck 1b803a357d h8300:let the checker know that size_t is ulong
All 64bit archs use unsigned long for size_t and most 32bit
archs use 'unsigned int'. By default, this is what is assumed
by sparse.

However, on h8300 (a 32bit arch) size_t is unsigned long which
can led sparse to emit wrong warnings.

Fix this by passing to sparse the flag -msize-long, telling it
that size_t is unsigned long.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:21 +09:00
Will Deacon 9819d4e47e h8300: Don't include linux/kernel.h in asm/atomic.h
linux/kernel.h isn't needed by asm/atomic.h and will result in circular
dependencies when the asm-generic atomic bitops are built around the
tomic_long_t interface.

Remove the broad include and replace it with linux/compiler.h for
READ_ONCE etc and asm/irqflags.h for arch_local_irq_save etc.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:20 +09:00
Rob Herring ec3d5f1658 h8300: remove unnecessary of_platform_populate call
The DT core will call of_platform_populate, so it is not necessary for
arch specific code to call it unless there are custom match entries,
auxdata or parent device. Neither of those apply here, so remove the call.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:20 +09:00
Geert Uytterhoeven 5743ee22bf h8300: Correct signature of test_bit()
mm/filemap.c: In function 'clear_bit_unlock_is_negative_byte':
    mm/filemap.c:1181:30: warning: passing argument 2 of 'test_bit' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
      return test_bit(PG_waiters, mem);
				  ^~~
    In file included from include/linux/bitops.h:38,
		     from include/linux/kernel.h:11,
		     from include/linux/list.h:9,
		     from include/linux/wait.h:7,
		     from include/linux/wait_bit.h:8,
		     from include/linux/fs.h:6,
		     from include/linux/dax.h:5,
		     from mm/filemap.c:14:
    arch/h8300/include/asm/bitops.h:69:57: note: expected 'const long unsigned int *' but argument is of type 'volatile void *'
     static inline int test_bit(int nr, const unsigned long *addr)
					~~~~~~~~~~~~~~~~~~~~~^~~~

Make the bitmask pointed to by the "addr" parameter volatile to fix
this, like is done on other architectures.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:19 +09:00
Yoshinori Sato 558e6694cd h8300: irqchip: fix warning
Var "addr" type incorrect.
It have interrupt controler register address.
Type of void __iomem is correct.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:19 +09:00
Rob Herring c489dfefe7 h8300: switch to NO_BOOTMEM
Commit 0fa1c57934 ("of/fdt: use memblock_virt_alloc for early alloc")
inadvertently switched the DT unflattening allocations from memblock to
bootmem which doesn't work because the unflattening happens before
bootmem is initialized. Swapping the order of bootmem init and
unflattening could also fix this, but removing bootmem is desired. So
enable NO_BOOTMEM on h8300 like other architectures have done.

Fixes: 0fa1c57934 ("of/fdt: use memblock_virt_alloc for early alloc")
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-h8-devel@lists.sourceforge.jp
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:18 +09:00
Yoshinori Sato 811d1b0e65 h8300: gcc-8.1 fix
Since gcc 8.1 does not generate an assignment statement to er 0,
we had to explicitly write it.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:18 +09:00
Yoshinori Sato 686320e94d h8300: Add missing output register.
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
2018-08-22 19:14:17 +09:00
Matthew Wilcox 1df8951902 ida: Change ida_get_new_above to return the id
This calling convention makes more sense for the implementation as well
as the callers.  It even shaves 32 bytes off the compiled code size.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:21 -04:00
Matthew Wilcox b03f8e43c9 ida: Remove old API
Delete ida_pre_get(), ida_get_new(), ida_get_new_above() and ida_remove()
from the public API.  Some of these functions still exist as internal
helpers, but they should not be called by consumers.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:21 -04:00
Matthew Wilcox f272668deb test_ida: check_ida_destroy and check_ida_alloc
Move these tests from the userspace test-suite to the kernel test-suite.
Also convert check_ida_random to the new API.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:21 -04:00
Matthew Wilcox 5c78b0b1eb test_ida: Convert check_ida_conv to new API
Move as much as possible to kernel space; leave the parts in user space
that rely on checking memory allocation failures to detect the
transition between an exceptional entry and a bitmap.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:20 -04:00
Matthew Wilcox 161b47e31f test_ida: Move ida_check_max
Convert to new API and move to kernel space.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:20 -04:00
Matthew Wilcox 0a3856392c test_ida: Move ida_check_leaf
Convert to new API and move to kernel space.  Take the opportunity to
test the situation a little more thoroughly (ie at different offsets).

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:20 -04:00
Matthew Wilcox 06b0111366 idr-test: Convert ida_check_nomem to new API
We can't move this test to kernel space because there's no way to
force kmalloc to fail.  But we can use the new API and check this
works when the test is in userspace.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:20 -04:00
Matthew Wilcox 8ab8ba38d4 ida: Start new test_ida module
Start transitioning the IDA tests into kernel space.  Framework heavily
cribbed from test_xarray.c.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:20 -04:00
Matthew Wilcox 31ff0ceeb2 target/iscsi: Allocate session IDs from an IDA
Since the session is never looked up by ID, we can use the more
space-efficient IDA instead of the IDR.

Signed-off-by: Matthew Wilcox <willy@infradead.org>
2018-08-21 23:54:19 -04:00