1. 30 Jul, 2018 6 commits
    • Randy Dunlap's avatar
      arc: fix type warnings in arc/mm/cache.c · ec837d62
      Randy Dunlap authored
      Fix type warnings in arch/arc/mm/cache.c.
      
      ../arch/arc/mm/cache.c: In function 'flush_anon_page':
      ../arch/arc/mm/cache.c:1062:55: warning: passing argument 2 of '__flush_dcache_page' makes integer from pointer without a cast [-Wint-conversion]
        __flush_dcache_page((phys_addr_t)page_address(page), page_address(page));
                                                             ^~~~~~~~~~~~~~~~~~
      ../arch/arc/mm/cache.c:1013:59: note: expected 'long unsigned int' but argument is of type 'void *'
       void __flush_dcache_page(phys_addr_t paddr, unsigned long vaddr)
                                                   ~~~~~~~~~~~~~~^~~~~
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Elad Kanfi <eladkan@mellanox.com>
      Cc: Leon Romanovsky <leonro@mellanox.com>
      Cc: Ofer Levi <oferle@mellanox.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      ec837d62
    • Randy Dunlap's avatar
      arc: fix build errors in arc/include/asm/delay.h · 2423665e
      Randy Dunlap authored
      Fix build errors in arch/arc/'s delay.h:
      - add "extern unsigned long loops_per_jiffy;"
      - add <asm-generic/types.h> for "u64"
      
      In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32:
      ../arch/arc/include/asm/delay.h: In function '__udelay':
      ../arch/arc/include/asm/delay.h:61:12: error: 'u64' undeclared (first use in this function)
        loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32;
                  ^~~
      
      In file included from ../drivers/infiniband/hw/cxgb3/cxio_hal.c:32:
      ../arch/arc/include/asm/delay.h: In function '__udelay':
      ../arch/arc/include/asm/delay.h:63:37: error: 'loops_per_jiffy' undeclared (first use in this function)
        loops = ((u64) usecs * 4295 * HZ * loops_per_jiffy) >> 32;
                                           ^~~~~~~~~~~~~~~
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Elad Kanfi <eladkan@mellanox.com>
      Cc: Leon Romanovsky <leonro@mellanox.com>
      Cc: Ofer Levi <oferle@mellanox.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      2423665e
    • Randy Dunlap's avatar
      arc: [plat-eznps] fix printk warning in arc/plat-eznps/mtm.c · 9e2ea405
      Randy Dunlap authored
      Fix printk format warning in arch/arc/plat-eznps/mtm.c:
      
      In file included from ../include/linux/printk.h:7,
                       from ../include/linux/kernel.h:14,
                       from ../include/linux/list.h:9,
                       from ../include/linux/smp.h:12,
                       from ../arch/arc/plat-eznps/mtm.c:17:
      ../arch/arc/plat-eznps/mtm.c: In function 'set_mtm_hs_ctr':
      ../include/linux/kern_levels.h:5:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long int' [-Wformat=]
       #define KERN_SOH "\001"  /* ASCII Start Of Header */
                        ^~~~~~
      ../include/linux/kern_levels.h:11:18: note: in expansion of macro 'KERN_SOH'
       #define KERN_ERR KERN_SOH "3" /* error conditions */
                        ^~~~~~~~
      ../include/linux/printk.h:308:9: note: in expansion of macro 'KERN_ERR'
        printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
               ^~~~~~~~
      ../arch/arc/plat-eznps/mtm.c:166:3: note: in expansion of macro 'pr_err'
         pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",
         ^~~~~~
      ../arch/arc/plat-eznps/mtm.c:166:40: note: format string is defined here
         pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n",
                                             ~^
                                             %ld
      The hs_ctr variable can just be int instead of long, so also change
      kstrtol() to kstrtoint() and leave the format string as %d.
      
      Also add 2 header files since they are used in mtm.c and we prefer
      not to depend on accidental/indirect #includes.
      
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Ofer Levi <oferle@mellanox.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      9e2ea405
    • Randy Dunlap's avatar
      arc: [plat-eznps] fix data type errors in platform headers · b1f32ce1
      Randy Dunlap authored
      Add <linux/types.h> to fix build errors.
      Both ctop.h and <soc/nps/common.h> use u32 types and cause many
      errors.
      
      Examples:
      ../include/soc/nps/common.h:71:4: error: unknown type name 'u32'
          u32 __reserved:20, cluster:4, core:4, thread:4;
      ../include/soc/nps/common.h:76:3: error: unknown type name 'u32'
         u32 value;
      ../include/soc/nps/common.h:124:4: error: unknown type name 'u32'
          u32 base:8, cl_x:4, cl_y:4,
      ../include/soc/nps/common.h:127:3: error: unknown type name 'u32'
         u32 value;
      
      ../arch/arc/plat-eznps/include/plat/ctop.h:83:4: error: unknown type name 'u32'
          u32 gen:1, gdis:1, clk_gate_dis:1, asb:1,
      ../arch/arc/plat-eznps/include/plat/ctop.h:86:3: error: unknown type name 'u32'
         u32 value;
      ../arch/arc/plat-eznps/include/plat/ctop.h:93:4: error: unknown type name 'u32'
          u32 csa:22, dmsid:6, __reserved:3, cs:1;
      ../arch/arc/plat-eznps/include/plat/ctop.h:95:3: error: unknown type name 'u32'
         u32 value;
      
      Cc: linux-snps-arc@lists.infradead.org
      Cc: Ofer Levi <oferle@mellanox.com>
      Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      b1f32ce1
    • Ofer Levi's avatar
      ARC: [plat-eznps] Add missing struct nps_host_reg_aux_dpc · 05b466bf
      Ofer Levi authored
      Fixing compilation issue caused by missing struct nps_host_reg_aux_dpc
      definition.
      
      Fixes: 3f9cd874 ("ARC: [plat-eznps] avoid toggling of DPC register")
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarOfer Levi <oferle@mellanox.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      05b466bf
    • Eugeniy Paltsev's avatar
      ARC: add SMP_CACHE_BYTES value validate · 386177da
      Eugeniy Paltsev authored
      Check that SMP_CACHE_BYTES (and hence ARCH_DMA_MINALIGN) is larger
      or equal to any cache line length by comparing it with values
      previously read from ARC cache BCR registers.
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      386177da
  2. 27 Jul, 2018 2 commits
    • Eugeniy Paltsev's avatar
      ARC: dma [non-IOC] setup SMP_CACHE_BYTES and cache_line_size · eb277739
      Eugeniy Paltsev authored
      As for today we don't setup SMP_CACHE_BYTES and cache_line_size for
      ARC, so they are set to L1_CACHE_BYTES by default. L1 line length
      (L1_CACHE_BYTES) might be easily smaller than L2 line (which is
      usually the case BTW). This breaks code.
      
      For example this breaks ethernet infrastructure on HSDK/AXS103 boards
      with IOC disabled, involving manual cache flushes
      Functions which alloc and manage sk_buff packet data area rely on
      SMP_CACHE_BYTES define. In the result we can share last L2 cache
      line in sk_buff linear packet data area between DMA buffer and
      some useful data in other structure. So we can lose this data when
      we invalidate DMA buffer.
      
         sk_buff linear packet data area
                      |
                      |
                      |         skb->end        skb->tail
                      V            |                |
                                   V                V
      ----------------------------------------------.
            packet data            | <tail padding> |  <useful data in other struct>
      ----------------------------------------------.
      
      ---------------------.--------------------------------------------------.
           SLC line        |             SLC (L2 cache) line (128B)           |
      ---------------------.--------------------------------------------------.
              ^                                     ^
              |                                     |
           These cache lines will be invalidated when we invalidate skb
           linear packet data area before DMA transaction starting.
      
      This leads to issues painful to debug as it reproduces only if
      (sk_buff->end - sk_buff->tail) < SLC_LINE_SIZE and
      if we have some useful data right after sk_buff->end.
      
      Fix that by hardcode SMP_CACHE_BYTES to max line length we may have.
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      eb277739
    • Eugeniy Paltsev's avatar
      ARC: dma [non IOC]: fix arc_dma_sync_single_for_(device|cpu) · 4c612add
      Eugeniy Paltsev authored
      ARC backend for dma_sync_single_for_(device|cpu) was broken as it was
      not honoring the @dir argument and simply forcing it based on the call:
       - arc_dma_sync_single_for_device(dir) assumed DMA_TO_DEVICE (cache wback)
       - arc_dma_sync_single_for_cpu(dir) assumed DMA_FROM_DEVICE (cache inv)
      
      This is not true given the DMA API programming model and has been
      discussed here [1] in some detail.
      
      Interestingly while the deficiency has been there forever, it only started
      showing up after 4.17 dma common ops rework, commit a8eb92d0
      ("arc: fix arc_dma_{map,unmap}_page") which wired up these calls under the
      more commonly used dma_map_page API triggering the issue.
      
      [1]: https://lkml.org/lkml/2018/5/18/979
      Fixes: commit a8eb92d0 ("arc: fix arc_dma_{map,unmap}_page")
      Cc: stable@kernel.org # v4.17+
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      [vgupta: reworked changelog]
      4c612add
  3. 24 Jul, 2018 1 commit
  4. 22 Jul, 2018 8 commits
  5. 21 Jul, 2018 12 commits
  6. 20 Jul, 2018 11 commits