1. 08 May, 2020 2 commits
    • Tiezhu Yang's avatar
      MIPS: Loongson: Add DMA support for LS7A · 68fbb972
      Tiezhu Yang authored
      In the current market, the most used bridge chip on the Loongson platform
      are RS780E and LS7A, the RS780E bridge chip is already supported by the
      mainline kernel.
      
      If use the default implementation of __phys_to_dma() and __dma_to_phys()
      in dma-direct.h when CONFIG_ARCH_HAS_PHYS_TO_DMA is not set, it works
      well used with LS7A on the Loongson single-way and multi-way platform,
      and also works well used with RS780E on the Loongson single-way platform,
      but the DMA address will be wrong on the non-node0 used with RS780E on
      the Loongson multi-way platform.
      
      Just as the description in the code comment, the devices get node id from
      40 bit of HyperTransport bus, so we extract 2 bit node id (bit 44~45) from
      48 bit address space of Loongson CPU and embed it into HyperTransport bus
      (bit 37-38), this operation can be done only at the software level used
      with RS780E on the Loongson multi-way platform, because it has no hardware
      function to translate address of node id, this is a hardware compatibility
      problem.
      
      Device
          |
          | DMA address
          |
      Host Bridge
          |
          | HT bus address (40 bit)
          |
         CPU
          |
          | physical address (48 bit)
          |
         RAM
      
      The LS7A has dma_node_id_offset field in the DMA route config register,
      the hardware can use the dma_node_id_offset to translate address of
      node id automatically, so we can get correct address when just use the
      dma_pfn_offset field in struct device.
      
      For the above reasons, in order to maintain downward compatibility
      to support the RS780E bridge chip, it is better to use the platform
      dependent implementation of __phys_to_dma() and __dma_to_phys().
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      68fbb972
    • Huacai Chen's avatar
      MIPS: inst.h: Stop including asm.h to avoid various build failures · e701656e
      Huacai Chen authored
      Commit d339cd02 ("MIPS: Move unaligned load/store helpers to
      inst.h") causes a lot of build failures because macros in asm.h conflict
      with various subsystems. Some of these conflictions has been fixed (such
      as LONG, PANIC and PRINT) by adjusting asm.h, but some of them is nearly
      impossible to fix (such as PTR and END). The only reason of including
      asm.h in inst.h is that we need the PTR macro which is used by unaligned
      load/store helpers. So in this patch we define a new PTR_STR macro and
      use it to replace STR(PTR), then we can stop including asm.h to avoid
      various build failures.
      
      Fixes: d339cd02 ("MIPS: Move unaligned load/store helpers to inst.h")
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      e701656e
  2. 07 May, 2020 9 commits
  3. 04 May, 2020 1 commit
  4. 02 May, 2020 3 commits
  5. 30 Apr, 2020 3 commits
  6. 29 Apr, 2020 9 commits
  7. 28 Apr, 2020 2 commits
  8. 26 Apr, 2020 3 commits
    • Jiaxun Yang's avatar
      MIPS: Kernel: Identify Loongson-2K processors · 0cf2ea11
      Jiaxun Yang authored
      Loongson-2K (Loongson64 Reduced) is a family of SoC shipped with
      gs264e core.
      Signed-off-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      0cf2ea11
    • Tiezhu Yang's avatar
      MIPS: Loongson: Add support for perf tool · e2e13925
      Tiezhu Yang authored
      In order to use perf tool on the Loongson platform, we should enable kernel
      support for various performance events provided by software and hardware,
      so add CONFIG_PERF_EVENTS=y to loongson3_defconfig.
      
      E.g. without this patch:
      
      [loongson@localhost perf]$ ./perf list
      
      List of pre-defined events (to be used in -e):
      
        duration_time                                      [Tool event]
      
        rNNN                                               [Raw hardware event descriptor]
        cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descriptor]
         (see 'man perf-list' on how to encode it)
      
        mem:<addr>[/len][:access]                          [Hardware breakpoint]
      
      With this patch:
      
      [loongson@localhost perf]$ ./perf list
      
      List of pre-defined events (to be used in -e):
      
        branch-instructions OR branches                    [Hardware event]
        branch-misses                                      [Hardware event]
        cpu-cycles OR cycles                               [Hardware event]
        instructions                                       [Hardware event]
      
        alignment-faults                                   [Software event]
        bpf-output                                         [Software event]
        context-switches OR cs                             [Software event]
        cpu-clock                                          [Software event]
        cpu-migrations OR migrations                       [Software event]
        dummy                                              [Software event]
        emulation-faults                                   [Software event]
        major-faults                                       [Software event]
        minor-faults                                       [Software event]
        page-faults OR faults                              [Software event]
        task-clock                                         [Software event]
      
        duration_time                                      [Tool event]
      
        L1-dcache-load-misses                              [Hardware cache event]
        L1-dcache-store-misses                             [Hardware cache event]
        L1-icache-load-misses                              [Hardware cache event]
        branch-load-misses                                 [Hardware cache event]
        branch-loads                                       [Hardware cache event]
        dTLB-load-misses                                   [Hardware cache event]
        dTLB-store-misses                                  [Hardware cache event]
        iTLB-load-misses                                   [Hardware cache event]
      
        rNNN                                               [Raw hardware event descriptor]
        cpu/t1=v1[,t2=v2,t3 ...]/modifier                  [Raw hardware event descriptor]
         (see 'man perf-list' on how to encode it)
      
        mem:<addr>[/len][:access]                          [Hardware breakpoint]
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      e2e13925
    • Huacai Chen's avatar
      MIPS: Rename the "Fill" cache ops to avoid build failure · a44f8309
      Huacai Chen authored
      MIPS define a "Fill" macro as a cache operation in cacheops.h, this
      will cause build failure under some special configurations because in
      seq_file.c there is a "Fill" label. To avoid this failure we rename the
      "Fill" macro to "Fill_I" which has the same coding style as other cache
      operations in cacheops.h (we think renaming the "Fill" macro is more
      reasonable than renaming the "Fill" label).
      
      Callers of "Fill" macro is also updated.
      Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      a44f8309
  9. 24 Apr, 2020 5 commits
  10. 21 Apr, 2020 3 commits
    • Christoph Hellwig's avatar
      ASoC: txx9: add back the hack for a too small resource_size_t · 6abf4a2f
      Christoph Hellwig authored
      Looks like I misread the Kconfig magic and this driver can be compiled
      into 32-bit kernels.  Add back the hack to extent the range of the
      resource_size_t, and include the header with the txx9-specific ioremap
      magic for that.
      
      Fixes: acfaaf52 ("ASoC: txx9: don't work around too small resource_size_t")
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Acked-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      6abf4a2f
    • Tiezhu Yang's avatar
      MIPS: Make sparse_init() using top-down allocation · 269b3a9a
      Tiezhu Yang authored
      In the current code, if CONFIG_SWIOTLB is set, when failed to get IO TLB
      memory from the low pages by plat_swiotlb_setup(), it may lead to the boot
      process failed with kernel panic.
      
      (1) On the Loongson and SiByte platform
      arch/mips/loongson64/dma.c
      arch/mips/sibyte/common/dma.c
      void __init plat_swiotlb_setup(void)
      {
      	swiotlb_init(1);
      }
      
      kernel/dma/swiotlb.c
      void  __init
      swiotlb_init(int verbose)
      {
      ...
      	vstart = memblock_alloc_low(PAGE_ALIGN(bytes), PAGE_SIZE);
      	if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, verbose))
      		return;
      ...
      	pr_warn("Cannot allocate buffer");
      	no_iotlb_memory = true;
      }
      
      phys_addr_t swiotlb_tbl_map_single()
      {
      ...
      	if (no_iotlb_memory)
      		panic("Can not allocate SWIOTLB buffer earlier ...");
      ...
      }
      
      (2) On the Cavium OCTEON platform
      arch/mips/cavium-octeon/dma-octeon.c
      void __init plat_swiotlb_setup(void)
      {
      ...
      	octeon_swiotlb = memblock_alloc_low(swiotlbsize, PAGE_SIZE);
      	if (!octeon_swiotlb)
      		panic("%s: Failed to allocate %zu bytes align=%lx\n",
      		      __func__, swiotlbsize, PAGE_SIZE);
      ...
      }
      
      Because IO_TLB_DEFAULT_SIZE is 64M, if the rest size of low memory is less
      than 64M when call plat_swiotlb_setup(), we can easily reproduce the panic
      case.
      
      In order to reduce the possibility of kernel panic when failed to get IO
      TLB memory under CONFIG_SWIOTLB, it is better to allocate low memory as
      small as possible before plat_swiotlb_setup(), so make sparse_init() using
      top-down allocation.
      Reported-by: default avatarJuxin Gao <gaojuxin@loongson.cn>
      Co-developed-by: default avatarJuxin Gao <gaojuxin@loongson.cn>
      Signed-off-by: default avatarJuxin Gao <gaojuxin@loongson.cn>
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      269b3a9a
    • Tiezhu Yang's avatar
      MIPS: Cleanup code about plat_mem_setup() · 2a3d47c9
      Tiezhu Yang authored
      In the current code, plat_mem_setup() is called by arch_mem_init() instead
      of setup_arch() and has been declared in asm/bootinfo.h, so modify the code
      comment to reflect the reality and remove the useless duplicate declartion
      in arch/mips/kernel/setup.c.
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
      2a3d47c9