[intel-tdx:kvm 23/181] arch/x86/kernel/cpu/tdx/tdmr-sysmem.c:39:7: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast

From: kernel test robot
Date: Tue Aug 31 2021 - 13:13:16 EST


tree: https://github.com/intel/tdx.git kvm
head: 0c7944582999466d6d979000c4c11a62b78f5472
commit: 8d0a6f4d22c62fbc7a98efda46e1146c218a59a0 [23/181] x86/cpu/tdx: Implement PAMT allocation for system memory
config: x86_64-buildonly-randconfig-r001-20210831 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/intel/tdx/commit/8d0a6f4d22c62fbc7a98efda46e1146c218a59a0
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx kvm
git checkout 8d0a6f4d22c62fbc7a98efda46e1146c218a59a0
# save the attached .config to linux build tree
make W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

arch/x86/kernel/cpu/tdx/tdmr-sysmem.c: In function 'sysmem_pamt_alloc':
arch/x86/kernel/cpu/tdx/tdmr-sysmem.c:39:9: error: implicit declaration of function 'alloc_contig_pages' [-Werror=implicit-function-declaration]
39 | page = alloc_contig_pages(nr_pages, GFP_KERNEL, tmb->nid,
| ^~~~~~~~~~~~~~~~~~
>> arch/x86/kernel/cpu/tdx/tdmr-sysmem.c:39:7: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
39 | page = alloc_contig_pages(nr_pages, GFP_KERNEL, tmb->nid,
| ^
arch/x86/kernel/cpu/tdx/tdmr-sysmem.c:42:8: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
42 | page = alloc_contig_pages(nr_pages, GFP_KERNEL, tmb->nid,
| ^
cc1: some warnings being treated as errors


vim +39 arch/x86/kernel/cpu/tdx/tdmr-sysmem.c

18
19 /*
20 * Using alloc_contig_pages() to allocate PAMT for system memory, instead of
21 * memblock_phys_alloc_range(), because PAMT allocation needs to happen after
22 * all TDMR ranges are finalized after *all* TDX memory blocks from *all* types
23 * are added to final TDX memory instance. This is because PAMT size depends
24 * on TDMR ranges, or final TDMRs, which depends on both CMR info, and TDX
25 * module info such as maximum TDMR number, etc. The other reason is PAMT size
26 * also depends on TDX module info, specifically, PAMT entry sizes. Therefore
27 * PAMT allocation must happen after TDX module is loaded, which happens during
28 * or after smp_init(), at which point memblock APIs don't work anymore.
29 *
30 * TODO:
31 *
32 * Allocate one big PAMT pool for each node, and divide?
33 */
34 static unsigned long __init sysmem_pamt_alloc(struct tdx_memblock *tmb,
35 unsigned long nr_pages)
36 {
37 struct page *page;
38
> 39 page = alloc_contig_pages(nr_pages, GFP_KERNEL, tmb->nid,
40 NULL);
41 if (!page)
42 page = alloc_contig_pages(nr_pages, GFP_KERNEL, tmb->nid,
43 &node_online_map);
44
45 return page ? page_to_pfn(page) : 0;
46 }
47

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip