1. 25 Jul, 2018 6 commits
  2. 24 Jul, 2018 9 commits
    • Paul Burton's avatar
      MIPS: Hardcode cpu_has_* where known at compile time due to ISA · 93e01942
      Paul Burton authored
      Many architectural features have over time moved from being optional to
      either be required or removed by newer architecture releases. This means
      that in many cases we can know at compile time whether a feature will be
      supported or not purely due to the knowledge we have about the ISA the
      kernel build is targeting.
      
      This patch introduces a bunch of utility macros for checking for
      supported options, ASEs & combinations of those with ISA revisions. It
      then makes use of these in the default definitions of cpu_has_* macros.
      The result is that many of the macros become compile-time constant,
      allowing more optimisation opportunities for the compiler - particularly
      with kernels built for later ISA revisions.
      
      To demonstrate the effect of this patch, the following table shows the
      size in bytes of the kernel binary as reported by scripts/bloat-o-meter
      for v4.12-rc4 maltasmvp_defconfig kernels with & without this patch. A
      variant of maltasmvp_defconfig with CONFIG_CPU_MIPS32_R6 selected is
      also shown, to demonstrate that MIPSr6 systems benefit more due to extra
      features becoming required by that architecture revision. Builds of
      pistachio_defconfig are also shown, as although this is a MIPSr2
      platform it doesn't hardcode any features in a machine-specific
      cpu-feature-overrides.h, which allows it to gain more from this patch
      than the equivalent Malta r2 build.
      
           Config         | Before  | After   |  Change
          ----------------|---------|---------|---------
           maltasmvp      | 7248316 | 7247714 |    -602
           maltasmvp + r6 | 6955595 | 6950777 |   -4818
           pistachio      | 8650977 | 8363898 | -287079
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/16360/
      Cc: Joshua Kinard <kumba@gentoo.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      93e01942
    • Mathieu Malaterre's avatar
      MIPS: jz4780: DTS: Probe the spi-gpio driver from devicetree · c24f5762
      Mathieu Malaterre authored
      Make use of the spi-gpio driver to provide SPI support on the Ingenic
      JZ4780 SoC using the pins that can be used with the SSI0 device as
      GPIOs, until such time as we have support for the Ingenic SPI/SSI
      controller.
      
      [paul.burton@mips.com: Rewrite commit message.]
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19489/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: devicetree@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      c24f5762
    • Mathieu Malaterre's avatar
      MIPS: Ci20: Enable SPI/GPIO driver · 2e90396a
      Mathieu Malaterre authored
      Enable CONFIG_SPI_GPIO in ci20_defconfig, in order to make use of the
      spi-gpio driver in a further commit.
      
      [paul.burton@mips.com: Rewrite commit message.]
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19488/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: devicetree@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      2e90396a
    • Alexander Sverdlin's avatar
      MIPS: Octeon: Select HAS_RAPIDIO · 491ec155
      Alexander Sverdlin authored
      All Octeons starting with Octeon II have RAPIDIO controller which
      can function even with PCI disabled.
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Acked-by: default avatarAlexandre Bounine <alex.bou9@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19988/
      Cc: linux-mips@linux-mips.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      491ec155
    • Alexander Sverdlin's avatar
      MIPS: Introduce HAS_RAPIDIO Kconfig option · fc5d9888
      Alexander Sverdlin authored
      Introduce the same option as PPC and ARM already have because
      RAPIDIO can function in the absence of PCI.
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Acked-by: default avatarAlexandre Bounine <alex.bou9@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19987/
      Cc: linux-mips@linux-mips.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Matt Porter <mporter@kernel.crashing.org>
      fc5d9888
    • Thomas Petazzoni's avatar
      mips: use asm-generic version of msi.h · 34a4399f
      Thomas Petazzoni authored
      This is necessary to be able to include <linux/msi.h> when
      CONFIG_GENERIC_MSI_IRQ_DOMAIN is enabled. Without this, a build with
      CONFIG_GENERIC_MSI_IRQ_DOMAIN fails with:
      
         In file included from include/linux/kvm_host.h:20:0,
                          from arch/mips/kernel/asm-offsets.c:24:
      >> include/linux/msi.h:197:10: fatal error: asm/msi.h: No such file or directory
          #include <asm/msi.h>
                   ^~~~~~~~~~~
         compilation terminated.
         make[2]: *** [arch/mips/kernel/asm-offsets.s] Error 1
         make[2]: Target '__build' not remade because of errors.
         make[1]: *** [prepare0] Error 2
         make[1]: Target 'prepare' not remade because of errors.
         make: *** [sub-make] Error 2
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19986/
      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: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Hanna Hawa <hannah@marvell.com>
      34a4399f
    • Huacai Chen's avatar
      MIPS: Loongson64: Define and use some CP0 registers · 97ab1bb4
      Huacai Chen authored
      Defines CP0_CONFIG3, CP0_CONFIG6, CP0_PAGEGRAIN and use them in
      kernel-entry-init.h for Loongson64.
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19264/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: Huacai Chen <chenhuacai@gmail.com>
      97ab1bb4
    • Huacai Chen's avatar
      MIPS: Loongson: Add Loongson-3A R3.1 basic support · 7cff3f16
      Huacai Chen authored
      Loongson-3A R3.1 is the bugfix revision of Loongson-3A R3.
      
      All Loongson-3 CPU family:
      
      Code-name         Brand-name       PRId
      Loongson-3A R1    Loongson-3A1000  0x6305
      Loongson-3A R2    Loongson-3A2000  0x6308
      Loongson-3A R3    Loongson-3A3000  0x6309
      Loongson-3A R3.1  Loongson-3A3000  0x630d
      Loongson-3B R1    Loongson-3B1000  0x6306
      Loongson-3B R2    Loongson-3B1500  0x6307
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19263/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: Huacai Chen <chenhuacai@gmail.com>
      7cff3f16
    • Paul Cercueil's avatar
      MIPS: jz4740: Bump zload address · c6ea7e97
      Paul Cercueil authored
      Having the zload address at 0x8060.0000 means the size of the
      uncompressed kernel cannot be bigger than around 6 MiB, as it is
      deflated at address 0x8001.0000.
      
      This limit is too small; a kernel with some built-in drivers and things
      like debugfs enabled will already be over 6 MiB in size, and so will
      fail to extract properly.
      
      To fix this, we bump the zload address from 0x8060.0000 to 0x8100.0000.
      
      This is fine, as all the boards featuring Ingenic JZ SoCs have at least
      32 MiB of RAM, and use u-boot or compatible bootloaders which won't
      hardcode the load address but read it from the uImage's header.
      Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19787/
      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
      c6ea7e97
  3. 23 Jul, 2018 2 commits
    • Hauke Mehrtens's avatar
      MIPS: lantiq: Use dma_zalloc_coherent() in dma code · 2b5c4913
      Hauke Mehrtens authored
      Instead of using dma_alloc_coherent() and memset() directly use
      dma_zalloc_coherent().
      Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19962/
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: john@phrozen.org
      Cc: linux-mips@linux-mips.org
      Cc: dev@kresin.me
      2b5c4913
    • Huacai Chen's avatar
      MIPS: Change definition of cpu_relax() for Loongson-3 · a3071886
      Huacai Chen authored
      Linux expects that if a CPU modifies a memory location, then that
      modification will eventually become visible to other CPUs in the system.
      
      Loongson 3 CPUs include a Store Fill Buffer (SFB) which sits between a
      core & its L1 data cache, queueing memory accesses & allowing for faster
      forwarding of data from pending stores to younger loads from the core.
      Unfortunately the SFB prioritizes loads such that a continuous stream of
      loads may cause a pending write to be buffered indefinitely. This is
      problematic if we end up with 2 CPUs which each perform a store that the
      other polls for - one or both CPUs may end up with their stores buffered
      in the SFB, never reaching cache due to the continuous reads from the
      poll loop. Such a deadlock condition has been observed whilst running
      qspinlock code.
      
      This patch changes the definition of cpu_relax() to smp_mb() for
      Loongson-3, forcing a flush of the SFB on SMP systems which will cause
      any pending writes to make it as far as the L1 caches where they will
      become visible to other CPUs. If the kernel is not compiled for SMP
      support, this will expand to a barrier() as before.
      
      This workaround matches that currently implemented for ARM when
      CONFIG_ARM_ERRATA_754327=y, which was introduced by commit 534be1d5
      ("ARM: 6194/1: change definition of cpu_relax() for ARM11MPCore").
      
      Although the workaround is only required when the Loongson 3 SFB
      functionality is enabled, and we only began explicitly enabling that
      functionality in v4.7 with commit 1e820da3 ("MIPS: Loongson-3:
      Introduce CONFIG_LOONGSON3_ENHANCEMENT"), existing or future firmware
      may enable the SFB which means we may need the workaround backported to
      earlier kernels too.
      
      [paul.burton@mips.com:
        - Reword commit message & comment.
        - Limit stable backport to v3.15+ where we support Loongson 3 CPUs.]
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      References: 534be1d5 ("ARM: 6194/1: change definition of cpu_relax() for ARM11MPCore")
      References: 1e820da3 ("MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT")
      Patchwork: https://patchwork.linux-mips.org/patch/19830/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: Fuxin Zhang <zhangfx@lemote.com>
      Cc: Zhangjin Wu <wuzhangjin@gmail.com>
      Cc: Huacai Chen <chenhuacai@gmail.com>
      Cc: stable@vger.kernel.org # v3.15+
      a3071886
  4. 20 Jul, 2018 1 commit
  5. 19 Jul, 2018 4 commits
    • Maciej W. Rozycki's avatar
      MIPS: Add FP_MODE regset support · 1ae22a0e
      Maciej W. Rozycki authored
      Define an NT_MIPS_FP_MODE core file note and implement a corresponding
      regset holding the state handled by PR_SET_FP_MODE and PR_GET_FP_MODE
      prctl(2) requests.  This lets debug software correctly interpret the
      contents of floating-point general registers both in live debugging and
      in core files, and also switch floating-point modes of a live process.
      
      [paul.burton@mips.com:
        - Changed NT_MIPS_FP_MODE to 0x801 to match first nibble of
          NT_MIPS_DSP, which was also changed to avoid a conflict.]
      Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19331/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      1ae22a0e
    • Maciej W. Rozycki's avatar
      MIPS: Add DSP ASE regset support · 44109c60
      Maciej W. Rozycki authored
      Define an NT_MIPS_DSP core file note type and implement a corresponding
      regset holding the DSP ASE register context, following the layout of the
      `mips_dsp_state' structure, except for the DSPControl register stored as
      a 64-bit rather than 32-bit quantity in a 64-bit note.
      
      The lack of DSP ASE register saving to core files can be considered a
      design flaw with commit e50c0a8f ("Support the MIPS32 / MIPS64 DSP
      ASE."), leading to an incomplete state being saved.  Consequently no DSP
      ASE regset has been created with commit 7aeb753b ("MIPS: Implement
      task_user_regset_view."), when regset support was added to the MIPS
      port.
      
      Additionally there is no way for ptrace(2) to correctly access the DSP
      accumulator registers in n32 processes with the existing interfaces.
      This is due to 32-bit truncation of data passed with PTRACE_PEEKUSR and
      PTRACE_POKEUSR requests, which cannot be avoided owing to how the data
      types for ptrace(3) have been defined.  This new NT_MIPS_DSP regset
      fills the missing interface gap.
      
      [paul.burton@mips.com:
        - Change NT_MIPS_DSP to 0x800 to avoid conflict with NT_VMCOREDD
          introduced by commit 2724273e ("vmcore: add API to collect
          hardware dump in second kernel").
        - Drop stable tag. Whilst I agree the lack of this functionality can
          be considered a flaw in earlier DSP ASE support, it's still new
          functionality which doesn't meet up to the requirements set out in
          Documentation/process/stable-kernel-rules.rst.]
      Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      References: 7aeb753b ("MIPS: Implement task_user_regset_view.")
      Patchwork: https://patchwork.linux-mips.org/patch/19330/
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      44109c60
    • Maciej W. Rozycki's avatar
      MIPS: Correct the 64-bit DSP accumulator register size · f5958b4c
      Maciej W. Rozycki authored
      Use the `unsigned long' rather than `__u32' type for DSP accumulator
      registers, like with the regular MIPS multiply/divide accumulator and
      general-purpose registers, as all are 64-bit in 64-bit implementations
      and using a 32-bit data type leads to contents truncation on context
      saving.
      
      Update `arch_ptrace' and `compat_arch_ptrace' accordingly, removing
      casts that are similarly not used with multiply/divide accumulator or
      general-purpose register accesses.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Fixes: e50c0a8f ("Support the MIPS32 / MIPS64 DSP ASE.")
      Patchwork: https://patchwork.linux-mips.org/patch/19329/
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # 2.6.15+
      f5958b4c
    • Maciej W. Rozycki's avatar
      binfmt_elf: Respect error return from `regset->active' · 2f819db5
      Maciej W. Rozycki authored
      The regset API documented in <linux/regset.h> defines -ENODEV as the
      result of the `->active' handler to be used where the feature requested
      is not available on the hardware found.  However code handling core file
      note generation in `fill_thread_core_info' interpretes any non-zero
      result from the `->active' handler as the regset requested being active.
      Consequently processing continues (and hopefully gracefully fails later
      on) rather than being abandoned right away for the regset requested.
      
      Fix the problem then by making the code proceed only if a positive
      result is returned from the `->active' handler.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Fixes: 4206d3aa ("elf core dump: notes user_regset")
      Patchwork: https://patchwork.linux-mips.org/patch/19332/
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-fsdevel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      2f819db5
  6. 17 Jul, 2018 2 commits
    • Paul Burton's avatar
      MIPS: loongson64: cs5536: Fix PCI_OHCI_INT_REG reads · cd87668d
      Paul Burton authored
      The PCI_OHCI_INT_REG case in pci_ohci_read_reg() contains the following
      if statement:
      
        if ((lo & 0x00000f00) == CS5536_USB_INTR)
      
      CS5536_USB_INTR expands to the constant 11, which gives us the following
      condition which can never evaluate true:
      
        if ((lo & 0xf00) == 11)
      
      At least when using GCC 8.1.0 this falls foul of the tautoligcal-compare
      warning, and since the code is built with the -Werror flag the build
      fails.
      
      Fix this by shifting lo right by 8 bits in order to match the
      corresponding PCI_OHCI_INT_REG case in pci_ohci_write_reg().
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19861/
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      cd87668d
    • Alexander Sverdlin's avatar
      mips: unify prom_putchar() declarations · 5c93316c
      Alexander Sverdlin authored
      prom_putchar() is used centrally in early printk infrastructure therefore
      at least MIPS should agree on the function return type.
      
      [paul.burton@mips.com:
        - Include linux/types.h in asm/setup.h to gain the bool typedef before
          we start include asm/setup.h elsewhere.
        - Include asm/setup.h in all files that use or define prom_putchar().
        - Also standardise on signed rather than unsigned char argument.]
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19842/
      Cc: linux-mips@linux-mips.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Jonas Gorski <jonas.gorski@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      5c93316c
  7. 12 Jul, 2018 3 commits
    • Joshua Kinard's avatar
      MIPS: Cleanup R10000_LLSC_WAR logic in atomic.h · 4936084c
      Joshua Kinard authored
      This patch reduces down the conditionals in MIPS atomic code that deal
      with a silicon bug in early R10000 cpus that required a workaround of
      a branch-likely instruction following a store-conditional in order to
      to guarantee the whole ll/sc sequence is atomic.  As the only real
      difference is a branch-likely instruction (beqzl) over a standard
      branch (beqz), the conditional is reduced down to a single preprocessor
      check at the top to pick the required instruction.
      
      This requires writing the uses in assembler, thus we discard the
      non-R10000 case that uses a mixture of a C do...while loop with
      embedded assembler that was added back in commit 7837314d ("MIPS:
      Get rid of branches to .subsections.").  A note found in the git log
      for commit 5999eca25c1f ("[MIPS] Improve branch prediction in ll/sc
      atomic operations.") is also addressed.
      
      The macro definition for the branch instruction and the code comment
      derives from a patch sent in earlier by Paul Burton for various cmpxchg
      cleanups.
      
      [paul.burton@mips.com:
        - Minor whitespace fix for checkpatch.]
      Signed-off-by: default avatarJoshua Kinard <kumba@gentoo.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/17736/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: "Maciej W. Rozycki" <macro@mips.com>
      Cc: linux-mips@linux-mips.org
      4936084c
    • Joshua Kinard's avatar
      MIPS: Fix delay slot bug in `atomic*_sub_if_positive' for R10000_LLSC_WAR · a0a5ac3c
      Joshua Kinard authored
      This patch fixes an old bug in MIPS ll/sc atomics, in the
      `atomic_sub_if_positive' and `atomic64_sub_if_positive' functions, for
      the R10000_LLSC_WAR case where the result of the subu/dsubu instruction
      would potentially not be made available to the sc/scd instruction due
      to being in the delay-slot of the branch-likely (beqzl) instruction.
      
      This also removes the need for the `noreorder' directive, allowing GAS
      to use delay slot scheduling as needed.
      
      The same fix is also applied to the standard branch (beqz) case in
      preparation for a follow-up patch that will cleanup/merge the
      R10000_LLSC_WAR and non-R10K sections together.
      Signed-off-by: default avatarJoshua Kinard <kumba@gentoo.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Tested-by: default avatarJoshua Kinard <kumba@gentoo.org>
      Patchwork: https://patchwork.linux-mips.org/patch/17735/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: "Maciej W. Rozycki" <macro@mips.com>
      Cc: linux-mips@linux-mips.org
      a0a5ac3c
    • Thomas Bogendoerfer's avatar
      mips/jazz: provide missing dma_mask/coherent_dma_mask · b5d69129
      Thomas Bogendoerfer authored
      Commit 205e1b7f ("dma-mapping: warn when there is no
      coherent_dma_mask") introduced a warning, if a device is missing a
      coherent_dma_mask. ESP and sonic are using dma mapping functions, so
      they need dma masks.
      
      [paul.burton@mips.com:
        - Wrap commit message.]
      Signed-off-by: default avatarThomas Bogendoerfer <tbogendoerfer@suse.de>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19828/
      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
      b5d69129
  8. 10 Jul, 2018 2 commits
    • Serge Semin's avatar
      mips: mm: Discard ioremap_uncached_accelerated() method · ddba595b
      Serge Semin authored
      Adaptive ioremap_wc() method is now available as of commit 9748e33e
      ("mips: mm: Create UCA-based ioremap_wc() method"). We can use it to
      obtain UnCached Accelerated (UCA) mappings safely on all MIPS systems,
      and so we don't need the MIPS-specific ioremap_uncached_accelerated()
      any longer. This macro hard-coded the UCA Cache Coherency Attribute
      (CCA) in a manner that isn't safe for kernels that may run on different
      CPUs, and it is also entirely unused so we can trivially remove it.
      
      [paul.burton@mips.com:
        - Reword the commit message a little.
        - Remove CC stable.]
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19790/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: okaya@codeaurora.org
      Cc: chenhc@lemote.com
      Cc: Sergey.Semin@t-platforms.ru
      Cc: linux-kernel@vger.kernel.org
      ddba595b
    • Serge Semin's avatar
      mips: mm: Create UCA-based ioremap_wc() method · 9748e33e
      Serge Semin authored
      Modern MIPS cores (like P5600/6600, M5150/6520, end so on) which
      got L2-cache on chip also can enable a special type Cache-Coherency
      attribute (CCA) named UnCached Accelerated attribute (UCA). In this
      way uncached accelerated accesses are treated the same way as
      non-accelerated uncached accesses, but uncached stores are gathered
      together for more efficient bus utilization. So to speak this CCA
      enables uncached transactions to better utilize bus bandwidth via
      burst transactions.
      
      This is exactly why ioremap_wc() method has been introduced in Linux.
      Alas MIPS-platform code hasn't implemented it so far, instead default
      one has been used which was an alias to ioremap_nocache. In order to
      fix this we added MIPS-specific ioremap_wc() macro substituted by
      generic __ioremap_mode() method call with writecombine CPU-info
      field passed. It shall create real ioremap_wc() method if CPU-cache
      supports UCA feature and fall-back to _CACHE_UNCACHED attribute
      if one doesn't. Additionally platform-specific io.h shall declare
      ARCH_HAS_IOREMAP_WC macro as indication of architectural definition
      of ioremap_wc() (similar to x86/powerpc).
      
      [paul.burton@mips.com:
        - Remove CC stable, this is new functionality.]
      Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19789/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: okaya@codeaurora.org
      Cc: chenhc@lemote.com
      Cc: Sergey.Semin@t-platforms.ru
      Cc: linux-kernel@vger.kernel.org
      9748e33e
  9. 03 Jul, 2018 6 commits
  10. 28 Jun, 2018 4 commits
    • Geert Uytterhoeven's avatar
      MIPS: AR7: Normalize clk API · 6b5939d2
      Geert Uytterhoeven authored
      Coldfire still provides its own variant of the clk API rather than using
      the generic COMMON_CLK API.  This generally works, but it causes some
      link errors with drivers using the clk_round_rate(), clk_set_rate(),
      clk_set_parent(), or clk_get_parent() functions when a platform lacks
      those interfaces.
      
      This adds empty stub implementations for each of them, and I don't even
      try to do something useful here but instead just print a WARN() message
      to make it obvious what is going on if they ever end up being called.
      
      The drivers that call these won't be used on these platforms (otherwise
      we'd get a link error today), so the added code is harmless bloat and
      will warn about accidental use.
      
      Based on commit bd7fefe1 ("ARM: w90x900: normalize clk API").
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19503/
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: linux-m68k@lists.linux-m68k.org
      Cc: linux-mips@linux-mips.org
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      6b5939d2
    • Paul Burton's avatar
      MIPS: Always use -march=<arch>, not -<arch> shortcuts · 344ebf09
      Paul Burton authored
      The VDSO Makefile filters CFLAGS to select a subset which it uses whilst
      building the VDSO ELF. One of the flags it allows through is the -march=
      flag that selects the architecture/ISA to target.
      
      Unfortunately in cases where CONFIG_CPU_MIPS32_R{1,2}=y and the
      toolchain defaults to building for MIPS64, the main MIPS Makefile ends
      up using the short-form -<arch> flags in cflags-y. This is because the
      calls to cc-option always fail to use the long-form -march=<arch> flag
      due to the lack of an -mabi=<abi> flag in KBUILD_CFLAGS at the point
      where the cc-option function is executed. The resulting GCC invocation
      is something like:
      
        $ mips64-linux-gcc -Werror -march=mips32r2 -c -x c /dev/null -o tmp
        cc1: error: '-march=mips32r2' is not compatible with the selected ABI
      
      These short-form -<arch> flags are dropped by the VDSO Makefile's
      filtering, and so we attempt to build the VDSO without specifying any
      architecture. This results in an attempt to build the VDSO using
      whatever the compiler's default architecture is, regardless of whether
      that is suitable for the kernel configuration.
      
      One encountered build failure resulting from this mismatch is a
      rejection of the sync instruction if the kernel is configured for a
      MIPS32 or MIPS64 r1 or r2 target but the toolchain defaults to an older
      architecture revision such as MIPS1 which did not include the sync
      instruction:
      
          CC      arch/mips/vdso/gettimeofday.o
        /tmp/ccGQKoOj.s: Assembler messages:
        /tmp/ccGQKoOj.s:273: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:329: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:520: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:714: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1009: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1066: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1114: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1279: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1334: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1374: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1459: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1514: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:1814: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:2002: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        /tmp/ccGQKoOj.s:2066: Error: opcode not supported on this processor: mips1 (mips1) `sync'
        make[2]: *** [scripts/Makefile.build:318: arch/mips/vdso/gettimeofday.o] Error 1
        make[1]: *** [scripts/Makefile.build:558: arch/mips/vdso] Error 2
        make[1]: *** Waiting for unfinished jobs....
      
      This can be reproduced for example by attempting to build
      pistachio_defconfig using Arnd's GCC 8.1.0 mips64 toolchain from
      kernel.org:
      
        https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.1.0/x86_64-gcc-8.1.0-nolibc-mips64-linux.tar.xz
      
      Resolve this problem by using the long-form -march=<arch> in all cases,
      which makes it through the arch/mips/vdso/Makefile's filtering & is thus
      consistently used to build both the kernel proper & the VDSO.
      
      The use of cc-option to prefer the long-form & fall back to the
      short-form flags makes no sense since the short-form is just an
      abbreviation for the also-supported long-form in all GCC versions that
      we support building with. This means there is no case in which we have
      to use the short-form -<arch> flags, so we can simply remove them.
      
      The manual redefinition of _MIPS_ISA is removed naturally along with the
      use of the short-form flags that it accompanied, and whilst here we
      remove the separate assembler ISA selection. I suspect that both of
      these were only required due to the mips32 vs mips2 mismatch that was
      introduced by commit 59b3e8e9 ("[MIPS] Makefile crapectomy.") and
      fixed but not cleaned up by commit 9200c0b2 ("[MIPS] Fix Makefile
      bugs for MIPS32/MIPS64 R1 and R2.").
      
      I've marked this for backport as far as v4.4 where the MIPS VDSO was
      introduced. In earlier kernels there should be no ill effect to using
      the short-form flags.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org # v4.4+
      Reviewed-by: default avatarJames Hogan <jhogan@kernel.org>
      Patchwork: https://patchwork.linux-mips.org/patch/19579/
      344ebf09
    • Joe Perches's avatar
      MIPS: ath25: Convert random_ether_addr to eth_random_addr · 8e5c88bf
      Joe Perches authored
      random_ether_addr is a #define for eth_random_addr which is
      generally preferred in kernel code by ~3:1
      
      Convert the uses of random_ether_addr to enable removing the #define
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/19600/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@linux-mips.org
      8e5c88bf
    • Paul Burton's avatar
      MIPS: Annotate cpu_wait implementations with __cpuidle · 97c8580e
      Paul Burton authored
      Annotate cpu_wait implementations using the __cpuidle macro which
      places these functions in the .cpuidle.text section. This allows
      cpu_in_idle() to return true for PC values which fall within these
      functions, allowing nmi_backtrace() to produce cleaner output for CPUs
      running idle functions. For example:
      
        # echo l >/proc/sysrq-trigger
        [   38.587170] sysrq: SysRq : Show backtrace of all active CPUs
        [   38.593657] NMI backtrace for cpu 1
        [   38.597611] CPU: 1 PID: 161 Comm: sh Not tainted 4.18.0-rc1+ #27
        [   38.604306] Stack : 00000000 00000004 00000006 80486724 00000000 00000000 00000000 00000000
        [   38.613647]         80e17eda 00000034 00000000 00000000 80d20000 80b67e98 8e559c90 0ffe1e88
        [   38.622986]         00000000 00000000 80e70000 00000000 8f61db18 38312e34 722d302e 202b3163
        [   38.632324]         8e559d3c 8e559adc 00000001 6b636162 80d20000 80000000 00000000 80d1cfa4
        [   38.641664]         00000001 80d20000 80d19520 00000000 00000003 80836724 00000004 80e10004
        [   38.650993]         ...
        [   38.653724] Call Trace:
        [   38.656499] [<8040cdd0>] show_stack+0xa0/0x144
        [   38.661475] [<80b67e98>] dump_stack+0xe8/0x120
        [   38.666455] [<80b6f6d4>] nmi_cpu_backtrace+0x1b4/0x1cc
        [   38.672189] [<80b6f81c>] nmi_trigger_cpumask_backtrace+0x130/0x1e4
        [   38.679081] [<808295d8>] __handle_sysrq+0xc0/0x180
        [   38.684421] [<80829b84>] write_sysrq_trigger+0x50/0x64
        [   38.690176] [<8061c984>] proc_reg_write+0xd0/0xfc
        [   38.695447] [<805aac1c>] __vfs_write+0x54/0x194
        [   38.700500] [<805aaf24>] vfs_write+0xe0/0x18c
        [   38.705360] [<805ab190>] ksys_write+0x7c/0xf0
        [   38.710238] [<80416018>] syscall_common+0x34/0x58
        [   38.715558] Sending NMI from CPU 1 to CPUs 0,2-3:
        [   38.720916] NMI backtrace for cpu 0 skipped: idling at r4k_wait_irqoff+0x2c/0x34
        [   38.729186] NMI backtrace for cpu 3 skipped: idling at r4k_wait_irqoff+0x2c/0x34
        [   38.737449] NMI backtrace for cpu 2 skipped: idling at r4k_wait_irqoff+0x2c/0x34
      
      Without this we get register value & backtrace output from all CPUs,
      which is generally useless for those running the idle function & serves
      only to overwhelm & obfuscate the meaningful output from non-idle CPUs.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/19598/
      97c8580e
  11. 24 Jun, 2018 1 commit