tree:   git://people.freedesktop.org/~gabbayo/linux habanalabs-next
head:   fd467452d554d95e0294e6e34781028f6d3f69f5
commit: 9b588e636ae2944f65223e2bb0df67772f97a178 [14/21] habanalabs: add MMU 
shadow mapping
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 9b588e636ae2944f65223e2bb0df67772f97a178
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=mips 

All warnings (new ones prefixed by >>):

   drivers/misc/habanalabs/mmu.c: In function 'free_hop':
>> drivers/misc/habanalabs/mmu.c:36:8: warning: cast to pointer from integer of 
>> different size [-Wint-to-pointer-cast]
     kfree((u64 *) pgt_info->shadow_addr);
           ^
   drivers/misc/habanalabs/mmu.c: In function 'alloc_hop':
>> drivers/misc/habanalabs/mmu.c:58:16: warning: cast from pointer to integer 
>> of different size [-Wpointer-to-int-cast]
     shadow_addr = (u64) kzalloc(prop->mmu_hop_table_size, GFP_KERNEL);
                   ^
   drivers/misc/habanalabs/mmu.c: In function 'write_pte':
   drivers/misc/habanalabs/mmu.c:114:3: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     *(u64 *) shadow_pte_addr = val;
      ^
   drivers/misc/habanalabs/mmu.c: In function 'write_final_pte':
   drivers/misc/habanalabs/mmu.c:124:3: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     *(u64 *) shadow_pte_addr = val;
      ^
   drivers/misc/habanalabs/mmu.c: In function '_hl_mmu_unmap':
   drivers/misc/habanalabs/mmu.c:541:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop0_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:550:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop1_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:559:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop2_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:568:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop3_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:586:15: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
      curr_pte = *(u64 *) hop4_pte_addr;
                  ^
   drivers/misc/habanalabs/mmu.c: In function '_hl_mmu_map':
   drivers/misc/habanalabs/mmu.c:748:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop0_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:755:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop1_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:762:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop2_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:769:14: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
     curr_pte = *(u64 *) hop3_pte_addr;
                 ^
   drivers/misc/habanalabs/mmu.c:777:15: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
      curr_pte = *(u64 *) hop4_pte_addr;
                  ^
   In file included from include/linux/printk.h:330:0,
                    from include/linux/kernel.h:15,
                    from include/linux/list.h:9,
                    from include/linux/kobject.h:19,
                    from include/linux/cdev.h:5,
                    from drivers/misc/habanalabs/habanalabs.h:16,
                    from drivers/misc/habanalabs/mmu.c:8:
   drivers/misc/habanalabs/mmu.c:805:5: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
       *(u64 *) hop0_pte_addr, hop0_pte_addr);
        ^
   include/linux/dynamic_debug.h:118:15: note: in definition of macro 
'__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:150:2: note: in expansion of macro 
'_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1495:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
>> drivers/misc/habanalabs/mmu.c:804:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(hdev->dev, "hop0 pte: 0x%llx (0x%llx)\n",
      ^~~~~~~
   drivers/misc/habanalabs/mmu.c:807:5: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
       *(u64 *) hop1_pte_addr, hop1_pte_addr);
        ^
   include/linux/dynamic_debug.h:118:15: note: in definition of macro 
'__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:150:2: note: in expansion of macro 
'_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1495:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   drivers/misc/habanalabs/mmu.c:806:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(hdev->dev, "hop1 pte: 0x%llx (0x%llx)\n",
      ^~~~~~~
   drivers/misc/habanalabs/mmu.c:809:5: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
       *(u64 *) hop2_pte_addr, hop2_pte_addr);
        ^
   include/linux/dynamic_debug.h:118:15: note: in definition of macro 
'__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:150:2: note: in expansion of macro 
'_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1495:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   drivers/misc/habanalabs/mmu.c:808:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(hdev->dev, "hop2 pte: 0x%llx (0x%llx)\n",
      ^~~~~~~
   drivers/misc/habanalabs/mmu.c:811:5: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
       *(u64 *) hop3_pte_addr, hop3_pte_addr);
        ^
   include/linux/dynamic_debug.h:118:15: note: in definition of macro 
'__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:150:2: note: in expansion of macro 
'_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1495:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   drivers/misc/habanalabs/mmu.c:810:3: note: in expansion of macro 'dev_dbg'
      dev_dbg(hdev->dev, "hop3 pte: 0x%llx (0x%llx)\n",
      ^~~~~~~
   drivers/misc/habanalabs/mmu.c:815:6: warning: cast to pointer from integer 
of different size [-Wint-to-pointer-cast]
        *(u64 *) hop4_pte_addr, hop4_pte_addr);
         ^
   include/linux/dynamic_debug.h:118:15: note: in definition of macro 
'__dynamic_func_call'
      func(&id, ##__VA_ARGS__);  \
                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:150:2: note: in expansion of macro 
'_dynamic_func_call'
     _dynamic_func_call(fmt,__dynamic_dev_dbg,   \
     ^~~~~~~~~~~~~~~~~~
   include/linux/device.h:1495:2: note: in expansion of macro 'dynamic_dev_dbg'
     dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
     ^~~~~~~~~~~~~~~
   drivers/misc/habanalabs/mmu.c:814:4: note: in expansion of macro 'dev_dbg'
       dev_dbg(hdev->dev, "hop4 pte: 0x%llx (0x%llx)\n",
       ^~~~~~~

vim +36 drivers/misc/habanalabs/mmu.c

    27  
    28  static void free_hop(struct hl_ctx *ctx, u64 hop_addr)
    29  {
    30          struct hl_device *hdev = ctx->hdev;
    31          struct pgt_info *pgt_info = get_pgt_info(ctx, hop_addr);
    32  
    33          gen_pool_free(hdev->mmu_pgt_pool, pgt_info->phys_addr,
    34                          hdev->asic_prop.mmu_hop_table_size);
    35          hash_del(&pgt_info->node);
  > 36          kfree((u64 *) pgt_info->shadow_addr);
    37          kfree(pgt_info);
    38  }
    39  
    40  static u64 alloc_hop(struct hl_ctx *ctx)
    41  {
    42          struct hl_device *hdev = ctx->hdev;
    43          struct asic_fixed_properties *prop = &hdev->asic_prop;
    44          struct pgt_info *pgt_info;
    45          u64 phys_addr, shadow_addr;
    46  
    47          pgt_info = kmalloc(sizeof(*pgt_info), GFP_KERNEL);
    48          if (!pgt_info)
    49                  return ULLONG_MAX;
    50  
    51          phys_addr = (u64) gen_pool_alloc(hdev->mmu_pgt_pool,
    52                                          prop->mmu_hop_table_size);
    53          if (!phys_addr) {
    54                  dev_err(hdev->dev, "failed to allocate page\n");
    55                  goto pool_add_err;
    56          }
    57  
  > 58          shadow_addr = (u64) kzalloc(prop->mmu_hop_table_size, 
GFP_KERNEL);
    59          if (!shadow_addr)
    60                  goto shadow_err;
    61  
    62          pgt_info->phys_addr = phys_addr;
    63          pgt_info->shadow_addr = shadow_addr;
    64          pgt_info->ctx = ctx;
    65          pgt_info->num_of_ptes = 0;
    66          hash_add(ctx->mmu_shadow_hash, &pgt_info->node, shadow_addr);
    67  
    68          return shadow_addr;
    69  
    70  shadow_err:
    71          gen_pool_free(hdev->mmu_pgt_pool, phys_addr, 
prop->mmu_hop_table_size);
    72  pool_add_err:
    73          kfree(pgt_info);
    74  
    75          return ULLONG_MAX;
    76  }
    77  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to