lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202207301805.lGuXicPm-lkp@intel.com>
Date:   Sat, 30 Jul 2022 18:47:34 +0800
From:   kernel test robot <lkp@...el.com>
To:     Chengming Gui <Jack.Gui@....com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Hawking Zhang <Hawking.Zhang@....com>
Subject: [agd5f:amd-staging-drm-next 1247/1278]
 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c:534:23: error: implicit declaration
 of function 'vmalloc'; did you mean 'kvmalloc'?

tree:   https://gitlab.freedesktop.org/agd5f/linux.git amd-staging-drm-next
head:   2305916dca043ed69bd464f74a886b0216780aa6
commit: 8d1669d0090d25da9faf3d72c30ad57056bd3888 [1247/1278] drm/amd/amdgpu: add memory training support for PSP_V13
config: alpha-buildonly-randconfig-r001-20220729 (https://download.01.org/0day-ci/archive/20220730/202207301805.lGuXicPm-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git remote add agd5f https://gitlab.freedesktop.org/agd5f/linux.git
        git fetch --no-tags agd5f amd-staging-drm-next
        git checkout 8d1669d0090d25da9faf3d72c30ad57056bd3888
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=alpha SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/

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

All error/warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/psp_v13_0.c: In function 'psp_v13_0_memory_training':
>> drivers/gpu/drm/amd/amdgpu/psp_v13_0.c:534:23: error: implicit declaration of function 'vmalloc'; did you mean 'kvmalloc'? [-Werror=implicit-function-declaration]
     534 |                 buf = vmalloc(sz);
         |                       ^~~~~~~
         |                       kvmalloc
>> drivers/gpu/drm/amd/amdgpu/psp_v13_0.c:534:21: warning: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     534 |                 buf = vmalloc(sz);
         |                     ^
>> drivers/gpu/drm/amd/amdgpu/psp_v13_0.c:545:33: error: implicit declaration of function 'vfree'; did you mean 'kfree'? [-Werror=implicit-function-declaration]
     545 |                                 vfree(buf);
         |                                 ^~~~~
         |                                 kfree
   cc1: some warnings being treated as errors


vim +534 drivers/gpu/drm/amd/amdgpu/psp_v13_0.c

   457	
   458	
   459	static int psp_v13_0_memory_training(struct psp_context *psp, uint32_t ops)
   460	{
   461		struct psp_memory_training_context *ctx = &psp->mem_train_ctx;
   462		uint32_t *pcache = (uint32_t *)ctx->sys_cache;
   463		struct amdgpu_device *adev = psp->adev;
   464		uint32_t p2c_header[4];
   465		uint32_t sz;
   466		void *buf;
   467		int ret, idx;
   468	
   469		if (ctx->init == PSP_MEM_TRAIN_NOT_SUPPORT) {
   470			dev_dbg(adev->dev, "Memory training is not supported.\n");
   471			return 0;
   472		} else if (ctx->init != PSP_MEM_TRAIN_INIT_SUCCESS) {
   473			dev_err(adev->dev, "Memory training initialization failure.\n");
   474			return -EINVAL;
   475		}
   476	
   477		if (psp_v13_0_is_sos_alive(psp)) {
   478			dev_dbg(adev->dev, "SOS is alive, skip memory training.\n");
   479			return 0;
   480		}
   481	
   482		amdgpu_device_vram_access(adev, ctx->p2c_train_data_offset, p2c_header, sizeof(p2c_header), false);
   483		dev_dbg(adev->dev,"sys_cache[%08x,%08x,%08x,%08x] p2c_header[%08x,%08x,%08x,%08x]\n",
   484			  pcache[0], pcache[1], pcache[2], pcache[3],
   485			  p2c_header[0], p2c_header[1], p2c_header[2], p2c_header[3]);
   486	
   487		if (ops & PSP_MEM_TRAIN_SEND_SHORT_MSG) {
   488			dev_dbg(adev->dev, "Short training depends on restore.\n");
   489			ops |= PSP_MEM_TRAIN_RESTORE;
   490		}
   491	
   492		if ((ops & PSP_MEM_TRAIN_RESTORE) &&
   493		    pcache[0] != MEM_TRAIN_SYSTEM_SIGNATURE) {
   494			dev_dbg(adev->dev, "sys_cache[0] is invalid, restore depends on save.\n");
   495			ops |= PSP_MEM_TRAIN_SAVE;
   496		}
   497	
   498		if (p2c_header[0] == MEM_TRAIN_SYSTEM_SIGNATURE &&
   499		    !(pcache[0] == MEM_TRAIN_SYSTEM_SIGNATURE &&
   500		      pcache[3] == p2c_header[3])) {
   501			dev_dbg(adev->dev, "sys_cache is invalid or out-of-date, need save training data to sys_cache.\n");
   502			ops |= PSP_MEM_TRAIN_SAVE;
   503		}
   504	
   505		if ((ops & PSP_MEM_TRAIN_SAVE) &&
   506		    p2c_header[0] != MEM_TRAIN_SYSTEM_SIGNATURE) {
   507			dev_dbg(adev->dev, "p2c_header[0] is invalid, save depends on long training.\n");
   508			ops |= PSP_MEM_TRAIN_SEND_LONG_MSG;
   509		}
   510	
   511		if (ops & PSP_MEM_TRAIN_SEND_LONG_MSG) {
   512			ops &= ~PSP_MEM_TRAIN_SEND_SHORT_MSG;
   513			ops |= PSP_MEM_TRAIN_SAVE;
   514		}
   515	
   516		dev_dbg(adev->dev, "Memory training ops:%x.\n", ops);
   517	
   518		if (ops & PSP_MEM_TRAIN_SEND_LONG_MSG) {
   519			/*
   520			 * Long training will encroach a certain amount on the bottom of VRAM;
   521			 * save the content from the bottom of VRAM to system memory
   522			 * before training, and restore it after training to avoid
   523			 * VRAM corruption.
   524			 */
   525			sz = GDDR6_MEM_TRAINING_ENCROACHED_SIZE;
   526	
   527			if (adev->gmc.visible_vram_size < sz || !adev->mman.aper_base_kaddr) {
   528				dev_err(adev->dev, "visible_vram_size %llx or aper_base_kaddr %p is not initialized.\n",
   529					  adev->gmc.visible_vram_size,
   530					  adev->mman.aper_base_kaddr);
   531				return -EINVAL;
   532			}
   533	
 > 534			buf = vmalloc(sz);
   535			if (!buf) {
   536				dev_err(adev->dev, "failed to allocate system memory.\n");
   537				return -ENOMEM;
   538			}
   539	
   540			if (drm_dev_enter(adev_to_drm(adev), &idx)) {
   541				memcpy_fromio(buf, adev->mman.aper_base_kaddr, sz);
   542				ret = psp_v13_0_memory_training_send_msg(psp, PSP_BL__DRAM_LONG_TRAIN);
   543				if (ret) {
   544					DRM_ERROR("Send long training msg failed.\n");
 > 545					vfree(buf);
   546					drm_dev_exit(idx);
   547					return ret;
   548				}
   549	
   550				memcpy_toio(adev->mman.aper_base_kaddr, buf, sz);
   551				adev->hdp.funcs->flush_hdp(adev, NULL);
   552				vfree(buf);
   553				drm_dev_exit(idx);
   554			} else {
   555				vfree(buf);
   556				return -ENODEV;
   557			}
   558		}
   559	
   560		if (ops & PSP_MEM_TRAIN_SAVE) {
   561			amdgpu_device_vram_access(psp->adev, ctx->p2c_train_data_offset, ctx->sys_cache, ctx->train_data_size, false);
   562		}
   563	
   564		if (ops & PSP_MEM_TRAIN_RESTORE) {
   565			amdgpu_device_vram_access(psp->adev, ctx->c2p_train_data_offset, ctx->sys_cache, ctx->train_data_size, true);
   566		}
   567	
   568		if (ops & PSP_MEM_TRAIN_SEND_SHORT_MSG) {
   569			ret = psp_v13_0_memory_training_send_msg(psp, (amdgpu_force_long_training > 0) ?
   570								 PSP_BL__DRAM_LONG_TRAIN : PSP_BL__DRAM_SHORT_TRAIN);
   571			if (ret) {
   572				dev_err(adev->dev, "send training msg failed.\n");
   573				return ret;
   574			}
   575		}
   576		ctx->training_cnt++;
   577		return 0;
   578	}
   579	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ