1. 04 Apr, 2018 1 commit
    • Sai Praneeth's avatar
      x86/mm: Fix bogus warning during EFI bootup, use boot_cpu_has() instead of... · 162ee5a8
      Sai Praneeth authored
      x86/mm: Fix bogus warning during EFI bootup, use boot_cpu_has() instead of this_cpu_has() in build_cr3_noflush()
      
      Linus reported the following boot warning:
      
        WARNING: CPU: 0 PID: 0 at arch/x86/include/asm/tlbflush.h:134 load_new_mm_cr3+0x114/0x170
        [...]
        Call Trace:
        switch_mm_irqs_off+0x267/0x590
        switch_mm+0xe/0x20
        efi_switch_mm+0x3e/0x50
        efi_enter_virtual_mode+0x43f/0x4da
        start_kernel+0x3bf/0x458
        secondary_startup_64+0xa5/0xb0
      
      ... after merging:
      
        03781e40: x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3
      
      When the platform supports PCID and if CONFIG_DEBUG_VM=y is enabled,
      build_cr3_noflush() (called via switch_mm()) does a sanity check to see
      if X86_FEATURE_PCID is set.
      
      Presently, build_cr3_noflush() uses "this_cpu_has(X86_FEATURE_PCID)" to
      perform the check but this_cpu_has() works only after SMP is initialized
      (i.e. per cpu cpu_info's should be populated) and this happens to be very
      late in the boot process (during rest_init()).
      
      As efi_runtime_services() are called during (early) kernel boot time
      and run time, modify build_cr3_noflush() to use boot_cpu_has() all the
      time. As suggested by Dave Hansen, this should be OK because all CPU's have
      same capabilities on x86.
      
      With this change the warning is fixed.
      
      ( Dave also suggested that we put a warning in this_cpu_has() if it's used
        early in the boot process. This is still work in progress as it affects
        MCE. )
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Lee Chun-Yi <jlee@suse.com>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Shankar <ravi.v.shankar@intel.com>
      Cc: Ricardo Neri <ricardo.neri@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/1522870459-7432-1-git-send-email-sai.praneeth.prakhya@intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      162ee5a8
  2. 03 Apr, 2018 7 commits
    • Linus Torvalds's avatar
      Merge branch 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux · 642e7fd2
      Linus Torvalds authored
      Pull removal of in-kernel calls to syscalls from Dominik Brodowski:
       "System calls are interaction points between userspace and the kernel.
        Therefore, system call functions such as sys_xyzzy() or
        compat_sys_xyzzy() should only be called from userspace via the
        syscall table, but not from elsewhere in the kernel.
      
        At least on 64-bit x86, it will likely be a hard requirement from
        v4.17 onwards to not call system call functions in the kernel: It is
        better to use use a different calling convention for system calls
        there, where struct pt_regs is decoded on-the-fly in a syscall wrapper
        which then hands processing over to the actual syscall function. This
        means that only those parameters which are actually needed for a
        specific syscall are passed on during syscall entry, instead of
        filling in six CPU registers with random user space content all the
        time (which may cause serious trouble down the call chain). Those
        x86-specific patches will be pushed through the x86 tree in the near
        future.
      
        Moreover, rules on how data may be accessed may differ between kernel
        data and user data. This is another reason why calling sys_xyzzy() is
        generally a bad idea, and -- at most -- acceptable in arch-specific
        code.
      
        This patchset removes all in-kernel calls to syscall functions in the
        kernel with the exception of arch/. On top of this, it cleans up the
        three places where many syscalls are referenced or prototyped, namely
        kernel/sys_ni.c, include/linux/syscalls.h and include/linux/compat.h"
      
      * 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux: (109 commits)
        bpf: whitelist all syscalls for error injection
        kernel/sys_ni: remove {sys_,sys_compat} from cond_syscall definitions
        kernel/sys_ni: sort cond_syscall() entries
        syscalls/x86: auto-create compat_sys_*() prototypes
        syscalls: sort syscall prototypes in include/linux/compat.h
        net: remove compat_sys_*() prototypes from net/compat.h
        syscalls: sort syscall prototypes in include/linux/syscalls.h
        kexec: move sys_kexec_load() prototype to syscalls.h
        x86/sigreturn: use SYSCALL_DEFINE0
        x86: fix sys_sigreturn() return type to be long, not unsigned long
        x86/ioport: add ksys_ioperm() helper; remove in-kernel calls to sys_ioperm()
        mm: add ksys_readahead() helper; remove in-kernel calls to sys_readahead()
        mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff()
        mm: add ksys_fadvise64_64() helper; remove in-kernel call to sys_fadvise64_64()
        fs: add ksys_fallocate() wrapper; remove in-kernel calls to sys_fallocate()
        fs: add ksys_p{read,write}64() helpers; remove in-kernel calls to syscalls
        fs: add ksys_truncate() wrapper; remove in-kernel calls to sys_truncate()
        fs: add ksys_sync_file_range helper(); remove in-kernel calls to syscall
        kernel: add ksys_setsid() helper; remove in-kernel call to sys_setsid()
        kernel: add ksys_unshare() helper; remove in-kernel calls to sys_unshare()
        ...
      642e7fd2
    • Omar Sandoval's avatar
      bitmap: fix memset optimization on big-endian systems · 21035965
      Omar Sandoval authored
      Commit 2a98dc02 ("include/linux/bitmap.h: turn bitmap_set and
      bitmap_clear into memset when possible") introduced an optimization to
      bitmap_{set,clear}() which uses memset() when the start and length are
      constants aligned to a byte.
      
      This is wrong on big-endian systems; our bitmaps are arrays of unsigned
      long, so bit n is not at byte n / 8 in memory.  This was caught by the
      Btrfs selftests, but the bitmap selftests also fail when run on a
      big-endian machine.
      
      We can still use memset if the start and length are aligned to an
      unsigned long, so do that on big-endian.  The same problem applies to
      the memcmp in bitmap_equal(), so fix it there, too.
      
      Fixes: 2a98dc02 ("include/linux/bitmap.h: turn bitmap_set and bitmap_clear into memset when possible")
      Fixes: 2c6deb01 ("bitmap: use memcmp optimisation in more situations")
      Cc: stable@kernel.org
      Reported-by: default avatar"Erhard F." <erhard_f@mailbox.org>
      Cc: Matthew Wilcox <mawilcox@microsoft.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      21035965
    • Linus Torvalds's avatar
      Merge tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic · f5a8eb63
      Linus Torvalds authored
      Pul removal of obsolete architecture ports from Arnd Bergmann:
       "This removes the entire architecture code for blackfin, cris, frv,
        m32r, metag, mn10300, score, and tile, including the associated device
        drivers.
      
        I have been working with the (former) maintainers for each one to
        ensure that my interpretation was right and the code is definitely
        unused in mainline kernels. Many had fond memories of working on the
        respective ports to start with and getting them included in upstream,
        but also saw no point in keeping the port alive without any users.
      
        In the end, it seems that while the eight architectures are extremely
        different, they all suffered the same fate: There was one company in
        charge of an SoC line, a CPU microarchitecture and a software
        ecosystem, which was more costly than licensing newer off-the-shelf
        CPU cores from a third party (typically ARM, MIPS, or RISC-V). It
        seems that all the SoC product lines are still around, but have not
        used the custom CPU architectures for several years at this point. In
        contrast, CPU instruction sets that remain popular and have actively
        maintained kernel ports tend to all be used across multiple licensees.
      
        [ See the new nds32 port merged in the previous commit for the next
          generation of "one company in charge of an SoC line, a CPU
          microarchitecture and a software ecosystem"   - Linus ]
      
        The removal came out of a discussion that is now documented at
        https://lwn.net/Articles/748074/. Unlike the original plans, I'm not
        marking any ports as deprecated but remove them all at once after I
        made sure that they are all unused. Some architectures (notably tile,
        mn10300, and blackfin) are still being shipped in products with old
        kernels, but those products will never be updated to newer kernel
        releases.
      
        After this series, we still have a few architectures without mainline
        gcc support:
      
         - unicore32 and hexagon both have very outdated gcc releases, but the
           maintainers promised to work on providing something newer. At least
           in case of hexagon, this will only be llvm, not gcc.
      
         - openrisc, risc-v and nds32 are still in the process of finishing
           their support or getting it added to mainline gcc in the first
           place. They all have patched gcc-7.3 ports that work to some
           degree, but complete upstream support won't happen before gcc-8.1.
           Csky posted their first kernel patch set last week, their situation
           will be similar
      
        [ Palmer Dabbelt points out that RISC-V support is in mainline gcc
          since gcc-7, although gcc-7.3.0 is the recommended minimum  - Linus ]"
      
      This really says it all:
      
       2498 files changed, 95 insertions(+), 467668 deletions(-)
      
      * tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (74 commits)
        MAINTAINERS: UNICORE32: Change email account
        staging: iio: remove iio-trig-bfin-timer driver
        tty: hvc: remove tile driver
        tty: remove bfin_jtag_comm and hvc_bfin_jtag drivers
        serial: remove tile uart driver
        serial: remove m32r_sio driver
        serial: remove blackfin drivers
        serial: remove cris/etrax uart drivers
        usb: Remove Blackfin references in USB support
        usb: isp1362: remove blackfin arch glue
        usb: musb: remove blackfin port
        usb: host: remove tilegx platform glue
        pwm: remove pwm-bfin driver
        i2c: remove bfin-twi driver
        spi: remove blackfin related host drivers
        watchdog: remove bfin_wdt driver
        can: remove bfin_can driver
        mmc: remove bfin_sdh driver
        input: misc: remove blackfin rotary driver
        input: keyboard: remove bf54x driver
        ...
      f5a8eb63
    • Linus Torvalds's avatar
      Merge tag 'nds32-for-linus-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux · c9297d28
      Linus Torvalds authored
      Pull nds32 architecture support from Greentime Hu:
       "This contains the core nds32 Linux port (including interrupt
        controller driver and timer driver), which has been through seven
        rounds of review on mailing list.
      
        It is able to boot to shell and passes most LTP-2017 testsuites in
        nds32 AE3XX platform:
      
          Total Tests: 1901
          Total Skipped Tests: 618
          Total Failures: 78"
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      
      * tag 'nds32-for-linus-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux: (44 commits)
        nds32: To use the generic dump_stack()
        nds32: fix building failed if using elf toolchain.
        nios2: add ioremap_nocache declaration before include asm-generic/io.h.
        nds32: fix building failed if using older version gcc.
        dt-bindings: timer: Add andestech atcpit100 timer binding doc
        clocksource/drivers/atcpit100: VDSO support
        clocksource/drivers/atcpit100: Add andestech atcpit100 timer
        net: faraday add nds32 support.
        irqchip: Andestech Internal Vector Interrupt Controller driver
        dt-bindings: interrupt-controller: Andestech Internal Vector Interrupt Controller
        dt-bindings: nds32 SoC Bindings
        dt-bindings: nds32 L2 cache controller Bindings
        dt-bindings: nds32 CPU Bindings
        MAINTAINERS: Add nds32
        nds32: Build infrastructure
        nds32: defconfig
        nds32: Miscellaneous header files
        nds32: Device tree support
        nds32: Generic timers support
        nds32: Loadable modules
        ...
      c9297d28
    • Linus Torvalds's avatar
      Merge tag 'm68k-for-v4.17-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k · 17e3cd22
      Linus Torvalds authored
      Pull m68k updates from Geert Uytterhoeven:
      
       - Macintosh enhancements and fixes
      
       - Remove useless memory layout printing using hashed pointers
      
       - Add missing Amiga Zorro bus DMA mask
      
       - Small fixes and cleanups
      
       - Defconfig updates
      
      * tag 'm68k-for-v4.17-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
        m68k/mac: Remove bogus "FIXME" comment
        m68k/mac: Enable RTC for 100-series PowerBooks
        m68k/mac: Clean up whitespace and remove redundant parentheses
        m68k/defconfig: Update defconfigs for v4.16-rc5
        zorro: Set up z->dev.dma_mask for the DMA API
        m68k/time: Stop validating rtc_time in .read_time
        m68k/mm: Stop printing the virtual memory layout
        macintosh/via-pmu68k: Initialize PMU driver with setup_arch and arch_initcall
        m68k/mac: Fix apparent race condition in Baboon interrupt dispatch
        m68k/mac: Enable PDMA support for PowerBook 190
      17e3cd22
    • Linus Torvalds's avatar
      Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · bc16d405
      Linus Torvalds authored
      Pull EFI updates from Ingo Molnar:
       "The main EFI changes in this cycle were:
      
         - Fix the apple-properties code (Andy Shevchenko)
      
         - Add WARN() on arm64 if UEFI Runtime Services corrupt the reserved
           x18 register (Ard Biesheuvel)
      
         - Use efi_switch_mm() on x86 instead of manipulating %cr3 directly
           (Sai Praneeth)
      
         - Fix early memremap leak in ESRT code (Ard Biesheuvel)
      
         - Switch to L"xxx" notation for wide string literals (Ard Biesheuvel)
      
         - ... plus misc other cleanups and bugfixes"
      
      * 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/efi: Use efi_switch_mm() rather than manually twiddling with %cr3
        x86/efi: Replace efi_pgd with efi_mm.pgd
        efi: Use string literals for efi_char16_t variable initializers
        efi/esrt: Fix handling of early ESRT table mapping
        efi: Use efi_mm in x86 as well as ARM
        efi: Make const array 'apple' static
        efi/apple-properties: Use memremap() instead of ioremap()
        efi: Reorder pr_notice() with add_device_randomness() call
        x86/efi: Replace GFP_ATOMIC with GFP_KERNEL in efi_query_variable_store()
        efi/arm64: Check whether x18 is preserved by runtime services calls
        efi/arm*: Stop printing addresses of virtual mappings
        efi/apple-properties: Remove redundant attribute initialization from unmarshal_key_value_pairs()
        efi/arm*: Only register page tables when they exist
      bc16d405
    • Linus Torvalds's avatar
      Merge branch 'x86-dma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2fcd2b30
      Linus Torvalds authored
      Pull x86 dma mapping updates from Ingo Molnar:
       "This tree, by Christoph Hellwig, switches over the x86 architecture to
        the generic dma-direct and swiotlb code, and also unifies more of the
        dma-direct code between architectures. The now unused x86-only
        primitives are removed"
      
      * 'x86-dma-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        dma-mapping: Don't clear GFP_ZERO in dma_alloc_attrs
        swiotlb: Make swiotlb_{alloc,free}_buffer depend on CONFIG_DMA_DIRECT_OPS
        dma/swiotlb: Remove swiotlb_{alloc,free}_coherent()
        dma/direct: Handle force decryption for DMA coherent buffers in common code
        dma/direct: Handle the memory encryption bit in common code
        dma/swiotlb: Remove swiotlb_set_mem_attributes()
        set_memory.h: Provide set_memory_{en,de}crypted() stubs
        x86/dma: Remove dma_alloc_coherent_gfp_flags()
        iommu/intel-iommu: Enable CONFIG_DMA_DIRECT_OPS=y and clean up intel_{alloc,free}_coherent()
        iommu/amd_iommu: Use CONFIG_DMA_DIRECT_OPS=y and dma_direct_{alloc,free}()
        x86/dma/amd_gart: Use dma_direct_{alloc,free}()
        x86/dma/amd_gart: Look at dev->coherent_dma_mask instead of GFP_DMA
        x86/dma: Use generic swiotlb_ops
        x86/dma: Use DMA-direct (CONFIG_DMA_DIRECT_OPS=y)
        x86/dma: Remove dma_alloc_coherent_mask()
      2fcd2b30
  3. 02 Apr, 2018 32 commits