Re: [PATCH] drm/ttm: Make sure the mapped tt pages are decrypted when needed

From: kernel test robot
Date: Tue Sep 26 2023 - 08:03:22 EST


Hi Zack,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.6-rc3 next-20230926]
[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/Zack-Rusin/drm-ttm-Make-sure-the-mapped-tt-pages-are-decrypted-when-needed/20230926-120619
base: linus/master
patch link: https://lore.kernel.org/r/20230926040359.3040017-1-zack%40kde.org
patch subject: [PATCH] drm/ttm: Make sure the mapped tt pages are decrypted when needed
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230926/202309261923.XeaDU2Wg-lkp@xxxxxxxxx/config)
compiler: mips-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230926/202309261923.XeaDU2Wg-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/202309261923.XeaDU2Wg-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

drivers/gpu/drm/ttm/ttm_tt.c: In function 'ttm_tt_create':
>> drivers/gpu/drm/ttm/ttm_tt.c:89:41: error: implicit declaration of function 'cc_platform_has' [-Werror=implicit-function-declaration]
89 | if (bdev->pool.use_dma_alloc && cc_platform_has(CC_ATTR_MEM_ENCRYPT))
| ^~~~~~~~~~~~~~~
>> drivers/gpu/drm/ttm/ttm_tt.c:89:57: error: 'CC_ATTR_MEM_ENCRYPT' undeclared (first use in this function)
89 | if (bdev->pool.use_dma_alloc && cc_platform_has(CC_ATTR_MEM_ENCRYPT))
| ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/ttm/ttm_tt.c:89:57: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors


vim +/cc_platform_has +89 drivers/gpu/drm/ttm/ttm_tt.c

56
57 /*
58 * Allocates a ttm structure for the given BO.
59 */
60 int ttm_tt_create(struct ttm_buffer_object *bo, bool zero_alloc)
61 {
62 struct ttm_device *bdev = bo->bdev;
63 uint32_t page_flags = 0;
64
65 dma_resv_assert_held(bo->base.resv);
66
67 if (bo->ttm)
68 return 0;
69
70 switch (bo->type) {
71 case ttm_bo_type_device:
72 if (zero_alloc)
73 page_flags |= TTM_TT_FLAG_ZERO_ALLOC;
74 break;
75 case ttm_bo_type_kernel:
76 break;
77 case ttm_bo_type_sg:
78 page_flags |= TTM_TT_FLAG_EXTERNAL;
79 break;
80 default:
81 pr_err("Illegal buffer object type\n");
82 return -EINVAL;
83 }
84 /*
85 * When using dma_alloc_coherent with memory encryption the
86 * mapped TT pages need to be decrypted or otherwise the drivers
87 * will end up sending encrypted mem to the gpu.
88 */
> 89 if (bdev->pool.use_dma_alloc && cc_platform_has(CC_ATTR_MEM_ENCRYPT))
90 page_flags |= TTM_TT_FLAG_DECRYPTED;
91
92 bo->ttm = bdev->funcs->ttm_tt_create(bo, page_flags);
93 if (unlikely(bo->ttm == NULL))
94 return -ENOMEM;
95
96 WARN_ON(bo->ttm->page_flags & TTM_TT_FLAG_EXTERNAL_MAPPABLE &&
97 !(bo->ttm->page_flags & TTM_TT_FLAG_EXTERNAL));
98
99 return 0;
100 }
101

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