[intel-tdx:guest-hardening-filter 14/16] drivers/virtio/virtio_mmio.c:578:13: error: implicit declaration of function 'cc_platform_has'

From: kernel test robot
Date: Thu Jul 07 2022 - 18:11:18 EST


tree: https://github.com/intel/tdx.git guest-hardening-filter
head: cadf5ac0e49f45fdd2a3828fa625e01ad5fb55e7
commit: 92e6731960eaf63df4626788d7d302941beaf3dd [14/16] virtio-mmio: Disable in TDX guest
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20220708/202207080639.lSQmEaSK-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 11.3.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
# https://github.com/intel/tdx/commit/92e6731960eaf63df4626788d7d302941beaf3dd
git remote add intel-tdx https://github.com/intel/tdx.git
git fetch --no-tags intel-tdx guest-hardening-filter
git checkout 92e6731960eaf63df4626788d7d302941beaf3dd
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/virtio/

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

All errors (new ones prefixed by >>):

drivers/virtio/virtio_mmio.c: In function 'virtio_mmio_probe':
>> drivers/virtio/virtio_mmio.c:578:13: error: implicit declaration of function 'cc_platform_has' [-Werror=implicit-function-declaration]
578 | if (cc_platform_has(CC_ATTR_GUEST_DEVICE_FILTER))
| ^~~~~~~~~~~~~~~
>> drivers/virtio/virtio_mmio.c:578:29: error: 'CC_ATTR_GUEST_DEVICE_FILTER' undeclared (first use in this function)
578 | if (cc_platform_has(CC_ATTR_GUEST_DEVICE_FILTER))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/virtio/virtio_mmio.c:578:29: 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 +578 drivers/virtio/virtio_mmio.c

571
572 static int virtio_mmio_probe(struct platform_device *pdev)
573 {
574 struct virtio_mmio_device *vm_dev;
575 unsigned long magic;
576 int rc;
577
> 578 if (cc_platform_has(CC_ATTR_GUEST_DEVICE_FILTER))
579 return -ENODEV;
580
581 vm_dev = devm_kzalloc(&pdev->dev, sizeof(*vm_dev), GFP_KERNEL);
582 if (!vm_dev)
583 return -ENOMEM;
584
585 vm_dev->vdev.dev.parent = &pdev->dev;
586 vm_dev->vdev.dev.release = virtio_mmio_release_dev;
587 vm_dev->vdev.config = &virtio_mmio_config_ops;
588 vm_dev->pdev = pdev;
589 INIT_LIST_HEAD(&vm_dev->virtqueues);
590 spin_lock_init(&vm_dev->lock);
591
592 vm_dev->base = devm_platform_ioremap_resource(pdev, 0);
593 if (IS_ERR(vm_dev->base))
594 return PTR_ERR(vm_dev->base);
595
596 /* Check magic value */
597 magic = readl(vm_dev->base + VIRTIO_MMIO_MAGIC_VALUE);
598 if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) {
599 dev_warn(&pdev->dev, "Wrong magic value 0x%08lx!\n", magic);
600 return -ENODEV;
601 }
602
603 /* Check device version */
604 vm_dev->version = readl(vm_dev->base + VIRTIO_MMIO_VERSION);
605 if (vm_dev->version < 1 || vm_dev->version > 2) {
606 dev_err(&pdev->dev, "Version %ld not supported!\n",
607 vm_dev->version);
608 return -ENXIO;
609 }
610
611 vm_dev->vdev.id.device = readl(vm_dev->base + VIRTIO_MMIO_DEVICE_ID);
612 if (vm_dev->vdev.id.device == 0) {
613 /*
614 * virtio-mmio device with an ID 0 is a (dummy) placeholder
615 * with no function. End probing now with no error reported.
616 */
617 return -ENODEV;
618 }
619 vm_dev->vdev.id.vendor = readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID);
620
621 if (vm_dev->version == 1) {
622 writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
623
624 rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
625 /*
626 * In the legacy case, ensure our coherently-allocated virtio
627 * ring will be at an address expressable as a 32-bit PFN.
628 */
629 if (!rc)
630 dma_set_coherent_mask(&pdev->dev,
631 DMA_BIT_MASK(32 + PAGE_SHIFT));
632 } else {
633 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
634 }
635 if (rc)
636 rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
637 if (rc)
638 dev_warn(&pdev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n");
639
640 platform_set_drvdata(pdev, vm_dev);
641
642 rc = register_virtio_device(&vm_dev->vdev);
643 if (rc)
644 put_device(&vm_dev->vdev.dev);
645
646 return rc;
647 }
648

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