[agd5f:drm-next 132/132] drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c:653:46: error: implicit declaration of function 'hypervisor_is_type'

From: kernel test robot
Date: Fri Apr 08 2022 - 01:06:00 EST


tree: https://gitlab.freedesktop.org/agd5f/linux.git drm-next
head: 49aa98ca30cd186ab33fc5802066e2024d3bfa39
commit: 49aa98ca30cd186ab33fc5802066e2024d3bfa39 [132/132] drm/amd/amdgpu: Only reserve vram for firmware with vega9 MS_HYPERV host.
config: sparc64-randconfig-r032-20220408 (https://download.01.org/0day-ci/archive/20220408/202204081332.6PEs6cNB-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 11.2.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 drm-next
git checkout 49aa98ca30cd186ab33fc5802066e2024d3bfa39
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sparc64 SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/

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

All errors (new ones prefixed by >>):

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c: In function 'amdgpu_gmc_get_vbios_allocations':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c:653:46: error: implicit declaration of function 'hypervisor_is_type' [-Werror=implicit-function-declaration]
653 | if (amdgpu_sriov_vf(adev) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
| ^~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c:653:65: error: 'X86_HYPER_MS_HYPERV' undeclared (first use in this function)
653 | if (amdgpu_sriov_vf(adev) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
| ^~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c:653:65: note: each undeclared identifier is reported only once for each function it appears in
cc1: some warnings being treated as errors


vim +/hypervisor_is_type +653 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c

627
628 void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
629 {
630 unsigned size;
631
632 /*
633 * Some ASICs need to reserve a region of video memory to avoid access
634 * from driver
635 */
636 adev->mman.stolen_reserved_offset = 0;
637 adev->mman.stolen_reserved_size = 0;
638
639 /*
640 * TODO:
641 * Currently there is a bug where some memory client outside
642 * of the driver writes to first 8M of VRAM on S3 resume,
643 * this overrides GART which by default gets placed in first 8M and
644 * causes VM_FAULTS once GTT is accessed.
645 * Keep the stolen memory reservation until the while this is not solved.
646 */
647 switch (adev->asic_type) {
648 case CHIP_VEGA10:
649 adev->mman.keep_stolen_vga_memory = true;
650 /*
651 * VEGA10 SRIOV VF with MS_HYPERV host needs some firmware reserved area.
652 */
> 653 if (amdgpu_sriov_vf(adev) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
654 adev->mman.stolen_reserved_offset = 0x500000;
655 adev->mman.stolen_reserved_size = 0x200000;
656 }
657 break;
658 case CHIP_RAVEN:
659 case CHIP_RENOIR:
660 adev->mman.keep_stolen_vga_memory = true;
661 break;
662 case CHIP_YELLOW_CARP:
663 if (amdgpu_discovery == 0) {
664 adev->mman.stolen_reserved_offset = 0x1ffb0000;
665 adev->mman.stolen_reserved_size = 64 * PAGE_SIZE;
666 }
667 break;
668 default:
669 adev->mman.keep_stolen_vga_memory = false;
670 break;
671 }
672
673 if (amdgpu_sriov_vf(adev) ||
674 !amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_DCE)) {
675 size = 0;
676 } else {
677 size = amdgpu_gmc_get_vbios_fb_size(adev);
678
679 if (adev->mman.keep_stolen_vga_memory)
680 size = max(size, (unsigned)AMDGPU_VBIOS_VGA_ALLOCATION);
681 }
682
683 /* set to 0 if the pre-OS buffer uses up most of vram */
684 if ((adev->gmc.real_vram_size - size) < (8 * 1024 * 1024))
685 size = 0;
686
687 if (size > AMDGPU_VBIOS_VGA_ALLOCATION) {
688 adev->mman.stolen_vga_size = AMDGPU_VBIOS_VGA_ALLOCATION;
689 adev->mman.stolen_extended_size = size - adev->mman.stolen_vga_size;
690 } else {
691 adev->mman.stolen_vga_size = size;
692 adev->mman.stolen_extended_size = 0;
693 }
694 }
695

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