1. 29 6月, 2017 19 次提交
  2. 28 6月, 2017 21 次提交
    • H
      MIPS: Loongson: Add Loongson-3A R3 basic support · 0a00024d
      Huacai Chen 提交于
      Loongson-3A R3 is very similar to Loongson-3A R2.
      
      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-3B R1  Loongson-3B1000  0x6306
      Loongson-3B R2  Loongson-3B1500  0x6307
      Signed-off-by: NHuacai Chen <chenhc@lemote.com>
      Cc: John Crispin <john@phrozen.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
      Patchwork: https://patchwork.linux-mips.org/patch/16585/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      0a00024d
    • P
      MIPS: SEAD-3: Fix GIC interrupt specifiers · d3f61634
      Paul Burton 提交于
      The various interrupt specifiers in the device tree are not in a valid
      format for the MIPS GIC interrupt controller binding. Where each
      interrupt should provide 3 values - GIC_LOCAL or GIC_SHARED, the
      pin number & the type of interrupt - the device tree was only providing
      the pin number. This causes interrupts for those devices to not be used
      when a GIC is present. SEAD-3 systems without a GIC are unaffected since
      the DT fixup code generates interrupt specifiers that are valid for the
      CPU interrupt controller.
      
      Fix this by adding the GIC_SHARED & IRQ_TYPE_LEVEL_HIGH values to each
      interrupt specifier.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Fixes: c11e3b48 ("MIPS: SEAD3: Probe UARTs using DT")
      Fixes: a34e9388 ("MIPS: SEAD3: Probe ethernet controller using DT")
      Fixes: 7afd2a5a ("MIPS: SEAD3: Probe EHCI controller using DT")
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org  # v4.9+
      Patchwork: https://patchwork.linux-mips.org/patch/16189/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d3f61634
    • P
      MIPS: SEAD-3: Set interrupt-parent per-device, not at root node · fbdc674b
      Paul Burton 提交于
      The SEAD-3 board may be configured with or without a MIPS Global
      Interrupt Controller (GIC). Because of this we have a device tree with a
      default case of a GIC present, and code to fixup the device tree based
      upon a configuration register that indicates the presence of the GIC.
      
      In order to keep this DT fixup code simple, the interrupt-parent
      property was specified at the root node of the SEAD-3 DT, allowing the
      fixup code to simply change this property to the phandle of the CPU
      interrupt controller if a GIC is not present & affect all
      interrupt-using devices at once. This however causes a problem if we do
      have a GIC & the device tree is used as-is, because the interrupt-parent
      property of the root node applies to the CPU interrupt controller node.
      This causes a cycle when of_irq_init() attempts to probe interrupt
      controllers in order and boots fail due to a lack of configured
      interrupts, with this message printed on the kernel console:
      
      [    0.000000] OF: of_irq_init: children remain, but no parents
      
      Fix this by removing the interrupt-parent property from the DT root node
      & instead setting it for each device which uses interrupts, ensuring
      that the CPU interrupt controller node has no interrupt-parent &
      allowing of_irq_init() to identify it as the root interrupt controller.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Reported-by: NKeng Koh <keng.koh@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16187/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      fbdc674b
    • P
      MIPS: generic: Set RTC_ALWAYS_BCD to 0 · ae7ce6b1
      Paul Burton 提交于
      Drivers for the mc146818 RTC generally check control registers to
      determine whether a value is encoded as binary or as a binary coded
      decimal. Setting RTC_ALWAYS_BCD to 1 effectively bypasses these checks
      and causes drivers to always expect binary coded decimal values,
      regardless of control register values.
      
      This does not seem like a sane default - defaulting to 0 allows the
      drivers to check control registers to determine encoding type & allows
      the driver to work generically with both binary & BCD encodings. Set
      this in mach-generic/mc146818rtc.h such that the generic kernel, or
      platforms which don't provide a custom mc146818rtc.h, can have an RTC
      driver which works with both encodings.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16185/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ae7ce6b1
    • P
      MIPS: generic: Abstract FDT fixup application · e889dfca
      Paul Burton 提交于
      Introduce an apply_mips_fdt_fixups() function which can apply fixups to
      an FDT based upon an array of fixup descriptions. This abstracts that
      functionality such that legacy board code can apply FDT fixups without
      requiring lots of duplication.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16184/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e889dfca
    • P
      MIPS: generic/yamon-dt: Use serial* rather than uart* aliases · c3d62fc6
      Paul Burton 提交于
      Name aliases in the SEAD-3 device tree serial0 & serial1, rather than
      uart0 & uart1. This allows the core serial code to make use of the
      aliases to ensure that the UARTs are consistently numbered as expected
      rather than having the numbering depend upon probe order.
      
      When translating YAMON-provided serial configuration to a device tree
      stdout-path property adjust accordingly, such that we continue to
      reference a valid alias.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16183/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      c3d62fc6
    • P
      MIPS: generic/yamon-dt: Support > 256MB of RAM · f41d2430
      Paul Burton 提交于
      YAMON can expose more than 256MB of RAM to Linux on Malta by passing an
      ememsize environment variable with the full size, but the kernel then
      needs to be careful to choose the corresponding physical memory regions,
      avoiding the IO memory window. This is platform dependent, and on Malta
      it also depends on the memory layout which varies between system
      controllers.
      
      Extend yamon_dt_amend_memory() to generically handle this by taking
      [e]memsize bytes of memory from an array of memory regions passed in as
      a new parameter. Board code provides this array as appropriate depending
      on its own memory map.
      
      [paul.burton@imgtec.com: SEAD-3 supports 384MB DDR from 0]
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16182/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      f41d2430
    • P
      MIPS: generic/yamon-dt: Pull YAMON DT shim code out of SEAD-3 board · 571b7e69
      Paul Burton 提交于
      In preparation for supporting other YAMON-using boards (Malta) & sharing
      code to translate information from YAMON into device tree properties,
      pull the code doing so for the kernel command line, system memory &
      serial configuration out of the SEAD-3 board code.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16181/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      571b7e69
    • P
      MIPS: SEAD-3: Remove GIC timer from DT · efe4a1ac
      Paul Burton 提交于
      The SEAD-3 board doesn't & never has configured the GIC frequency.
      Remove the timer node from the DT in order to avoid attempting to probe
      the GIC clocksource/clockevent driver which will produce error messages
      such as these during boot:
      
      [    0.000000] GIC frequency not specified.
      [    0.000000] Failed to initialize '/interrupt-controller@1b1c0000/timer': -22
      [    0.000000] clocksource_probe: no matching clocksources found
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16188/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      efe4a1ac
    • J
      MIPS: Branch straight to ll in mips_atomic_set() · 203e090a
      James Hogan 提交于
      Adjust the atomic loop in the MIPS_ATOMIC_SET operation of the sysmips
      system call to branch straight back to the linked load rather than
      jumping via a different subsection (whose purpose remains a mystery to
      me).
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16150/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      203e090a
    • J
      MIPS: Fix mips_atomic_set() with EVA · 4915e1b0
      James Hogan 提交于
      EVA linked loads (LLE) and conditional stores (SCE) should be used on
      EVA kernels for the MIPS_ATOMIC_SET operation of the sysmips system
      call, or else the atomic set will apply to the kernel view of the
      virtual address space (potentially unmapped on EVA kernels) rather than
      the user view (TLB mapped).
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.15.x-
      Patchwork: https://patchwork.linux-mips.org/patch/16151/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4915e1b0
    • J
      MIPS: Save static registers before sysmips · 49955d84
      James Hogan 提交于
      The MIPS sysmips system call handler may return directly from the
      MIPS_ATOMIC_SET case (mips_atomic_set()) to syscall_exit. This path
      restores the static (callee saved) registers, however they won't have
      been saved on entry to the system call.
      
      Use the save_static_function() macro to create a __sys_sysmips wrapper
      function which saves the static registers before calling sys_sysmips, so
      that the correct static register state is restored by syscall_exit.
      
      Fixes: f1e39a4a ("MIPS: Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16149/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      49955d84
    • J
      MIPS: Fix mips_atomic_set() retry condition · 2ec420b2
      James Hogan 提交于
      The inline asm retry check in the MIPS_ATOMIC_SET operation of the
      sysmips system call has been backwards since commit f1e39a4a ("MIPS:
      Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
      merged in v2.6.32, resulting in the non R10000_LLSC_WAR case retrying
      until the operation was inatomic, before returning the new value that
      was probably just written multiple times instead of the old value.
      
      Invert the branch condition to fix that particular issue.
      
      Fixes: f1e39a4a ("MIPS: Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16148/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      2ec420b2
    • M
      MIPS: perf: add I6500 handling · 736add24
      Marcin Nowakowski 提交于
      Add a definition of the perf registers for the new I6500 core.
      
      Since I6500 has the same event definitions as I6400, re-use the existing
      i6400 map structures by renaming them to a slightly more generic
      'i6x00_***_map'.
      Signed-off-by: NMarcin Nowakowski <marcin.nowakowski@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16362/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      736add24
    • P
      MIPS: Probe the I6500 CPU · 859aeb1b
      Paul Burton 提交于
      Introduce the I6500 PRID & probe it just the same way as I6400. The MIPS
      I6500 is the latest in Imagination Technologies' I-Class range of CPUs,
      with a focus on scalability & heterogeneity. It introduces the notion of
      multiple clusters to the MIPS Coherent Processing System, allowing for a
      far higher total number of cores & threads in a system when compared
      with its predecessors. Clusters don't need to be identical, and may
      contain differing numbers of cores & IOCUs, or cores with differing
      properties.
      
      This patch alone adds the basic support for booting Linux on an I6500
      CPU without support for any of its new functionality, for which support
      will be introduced in further patches.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16190/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      859aeb1b
    • P
      MIPS: Perform post-DMA cache flushes on systems with MAARs · 498e9ade
      Paul Burton 提交于
      Recent CPUs from Imagination Technologies such as the I6400 or P6600 are
      able to speculatively fetch data from memory into caches. This means
      that if used in a system with non-coherent DMA they require that caches
      be invalidated after a device performs DMA, and before the CPU reads the
      DMA'd data, in order to ensure that stale values weren't speculatively
      prefetched.
      
      Such CPUs also introduced Memory Accessibility Attribute Registers
      (MAARs) in order to control the regions in which they are allowed to
      speculate. Thus we can use the presence of MAARs as a good indication
      that the CPU requires the above cache maintenance. Use the presence of
      MAARs to determine the result of cpu_needs_post_dma_flush() in the
      default case, in order to handle these recent CPUs correctly.
      
      Note that the return type of cpu_needs_post_dma_flush() is changed to
      bool, such that it's clearer what's happening when cpu_has_maar is cast
      to bool for the return value. If this patch were backported to a
      pre-v4.7 kernel then MIPS_CPU_MAAR was 1ull<<34, so when cast to an int
      we would incorrectly return 0. It so happens that MIPS_CPU_MAAR is
      currently 1ull<<30, so when truncated to an int gives a non-zero value
      anyway, but even so the implicit conversion from long long int to bool
      makes it clearer to understand what will happen than the implicit
      conversion from long long int to int would. The bool return type also
      fits this usage better semantically, so seems like an all-round win.
      
      Thanks to Ed for spotting the issue for pre-v4.7 kernels & suggesting
      the return type change.
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Reviewed-by: NBryan O'Donoghue <pure.logic@nexus-software.ie>
      Tested-by: NBryan O'Donoghue <pure.logic@nexus-software.ie>
      Cc: Ed Blake <ed.blake@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16363/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      498e9ade
    • D
      MIPS: Give __secure_computing() access to syscall arguments. · 669c4092
      David Daney 提交于
      KProbes of __seccomp_filter() are not very useful without access to
      the syscall arguments.
      
      Do what x86 does, and populate a struct seccomp_data to be passed to
      __secure_computing().  This allows samples/bpf/tracex5 to extract a
      sensible trace.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16368/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      669c4092
    • D
      MIPS: Add support for eBPF JIT. · f381bf6d
      David Daney 提交于
      Since the eBPF machine has 64-bit registers, we only support this in
      64-bit kernels.  As of the writing of this commit log test-bpf is showing:
      
        test_bpf: Summary: 316 PASSED, 0 FAILED, [308/308 JIT'ed]
      
      All current test cases are successfully compiled.
      
      Many examples in samples/bpf are usable, specifically tracex5 which
      uses tail calls works.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16369/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      f381bf6d
    • D
      MIPS: Add some instructions to uasm. · dc190129
      David Daney 提交于
      Follow on patches for eBPF JIT require these additional instructions:
      
         insn_bgtz, insn_blez, insn_break, insn_ddivu, insn_dmultu,
         insn_dsbh, insn_dshd, insn_dsllv, insn_dsra32, insn_dsrav,
         insn_dsrlv, insn_lbu, insn_movn, insn_movz, insn_multu, insn_nor,
         insn_sb, insn_sh, insn_slti, insn_dinsu, insn_lwu
      
      ... so, add them.
      
      Sort the insn_* enumeration values alphabetically.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16367/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      dc190129
    • D
      MIPS: Correctly define DBSHFL type instruction opcodes. · 1f22d599
      David Daney 提交于
      DSHD was incorrectly classified as being BSHFL, and DSHD was missing
      altogether.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16366/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      1f22d599
    • D
      MIPS: Optimize uasm insn lookup. · ce807d5f
      David Daney 提交于
      Instead of doing a linear search through the insn_table for each
      instruction, use the opcode as direct index into the table.  This will
      give constant time lookup performance as the number of supported
      opcodes increases.  Make the tables const as they are only ever read.
      For uasm-mips.c sort the table alphabetically, and remove duplicate
      entries, uasm-micromips.c was already sorted and duplicate free.
      There is a small savings in object size as struct insn loses a field:
      
      $ size arch/mips/mm/uasm-mips.o arch/mips/mm/uasm-mips.o.save
         text	   data	    bss	    dec	    hex	filename
        10040	      0	      0	  10040	   2738	arch/mips/mm/uasm-mips.o
         9240	   1120	      0	  10360	   2878	arch/mips/mm/uasm-mips.o.save
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16365/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ce807d5f