1. 16 Oct, 2018 9 commits
  2. 09 Oct, 2018 8 commits
    • Maciej W. Rozycki's avatar
      MIPS: Provide actually relaxed MMIO accessors · 8b656253
      Maciej W. Rozycki authored
      Improve performance for the relevant systems and remove the DMA ordering
      barrier from `readX_relaxed' and `writeX_relaxed' MMIO accessors, where
      it is not needed according to our requirements[1].  For consistency make
      the same arrangement with low-level port I/O accessors, but do not
      actually provide any accessors making use of it.
      
      References:
      
      [1] "LINUX KERNEL MEMORY BARRIERS", Documentation/memory-barriers.txt,
          Section "KERNEL I/O BARRIER EFFECTS"
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20865/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      8b656253
    • Maciej W. Rozycki's avatar
      MIPS: Enforce strong ordering for MMIO accessors · 3d474dac
      Maciej W. Rozycki authored
      Architecturally the MIPS ISA does not specify ordering requirements for
      uncached bus accesses such as MMIO operations normally use and therefore
      explicit barriers have to be inserted between MMIO accesses where
      unspecified ordering of operations would cause unpredictable results.
      
      For example the R2020 write buffer implements write gathering and
      combining[1] and as used with the DECstation models 2100 and 3100 for
      MMIO accesses it bypasses the read buffer entirely, because conflicts
      are resolved by the memory controller for DRAM accesses only[2] (NB the
      R2020 and R3020 buffers are the same except for the maximum clock rate).
      
      Consequently if a device has say a 16-bit control register at offset 0,
      a 16-bit event mask register at offset 2 and a 16-bit reset register at
      offset 4, and the initial value of the control register is 0x1111, then
      in the absence of barriers a hypothetical code sequence like this:
      
      u16 init_dev(u16 __iomem *dev);
      	u16 x;
      
      	write16(dev + 2, 0xffff);
      	write16(dev + 0, 0x2222);
      	x = read16(dev + 0);
      	write16(dev + 1, 0x3333);
      	write16(dev + 0, 0x4444);
      
      	return x;
      }
      
      will return 0x1111 and issue a single 32-bit write of 0x33334444 (in the
      little-endian bus configuration) to offset 0 on the system bus.
      
      This is because the read to set `x' from offset 0 bypasses the write of
      0x2222 that is still in the write buffer pending the completion of the
      write of 0xffff to the reset register.  Then the write of 0x3333 to the
      event mask register is merged with the preceding write to the control
      register as they share the same word address, making it a 32-bit write
      of 0x33332222 to offset 0.  Finally the write of 0x4444 to the control
      register is combined with the outstanding 32-bit write of 0x33332222 to
      offset 0, because, again, it shares the same address.
      
      This is an example from a legacy system, given here because it is well
      documented and affects a machine we actually support.  But likewise
      modern MIPS systems may implement weak MMIO ordering, possibly even
      without having it clearly documented except for being compliant with the
      architecture specification with respect to the currently defined SYNC
      instruction variants[3].
      
      Considering the above and that we are required to implement MMIO
      accessors such that individual accesses made with them are strongly
      ordered with respect to each other[4], add the necessary barriers to our
      `inX', `outX', `readX' and `writeX' handlers, as well the associated
      special use variants.  It's up to platforms then to possibly define the
      respective barriers so as to expand to nil if no ordering enforcement is
      actually needed for a given system; SYNC is supposed to be as cheap as
      a NOP on strongly ordered MIPS implementations though.
      
      Retain the option to generate weakly-ordered accessors, so that the
      arrangement for `war_io_reorder_wmb' is not lost in case we need it for
      fully raw accessors in the future.  The reason for this is that it is
      unclear from commit 1e820da3 ("MIPS: Loongson-3: Introduce
      CONFIG_LOONGSON3_ENHANCEMENT") and especially commit 8faca49a
      ("MIPS: Modify core io.h macros to account for the Octeon Errata
      Core-301.") why they are needed there under the previous assumption that
      these accessors can be weakly ordered.
      
      References:
      
      [1] "LR3020 Write Buffer", LSI Logic Corporation, September 1988,
          Section "Byte Gathering", pp. 6-7
      
      [2] "DECstation 3100 Desktop Workstation Functional Specification",
          Digital Equipment Corporation, Revision 1.3, August 28, 1990,
          Section 6.1 "Processor", p. 4
      
      [3] "MIPS Architecture For Programmers, Volume II-A: The MIPS32
          Instruction Set Manual", Imagination Technologies LTD, Document
          Number: MD00086, Revision 6.06, December 15, 2016, Table 5.5
          "Encodings of the Bits[10:6] of the SYNC instruction; the SType
          Field", p. 409
      
      [4] "LINUX KERNEL MEMORY BARRIERS", Documentation/memory-barriers.txt,
          Section "KERNEL I/O BARRIER EFFECTS"
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      References: 8faca49a ("MIPS: Modify core io.h macros to account for the Octeon Errata Core-301.")
      References: 1e820da3 ("MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT")
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20864/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      3d474dac
    • Maciej W. Rozycki's avatar
      MIPS: Correct `mmiowb' barrier for `wbflush' platforms · a711d43c
      Maciej W. Rozycki authored
      Redefine `mmiowb' in terms of `iobarrier_w' so that it works correctly
      for MIPS I platforms, which have no SYNC machine instruction and use a
      call to `wbflush' instead.
      
      This doesn't change the semantics for CONFIG_CPU_CAVIUM_OCTEON, because
      `iobarrier_w' expands to `wmb', which is ultimately the same as the
      current arrangement.  For MIPS I platforms this not only makes any code
      that would happen to use `mmiowb' build and run, but it actually
      enforces the ordering required as well, as `iobarrier_w' has it already
      covered with the use of `wmb'.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20863/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      a711d43c
    • Maciej W. Rozycki's avatar
      MIPS: Define MMIO ordering barriers · 4ae0452b
      Maciej W. Rozycki authored
      Define MMIO ordering barriers as separate operations so as to allow
      making places where such a barrier is required distinct from places
      where a memory or a DMA barrier is needed.
      
      Architecturally MIPS does not specify ordering requirements for uncached
      bus accesses such as MMIO operations normally use and therefore explicit
      barriers have to be inserted between MMIO accesses where unspecified
      ordering of operations would cause unpredictable results.
      
      MIPS MMIO ordering barriers are implemented using the same underlying
      mechanism that memory or a DMA barrier ordering barriers use, that is
      either a suitable SYNC instruction or a platform-specific `wbflush'
      call.  However platforms may implement different ordering rules for
      different kinds of bus activity, so having a separate API makes it
      possible to remove unnecessary barriers and avoid a performance hit they
      may cause due to unrelated bus activity by making their implementation
      expand to nil while keeping the necessary ones.
      
      Also having distinct barriers for each kind of use makes it easier for
      the reader to understand what code has been intended to do.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20862/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      4ae0452b
    • Quentin Schulz's avatar
      MIPS: mscc: add PCB120 to the ocelot fitImage · 39249d77
      Quentin Schulz authored
      PCB120 and PCB123 are both development boards based on Microsemi Ocelot
      so let's use the same fitImage for both.
      Reviewed-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: default avatarQuentin Schulz <quentin.schulz@bootlin.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20871/
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: robh+dt@kernel.org
      Cc: mark.rutland@arm.com
      Cc: davem@davemloft.net
      Cc: andrew@lunn.ch
      Cc: f.fainelli@gmail.com
      Cc: allan.nielsen@microchip.com
      Cc: linux-mips@linux-mips.org
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: thomas.petazzoni@bootlin.com
      Cc: antoine.tenart@bootlin.com
      39249d77
    • Quentin Schulz's avatar
      MIPS: mscc: add DT for Ocelot PCB120 · 116edf6e
      Quentin Schulz authored
      The Ocelot PCB120 evaluation board is different from the PCB123 in that
      it has 4 external VSC8584 (or VSC8574) PHYs.
      
      It uses the SoC's second MDIO bus for external PHYs which have a
      reversed address on the bus (i.e. PHY4 is on address 3, PHY5 is on
      address 2, PHY6 on 1 and PHY7 on 0).
      
      Here is how the PHYs are connected to the switch ports:
      port 0: phy0 (internal)
      port 1: phy1 (internal)
      port 2: phy2 (internal)
      port 3: phy3 (internal)
      port 4: phy7
      port 5: phy4
      port 6: phy6
      port 9: phy5
      Reviewed-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Signed-off-by: default avatarQuentin Schulz <quentin.schulz@bootlin.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20869/
      Cc: ralf@linux-mips.org
      Cc: jhogan@kernel.org
      Cc: robh+dt@kernel.org
      Cc: mark.rutland@arm.com
      Cc: davem@davemloft.net
      Cc: andrew@lunn.ch
      Cc: f.fainelli@gmail.com
      Cc: allan.nielsen@microchip.com
      Cc: linux-mips@linux-mips.org
      Cc: devicetree@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: thomas.petazzoni@bootlin.com
      Cc: antoine.tenart@bootlin.com
      116edf6e
    • Maciej W. Rozycki's avatar
      MIPS: memset: Limit excessive `noreorder' assembly mode use · 68dec269
      Maciej W. Rozycki authored
      Rewrite to use the `reorder' assembly mode and remove manually scheduled
      delay slots except where GAS cannot schedule a delay-slot instruction
      due to a data dependency or a section switch (as is the case with the EX
      macro).  No change in machine code produced.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      [paul.burton@mips.com:
        Fix conflict with commit 932afdee ("MIPS: Add Kconfig variable for
        CPUs with unaligned load/store instructions")]
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20834/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      68dec269
    • Maciej W. Rozycki's avatar
      MIPS: memset: Fix CPU_DADDI_WORKAROUNDS `small_fixup' regression · 2f7619ae
      Maciej W. Rozycki authored
      Fix a commit 8a8158c8 ("MIPS: memset.S: EVA & fault support for
      small_memset") regression and remove assembly warnings:
      
      arch/mips/lib/memset.S: Assembler messages:
      arch/mips/lib/memset.S:243: Warning: Macro instruction expanded into multiple instructions in a branch delay slot
      
      triggering with the CPU_DADDI_WORKAROUNDS option set and this code:
      
      	PTR_SUBU	a2, t1, a0
      	jr		ra
      	 PTR_ADDIU	a2, 1
      
      This is because with that option in place the DADDIU instruction, which
      the PTR_ADDIU CPP macro expands to, becomes a GAS macro, which in turn
      expands to an LI/DADDU (or actually ADDIU/DADDU) sequence:
      
       13c:	01a4302f 	dsubu	a2,t1,a0
       140:	03e00008 	jr	ra
       144:	24010001 	li	at,1
       148:	00c1302d 	daddu	a2,a2,at
      	...
      
      Correct this by switching off the `noreorder' assembly mode and letting
      GAS schedule this jump's delay slot, as there is nothing special about
      it that would require manual scheduling.  With this change in place
      correct code is produced:
      
       13c:	01a4302f 	dsubu	a2,t1,a0
       140:	24010001 	li	at,1
       144:	03e00008 	jr	ra
       148:	00c1302d 	daddu	a2,a2,at
      	...
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Fixes: 8a8158c8 ("MIPS: memset.S: EVA & fault support for small_memset")
      Patchwork: https://patchwork.linux-mips.org/patch/20833/
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: stable@vger.kernel.org # 4.17+
      2f7619ae
  3. 28 Sep, 2018 2 commits
  4. 26 Sep, 2018 5 commits
  5. 25 Sep, 2018 2 commits
  6. 22 Sep, 2018 4 commits
  7. 21 Sep, 2018 1 commit
  8. 20 Sep, 2018 1 commit
  9. 18 Sep, 2018 2 commits
    • Huacai Chen's avatar
      MIPS: Loongson-3: Enable Store Fill Buffer at runtime · c824ad16
      Huacai Chen authored
      New Loongson-3 (Loongson-3A R2, Loongson-3A R3, and newer) has SFB
      (Store Fill Buffer) which can improve the performance of memory access.
      Now, SFB enablement is controlled by CONFIG_LOONGSON3_ENHANCEMENT, and
      the generic kernel has no benefit from SFB (even it is running on a new
      Loongson-3 machine). With this patch, we can enable SFB at runtime by
      detecting the CPU type (the expense is war_io_reorder_wmb() will always
      be a 'sync', which will hurt the performance of old Loongson-3).
      
      [paul.burton@mips.com: Further info from Huacai:
        In practise, I found that sometimes there are boot failures if I
        enable SFB/LPA in cpu_probe(). I don't know why because processor
        designers also haven't give me an explaination, but I think this may
        have some relationships to speculative execution.]
      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/20426/
      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>
      c824ad16
    • Huacai Chen's avatar
      MIPS/PCI: Call pcie_bus_configure_settings() to set MPS/MRRS · 2794f688
      Huacai Chen authored
      Call pcie_bus_configure_settings() on MIPS, like for other platforms.
      The function pcie_bus_configure_settings() makes sure the MPS (Max
      Payload Size) across the bus is uniform and provides the ability to
      tune the MRSS (Max Read Request Size) and MPS (Max Payload Size) to
      higher performance values. Some devices will not operate properly if
      these aren't set correctly because the firmware doesn't always do it.
      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/20649/
      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>
      2794f688
  10. 14 Sep, 2018 1 commit
    • Mike Rapoport's avatar
      mips: switch to NO_BOOTMEM · bcec54bf
      Mike Rapoport authored
      MIPS already has memblock support and all the memory is already registered
      with it.
      
      This patch replaces bootmem memory reservations with memblock ones and
      removes the bootmem initialization.
      
      Since memblock allocates memory in top-down mode, we ensure that memblock
      limit is max_low_pfn to prevent allocations from the high memory.
      
      To have the exceptions base in the lower 512M of the physical memory, its
      allocation in arch/mips/kernel/traps.c::traps_init() is using bottom-up
      mode.
      Signed-off-by: default avatarMike Rapoport <rppt@linux.vnet.ibm.com>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/20560/
      Cc: Serge Semin <fancer.lancer@gmail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-mm@kvack.org
      Cc: linux-kernel@vger.kernel.org
      bcec54bf
  11. 06 Sep, 2018 2 commits
  12. 05 Sep, 2018 2 commits
  13. 31 Aug, 2018 1 commit