Re: [PATCH v3 05/15] firmware: qcom: scm: enable the TZ mem allocator

From: kernel test robot
Date: Tue Oct 10 2023 - 05:11:33 EST


Hi Bartosz,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20231009]
[cannot apply to arm64/for-next/core krzk-dt/for-next linus/master v6.6-rc5 v6.6-rc4 v6.6-rc3 v6.6-rc5]
[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-move-Qualcomm-code-into-its-own-directory/20231009-233826
base: next-20231009
patch link: https://lore.kernel.org/r/20231009153427.20951-6-brgl%40bgdev.pl
patch subject: [PATCH v3 05/15] firmware: qcom: scm: enable the TZ mem allocator
config: arc-randconfig-001-20231010 (https://download.01.org/0day-ci/archive/20231010/202310101720.hVVWyJf3-lkp@xxxxxxxxx/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231010/202310101720.hVVWyJf3-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310101720.hVVWyJf3-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/firmware/qcom/qcom_tzmem.c:72: warning: Function parameter or member 'size' not described in 'qcom_tzmem_pool_new'


vim +72 drivers/firmware/qcom/qcom_tzmem.c

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

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