1. 23 1月, 2019 9 次提交
    • Y
      Disable MSI also when pcie-octeon.pcie_disable on · 89a9f049
      YunQiang Su 提交于
      commit a214720cbf50cd8c3f76bbb9c3f5c283910e9d33 upstream.
      
      Octeon has an boot-time option to disable pcie.
      
      Since MSI depends on PCI-E, we should also disable MSI also with
      this option is on in order to avoid inadvertently accessing PCIe
      registers.
      Signed-off-by: NYunQiang Su <ysu@wavecomp.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: pburton@wavecomp.com
      Cc: linux-mips@vger.kernel.org
      Cc: aaro.koskinen@iki.fi
      Cc: stable@vger.kernel.org # v3.3+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89a9f049
    • H
      arm64: dts: marvell: armada-ap806: reserve PSCI area · 3832c115
      Heinrich Schuchardt 提交于
      commit 132ac39cffbcfed80ada38ef0fc6d34d95da7be6 upstream.
      
      The memory area [0x4000000-0x4200000[ is occupied by the PSCI firmware. Any
      attempt to access it from Linux leads to an immediate crash.
      
      So let's make the same memory reservation as the vendor kernel.
      
      [gregory: added as comment that this region matches the mainline U-boot]
      Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
      Signed-off-by: NGregory CLEMENT <gregory.clement@bootlin.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3832c115
    • A
      arm64: kaslr: ensure randomized quantities are clean to the PoC · ca8080c3
      Ard Biesheuvel 提交于
      commit 1598ecda7b239e9232dda032bfddeed9d89fab6c upstream.
      
      kaslr_early_init() is called with the kernel mapped at its
      link time offset, and if it returns with a non-zero offset,
      the kernel is unmapped and remapped again at the randomized
      offset.
      
      During its execution, kaslr_early_init() also randomizes the
      base of the module region and of the linear mapping of DRAM,
      and sets two variables accordingly. However, since these
      variables are assigned with the caches on, they may get lost
      during the cache maintenance that occurs when unmapping and
      remapping the kernel, so ensure that these values are cleaned
      to the PoC.
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Fixes: f80fb3a3 ("arm64: add support for kernel ASLR")
      Cc: <stable@vger.kernel.org> # v4.6+
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ca8080c3
    • H
      MIPS: lantiq: Fix IPI interrupt handling · 434b1b91
      Hauke Mehrtens 提交于
      commit 2b4dba55b04b212a7fd1f0395b41d79ee3a9801b upstream.
      
      This makes SMP on the vrx200 work again, by removing all the MIPS CPU
      interrupt specific code and making it fully use the generic MIPS CPU
      interrupt controller.
      
      The mti,cpu-interrupt-controller from irq-mips-cpu.c now handles the CPU
      interrupts and also the IPI interrupts which are used to communication
      between the CPUs in a SMP system. The generic interrupt code was
      already used before but the interrupt vectors were overwritten again
      when we called set_vi_handler() in the lantiq interrupt driver and we
      also provided our own plat_irq_dispatch() function which overwrote the
      weak generic implementation. Now the code uses the generic handler for
      the MIPS CPU interrupts including the IPI interrupts and registers a
      handler for the CPU interrupts which are handled by the lantiq ICU with
      irq_set_chained_handler() which was already called before.
      
      Calling the set_c0_status() function is also not needed any more because
      the generic MIPS CPU interrupt already activates the needed bits.
      
      Fixes: 1eed4004 ("MIPS: smp-mt: Use CPU interrupt controller IPI IRQ domain support")
      Cc: stable@kernel.org # v4.12
      Signed-off-by: NHauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: jhogan@kernel.org
      Cc: ralf@linux-mips.org
      Cc: john@phrozen.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-mips@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      434b1b91
    • R
      MIPS: BCM47XX: Setup struct device for the SoC · 19f41f32
      Rafał Miłecki 提交于
      commit 321c46b91550adc03054125fa7a1639390608e1a upstream.
      
      So far we never had any device registered for the SoC. This resulted in
      some small issues that we kept ignoring like:
      1) Not working GPIOLIB_IRQCHIP (gpiochip_irqchip_add_key() failing)
      2) Lack of proper tree in the /sys/devices/
      3) mips_dma_alloc_coherent() silently handling empty coherent_dma_mask
      
      Kernel 4.19 came with a lot of DMA changes and caused a regression on
      bcm47xx. Starting with the commit f8c55dc6 ("MIPS: use generic dma
      noncoherent ops for simple noncoherent platforms") DMA coherent
      allocations just fail. Example:
      [    1.114914] bgmac_bcma bcma0:2: Allocation of TX ring 0x200 failed
      [    1.121215] bgmac_bcma bcma0:2: Unable to alloc memory for DMA
      [    1.127626] bgmac_bcma: probe of bcma0:2 failed with error -12
      [    1.133838] bgmac_bcma: Broadcom 47xx GBit MAC driver loaded
      
      The bgmac driver also triggers a WARNING:
      [    0.959486] ------------[ cut here ]------------
      [    0.964387] WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 bgmac_enet_probe+0x1b4/0x5c4
      [    0.973751] Modules linked in:
      [    0.976913] CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.9 #0
      [    0.982750] Stack : 804a0000 804597c4 00000000 00000000 80458fd8 8381bc2c 838282d4 80481a47
      [    0.991367]         8042e3ec 00000001 804d38f0 00000204 83980000 00000065 8381bbe0 6f55b24f
      [    0.999975]         00000000 00000000 80520000 00002018 00000000 00000075 00000007 00000000
      [    1.008583]         00000000 80480000 000ee811 00000000 00000000 00000000 80432c00 80248db8
      [    1.017196]         00000009 00000204 83980000 803ad7b0 00000000 801feeec 00000000 804d0000
      [    1.025804]         ...
      [    1.028325] Call Trace:
      [    1.030875] [<8000aef8>] show_stack+0x58/0x100
      [    1.035513] [<8001f8b4>] __warn+0xe4/0x118
      [    1.039708] [<8001f9a4>] warn_slowpath_null+0x48/0x64
      [    1.044935] [<80248db8>] bgmac_enet_probe+0x1b4/0x5c4
      [    1.050101] [<802498e0>] bgmac_probe+0x558/0x590
      [    1.054906] [<80252fd0>] bcma_device_probe+0x38/0x70
      [    1.060017] [<8020e1e8>] really_probe+0x170/0x2e8
      [    1.064891] [<8020e714>] __driver_attach+0xa4/0xec
      [    1.069784] [<8020c1e0>] bus_for_each_dev+0x58/0xb0
      [    1.074833] [<8020d590>] bus_add_driver+0xf8/0x218
      [    1.079731] [<8020ef24>] driver_register+0xcc/0x11c
      [    1.084804] [<804b54cc>] bgmac_init+0x1c/0x44
      [    1.089258] [<8000121c>] do_one_initcall+0x7c/0x1a0
      [    1.094343] [<804a1d34>] kernel_init_freeable+0x150/0x218
      [    1.099886] [<803a082c>] kernel_init+0x10/0x104
      [    1.104583] [<80005878>] ret_from_kernel_thread+0x14/0x1c
      [    1.110107] ---[ end trace f441c0d873d1fb5b ]---
      
      This patch setups a "struct device" (and passes it to the bcma) which
      allows fixing all the mentioned problems. It'll also require a tiny bcma
      patch which will follow through the wireless tree & its maintainer.
      
      Fixes: f8c55dc6 ("MIPS: use generic dma noncoherent ops for simple noncoherent platforms")
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Acked-by: NHauke Mehrtens <hauke@hauke-m.de>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: linux-wireless@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.19+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19f41f32
    • A
      mips: fix n32 compat_ipc_parse_version · 8f469dc0
      Arnd Bergmann 提交于
      commit 5a9372f751b5350e0ce3d2ee91832f1feae2c2e5 upstream.
      
      While reading through the sysvipc implementation, I noticed that the n32
      semctl/shmctl/msgctl system calls behave differently based on whether
      o32 support is enabled or not: Without o32, the IPC_64 flag passed by
      user space is rejected but calls without that flag get IPC_64 behavior.
      
      As far as I can tell, this was inadvertently changed by a cleanup patch
      but never noticed by anyone, possibly nobody has tried using sysvipc
      on n32 after linux-3.19.
      
      Change it back to the old behavior now.
      
      Fixes: 78aaf956 ("MIPS: Compat: Fix build error if CONFIG_MIPS32_COMPAT but no compat ABI.")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # 3.19+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8f469dc0
    • J
      xen: Fix x86 sched_clock() interface for xen · 4432362a
      Juergen Gross 提交于
      commit 867cefb4cb1012f42cada1c7d1f35ac8dd276071 upstream.
      
      Commit f94c8d11 ("sched/clock, x86/tsc: Rework the x86 'unstable'
      sched_clock() interface") broke Xen guest time handling across
      migration:
      
      [  187.249951] Freezing user space processes ... (elapsed 0.001 seconds) done.
      [  187.251137] OOM killer disabled.
      [  187.251137] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
      [  187.252299] suspending xenstore...
      [  187.266987] xen:grant_table: Grant tables using version 1 layout
      [18446743811.706476] OOM killer enabled.
      [18446743811.706478] Restarting tasks ... done.
      [18446743811.720505] Setting capacity to 16777216
      
      Fix that by setting xen_sched_clock_offset at resume time to ensure a
      monotonic clock value.
      
      [boris: replaced pr_info() with pr_info_once() in xen_callback_vector()
       to avoid printing with incorrect timestamp during resume (as we
       haven't re-adjusted the clock yet)]
      
      Fixes: f94c8d11 ("sched/clock, x86/tsc: Rework the x86 'unstable' sched_clock() interface")
      Cc: <stable@vger.kernel.org> # 4.11
      Reported-by: NHans van Kranenburg <hans.van.kranenburg@mendix.com>
      Signed-off-by: NJuergen Gross <jgross@suse.com>
      Tested-by: NHans van Kranenburg <hans.van.kranenburg@mendix.com>
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4432362a
    • M
      arm64: Don't trap host pointer auth use to EL2 · d29d3891
      Mark Rutland 提交于
      [ Upstream commit b3669b1e1c09890d61109a1a8ece2c5b66804714 ]
      
      To allow EL0 (and/or EL1) to use pointer authentication functionality,
      we must ensure that pointer authentication instructions and accesses to
      pointer authentication keys are not trapped to EL2.
      
      This patch ensures that HCR_EL2 is configured appropriately when the
      kernel is booted at EL2. For non-VHE kernels we set HCR_EL2.{API,APK},
      ensuring that EL1 can access keys and permit EL0 use of instructions.
      For VHE kernels host EL0 (TGE && E2H) is unaffected by these settings,
      and it doesn't matter how we configure HCR_EL2.{API,APK}, so we don't
      bother setting them.
      
      This does not enable support for KVM guests, since KVM manages HCR_EL2
      itself when running VMs.
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NKristina Martsenko <kristina.martsenko@arm.com>
      Acked-by: NChristoffer Dall <christoffer.dall@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: kvmarm@lists.cs.columbia.edu
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d29d3891
    • M
      arm64/kvm: consistently handle host HCR_EL2 flags · a31edd1c
      Mark Rutland 提交于
      [ Upstream commit 4eaed6aa2c628101246bcabc91b203bfac1193f8 ]
      
      In KVM we define the configuration of HCR_EL2 for a VHE HOST in
      HCR_HOST_VHE_FLAGS, but we don't have a similar definition for the
      non-VHE host flags, and open-code HCR_RW. Further, in head.S we
      open-code the flags for VHE and non-VHE configurations.
      
      In future, we're going to want to configure more flags for the host, so
      lets add a HCR_HOST_NVHE_FLAGS defintion, and consistently use both
      HCR_HOST_VHE_FLAGS and HCR_HOST_NVHE_FLAGS in the kvm code and head.S.
      
      We now use mov_q to generate the HCR_EL2 value, as we use when
      configuring other registers in head.S.
      Reviewed-by: NMarc Zyngier <marc.zyngier@arm.com>
      Reviewed-by: NRichard Henderson <richard.henderson@linaro.org>
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Signed-off-by: NKristina Martsenko <kristina.martsenko@arm.com>
      Reviewed-by: NChristoffer Dall <christoffer.dall@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: kvmarm@lists.cs.columbia.edu
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a31edd1c
  2. 17 1月, 2019 2 次提交
  3. 13 1月, 2019 20 次提交
    • B
      powerpc/tm: Set MSR[TS] just prior to recheckpoint · a854ab8f
      Breno Leitao 提交于
      commit e1c3743e1a20647c53b719dbf28b48f45d23f2cd upstream.
      
      On a signal handler return, the user could set a context with MSR[TS] bits
      set, and these bits would be copied to task regs->msr.
      
      At restore_tm_sigcontexts(), after current task regs->msr[TS] bits are set,
      several __get_user() are called and then a recheckpoint is executed.
      
      This is a problem since a page fault (in kernel space) could happen when
      calling __get_user(). If it happens, the process MSR[TS] bits were
      already set, but recheckpoint was not executed, and SPRs are still invalid.
      
      The page fault can cause the current process to be de-scheduled, with
      MSR[TS] active and without tm_recheckpoint() being called.  More
      importantly, without TEXASR[FS] bit set also.
      
      Since TEXASR might not have the FS bit set, and when the process is
      scheduled back, it will try to reclaim, which will be aborted because of
      the CPU is not in the suspended state, and, then, recheckpoint. This
      recheckpoint will restore thread->texasr into TEXASR SPR, which might be
      zero, hitting a BUG_ON().
      
      	kernel BUG at /build/linux-sf3Co9/linux-4.9.30/arch/powerpc/kernel/tm.S:434!
      	cpu 0xb: Vector: 700 (Program Check) at [c00000041f1576d0]
      	    pc: c000000000054550: restore_gprs+0xb0/0x180
      	    lr: 0000000000000000
      	    sp: c00000041f157950
      	   msr: 8000000100021033
      	  current = 0xc00000041f143000
      	  paca    = 0xc00000000fb86300	 softe: 0	 irq_happened: 0x01
      	    pid   = 1021, comm = kworker/11:1
      	kernel BUG at /build/linux-sf3Co9/linux-4.9.30/arch/powerpc/kernel/tm.S:434!
      	Linux version 4.9.0-3-powerpc64le (debian-kernel@lists.debian.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18) ) #1 SMP Debian 4.9.30-2+deb9u2 (2017-06-26)
      	enter ? for help
      	[c00000041f157b30] c00000000001bc3c tm_recheckpoint.part.11+0x6c/0xa0
      	[c00000041f157b70] c00000000001d184 __switch_to+0x1e4/0x4c0
      	[c00000041f157bd0] c00000000082eeb8 __schedule+0x2f8/0x990
      	[c00000041f157cb0] c00000000082f598 schedule+0x48/0xc0
      	[c00000041f157ce0] c0000000000f0d28 worker_thread+0x148/0x610
      	[c00000041f157d80] c0000000000f96b0 kthread+0x120/0x140
      	[c00000041f157e30] c00000000000c0e0 ret_from_kernel_thread+0x5c/0x7c
      
      This patch simply delays the MSR[TS] set, so, if there is any page fault in
      the __get_user() section, it does not have regs->msr[TS] set, since the TM
      structures are still invalid, thus avoiding doing TM operations for
      in-kernel exceptions and possible process reschedule.
      
      With this patch, the MSR[TS] will only be set just before recheckpointing
      and setting TEXASR[FS] = 1, thus avoiding an interrupt with TM registers in
      invalid state.
      
      Other than that, if CONFIG_PREEMPT is set, there might be a preemption just
      after setting MSR[TS] and before tm_recheckpoint(), thus, this block must
      be atomic from a preemption perspective, thus, calling
      preempt_disable/enable() on this code.
      
      It is not possible to move tm_recheckpoint to happen earlier, because it is
      required to get the checkpointed registers from userspace, with
      __get_user(), thus, the only way to avoid this undesired behavior is
      delaying the MSR[TS] set.
      
      The 32-bits signal handler seems to be safe this current issue, but, it
      might be exposed to the preemption issue, thus, disabling preemption in
      this chunk of code.
      
      Changes from v2:
       * Run the critical section with preempt_disable.
      
      Fixes: 87b4e539 ("powerpc/tm: Fix return of active 64bit signals")
      Cc: stable@vger.kernel.org (v3.9+)
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a854ab8f
    • G
      Revert "powerpc/tm: Unset MSR[TS] if not recheckpointing" · 6d9e96f3
      Greg Kroah-Hartman 提交于
      This reverts commit a9935a12 which is
      commit 6f5b9f018f4c7686fd944d920209d1382d320e4e upstream.
      
      It breaks the powerpc build, so drop it from the tree until a fix goes
      upstream.
      Reported-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: Breno Leitao <leitao@debian.org>
      Cc: Michal Suchánek <msuchanek@suse.de>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6d9e96f3
    • A
      arm64: relocatable: fix inconsistencies in linker script and options · ae5c75e6
      Ard Biesheuvel 提交于
      commit 3bbd3db86470c701091fb1d67f1fab6621debf50 upstream.
      
      readelf complains about the section layout of vmlinux when building
      with CONFIG_RELOCATABLE=y (for KASLR):
      
        readelf: Warning: [21]: Link field (0) should index a symtab section.
        readelf: Warning: [21]: Info field (0) should index a relocatable section.
      
      Also, it seems that our use of '-pie -shared' is contradictory, and
      thus ambiguous. In general, the way KASLR is wired up at the moment
      is highly tailored to how ld.bfd happens to implement (and conflate)
      PIE executables and shared libraries, so given the current effort to
      support other toolchains, let's fix some of these issues as well.
      
      - Drop the -pie linker argument and just leave -shared. In ld.bfd,
        the differences between them are unclear (except for the ELF type
        of the produced image [0]) but lld chokes on seeing both at the
        same time.
      
      - Rename the .rela output section to .rela.dyn, as is customary for
        shared libraries and PIE executables, so that it is not misidentified
        by readelf as a static relocation section (producing the warnings
        above).
      
      - Pass the -z notext and -z norelro options to explicitly instruct the
        linker to permit text relocations, and to omit the RELRO program
        header (which requires a certain section layout that we don't adhere
        to in the kernel). These are the defaults for current versions of
        ld.bfd.
      
      - Discard .eh_frame and .gnu.hash sections to avoid them from being
        emitted between .head.text and .text, screwing up the section layout.
      
      These changes only affect the ELF image, and produce the same binary
      image.
      
      [0] b9dce7f1 ("arm64: kernel: force ET_DYN ELF type for ...")
      
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Peter Smith <peter.smith@linaro.org>
      Tested-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae5c75e6
    • A
      arm64: drop linker script hack to hide __efistub_ symbols · 9873efe7
      Ard Biesheuvel 提交于
      commit dd6846d774693bfa27d7db4dae5ea67dfe373fa1 upstream.
      
      Commit 1212f7a1 ("scripts/kallsyms: filter arm64's __efistub_
      symbols") updated the kallsyms code to filter out symbols with
      the __efistub_ prefix explicitly, so we no longer require the
      hack in our linker script to emit them as absolute symbols.
      
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9873efe7
    • J
      powerpc/boot: Set target when cross-compiling for clang · 7dfb22b5
      Joel Stanley 提交于
      commit 813af51f5d30a2da6a2523c08465f9726e51772e upstream.
      
      Clang needs to be told which target it is building for when cross
      compiling.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/259Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Tested-by: Daniel Axtens <dja@axtens.net> # powerpc 64-bit BE
      Acked-by: NMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7dfb22b5
    • J
      powerpc: Disable -Wbuiltin-requires-header when setjmp is used · 28e1d143
      Joel Stanley 提交于
      commit aea447141c7e7824b81b49acd1bc785506fba46e upstream.
      
      The powerpc kernel uses setjmp which causes a warning when building
      with clang:
      
        In file included from arch/powerpc/xmon/xmon.c:51:
        ./arch/powerpc/include/asm/setjmp.h:15:13: error: declaration of
        built-in function 'setjmp' requires inclusion of the header <setjmp.h>
              [-Werror,-Wbuiltin-requires-header]
        extern long setjmp(long *);
                    ^
        ./arch/powerpc/include/asm/setjmp.h:16:13: error: declaration of
        built-in function 'longjmp' requires inclusion of the header <setjmp.h>
              [-Werror,-Wbuiltin-requires-header]
        extern void longjmp(long *, long);
                    ^
      
      This *is* the header and we're not using the built-in setjump but
      rather the one in arch/powerpc/kernel/misc.S. As the compiler warning
      does not make sense, it for the files where setjmp is used.
      Signed-off-by: NJoel Stanley <joel@jms.id.au>
      Reviewed-by: NNick Desaulniers <ndesaulniers@google.com>
      [mpe: Move subdir-ccflags in xmon/Makefile to not clobber -Werror]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28e1d143
    • N
      powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer · ba1fe90b
      Nicholas Piggin 提交于
      commit 6977f95e63b9b3fb4a5973481a800dd9f48a1338 upstream.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba1fe90b
    • N
      powerpc: consolidate -mno-sched-epilog into FTRACE flags · 24e26062
      Nicholas Piggin 提交于
      commit 2a056f58fd33ccc6a0261b552b0f17e7fa4a12f3 upstream.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24e26062
    • N
      powerpc: remove old GCC version checks · 5b59eeba
      Nicholas Piggin 提交于
      commit f2910f0e6835339e6ce82cef22fa15718b7e3bfa upstream.
      
      GCC 4.6 is the minimum supported now.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NJoel Stanley <joel@jms.id.au>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      [nc: Applied to minimize unnecessary conflicts]
      Signed-off-by: NNathan Chancellor <natechancellor@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b59eeba
    • G
      m68k: Fix memblock-related crashes · e46d5bd8
      Geert Uytterhoeven 提交于
      [ Upstream commit bed1369f51901b17108a4bb4f7210aab183bea42 ]
      
      When running the kernel in Fast RAM on Atari:
      
          Ignoring memory chunk at 0x0:0xe00000 before the first chunk
          ...
          Unable to handle kernel NULL pointer dereference at virtual address (ptrval)
          Oops: 00000000
          Modules linked in:
          PC: [<0069dbac>] free_all_bootmem+0x12c/0x186
          SR: 2714  SP: (ptrval)  a2: 005e3314
          d0: 00000000    d1: 0000000a    d2: 00000e00    d3: 00000000
          d4: 005e1fc0    d5: 0000001a    a0: 01000000    a1: 00000000
          Process swapper (pid: 0, task=(ptrval))
          Frame format=7 eff addr=00000736 ssw=0505 faddr=00000736
          wb 1 stat/addr/data: 0000 00000000 00000000
          wb 2 stat/addr/data: 0000 00000000 00000000
          wb 3 stat/addr/data: 0000 00000736 00000000
          push data: 00000000 00000000 00000000 00000000
          Stack from 005e1f84:
                  00000000 0000000a 027d3260 006b5006 00000000 00000000 00000000 00000000
                  0004f062 0003a220 0069e272 005e1ff8 0000054c 00000000 00e00000 00000000
                  00000001 00693cd8 027d3260 0004f062 0003a220 00691be6 00000000 00000000
                  00000000 00000000 00000000 00000000 006b5006 00000000 00690872
          Call Trace: [<0004f062>] printk+0x0/0x18
           [<0003a220>] parse_args+0x0/0x2d4
           [<0069e272>] memblock_virt_alloc_try_nid+0x0/0xa4
           [<00693cd8>] mem_init+0xa/0x5c
           [<0004f062>] printk+0x0/0x18
           [<0003a220>] parse_args+0x0/0x2d4
           [<00691be6>] start_kernel+0x1ca/0x462
           [<00690872>] _sinittext+0x872/0x11f8
          Code: 7a1a eaae 2270 6db0 0061 ef14 2f01 2f03 <96a9> 0736 2203 e589 d681 e78b d6a9 0732 2f03 2f40 0034 4eb9 0069 b8d0 260e 4fef
          Disabling lock debugging due to kernel taint
          Kernel panic - not syncing: Attempted to kill the idle task!
      
      As the kernel must run in the memory chunk with the lowest address,
      ST-RAM is ignored, and removed from the m68k_memory[] array.
      However, it is not removed from memblock, causing a crash later.
      
      More investigation shows that there are 3 places where memory chunks are
      ignored, all after the calls to memblock_add() in m68k_parse_bootinfo(),
      and thus causing crashes:
        1. On classic m68k CPUs with a MMU, paging_init() ignores all memory
           chunks below the first chunk, cfr. above,
        2. On Amigas equipped with a Zorro III bus, config_amiga() ignores all
           Zorro II memory,
        3. If CONFIG_SINGLE_MEMORY_CHUNK=y, m68k_parse_bootinfo() ignores all
           but the first memory chunk.
      
      Fix this by moving the calls to memblock_add() from
      m68k_parse_bootinfo() to paging_init(), after all ignored memory chunks
      have been removed from m68k_memory[].
      Reported-by: NAndreas Schwab <schwab@linux-m68k.org>
      Fixes: 1008a115 ("m68k: switch to MEMBLOCK + NO_BOOTMEM")
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      e46d5bd8
    • K
      x86/dump_pagetables: Fix LDT remap address marker · 56769ef9
      Kirill A. Shutemov 提交于
      [ Upstream commit 254eb5505ca0ca749d3a491fc6668b6c16647a99 ]
      
      The LDT remap placement has been changed. It's now placed before the direct
      mapping in the kernel virtual address space for both paging modes.
      
      Change address markers order accordingly.
      
      Fixes: d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging")
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: bp@alien8.de
      Cc: hpa@zytor.com
      Cc: dave.hansen@linux.intel.com
      Cc: luto@kernel.org
      Cc: peterz@infradead.org
      Cc: boris.ostrovsky@oracle.com
      Cc: jgross@suse.com
      Cc: bhe@redhat.com
      Cc: hans.van.kranenburg@mendix.com
      Cc: linux-mm@kvack.org
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20181130202328.65359-3-kirill.shutemov@linux.intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      56769ef9
    • K
      x86/mm: Fix guard hole handling · 62075c98
      Kirill A. Shutemov 提交于
      [ Upstream commit 16877a5570e0c5f4270d5b17f9bab427bcae9514 ]
      
      There is a guard hole at the beginning of the kernel address space, also
      used by hypervisors. It occupies 16 PGD entries.
      
      This reserved range is not defined explicitely, it is calculated relative
      to other entities: direct mapping and user space ranges.
      
      The calculation got broken by recent changes of the kernel memory layout:
      LDT remap range is now mapped before direct mapping and makes the
      calculation invalid.
      
      The breakage leads to crash on Xen dom0 boot[1].
      
      Define the reserved range explicitely. It's part of kernel ABI (hypervisors
      expect it to be stable) and must not depend on changes in the rest of
      kernel memory layout.
      
      [1] https://lists.xenproject.org/archives/html/xen-devel/2018-11/msg03313.html
      
      Fixes: d52888aa2753 ("x86/mm: Move LDT remap out of KASLR region on 5-level paging")
      Reported-by: NHans van Kranenburg <hans.van.kranenburg@mendix.com>
      Signed-off-by: NKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NHans van Kranenburg <hans.van.kranenburg@mendix.com>
      Reviewed-by: NJuergen Gross <jgross@suse.com>
      Cc: bp@alien8.de
      Cc: hpa@zytor.com
      Cc: dave.hansen@linux.intel.com
      Cc: luto@kernel.org
      Cc: peterz@infradead.org
      Cc: boris.ostrovsky@oracle.com
      Cc: bhe@redhat.com
      Cc: linux-mm@kvack.org
      Cc: xen-devel@lists.xenproject.org
      Link: https://lkml.kernel.org/r/20181130202328.65359-2-kirill.shutemov@linux.intel.comSigned-off-by: NSasha Levin <sashal@kernel.org>
      62075c98
    • O
      powerpc/mm: Fallback to RAM if the altmap is unusable · 54568ab2
      Oliver O'Halloran 提交于
      [ Upstream commit 9ef34630a4614ee1cd478f9859ebea55d55f10ec ]
      
      The "altmap" is used to provide a pool of memory that is reserved for
      the vmemmap backing of hot-plugged memory. This is useful when adding
      large amount of ZONE_DEVICE memory to a system with a limited amount of
      normal memory.
      
      On ppc64 we use huge pages to map the vmemmap which requires the backing
      storage to be contigious and aligned to the hugepage size. The altmap
      implementation allows for the altmap provider to reserve a few PFNs at
      the start of the range for it's own uses and when this occurs the
      first chunk of the altmap is not usable for hugepage mappings. On hash
      there is no sane way to fall back to a normal sized page mapping so we
      fail the allocation. This results in memory hotplug failing with
      ENOMEM when the new range doesn't fall into an existing vmemmap block.
      
      This patch handles this case by falling back to using system memory
      rather than failing if we cannot allocate from the altmap. This
      fallback should only ever be used for the first vmemmap block so it
      should not cause excess memory consumption.
      
      Fixes: 7b73d978 ("mm: pass the vmem_altmap to vmemmap_populate")
      Signed-off-by: NOliver O'Halloran <oohall@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      54568ab2
    • F
      ARM: dts: imx7d-nitrogen7: Fix the description of the Wifi clock · aad142a6
      Fabio Estevam 提交于
      [ Upstream commit f15096f12a4e9340168df5fdd9201aa8ed60d59e ]
      
      According to bindings/regulator/fixed-regulator.txt the 'clocks' and
      'clock-names' properties are not valid ones.
      
      In order to turn on the Wifi clock the correct location for describing
      the CLKO2 clock is via a mmc-pwrseq handle, so do it accordingly.
      
      Fixes: 56354959 ("ARM: dts: imx: add Boundary Devices Nitrogen7 board")
      Signed-off-by: NFabio Estevam <festevam@gmail.com>
      Acked-by: NTroy Kisky <troy.kisky@boundarydevices.com>
      Signed-off-by: NShawn Guo <shawnguo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      aad142a6
    • A
      ARM: imx: update the cpu power up timing setting on i.mx6sx · eab3109e
      Anson Huang 提交于
      [ Upstream commit 1e434b703248580b7aaaf8a115d93e682f57d29f ]
      
      The sw2iso count should cover ARM LDO ramp-up time,
      the MAX ARM LDO ramp-up time may be up to more than
      100us on some boards, this patch sets sw2iso to 0xf
      (~384us) which is the reset value, and it is much
      more safe to cover different boards, since we have
      observed that some customer boards failed with current
      setting of 0x2.
      
      Fixes: 05136f08 ("ARM: imx: support arm power off in cpuidle for i.mx6sx")
      Signed-off-by: NAnson Huang <Anson.Huang@nxp.com>
      Reviewed-by: NFabio Estevam <festevam@gmail.com>
      Signed-off-by: NShawn Guo <shawnguo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      eab3109e
    • F
      ARM: dts: imx7d-pico: Describe the Wifi clock · 94541b59
      Fabio Estevam 提交于
      [ Upstream commit c3b9ab5db11d8098ca7674175f12ab21cdce1bbb ]
      
      The Wifi chip should be clocked by a 32kHz clock coming from i.MX7D
      CLKO2 output pin, so describe the pinmux and clock hierarchy in the
      device tree to allow the Wifi chip to be properly clocked.
      
      Managed to successfully test Wifi with such change. Used the standard
      nvram.txt file provided by TechNexion, which selects an external 32kHz
      clock for the Wifi chip by default.
      
      Fixes: 99a52450 ("ARM: dts: imx7d-pico: Add Wifi support")
      Suggested-by: NArend van Spriel <arend.vanspriel@broadcom.com>
      Tested-by: NOtavio Salvador <otavio@ossystems.com.br>
      Signed-off-by: NFabio Estevam <festevam@gmail.com>
      Signed-off-by: NShawn Guo <shawnguo@kernel.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      94541b59
    • M
      powerpc/mm: Fix linux page tables build with some configs · d4fdc5e8
      Michael Ellerman 提交于
      [ Upstream commit 462951cd32e1496dc64b00051dfb777efc8ae5d8 ]
      
      For some configs the build fails with:
      
        arch/powerpc/mm/dump_linuxpagetables.c: In function 'populate_markers':
        arch/powerpc/mm/dump_linuxpagetables.c:306:39: error: 'PKMAP_BASE' undeclared (first use in this function)
        arch/powerpc/mm/dump_linuxpagetables.c:314:50: error: 'LAST_PKMAP' undeclared (first use in this function)
      
      These come from highmem.h, including that fixes the build.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      d4fdc5e8
    • P
      powerpc: Fix COFF zImage booting on old powermacs · 4642a5c5
      Paul Mackerras 提交于
      [ Upstream commit 5564597d51c8ff5b88d95c76255e18b13b760879 ]
      
      Commit 6975a783 ("powerpc/boot: Allow building the zImage wrapper
      as a relocatable ET_DYN", 2011-04-12) changed the procedure descriptor
      at the start of crt0.S to have a hard-coded start address of 0x500000
      rather than a reference to _zimage_start, presumably because having
      a reference to a symbol introduced a relocation which is awkward to
      handle in a position-independent executable.  Unfortunately, what is
      at 0x500000 in the COFF image is not the first instruction, but the
      procedure descriptor itself, that is, a word containing 0x500000,
      which is not a valid instruction.  Hence, booting a COFF zImage
      results in a "DEFAULT CATCH!, code=FFF00700" message from Open
      Firmware.
      
      This fixes the problem by (a) putting the procedure descriptor in the
      data section and (b) adding a branch to _zimage_start as the first
      instruction in the program.
      
      Fixes: 6975a783 ("powerpc/boot: Allow building the zImage wrapper as a relocatable ET_DYN")
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      4642a5c5
    • R
      arm64: dts: mt7622: fix no more console output on rfb1 · a294de73
      Ryder Lee 提交于
      [ Upstream commit 6c05946e349d92f527d98644fbc9c41f06312c00 ]
      
      No default serial console on boot.
      Fix this by using a 'stdout-path' property that points to the device.
      
      Fixes: c0d9f9ad ("arm64: dts: mt7622: add earlycon to mt7622-rfb1 board")
      Signed-off-by: NRyder Lee <ryder.lee@mediatek.com>
      Tested-by: NKevin Hilman <khilman@baylibre.com>
      [mb: Fix commit message]
      Signed-off-by: NMatthias Brugger <matthias.bgg@gmail.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      a294de73
    • C
      ARM: dts: sun8i: a83t: bananapi-m3: increase vcc-pd voltage to 3.3V · 0dc2ffac
      Corentin Labbe 提交于
      [ Upstream commit 5f8208f557065163f9a8089ea2ea7888f9d96922 ]
      
      Since commit d7c5f686 ("ARM: dts: sun8i: a83t: bananapi-m3: Add
      AXP813 regulator nodes") my BPIM3 no longer works at gigabit speed.
      
      With the default setting, dldo3 is regulated at 2.9v which seems
      sufficient for the PHY but the aforementioned commit drops it to 2.5V
      which is insufficient. Note that this behaviour is random for all BPIM3.
      Some work with 2.5V, but some don't.
      
      Finnaly, someone from Bananapi confirmed that this regulator must be set
      to 3.3V.
      
      Fixes: d7c5f686 ("ARM: dts: sun8i: a83t: bananapi-m3: Add AXP813
      		      regulator nodes")
      Signed-off-by: NCorentin Labbe <clabbe@baylibre.com>
      [wens@csie.org: Reworked commit message]
      Signed-off-by: NChen-Yu Tsai <wens@csie.org>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      0dc2ffac
  4. 10 1月, 2019 9 次提交
    • P
      MIPS: Only include mmzone.h when CONFIG_NEED_MULTIPLE_NODES=y · a4a929aa
      Paul Burton 提交于
      commit 66a4059ba72c23ae74a7c702894ff76c4b7eac1f upstream.
      
      MIPS' asm/mmzone.h includes the machine/platform mmzone.h
      unconditionally, but since commit bb53fdf395ee ("MIPS: c-r4k: Add
      r4k_blast_scache_node for Loongson-3") is included by asm/rk4cache.h for
      all r4k-style configs regardless of CONFIG_NEED_MULTIPLE_NODES.
      
      This is problematic when CONFIG_NEED_MULTIPLE_NODES=n because both the
      loongson3 & ip27 mmzone.h headers unconditionally define the NODE_DATA
      preprocessor macro which is aready defined by linux/mmzone.h, resulting
      in the following build error:
      
        In file included from ./arch/mips/include/asm/mmzone.h:10,
                         from ./arch/mips/include/asm/r4kcache.h:23,
                         from arch/mips/mm/c-r4k.c:33:
        ./arch/mips/include/asm/mach-loongson64/mmzone.h:48: error: "NODE_DATA" redefined [-Werror]
         #define NODE_DATA(n)  (&__node_data[(n)]->pglist)
      
        In file included from ./include/linux/topology.h:32,
                         from ./include/linux/irq.h:19,
                         from ./include/asm-generic/hardirq.h:13,
                         from ./arch/mips/include/asm/hardirq.h:16,
                         from ./include/linux/hardirq.h:9,
                         from arch/mips/mm/c-r4k.c:11:
        ./include/linux/mmzone.h:907: note: this is the location of the previous definition
         #define NODE_DATA(nid)  (&contig_page_data)
      
      Resolve this by only including the machine mmzone.h when
      CONFIG_NEED_MULTIPLE_NODES=y, which also removes the need for the empty
      mach-generic version of the header which we delete.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Fixes: bb53fdf395ee ("MIPS: c-r4k: Add r4k_blast_scache_node for Loongson-3")
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4a929aa
    • W
      arm64: compat: Avoid sending SIGILL for unallocated syscall numbers · 920735c6
      Will Deacon 提交于
      commit 169113ece0f29ebe884a6cfcf57c1ace04d8a36a upstream.
      
      The ARM Linux kernel handles the EABI syscall numbers as follows:
      
        0           - NR_SYSCALLS-1	: Invoke syscall via syscall table
        NR_SYSCALLS - 0xeffff		: -ENOSYS (to be allocated in future)
        0xf0000     - 0xf07ff		: Private syscall or -ENOSYS if not allocated
        > 0xf07ff			: SIGILL
      
      Our compat code gets this wrong and ends up sending SIGILL in response
      to all syscalls greater than NR_SYSCALLS which have a value greater
      than 0x7ff in the bottom 16 bits.
      
      Fix this by defining the end of the ARM private syscall region and
      checking the syscall number against that directly. Update the comment
      while we're at it.
      
      Cc: <stable@vger.kernel.org>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Reported-by: NPi-Hsun Shih <pihsun@chromium.org>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      920735c6
    • S
      ARM: dts: exynos: Specify I2S assigned clocks in proper node · badd5690
      Sylwester Nawrocki 提交于
      commit 8ac686d7dfed721102860ff2571e6b9f529ae81a upstream.
      
      The assigned parent clocks should be normally specified in the consumer
      device's DT node, this ensures respective driver always sees correct clock
      settings when required.
      
      This patch fixes regression in audio subsystem on Odroid XU3/XU4 boards
      that appeared after commits:
      
      commit 647d04f8 ("ASoC: samsung: i2s: Ensure the RCLK rate is properly determined")
      commit 995e73e5 ("ASoC: samsung: i2s: Fix rclk_srcrate handling")
      commit 48279c53 ("ASoC: samsung: i2s: Prevent external abort on exynos5433 I2S1 access")
      
      Without this patch the driver gets wrong clock as the I2S function clock
      (op_clk) in probe() and effectively the clock which is finally assigned
      from DT is not being enabled/disabled in the runtime resume/suspend ops.
      
      Without the above listed commits the EXYNOS_I2S_BUS clock was always set
      as parent of CLK_I2S_RCLK_SRC regardless of DT settings so there was no issue
      with not enabled EXYNOS_SCLK_I2S.
      
      Cc: <stable@vger.kernel.org> # 4.17.x
      Signed-off-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: NKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      badd5690
    • W
      arm64: KVM: Avoid setting the upper 32 bits of VTCR_EL2 to 1 · 7ec9ea67
      Will Deacon 提交于
      commit df655b75c43fba0f2621680ab261083297fd6d16 upstream.
      
      Although bit 31 of VTCR_EL2 is RES1, we inadvertently end up setting all
      of the upper 32 bits to 1 as well because we define VTCR_EL2_RES1 as
      signed, which is sign-extended when assigning to kvm->arch.vtcr.
      
      Lucky for us, the architecture currently treats these upper bits as RES0
      so, whilst we've been naughty, we haven't set fire to anything yet.
      
      Cc: <stable@vger.kernel.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Christoffer Dall <christoffer.dall@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7ec9ea67
    • H
      MIPS: Fix a R10000_LLSC_WAR logic in atomic.h · db825a79
      Huacai Chen 提交于
      commit db1ce3f5d01d2d6d5714aefba0159d2cb5167a0b upstream.
      
      Commit 4936084c ("MIPS: Cleanup R10000_LLSC_WAR logic in atomic.h")
      introduce a mistake in atomic64_fetch_##op##_relaxed(), because it
      forget to delete R10000_LLSC_WAR in the if-condition. So fix it.
      
      Fixes: 4936084c ("MIPS: Cleanup R10000_LLSC_WAR logic in atomic.h")
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Joshua Kinard <kumba@gentoo.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Steven J . Hill <Steven.Hill@cavium.com>
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org # 4.19+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      db825a79
    • A
      MIPS: OCTEON: mark RGMII interface disabled on OCTEON III · 34c512d8
      Aaro Koskinen 提交于
      commit edefae94b7b9f10d5efe32dece5a36e9d9ecc29e upstream.
      
      Commit 885872b7 ("MIPS: Octeon: Add Octeon III CN7xxx
      interface detection") added RGMII interface detection for OCTEON III,
      but it results in the following logs:
      
      [    7.165984] ERROR: Unsupported Octeon model in __cvmx_helper_rgmii_probe
      [    7.173017] ERROR: Unsupported Octeon model in __cvmx_helper_rgmii_probe
      
      The current RGMII routines are valid only for older OCTEONS that
      use GMX/ASX hardware blocks. On later chips AGL should be used,
      but support for that is missing in the mainline. Until that is added,
      mark the interface as disabled.
      
      Fixes: 885872b7 ("MIPS: Octeon: Add Octeon III CN7xxx interface detection")
      Signed-off-by: NAaro Koskinen <aaro.koskinen@iki.fi>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: stable@vger.kernel.org # 4.7+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      34c512d8
    • P
      MIPS: Expand MIPS32 ASIDs to 64 bits · fb38b12e
      Paul Burton 提交于
      commit ff4dd232ec45a0e45ea69f28f069f2ab22b4908a upstream.
      
      ASIDs have always been stored as unsigned longs, ie. 32 bits on MIPS32
      kernels. This is problematic because it is feasible for the ASID version
      to overflow & wrap around to zero.
      
      We currently attempt to handle this overflow by simply setting the ASID
      version to 1, using asid_first_version(), but we make no attempt to
      account for the fact that there may be mm_structs with stale ASIDs that
      have versions which we now reuse due to the overflow & wrap around.
      
      Encountering this requires that:
      
        1) A struct mm_struct X is active on CPU A using ASID (V,n).
      
        2) That mm is not used on CPU A for the length of time that it takes
           for CPU A's asid_cache to overflow & wrap around to the same
           version V that the mm had in step 1. During this time tasks using
           the mm could either be sleeping or only scheduled on other CPUs.
      
        3) Some other mm Y becomes active on CPU A and is allocated the same
           ASID (V,n).
      
        4) mm X now becomes active on CPU A again, and now incorrectly has the
           same ASID as mm Y.
      
      Where struct mm_struct ASIDs are represented above in the format
      (version, EntryHi.ASID), and on a typical MIPS32 system version will be
      24 bits wide & EntryHi.ASID will be 8 bits wide.
      
      The length of time required in step 2 is highly dependent upon the CPU &
      workload, but for a hypothetical 2GHz CPU running a workload which
      generates a new ASID every 10000 cycles this period is around 248 days.
      Due to this long period of time & the fact that tasks need to be
      scheduled in just the right (or wrong, depending upon your inclination)
      way, this is obviously a difficult bug to encounter but it's entirely
      possible as evidenced by reports.
      
      In order to fix this, simply extend ASIDs to 64 bits even on MIPS32
      builds. This will extend the period of time required for the
      hypothetical system above to encounter the problem from 28 days to
      around 3 trillion years, which feels safely outside of the realms of
      possibility.
      
      The cost of this is slightly more generated code in some commonly
      executed paths, but this is pretty minimal:
      
                               | Code Size Gain | Percentage
        -----------------------|----------------|-------------
          decstation_defconfig |           +270 | +0.00%
              32r2el_defconfig |           +652 | +0.01%
              32r6el_defconfig |          +1000 | +0.01%
      
      I have been unable to measure any change in performance of the LMbench
      lat_ctx or lat_proc tests resulting from the 64b ASIDs on either
      32r2el_defconfig+interAptiv or 32r6el_defconfig+I6500 systems.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Suggested-by: NJames Hogan <jhogan@kernel.org>
      References: https://lore.kernel.org/linux-mips/80B78A8B8FEE6145A87579E8435D78C30205D5F3@fzex.ruijie.com.cn/
      References: https://lore.kernel.org/linux-mips/1488684260-18867-1-git-send-email-jiwei.sun@windriver.com/
      Cc: Jiwei Sun <jiwei.sun@windriver.com>
      Cc: Yu Huabing <yhb@ruijie.com.cn>
      Cc: stable@vger.kernel.org # 2.6.12+
      Cc: linux-mips@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fb38b12e
    • H
      MIPS: Align kernel load address to 64KB · 88c61f5c
      Huacai Chen 提交于
      commit bec0de4cfad21bd284dbddee016ed1767a5d2823 upstream.
      
      KEXEC needs the new kernel's load address to be aligned on a page
      boundary (see sanity_check_segment_list()), but on MIPS the default
      vmlinuz load address is only explicitly aligned to 16 bytes.
      
      Since the largest PAGE_SIZE supported by MIPS kernels is 64KB, increase
      the alignment calculated by calc_vmlinuz_load_addr to 64KB.
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/21131/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Steven J . Hill <Steven.Hill@cavium.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: <stable@vger.kernel.org> # 2.6.36+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88c61f5c
    • H
      MIPS: Ensure pmd_present() returns false after pmd_mknotpresent() · 76a9f7b4
      Huacai Chen 提交于
      commit 92aa0718c9fa5160ad2f0e7b5bffb52f1ea1e51a upstream.
      
      This patch is borrowed from ARM64 to ensure pmd_present() returns false
      after pmd_mknotpresent(). This is needed for THP.
      
      References: 5bb1cc0f ("arm64: Ensure pmd_present() returns false after pmd_mknotpresent()")
      Reviewed-by: NJames Hogan <jhogan@kernel.org>
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/21135/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Steven J . Hill <Steven.Hill@cavium.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: <stable@vger.kernel.org> # 3.8+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76a9f7b4