lkml.org 
[lkml]   [2022]   [Jul]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[intel-tdx:guest-hardening-filter 14/16] drivers/virtio/virtio_mmio.c:578:6: error: call to undeclared function 'cc_platform_has'; ISO C99 and later do not support implicit function declarations
tree:   https://github.com/intel/tdx.git guest-hardening-filter
head: cadf5ac0e49f45fdd2a3828fa625e01ad5fb55e7
commit: 92e6731960eaf63df4626788d7d302941beaf3dd [14/16] virtio-mmio: Disable in TDX guest
config: hexagon-randconfig-r045-20220707 (https://download.01.org/0day-ci/archive/20220708/202207080447.LxoIupJT-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 66ae1d60bb278793fd651cece264699d522bab84)
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=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/virtio/

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

All errors (new ones prefixed by >>):

>> drivers/virtio/virtio_mmio.c:578:6: error: call to undeclared function 'cc_platform_has'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (cc_platform_has(CC_ATTR_GUEST_DEVICE_FILTER))
^
>> drivers/virtio/virtio_mmio.c:578:22: error: use of undeclared identifier 'CC_ATTR_GUEST_DEVICE_FILTER'
if (cc_platform_has(CC_ATTR_GUEST_DEVICE_FILTER))
^
drivers/virtio/virtio_mmio.c:624:33: warning: shift count >= width of type [-Wshift-count-overflow]
rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
drivers/virtio/virtio_mmio.c:633:46: warning: shift count >= width of type [-Wshift-count-overflow]
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
2 warnings and 2 errors generated.


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

\
 
 \ /
  Last update: 2022-07-07 23:00    [W:0.025 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site