1. 30 Jul, 2018 3 commits
    • Paul Burton's avatar
      MIPS: Allow auto-dection of ARCH_PFN_OFFSET & PHYS_OFFSET · 6c359eb1
      Paul Burton authored
      On systems where physical memory begins at a non-zero address, defining
      PHYS_OFFSET (which influences ARCH_PFN_OFFSET) can save us time & memory
      by avoiding book-keeping for pages from address zero to the start of
      memory.
      
      Some MIPS platforms already make use of this, but with the definition of
      PHYS_OFFSET being compile-time constant it hasn't been possible to
      enable this optimization for a kernel which may run on systems with
      varying physical memory base addresses.
      
      Introduce a new Kconfig option CONFIG_MIPS_AUTO_PFN_OFFSET which, when
      enabled, makes ARCH_PFN_OFFSET a variable & detects it from the boot
      memory map (which for example may have been populated from DT). The
      relationship with PHYS_OFFSET is reversed, with PHYS_OFFSET now being
      based on ARCH_PFN_OFFSET. This is because ARCH_PFN_OFFSET is used far
      more often, so avoiding the need for runtime calculation gives us a
      smaller impact on kernel text size (0.1% rather than 0.15% for
      64r6el_defconfig).
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Suggested-by: default avatarVladimir Kondratiev <vladimir.kondratiev@intel.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20048/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      6c359eb1
    • Paul Burton's avatar
      MIPS: Fix ISA virt/bus conversion for non-zero PHYS_OFFSET · 0494d7ff
      Paul Burton authored
      isa_virt_to_bus() & isa_bus_to_virt() claim to treat ISA bus addresses
      as being identical to physical addresses, but they fail to do so in the
      presence of a non-zero PHYS_OFFSET.
      
      Correct this by having them use virt_to_phys() & phys_to_virt(), which
      consolidates the calculations to one place & ensures that ISA bus
      addresses do indeed match physical addresses.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20047/
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
      0494d7ff
    • Paul Burton's avatar
      MIPS: Make (UN)CAC_ADDR() PHYS_OFFSET-agnostic · 0d0e1477
      Paul Burton authored
      Converting an address between cached & uncached (typically addresses in
      (c)kseg0 & (c)kseg1 or 2 xkphys regions) should not depend upon
      PHYS_OFFSET in any way - we're converting from a virtual address in one
      unmapped region to a virtual address in another unmapped region.
      
      For some reason our CAC_ADDR() & UNCAC_ADDR() macros make use of
      PAGE_OFFSET, which typically includes PHYS_OFFSET. This means that
      platforms with a non-zero PHYS_OFFSET typically have to workaround
      miscalculation by these 2 macros by also defining UNCAC_BASE to a value
      that isn't really correct.
      
      It appears that an attempt has previously been made to address this with
      commit 3f4579252aa1 ("MIPS: make CAC_ADDR and UNCAC_ADDR account for
      PHYS_OFFSET") which was later undone by commit ed3ce16c ("Revert
      "MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET"") which
      also introduced the ar7 workaround. That attempt at a fix was roughly
      equivalent, but essentially caused the CAC_ADDR() & UNCAC_ADDR() macros
      to cancel out PHYS_OFFSET by adding & then subtracting it again. In his
      revert Leonid is correct that using PHYS_OFFSET makes no sense in the
      context of these macros, but appears to have missed its inclusion via
      PAGE_OFFSET which means PHYS_OFFSET actually had an effect after the
      revert rather than before it.
      
      Here we fix this by modifying CAC_ADDR() & UNCAC_ADDR() to stop using
      PAGE_OFFSET (& thus PHYS_OFFSET), instead using __pa() & __va() along
      with UNCAC_BASE.
      
      For UNCAC_ADDR(), __pa() will convert a cached address to a physical
      address which we can simply use as an offset from UNCAC_BASE to obtain
      an address in the uncached region.
      
      For CAC_ADDR() we can undo the effect of UNCAC_ADDR() by subtracting
      UNCAC_BASE and using __va() on the result.
      
      With this change made, remove definitions of UNCAC_BASE from the ar7 &
      pic32 platforms which appear to have defined them only to workaround
      this problem.
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      References: 3f4579252aa1 ("MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET")
      References: ed3ce16c ("Revert "MIPS: make CAC_ADDR and UNCAC_ADDR account for PHYS_OFFSET"")
      Patchwork: https://patchwork.linux-mips.org/patch/20046/
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: Vladimir Kondratiev <vladimir.kondratiev@intel.com>
      0d0e1477
  2. 28 Jul, 2018 4 commits
  3. 27 Jul, 2018 1 commit
    • Christoph Hellwig's avatar
      MIPS: remove mips_swiotlb_ops · a999933d
      Christoph Hellwig authored
      mips_swiotlb_ops differs from the generic swiotlb_dma_ops only in that
      it contains a mb() barrier after each operations that maps or syncs
      dma memory to the device.
      
      The dma operations are defined to not be memory barriers, but instead
      the write* operations to kick the DMA off are supposed to contain them.
      
      For mips this handled by war_io_reorder_wmb(), which evaluates to the
      stronger wmb() instead of the pure compiler barrier barrier() for
      just those platforms that use swiotlb, so I think we are covered
      properly.
      
      [paul.burton@mips.com:
        - Include linux/swiotlb.h to fix build failures for configs with
          CONFIG_SWIOTLB=y.]
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20038/
      Cc: David Daney <ddaney@caviumnetworks.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: linux-mips@linux-mips.org
      Cc: iommu@lists.linux-foundation.org
      Cc: linux-kernel@vger.kernel.org
      a999933d
  4. 26 Jul, 2018 5 commits
  5. 25 Jul, 2018 11 commits
  6. 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
  7. 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
  8. 20 Jul, 2018 1 commit
  9. 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