[RESEND PATCH v5 02/12] firmware: qcom: scm: enable the TZ mem allocator

kernel test robot lkp at intel.com
Fri Nov 24 07:23:31 PST 2023


Hi Bartosz,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc2 next-20231124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/firmware-qcom-add-a-dedicated-TrustZone-buffer-allocator/20231120-213154
base:   linus/master
patch link:    https://lore.kernel.org/r/20231120132118.30473-3-brgl%40bgdev.pl
patch subject: [RESEND PATCH v5 02/12] firmware: qcom: scm: enable the TZ mem allocator
config: arm-randconfig-r071-20231123 (https://download.01.org/0day-ci/archive/20231124/202311241607.v3tvaLvH-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231124/202311241607.v3tvaLvH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311241607.v3tvaLvH-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/firmware/qcom/qcom_tzmem.c: In function 'qcom_tzmem_pool_new':
>> drivers/firmware/qcom/qcom_tzmem.c:87:64: error: passing argument 3 of 'dma_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]
      87 |         pool->vbase = dma_alloc_coherent(qcom_tzmem_dev, size, &pool->pbase,
         |                                                                ^~~~~~~~~~~~
         |                                                                |
         |                                                                phys_addr_t * {aka unsigned int *}
   In file included from drivers/firmware/qcom/qcom_tzmem.c:10:
   include/linux/dma-mapping.h:429:29: note: expected 'dma_addr_t *' {aka 'long long unsigned int *'} but argument is of type 'phys_addr_t *' {aka 'unsigned int *'}
     429 |                 dma_addr_t *dma_handle, gfp_t gfp)
         |                 ~~~~~~~~~~~~^~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/dma_alloc_coherent +87 drivers/firmware/qcom/qcom_tzmem.c

757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   59  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   60  /**
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   61   * qcom_tzmem_pool_new() - Create a new TZ memory pool.
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   62   * @size: Size of the new pool in bytes.
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   63   *
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   64   * Create a new pool of memory suitable for sharing with the TrustZone.
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   65   *
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   66   * Must not be used in atomic context.
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   67   *
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   68   * Returns:
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   69   * New memory pool address or ERR_PTR() on error.
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   70   */
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   71  struct qcom_tzmem_pool *qcom_tzmem_pool_new(size_t size)
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   72  {
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   73  	struct qcom_tzmem_pool *pool;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   74  	int ret = -ENOMEM;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   75  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   76  	if (!size)
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   77  		return ERR_PTR(-EINVAL);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   78  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   79  	size = PAGE_ALIGN(size);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   80  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   81  	pool = kzalloc(sizeof(*pool), GFP_KERNEL);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   82  	if (!pool)
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   83  		return ERR_PTR(-ENOMEM);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   84  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   85  	pool->size = size;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   86  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  @87  	pool->vbase = dma_alloc_coherent(qcom_tzmem_dev, size, &pool->pbase,
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   88  					 GFP_KERNEL);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   89  	if (!pool->vbase)
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   90  		goto err_kfree_pool;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   91  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   92  	pool->pool = gen_pool_create(PAGE_SHIFT, -1);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   93  	if (!pool)
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   94  		goto err_dma_free;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   95  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   96  	gen_pool_set_algo(pool->pool, gen_pool_best_fit, NULL);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   97  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   98  	ret = gen_pool_add_virt(pool->pool, (unsigned long)pool->vbase,
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20   99  				pool->pbase, size, -1);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  100  	if (ret)
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  101  		goto err_destroy_genpool;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  102  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  103  	ret = qcom_tzmem_init_pool(pool);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  104  	if (ret)
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  105  		goto err_destroy_genpool;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  106  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  107  	return pool;
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  108  
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  109  err_destroy_genpool:
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  110  	gen_pool_destroy(pool->pool);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  111  err_dma_free:
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  112  	dma_free_coherent(qcom_tzmem_dev, size, pool->vbase, pool->pbase);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  113  err_kfree_pool:
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  114  	kfree(pool);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  115  	return ERR_PTR(ret);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  116  }
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  117  EXPORT_SYMBOL_GPL(qcom_tzmem_pool_new);
757fc9ecf8f244 Bartosz Golaszewski 2023-11-20  118  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



More information about the linux-arm-kernel mailing list