1. 19 May, 2019 6 commits
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 39feaa3f
      Linus Torvalds authored
      Pull EFI fix from Ingo Molnar:
       "Fix an EFI-fb regression that affects certain x86 systems"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        fbdev/efifb: Ignore framebuffer memmap entries that lack any memory types
      39feaa3f
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1335d9a1
      Linus Torvalds authored
      Pull core fixes from Ingo Molnar:
       "This fixes a particularly thorny munmap() bug with MPX, plus fixes a
        host build environment assumption in objtool"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool: Allow AR to be overridden with HOSTAR
        x86/mpx, mm/core: Fix recursive munmap() corruption
      1335d9a1
    • Linus Torvalds's avatar
      Merge tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 4c4a5c99
      Linus Torvalds authored
      Pull ARM SoC late updates from Olof Johansson:
       "This is some material that we picked up into our tree late. Most of it
        are smaller fixes and additions, some defconfig updates due to recent
        development, etc.
      
        Code-wise the largest portion is a series of PM updates for the at91
        platform, and those have been in linux-next a while through the at91
        tree before we picked them up"
      
      * tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (29 commits)
        arm64: dts: sprd: Add clock properties for serial devices
        Opt out of scripts/get_maintainer.pl
        ARM: ixp4xx: Remove duplicated include from common.c
        soc: ixp4xx: qmgr: Fix an NULL vs IS_ERR() check in probe
        arm64: tegra: Disable XUSB support on Jetson TX2
        arm64: tegra: Enable SMMU translation for PCI on Tegra186
        arm64: tegra: Fix insecure SMMU users for Tegra186
        arm64: tegra: Select ARM_GIC_PM
        amba: tegra-ahb: Mark PM functions as __maybe_unused
        ARM: dts: logicpd-som-lv: Fix MMC1 card detect
        ARM: mvebu: drop return from void function
        ARM: mvebu: prefix coprocessor operand with p
        ARM: mvebu: drop unnecessary label
        ARM: mvebu: fix a leaked reference by adding missing of_node_put
        ARM: socfpga_defconfig: enable LTC2497
        ARM: mvebu: kirkwood: remove error message when retrieving mac address
        ARM: at91: sama5: make ov2640 as a module
        ARM: OMAP1: ams-delta: fix early boot crash when LED support is disabled
        ARM: at91: remove HAVE_FB_ATMEL for sama5 SoC as they use DRM
        soc/fsl/qe: Fix an error code in qe_pin_request()
        ...
      4c4a5c99
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 86a78a8b
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "One fix going back to stable, for a bug on 32-bit introduced when we
        added support for THREAD_INFO_IN_TASK.
      
        A fix for a typo in a recent rework of our hugetlb code that leads to
        crashes on 64-bit when using hugetlbfs with a 4K PAGE_SIZE.
      
        Two fixes for our recent rework of the address layout on 64-bit hash
        CPUs, both only triggered when userspace tries to access addresses
        outside the user or kernel address ranges.
      
        Finally a fix for a recently introduced double free in an error path
        in our cacheinfo code.
      
        Thanks to: Aneesh Kumar K.V, Christophe Leroy, Sachin Sant, Tobin C.
        Harding"
      
      * tag 'powerpc-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/cacheinfo: Remove double free
        powerpc/mm/hash: Fix get_region_id() for invalid addresses
        powerpc/mm: Drop VM_BUG_ON in get_region_id()
        powerpc/mm: Fix crashes with hugepages & 4K pages
        powerpc/32s: fix flush_hash_pages() on SMP
      86a78a8b
    • Linus Torvalds's avatar
      Merge tag 'mips_5.2_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · bcd17397
      Linus Torvalds authored
      Pull a few more MIPS updates from Paul Burton:
       "Some SGI IP27 specific PCI rework and a batch of fixes:
      
         - A build fix for BMIPS5000 configurations with
           CONFIG_HW_PERF_EVENTS=y, which also neatly removes some #ifdefery.
      
         - A fix to report supported ISAs correctly on older Ingenic SoCs
           which incorrectly indicate MIPSr2 support in their cop0 Config
           register.
      
         - Some PCI modernization for SGI IP27 systems as part of ongoing work
           to support some other SGI systems.
      
         - A fix allowing use of appended DTB files with generic kernels.
      
         - DMA mask fixes for SGI IP22 & Alchemy systems"
      
      * tag 'mips_5.2_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
        MIPS: Alchemy: add DMA masks for on-chip ethernet
        MIPS: SGI-IP22: provide missing dma_mask/coherent_dma_mask
        generic: fix appended dtb support
        MIPS: SGI-IP27: abstract chipset irq from bridge
        MIPS: SGI-IP27: use generic PCI driver
        MIPS: Fix Ingenic SoCs sometimes reporting wrong ISA
        MIPS: perf: Fix build with CONFIG_CPU_BMIPS5000 enabled
      bcd17397
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.2-mw2' of... · b0bb1269
      Linus Torvalds authored
      Merge tag 'riscv-for-linus-5.2-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux
      
      Pull RISC-V updates from Palmer Dabbelt:
       "This contains an assortment of RISC-V related patches that I'd like to
        target for the 5.2 merge window. Most of the patches are cleanups, but
        there are a handful of user-visible changes:
      
         - The nosmp and nr_cpus command-line arguments are now supported,
           which work like normal.
      
         - The SBI console no longer installs itself as a preferred console,
           we rely on standard mechanisms (/chosen, command-line, hueristics)
           instead.
      
         - sfence_remove_sfence_vma{,_asid} now pass their arguments along to
           the SBI call.
      
         - Modules now support BUG().
      
         - A missing sfence.vma during boot has been added. This bug only
           manifests during boot.
      
         - The arch/riscv support for SiFive's L2 cache controller has been
           merged, which should un-block the EDAC framework work.
      
        I've only tested this on QEMU again, as I didn't have time to get
        things running on the Unleashed. The latest master from this morning
        merges in cleanly and passes the tests as well"
      
      * tag 'riscv-for-linus-5.2-mw2' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux: (31 commits)
        riscv: fix locking violation in page fault handler
        RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs
        RISC-V: Add DT documentation for SiFive L2 Cache Controller
        RISC-V: Avoid using invalid intermediate translations
        riscv: Support BUG() in kernel module
        riscv: Add the support for c.ebreak check in is_valid_bugaddr()
        riscv: support trap-based WARN()
        riscv: fix sbi_remote_sfence_vma{,_asid}.
        riscv: move switch_mm to its own file
        riscv: move flush_icache_{all,mm} to cacheflush.c
        tty: Don't force RISCV SBI console as preferred console
        RISC-V: Access CSRs using CSR numbers
        RISC-V: Add interrupt related SCAUSE defines in asm/csr.h
        RISC-V: Use tabs to align macro values in asm/csr.h
        RISC-V: Fix minor checkpatch issues.
        RISC-V: Support nr_cpus command line option.
        RISC-V: Implement nosmp commandline option.
        RISC-V: Add RISC-V specific arch_match_cpu_phys_id
        riscv: vdso: drop unnecessary cc-ldoption
        riscv: call pm_power_off from machine_halt / machine_power_off
        ...
      b0bb1269
  2. 17 May, 2019 34 commits
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 72cf0b07
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "Just a few HD-audio fixes, most of which are specific to Realtek
        codecs"
      
      * tag 'sound-fix-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda/realtek - Fix for Lenovo B50-70 inverted internal microphone bug
        ALSA: hda: Fix race between creating and refreshing sysfs entries
        ALSA: hda/realtek - Corrected fixup for System76 Gazelle (gaze14)
        ALSA: hda/realtek - Avoid superfluous COEF EAPD setups
        ALSA: hda/realtek - Fixup headphone noise via runtime suspend
      72cf0b07
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 0ef0fd35
      Linus Torvalds authored
      Pull KVM updates from Paolo Bonzini:
       "ARM:
         - support for SVE and Pointer Authentication in guests
         - PMU improvements
      
        POWER:
         - support for direct access to the POWER9 XIVE interrupt controller
         - memory and performance optimizations
      
        x86:
         - support for accessing memory not backed by struct page
         - fixes and refactoring
      
        Generic:
         - dirty page tracking improvements"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (155 commits)
        kvm: fix compilation on aarch64
        Revert "KVM: nVMX: Expose RDPMC-exiting only when guest supports PMU"
        kvm: x86: Fix L1TF mitigation for shadow MMU
        KVM: nVMX: Disable intercept for FS/GS base MSRs in vmcs02 when possible
        KVM: PPC: Book3S: Remove useless checks in 'release' method of KVM device
        KVM: PPC: Book3S HV: XIVE: Fix spelling mistake "acessing" -> "accessing"
        KVM: PPC: Book3S HV: Make sure to load LPID for radix VCPUs
        kvm: nVMX: Set nested_run_pending in vmx_set_nested_state after checks complete
        tests: kvm: Add tests for KVM_SET_NESTED_STATE
        KVM: nVMX: KVM_SET_NESTED_STATE - Tear down old EVMCS state before setting new state
        tests: kvm: Add tests for KVM_CAP_MAX_VCPUS and KVM_CAP_MAX_CPU_ID
        tests: kvm: Add tests to .gitignore
        KVM: Introduce KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
        KVM: Fix kvm_clear_dirty_log_protect off-by-(minus-)one
        KVM: Fix the bitmap range to copy during clear dirty
        KVM: arm64: Fix ptrauth ID register masking logic
        KVM: x86: use direct accessors for RIP and RSP
        KVM: VMX: Use accessors for GPRs outside of dedicated caching logic
        KVM: x86: Omit caching logic for always-available GPRs
        kvm, x86: Properly check whether a pfn is an MMIO or not
        ...
      0ef0fd35
    • Linus Torvalds's avatar
      Merge tag 'nds32-for-linus-5.2-rc1' of... · 4489da71
      Linus Torvalds authored
      Merge tag 'nds32-for-linus-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux
      
      Pull nds32 updates from Greentime Hu:
      
       - Clean up codes and Makefile
      
       - Fix a vDSO bug
      
       - Remove useless functions/header files
      
       - Update git repo path in MAINTAINERS
      
      * tag 'nds32-for-linus-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux:
        nds32: Fix vDSO clock_getres()
        MAINTAINERS: update nds32 git repo path
        nds32: don't export low-level cache flushing routines
        arch: nds32: Kconfig: pedantic formatting
        nds32: fix semicolon code style issue
        nds32: vdso: drop unnecessary cc-ldoption
        nds32: remove unused generic-y += cmpxchg-local.h
        nds32: Use the correct style for SPDX License Identifier
        nds32: remove __virt_to_bus and __bus_to_virt
        nds32: vdso: fix and clean-up Makefile
        nds32: add vmlinux.lds and vdso.so to .gitignore
        nds32: ex-exit: Remove unneeded need_resched() loop
        nds32/io: Remove useless definition of mmiowb()
        nds32: Removed unused thread flag TIF_USEDFPU
      4489da71
    • Linus Torvalds's avatar
      Merge tag 's390-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 80111bfb
      Linus Torvalds authored
      Pull more s390 updates from Martin Schwidefsky:
      
       - Enhancements for the QDIO layer
      
       - Remove the RCP trace event
      
       - Avoid three build issues
      
       - Move the defconfig to the configs directory
      
      * tag 's390-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390: move arch/s390/defconfig to arch/s390/configs/defconfig
        s390/qdio: optimize state inspection of HW-owned SBALs
        s390/qdio: use get_buf_state() in debug_get_buf_state()
        s390/qdio: allow to scan all Output SBALs in one go
        s390/cio: Remove tracing for rchp instruction
        s390/kasan: adapt disabled_wait usage to avoid build error
        latent_entropy: avoid build error when plugin cflags are not set
        s390/boot: fix compiler error due to missing awk strtonum
      80111bfb
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · bf8a9a47
      Linus Torvalds authored
      Pull more vfs mount updates from Al Viro:
       "Propagation of new syscalls to other architectures + cosmetic change
        from Christian (fscontext didn't follow the convention for anon inode
        names)"
      
      * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        uapi: Wire up the mount API syscalls on non-x86 arches [ver #2]
        uapi, x86: Fix the syscall numbering of the mount API syscalls [ver #2]
        uapi, fsopen: use square brackets around "fscontext" [ver #2]
      bf8a9a47
    • Tobin C. Harding's avatar
      powerpc/cacheinfo: Remove double free · 672eaf37
      Tobin C. Harding authored
      kfree() after kobject_put(). Who ever wrote this was on crack.
      
      Fixes: 7e803979 ("powerpc/cacheinfo: Fix kobject memleak")
      Signed-off-by: default avatarTobin C. Harding <tobin@kernel.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      672eaf37
    • Aneesh Kumar K.V's avatar
      powerpc/mm/hash: Fix get_region_id() for invalid addresses · c179976c
      Aneesh Kumar K.V authored
      Accesses by userspace to random addresses outside the user or kernel
      address range will generate an SLB fault. When we handle that fault we
      classify the effective address into several classes, eg. user, kernel
      linear, kernel virtual etc.
      
      For addresses that are completely outside of any valid range, we
      should not insert an SLB entry at all, and instead immediately an
      exception.
      
      In the past this was handled in two ways. Firstly we would check the
      top nibble of the address (using REGION_ID(ea)) and that would tell us
      if the address was user (0), kernel linear (c), kernel virtual (d), or
      vmemmap (f). If the address didn't match any of these it was invalid.
      
      Then for each type of address we would do a secondary check. For the
      user region we check against H_PGTABLE_RANGE, for kernel linear we
      would mask the top nibble of the address and then check the address
      against MAX_PHYSMEM_BITS.
      
      As part of commit 0034d395 ("powerpc/mm/hash64: Map all the kernel
      regions in the same 0xc range") we replaced REGION_ID() with
      get_region_id() and changed the masking of the top nibble to only mask
      the top two bits, which introduced a bug.
      
      Addresses less than (4 << 60) are still handled correctly, they are
      either less than (1 << 60) in which case they are subject to the
      H_PGTABLE_RANGE check, or they are correctly checked against
      MAX_PHYSMEM_BITS.
      
      However addresses from (4 << 60) to ((0xc << 60) - 1), are incorrectly
      treated as kernel linear addresses in get_region_id(). Then the top
      two bits are cleared by EA_MASK in slb_allocate_kernel() and the
      address is checked against MAX_PHYSMEM_BITS, which it passes due to
      the masking. The end result is we incorrectly insert SLB entries for
      those addresses.
      
      That is not actually catastrophic, having inserted the SLB entry we
      will then go on to take a page fault for the address and at that point
      we detect the problem and report it as a bad fault.
      
      Still we should not be inserting those entries, or treating them as
      kernel linear addresses in the first place. So fix get_region_id() to
      detect addresses in that range and return an invalid region id, which
      we cause use to not insert an SLB entry and directly report an
      exception.
      
      Fixes: 0034d395 ("powerpc/mm/hash64: Map all the kernel regions in the same 0xc range")
      Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      [mpe: Drop change to EA_MASK for now, rewrite change log]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      c179976c
    • Paolo Bonzini's avatar
      kvm: fix compilation on aarch64 · c011d23b
      Paolo Bonzini authored
      Commit e45adf66 ("KVM: Introduce a new guest mapping API", 2019-01-31)
      introduced a build failure on aarch64 defconfig:
      
      $ make -j$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- O=out defconfig \
                      Image.gz
      ...
      ../arch/arm64/kvm/../../../virt/kvm/kvm_main.c:
          In function '__kvm_map_gfn':
      ../arch/arm64/kvm/../../../virt/kvm/kvm_main.c:1763:9: error:
          implicit declaration of function 'memremap'; did you mean 'memset_p'?
      ../arch/arm64/kvm/../../../virt/kvm/kvm_main.c:1763:46: error:
          'MEMREMAP_WB' undeclared (first use in this function)
      ../arch/arm64/kvm/../../../virt/kvm/kvm_main.c:
          In function 'kvm_vcpu_unmap':
      ../arch/arm64/kvm/../../../virt/kvm/kvm_main.c:1795:3: error:
          implicit declaration of function 'memunmap'; did you mean 'vm_munmap'?
      
      because these functions are declared in <linux/io.h> rather than <asm/io.h>,
      and the former was being pulled in already on x86 but not on aarch64.
      Reported-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c011d23b
    • Nathan Chancellor's avatar
      objtool: Allow AR to be overridden with HOSTAR · 8ea58f1e
      Nathan Chancellor authored
      Currently, this Makefile hardcodes GNU ar, meaning that if it is not
      available, there is no way to supply a different one and the build will
      fail.
      
        $ make AR=llvm-ar CC=clang LD=ld.lld HOSTAR=llvm-ar HOSTCC=clang \
               HOSTLD=ld.lld HOSTLDFLAGS=-fuse-ld=lld defconfig modules_prepare
        ...
          AR       /out/tools/objtool/libsubcmd.a
        /bin/sh: 1: ar: not found
        ...
      
      Follow the logic of HOST{CC,LD} and allow the user to specify a
      different ar tool via HOSTAR (which is used elsewhere in other
      tools/ Makefiles).
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Reviewed-by: default avatarMukesh Ojha <mojha@codeaurora.org>
      Cc: <stable@vger.kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/80822a9353926c38fd7a152991c6292491a9d0e8.1558028966.git.jpoimboe@redhat.com
      Link: https://github.com/ClangBuiltLinux/linux/issues/481Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8ea58f1e
    • Ard Biesheuvel's avatar
      fbdev/efifb: Ignore framebuffer memmap entries that lack any memory types · f8585539
      Ard Biesheuvel authored
      The following commit:
      
        38ac0287 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB")
      
      updated the EFI framebuffer code to use memory mappings for the linear
      framebuffer that are permitted by the memory attributes described by the
      EFI memory map for the particular region, if the framebuffer happens to
      be covered by the EFI memory map (which is typically only the case for
      framebuffers in shared memory). This is required since non-x86 systems
      may require cacheable attributes for memory mappings that are shared
      with other masters (such as GPUs), and this information cannot be
      described by the Graphics Output Protocol (GOP) EFI protocol itself,
      and so we rely on the EFI memory map for this.
      
      As reported by James, this breaks some x86 systems:
      
        [ 1.173368] efifb: probing for efifb
        [ 1.173386] efifb: abort, cannot remap video memory 0x1d5000 @ 0xcf800000
        [ 1.173395] Trying to free nonexistent resource <00000000cf800000-00000000cf9d4bff>
        [ 1.173413] efi-framebuffer: probe of efi-framebuffer.0 failed with error -5
      
      The problem turns out to be that the memory map entry that describes the
      framebuffer has no memory attributes listed at all, and so we end up with
      a mem_flags value of 0x0.
      
      So work around this by ensuring that the memory map entry's attribute field
      has a sane value before using it to mask the set of usable attributes.
      Reported-by: default avatarJames Hilliard <james.hilliard1@gmail.com>
      Tested-by: default avatarJames Hilliard <james.hilliard1@gmail.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: <stable@vger.kernel.org> # v4.19+
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: James Morse <james.morse@arm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Fixes: 38ac0287 ("fbdev/efifb: Honour UEFI memory map attributes when ...")
      Link: http://lkml.kernel.org/r/20190516213159.3530-2-ard.biesheuvel@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f8585539
    • Andreas Schwab's avatar
      riscv: fix locking violation in page fault handler · 8fef9900
      Andreas Schwab authored
      When a user mode process accesses an address in the vmalloc area
      do_page_fault tries to unlock the mmap semaphore when it isn't locked.
      Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
      [Palmer: Duplicated code instead of a goto]
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      8fef9900
    • Yash Shah's avatar
      RISC-V: sifive_l2_cache: Add L2 cache controller driver for SiFive SoCs · a967a289
      Yash Shah authored
      The driver currently supports only SiFive FU540-C000 platform.
      
      The initial version of L2 cache controller driver includes:
      - Initial configuration reporting at boot up.
      - Support for ECC related functionality.
      Signed-off-by: default avatarYash Shah <yash.shah@sifive.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      a967a289
    • Yash Shah's avatar
      RISC-V: Add DT documentation for SiFive L2 Cache Controller · 5545b6d1
      Yash Shah authored
      Add device tree bindings for SiFive FU540 L2 cache controller driver
      Signed-off-by: default avatarYash Shah <yash.shah@sifive.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      5545b6d1
    • Palmer Dabbelt's avatar
      RISC-V: Avoid using invalid intermediate translations · 4c3aeb82
      Palmer Dabbelt authored
      This is almost entirely a comment.
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      4c3aeb82
    • Vincent Chen's avatar
      riscv: Support BUG() in kernel module · 9a6e7af0
      Vincent Chen authored
      The kernel module is loaded into vmalloc region which is located below
      to the PAGE_OFFSET. Hence the condition, pc < PAGE_OFFSET, in the
      is_valid_bugaddr() will filter out all trap exceptions triggered
      by kernel module. To support BUG() in kernel module, the condition is
      changed to pc < VMALLOC_START.
      Signed-off-by: default avatarVincent Chen <vincentc@andestech.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      9a6e7af0
    • Vincent Chen's avatar
      riscv: Add the support for c.ebreak check in is_valid_bugaddr() · ee72e0e7
      Vincent Chen authored
      The macro __BUG_INSN currently is defined as the "ebreak" opcode.
      The is_valid_bugaddr() function compares the instruction pointed to by
      $sepc with macro __BUG_INSN to check whether the current trap exception
      is caused by an "ebreak" instruction. However, this check flow is possibly
      erroneous because if C extension is supported, the expected trap
      instruction "ebreak" is possibly translated to "c.ebreak" by the assembler.
      Therefore, it requires a mechanism to distinguish the length of the
      instruction in $spec and compare it to the correct trap instruction.
      Signed-off-by: default avatarVincent Chen <vincentc@andestech.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      ee72e0e7
    • Vincent Chen's avatar
      riscv: support trap-based WARN() · d18ebc27
      Vincent Chen authored
      The WARN() related function will trigger a debug exception. This can help
      developers to analyze the cause of WARN() because if the debugger is
      connected, the control flow will be transferred to debugging
      environment.
      Signed-off-by: default avatarVincent Chen <vincentc@andestech.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      d18ebc27
    • Gary Guo's avatar
      riscv: fix sbi_remote_sfence_vma{,_asid}. · a21344df
      Gary Guo authored
      Currently sbi_remote_sfence_vma{,_asid} does not pass their arguments
      to SBI at all, which is semantically incorrect.
      
      Neither BBL nor OpenSBI is using these arguments at the moment, and
      they just do a global flush instead. However we still need to provide
      correct arguments.
      Signed-off-by: default avatarGary Guo <gary@garyguo.net>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      a21344df
    • Gary Guo's avatar
      riscv: move switch_mm to its own file · f6635f87
      Gary Guo authored
      switch_mm is an expensive operations that has two users.
      flush_icache_deferred is only called within switch_mm and can be moved
      together. The function is expected to be more complicated when ASID
      support is added, so clean up eagerly.
      
      By moving them to a separate file we also removes some excessive
      dependency of tlbflush.h and cacheflush.h.
      Signed-off-by: default avatarGary Guo <gary@garyguo.net>
      Reviewed-by: default avatarAnup Patel <anup@brainfault.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      f6635f87
    • Gary Guo's avatar
      riscv: move flush_icache_{all,mm} to cacheflush.c · 58de7754
      Gary Guo authored
      Currently, flush_icache_all is macro-expanded into a SBI call, yet no
      asm/sbi.h is included in asm/cacheflush.h. This could be moved to
      mm/cacheflush.c instead (SBI call will dominate performance-wise and
      there is no worry to not have it inlined.
      
      Currently, flush_icache_mm stays in kernel/smp.c, which looks like a
      hack to prevent it from being compiled when CONFIG_SMP=n. It should
      also be in mm/cacheflush.c.
      Signed-off-by: default avatarGary Guo <gary@garyguo.net>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      58de7754
    • Anup Patel's avatar
      tty: Don't force RISCV SBI console as preferred console · f91253a3
      Anup Patel authored
      The Linux kernel will auto-disables all boot consoles whenever it
      gets a preferred real console.
      
      Currently on RISC-V systems, if we have a real console which is not
      RISCV SBI console then boot consoles (such as earlycon=sbi) are not
      auto-disabled when a real console (ttyS0 or ttySIF0) is available.
      This results in duplicate prints at boot-time after kernel starts
      using real console (i.e. ttyS0 or ttySIF0) if "earlycon=" kernel
      parameter was passed by bootloader.
      
      The reason for above issue is that RISCV SBI console always adds
      itself as preferred console which is causing other real consoles
      to be not used as preferred console.
      
      Ideally "console=" kernel parameter passed by bootloaders should
      be the one selecting a preferred real console.
      
      This patch fixes above issue by not forcing RISCV SBI console as
      preferred console.
      
      Fixes: afa6b1cc ("tty: New RISC-V SBI console driver")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarAnup Patel <anup.patel@wdc.com>
      Reviewed-by: default avatarAtish Patra <atish.patra@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      f91253a3
    • Anup Patel's avatar
      RISC-V: Access CSRs using CSR numbers · a3182c91
      Anup Patel authored
      We should prefer accessing CSRs using their CSR numbers because:
      1. It compiles fine with older toolchains.
      2. We can use latest CSR names in #define macro names of CSR numbers
         as-per RISC-V spec.
      3. We can access newly added CSRs even if toolchain does not recognize
         newly addes CSRs by name.
      Signed-off-by: default avatarAnup Patel <anup.patel@wdc.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      a3182c91
    • Anup Patel's avatar
      RISC-V: Add interrupt related SCAUSE defines in asm/csr.h · 6dcaf004
      Anup Patel authored
      This patch adds SCAUSE interrupt flag and SCAUSE interrupt related
      defines to asm/csr.h. We also use these defines in kernel/irq.c and
      express SIE/SIP flags in-terms of SCAUSE interrupt causes.
      Signed-off-by: default avatarAnup Patel <anup.patel@wdc.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      6dcaf004
    • Anup Patel's avatar
      RISC-V: Use tabs to align macro values in asm/csr.h · 196a14d4
      Anup Patel authored
      The spacing between macro name and value is not consistent in
      asm/csr.h. This patch beautifies asm/csr.h by using tabs to align
      macro values instead of spaces.
      Signed-off-by: default avatarAnup Patel <anup.patel@wdc.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      196a14d4
    • Atish Patra's avatar
      RISC-V: Fix minor checkpatch issues. · f1f47c6c
      Atish Patra authored
      While working on the patches, I found some minor checkpatch issues.
      Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      f1f47c6c
    • Atish Patra's avatar
      RISC-V: Support nr_cpus command line option. · 8b4302a4
      Atish Patra authored
      If nr_cpus command line option is set, maximum possible cpu should be
      set to that value.
      Signed-off-by: default avatarAtish Patra <atish.patra@wdc.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      8b4302a4
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20190516' of git://git.kernel.dk/linux-block · a6a4b66b
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "A small set of fixes for io_uring.
      
        This contains:
      
         - smp_rmb() cleanup for io_cqring_events() (Jackie)
      
         - io_cqring_wait() simplification (Jackie)
      
         - removal of dead 'ev_flags' passing (me)
      
         - SQ poll CPU affinity verification fix (me)
      
         - SQ poll wait fix (Roman)
      
         - SQE command prep cleanup and fix (Stefan)"
      
      * tag 'for-linus-20190516' of git://git.kernel.dk/linux-block:
        io_uring: use wait_event_interruptible for cq_wait conditional wait
        io_uring: adjust smp_rmb inside io_cqring_events
        io_uring: fix infinite wait in khread_park() on io_finish_async()
        io_uring: remove 'ev_flags' argument
        io_uring: fix failure to verify SQ_AFF cpu
        io_uring: fix race condition reading SQE data
      a6a4b66b
    • Linus Torvalds's avatar
      Merge tag 'for-5.2/block-post-20190516' of git://git.kernel.dk/linux-block · 1718de78
      Linus Torvalds authored
      Pull more block updates from Jens Axboe:
       "This is mainly some late lightnvm changes that came in just before the
        merge window, as well as fixes that have been queued up since the
        initial pull request was frozen.
      
        This contains:
      
         - lightnvm changes, fixing race conditions, improving memory
           utilization, and improving pblk compatability (Chansol, Igor,
           Marcin)
      
         - NVMe pull request with minor fixes all over the map (via Christoph)
      
         - remove redundant error print in sata_rcar (Geert)
      
         - struct_size() cleanup (Jackie)
      
         - dasd CONFIG_LBADF warning fix (Ming)
      
         - brd cond_resched() improvement (Mikulas)"
      
      * tag 'for-5.2/block-post-20190516' of git://git.kernel.dk/linux-block: (41 commits)
        block/bio-integrity: use struct_size() in kmalloc()
        nvme: validate cntlid during controller initialisation
        nvme: change locking for the per-subsystem controller list
        nvme: trace all async notice events
        nvme: fix typos in nvme status code values
        nvme-fabrics: remove unused argument
        nvme-multipath: avoid crash on invalid subsystem cntlid enumeration
        nvme-fc: use separate work queue to avoid warning
        nvme-rdma: remove redundant reference between ib_device and tagset
        nvme-pci: mark expected switch fall-through
        nvme-pci: add known admin effects to augument admin effects log page
        nvme-pci: init shadow doorbell after each reset
        brd: add cond_resched to brd_free_pages
        sata_rcar: Remove ata_host_alloc() error printing
        s390/dasd: fix build warning in dasd_eckd_build_cp_raw
        lightnvm: pblk: use nvm_rq_to_ppa_list()
        lightnvm: pblk: simplify partial read path
        lightnvm: do not remove instance under global lock
        lightnvm: track inflight target creations
        lightnvm: pblk: recover only written metadata
        ...
      1718de78
    • Linus Torvalds's avatar
      Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 815d469d
      Linus Torvalds authored
      Pull more clk framework updates from Stephen Boyd:
       "One more patch to remove io.h from clk-provider.h.
      
        We used to need this include when we had clk_readl() and clk_writel(),
        but those are gone now so this patch pushes the dependency out to the
        users of clk-provider.h"
      
      * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: Remove io.h from clk-provider.h
      815d469d
    • Linus Torvalds's avatar
      Merge branch 'for-5.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · 5f3ab27b
      Linus Torvalds authored
      Pull cgroup fix from Tejun Heo:
       "The cgroup2 freezer pulled in this cycle broke strace. This pull
        request includes a workaround for the problem.
      
        It's not a complete fix in that it may cause spurious frozen state
        flip-flops which is fairly minor. Will push a full fix once it's
        ready"
      
      * 'for-5.2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
        signal: unconditionally leave the frozen state in ptrace_stop()
      5f3ab27b
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-5.2-rc1-2' of... · 4c7b63a3
      Linus Torvalds authored
      Merge tag 'linux-kselftest-5.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull more kselftest updates from Shuah Khan:
      
       - kselftest framework bpf build/test workflow regression fix
      
       - Fix to kselftest install to use default install path
      
       - Fix to kselftest KBUILD_OUTPUT builds to not clutter main
         KBUILD_OUTPUT directory with selftest objects
      
       - .gitignore fixes (Kelsey Skunberg)
      
       - rseq selftests updates (Mathieu Desnoyers and Martin Schwidefsky)
      
         They change the per-architecture pre-abort signatures to ensure those
         are valid trap instructions.
      
         The way exit points are presented to debuggers is enhanced, ensuring
         all exit points are present, so debuggers don't have to disassemble
         rseq critical section to properly skip over them.
      
         Discussions with the glibc community is reaching a consensus of
         exposing a __rseq_handled symbol from glibc to coexist with rseq
         early adopters. Update the rseq selftest code to expose and use this
         symbol.
      
         Support for compiling asm goto with clang is added with the
         "-no-integrated-as" compiler switch, similarly to the top level
         kernel Makefile.
      
       - kselftest Makefile test run output refactoring and making test output
         TAP13 compliant from Kees Cook:
      
         This re-factors the selftest Makefiles to extract the test running
         logic to be reused between "run_tests" and "emit_tests", while also
         fixing up the test output to be TAP version 13 compliant:
      	- added "plan" line
      	- fixed result line syntax
      	- moved all test output to be "# "-prefixed as TAP "diagnostic"
      	  lines
      
         The prefixing code includes a fallback mode for limited execution
         environments.
      
         Additionally, the plan lines are fixed for all callers of
         kselftest.h.
      
      * tag 'linux-kselftest-5.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (25 commits)
        selftests: avoid KBUILD_OUTPUT dir cluttering with selftest objects
        selftests: drivers: Create .gitignore to include /dma-buf/udmabuf
        selftests: pidfd: Create .gitignore to include pidfd_test
        selftests: fix bpf build/test workflow regression when KBUILD_OUTPUT is set
        selftests: fix install target to use default install path
        rseq/selftests: add -no-integrated-as for clang
        rseq/selftests: mips: use break instruction for RSEQ_SIG
        rseq/selftests: powerpc code signature: generate valid instructions
        rseq/selftests: aarch64 code signature: handle big-endian environment
        rseq/selftests: arm: use udf instruction for RSEQ_SIG
        rseq/selftests: s390: use trap4 for RSEQ_SIG
        rseq/selftests: x86: use ud1 instruction as RSEQ_SIG opcode
        rseq/selftests: s390: use jg instruction for jumps outside of the asm
        rseq/selftests: Use __rseq_handled symbol to coexist with glibc
        rseq/selftests: Introduce __rseq_cs_ptr_array, rename __rseq_table to __rseq_cs
        rseq/selftests: Add __rseq_exit_point_array section for debuggers
        rseq/selftests: x86: Work-around bogus gcc-8 optimisation
        selftests: Add test plan API to kselftest.h and adjust callers
        selftests: Remove KSFT_TAP_LEVEL
        selftests: Move test output to diagnostic lines
        ...
      4c7b63a3
    • Linus Torvalds's avatar
      Merge tag 'devicetree-for-5.2-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · 9cbda1bd
      Linus Torvalds authored
      Pull Devicetree vendor prefix conversion from Rob Herring:
       "Conversion of vendor-prefixes.txt to json-schema"
      
      * tag 'devicetree-for-5.2-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: Convert vendor prefixes to json-schema
      9cbda1bd
    • Linus Torvalds's avatar
      Merge tag 'afs-fixes-b-20190516' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · 0d744719
      Linus Torvalds authored
      Pull AFS callback promise fixes from David Howells:
       "This series fixes a bunch of problems in callback promise handling,
        where a callback promise indicates a promise on the part of the server
        to notify the client in the event of some sort of change to a file or
        volume. In the event of a break, the client has to go and refetch the
        client status from the server and discard any cached permission
        information as the ACL might have changed.
      
        The problem in the current code is that changes made by other clients
        aren't always noticed, primarily because the file status information
        and the callback information aren't updated in the same critical
        section, even if these are carried in the same reply from an RPC
        operation, and so the AFS_VNODE_CB_PROMISED flag is unreliable.
      
        Arranging for them to be done in the same critical section during
        reply decoding is tricky because of the FS.InlineBulkStatus op - which
        has all the statuses in the reply arriving and then all the callbacks,
        so they have to be buffered. It simplifies things a lot to move the
        critical section out of the decode phase and do it after the RPC
        function returns.
      
        Also new inodes (either newly fetched or newly created) aren't
        properly managed against a callback break happening before we get the
        local inode up and running.
      
        Fix this by:
      
         - There's now a combined file status and callback record (struct
           afs_status_cb) to carry both plus some flags.
      
         - Each operation wrapper function allocates sufficient afs_status_cb
           records for all the vnodes it is interested in and passes them into
           RPC operations to be filled in from the reply.
      
         - The FileStatus and CallBack record decoders no longer apply the
           new/revised status and callback information to the inode/vnode at
           the point of decoding and instead store the information into the
           record from (2).
      
         - afs_vnode_commit_status() then revises the file status, detects
           deletion and notes callback information inside of a single critical
           section. It also checks the callback break counters and cancels the
           callback promise if they changed during the operation.
      
           [*] Note that "callback break counters" are counters of server
           events that cancel one or more callback promises that the client
           thinks it has. The client counts the events and compares the
           counters before and after an operation to see if the callback
           promise it thinks it just got evaporated before it got recorded
           under lock.
      
         - Volume and server callback break counters are passed into
           afs_iget() allowing callback breaks concurrent with inode set up to
           be detected and the callback promise thence to be cancelled.
      
         - AFS validation checks are now done under RCU conditions using a
           read lock on cb_lock. This requires vnode->cb_interest to be made
           RCU safe.
      
         - If the checks in (6) fail, the callback breaker is then called
           under write lock on the cb_lock - but only if the callback break
           counter didn't change from the value read before the checks were
           made.
      
         - Results from FS.InlineBulkStatus that correspond to inodes we
           currently have in memory are now used to update those inodes'
           status and callback information rather than being discarded. This
           requires those inodes to be looked up before the RPC op is made and
           all their callback break values saved.
      
        To aid in this, the following changes have also been made:
      
         - Don't pass the vnode into the reply delivery functions or the
           decoders. The vnode shouldn't be altered anywhere in those paths.
           The only exception, for the moment, is for the call done hook for
           file lock ops that wants access to both the vnode and the call -
           this can be fixed at a later time.
      
         - Get rid of the call->reply[] void* array and replace it with named
           and typed members. This avoids confusion since different ops were
           mapping different reply[] members to different things.
      
         - Fix an order-1 kmalloc allocation in afs_do_lookup() and replace it
           with kvcalloc().
      
         - Always get the reply time. Since callback, lock and fileserver
           record expiry times are calculated for several RPCs, make this
           mandatory.
      
         - Call afs_pages_written_back() from the operation wrapper rather
           than from the delivery function.
      
         - Don't store the version and type from a callback promise in a reply
           as the information in them is of very limited use"
      
      * tag 'afs-fixes-b-20190516' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        afs: Fix application of the results of a inline bulk status fetch
        afs: Pass pre-fetch server and volume break counts into afs_iget5_set()
        afs: Fix unlink to handle YFS.RemoveFile2 better
        afs: Clear AFS_VNODE_CB_PROMISED if we detect callback expiry
        afs: Make vnode->cb_interest RCU safe
        afs: Split afs_validate() so first part can be used under LOOKUP_RCU
        afs: Don't save callback version and type fields
        afs: Fix application of status and callback to be under same lock
        afs: Always get the reply time
        afs: Fix order-1 allocation in afs_do_lookup()
        afs: Get rid of afs_call::reply[]
        afs: Don't pass the vnode pointer through into the inline bulk status op
      0d744719
    • Linus Torvalds's avatar
      Merge tag 'afs-fixes-20190516' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · 227747fb
      Linus Torvalds authored
      Pull misc AFS fixes from David Howells:
       "This fixes a set of miscellaneous issues in the afs filesystem,
        including:
      
         - leak of keys on file close.
      
         - broken error handling in xattr functions.
      
         - missing locking when updating VL server list.
      
         - volume location server DNS lookup whereby preloaded cells may not
           ever get a lookup and regular DNS lookups to maintain server lists
           consume power unnecessarily.
      
         - incorrect error propagation and handling in the fileserver
           iteration code causes operations to sometimes apparently succeed.
      
         - interruption of server record check/update side op during
           fileserver iteration causes uninterruptible main operations to fail
           unexpectedly.
      
         - callback promise expiry time miscalculation.
      
         - over invalidation of the callback promise on directories.
      
         - double locking on callback break waking up file locking waiters.
      
         - double increment of the vnode callback break counter.
      
        Note that it makes some changes outside of the afs code, including:
      
         - an extra parameter to dns_query() to allow the dns_resolver key
           just accessed to be immediately invalidated. AFS is caching the
           results itself, so the key can be discarded.
      
         - an interruptible version of wait_var_event().
      
         - an rxrpc function to allow the maximum lifespan to be set on a
           call.
      
         - a way for an rxrpc call to be marked as non-interruptible"
      
      * tag 'afs-fixes-20190516' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        afs: Fix double inc of vnode->cb_break
        afs: Fix lock-wait/callback-break double locking
        afs: Don't invalidate callback if AFS_VNODE_DIR_VALID not set
        afs: Fix calculation of callback expiry time
        afs: Make dynamic root population wait uninterruptibly for proc_cells_lock
        afs: Make some RPC operations non-interruptible
        rxrpc: Allow the kernel to mark a call as being non-interruptible
        afs: Fix error propagation from server record check/update
        afs: Fix the maximum lifespan of VL and probe calls
        rxrpc: Provide kernel interface to set max lifespan on a call
        afs: Fix "kAFS: AFS vnode with undefined type 0"
        afs: Fix cell DNS lookup
        Add wait_var_event_interruptible()
        dns_resolver: Allow used keys to be invalidated
        afs: Fix afs_cell records to always have a VL server list record
        afs: Fix missing lock when replacing VL server list
        afs: Fix afs_xattr_get_yfs() to not try freeing an error value
        afs: Fix incorrect error handling in afs_xattr_get_acl()
        afs: Fix key leak in afs_release() and afs_evict_inode()
      227747fb