[intel-tdx:guest-hardening-rebased 14/36] arch/x86/mm/mem_encrypt_amd.c:218:13: warning: no previous prototype for 'sev_setup_arch'

From: kernel test robot
Date: Fri Aug 19 2022 - 20:35:33 EST


arch/x86/include/asm/mem_encrypt.h
arch/x86/kernel/setup.c
arch/x86/mm/mem_encrypt.c
tree: https://github.com/intel/tdx.git guest-hardening-rebased
head: d941f409a509c084250b50a3b5fc1c3c84a596a0
commit: 2549eea318a696f39dcf080dd7143de849c530d0 [14/36] x86/swiotlb: Adjust SWIOTLB bounce buffer size for TDX guests
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220820/202208200810.iwA9Ntvg-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel/tdx/commit/2549eea318a696f39dcf080dd7143de849c530d0
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx guest-hardening-rebased
git checkout 2549eea318a696f39dcf080dd7143de849c530d0
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/mm/

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

All warnings (new ones prefixed by >>):

>> arch/x86/mm/mem_encrypt_amd.c:218:13: warning: no previous prototype for 'sev_setup_arch' [-Wmissing-prototypes]
218 | void __init sev_setup_arch(void)
| ^~~~~~~~~~~~~~


vim +/sev_setup_arch +218 arch/x86/mm/mem_encrypt_amd.c

b9d05200bc1244 arch/x86/mm/mem_encrypt.c Tom Lendacky 2017-07-17 217
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 @218 void __init sev_setup_arch(void)
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 219 {
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 220 phys_addr_t total_mem = memblock_phys_mem_size();
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 221 unsigned long size;
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 222
4d96f9109109be arch/x86/mm/mem_encrypt.c Tom Lendacky 2021-09-08 223 if (!cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 224 return;
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 225
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 226 /*
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 227 * For SEV, all DMA has to occur via shared/unencrypted pages.
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 228 * SEV uses SWIOTLB to make this happen without changing device
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 229 * drivers. However, depending on the workload being run, the
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 230 * default 64MB of SWIOTLB may not be enough and SWIOTLB may
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 231 * run out of buffers for DMA, resulting in I/O errors and/or
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 232 * performance degradation especially with high I/O workloads.
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 233 *
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 234 * Adjust the default size of SWIOTLB for SEV guests using
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 235 * a percentage of guest memory for SWIOTLB buffers.
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 236 * Also, as the SWIOTLB bounce buffer memory is allocated
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 237 * from low memory, ensure that the adjusted size is within
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 238 * the limits of low available memory.
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 239 *
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 240 * The percentage of guest memory used here for SWIOTLB buffers
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 241 * is more of an approximation of the static adjustment which
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 242 * 64MB for <1G, and ~128M to 256M for 1G-to-4G, i.e., the 6%
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 243 */
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 244 size = total_mem * 6 / 100;
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 245 size = clamp_val(size, IO_TLB_DEFAULT_SIZE, SZ_1G);
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 246 swiotlb_adjust_size(size);
3f9dfbebdc48ce arch/x86/mm/mem_encrypt_amd.c Juergen Gross 2022-06-06 247
3f9dfbebdc48ce arch/x86/mm/mem_encrypt_amd.c Juergen Gross 2022-06-06 248 /* Set restricted memory access for virtio. */
a603002eea8213 arch/x86/mm/mem_encrypt_amd.c Juergen Gross 2022-06-22 249 virtio_set_mem_acc_cb(virtio_require_restricted_mem_acc);
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 250 }
e998879d4fb799 arch/x86/mm/mem_encrypt.c Ashish Kalra 2020-12-10 251

:::::: The code at line 218 was first introduced by commit
:::::: e998879d4fb7991856916972168cf27c0d86ed12 x86,swiotlb: Adjust SWIOTLB bounce buffer size for SEV guests

:::::: TO: Ashish Kalra <ashish.kalra@xxxxxxx>
:::::: CC: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp