All of lore.kernel.org
 help / color / mirror / Atom feed
* [leon-rdma:dmabuf-vfio 18/24] drivers/pci/p2pdma.c:272:16: error: too few arguments to function call, expected 2, have 1
@ 2025-07-17 13:56 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-07-17 13:56 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git dmabuf-vfio
head:   8662d1e1cc127e6b95c53b1258f0364d6c53ce44
commit: e2eef194f5c392d9f15b0d20938dd640f106ac28 [18/24] PCI/P2PDMA: Separate global to device p2p initialization logic
config: x86_64-buildonly-randconfig-003-20250717 (https://download.01.org/0day-ci/archive/20250717/202507172149.FRPx4fN0-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250717/202507172149.FRPx4fN0-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507172149.FRPx4fN0-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/pci/p2pdma.c:14:
   include/linux/pci-p2pdma.h:30:8: error: must use 'struct' tag to refer to type 'p2pdma_provider'
      30 | static p2pdma_provider *pci_p2pdma_enable(struct pci_dev *pdev);
         |        ^
         |        struct 
>> drivers/pci/p2pdma.c:272:16: error: too few arguments to function call, expected 2, have 1
     272 |         devm_kfree(p2p);
         |         ~~~~~~~~~~    ^
   include/linux/device/devres.h:79:6: note: 'devm_kfree' declared here
      79 | void devm_kfree(struct device *dev, const void *p);
         |      ^          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/pci/p2pdma.c:362:10: error: use of undeclared identifier 'free_pool'
     362 |                 return free_pool;
         |                        ^
>> drivers/pci/p2pdma.c:400:2: error: call to undeclared function 'sysfs_rmeove_group'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     400 |         sysfs_rmeove_group(&pdev->dev.kobj, &p2pmem_group);
         |         ^
   drivers/pci/p2pdma.c:400:2: note: did you mean 'sysfs_remove_group'?
   include/linux/sysfs.h:450:6: note: 'sysfs_remove_group' declared here
     450 | void sysfs_remove_group(struct kobject *kobj,
         |      ^
>> drivers/pci/p2pdma.c:401:19: error: use of undeclared identifier 'p2p'
     401 |         gen_pool_destroy(p2p->pool);
         |                          ^
   5 errors generated.


vim +272 drivers/pci/p2pdma.c

   240	
   241	/**
   242	 * pci_p2pdma_enable - Enable peer-to-peer DMA support for a PCI device
   243	 * @pdev: The PCI device to enable P2PDMA for
   244	 *
   245	 * This function initializes the peer-to-peer DMA infrastructure for a PCI
   246	 * device. It allocates and sets up the necessary data structures to support
   247	 * P2PDMA operations, including memory pools and mapping type tracking.
   248	 */
   249	struct p2pdma_provider *pci_p2pdma_enable(struct pci_dev *pdev)
   250	{
   251		struct pci_p2pdma *p2p;
   252		int ret;
   253	
   254		p2p = devm_kzalloc(&pdev->dev, sizeof(*p2p), GFP_KERNEL);
   255		if (!p2p)
   256			return ERR_PTR(-ENOMEM);
   257	
   258		xa_init(&p2p->map_types);
   259		p2p->mem.owner = &pdev->dev;
   260		/* On all p2p platforms bus_offset is the same fo all BARs */
   261		p2p->mem.bus_offset =
   262			pci_bus_address(pdev, 0) - pci_resource_start(pdev, 0);
   263	
   264		ret = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_release, pdev);
   265		if (ret)
   266			goto out_p2p;
   267	
   268		rcu_assign_pointer(pdev->p2pdma, p2p);
   269		return &p2p->mem;
   270	
   271	out_p2p:
 > 272		devm_kfree(p2p);
   273		return ERR_PTR(ret);
   274	}
   275	EXPORT_SYMBOL_GPL(pci_p2pdma_enable);
   276	
   277	static int pci_p2pdma_setup_pool(struct pci_dev *pdev)
   278	{
   279		struct pci_p2pdma *p2pdma;
   280		int ret;
   281	
   282		p2pdma = rcu_dereference_protected(pdev->p2pdma, 1);
   283		if (p2pdma->pool)
   284			/* We already setup pools, do nothing, */
   285			return 0;
   286	
   287		p2pdma->pool = gen_pool_create(PAGE_SHIFT, dev_to_node(&pdev->dev));
   288		if (!p2pdma->pool)
   289			return -ENOMEM;
   290	
   291		ret = sysfs_create_group(&pdev->dev.kobj, &p2pmem_group);
   292		if (ret)
   293			goto out_pool_destroy;
   294	
   295		return 0;
   296	
   297	out_pool_destroy:
   298		gen_pool_destroy(p2pdma->pool);
   299		p2pdma->pool = NULL;
   300		return ret;
   301	}
   302	
   303	static void pci_p2pdma_unmap_mappings(void *data)
   304	{
   305		struct pci_p2pdma_pagemap *p2p_pgmap = data;
   306	
   307		/*
   308		 * Removing the alloc attribute from sysfs will call
   309		 * unmap_mapping_range() on the inode, teardown any existing userspace
   310		 * mappings and prevent new ones from being created.
   311		 */
   312		sysfs_remove_file_from_group(&p2p_pgmap->mem->owner->kobj,
   313					     &p2pmem_alloc_attr.attr,
   314					     p2pmem_group.name);
   315	}
   316	
   317	/**
   318	 * pci_p2pdma_add_resource - add memory for use as p2p memory
   319	 * @pdev: the device to add the memory to
   320	 * @bar: PCI BAR to add
   321	 * @size: size of the memory to add, may be zero to use the whole BAR
   322	 * @offset: offset into the PCI BAR
   323	 *
   324	 * The memory will be given ZONE_DEVICE struct pages so that it may
   325	 * be used with any DMA request.
   326	 */
   327	int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size,
   328				    u64 offset)
   329	{
   330		struct pci_p2pdma_pagemap *p2p_pgmap;
   331		struct p2pdma_provider *mem;
   332		struct dev_pagemap *pgmap;
   333		struct pci_p2pdma *p2pdma;
   334		void *addr;
   335		int error;
   336	
   337		if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM))
   338			return -EINVAL;
   339	
   340		if (offset >= pci_resource_len(pdev, bar))
   341			return -EINVAL;
   342	
   343		if (!size)
   344			size = pci_resource_len(pdev, bar) - offset;
   345	
   346		if (size + offset > pci_resource_len(pdev, bar))
   347			return -EINVAL;
   348	
   349		p2pdma = rcu_dereference_protected(pdev->p2pdma, 1);
   350		if (!p2pdma) {
   351			mem = pci_p2pdma_enable(pdev);
   352			if (IS_ERR(mem))
   353				return PTR_ERR(mem);
   354	
   355			error = pci_p2pdma_setup_pool(pdev);
   356			if (error)
   357				return error;
   358		}
   359	
   360		p2p_pgmap = devm_kzalloc(&pdev->dev, sizeof(*p2p_pgmap), GFP_KERNEL);
   361		if (!p2p_pgmap)
 > 362			return free_pool;
   363	
   364		pgmap = &p2p_pgmap->pgmap;
   365		pgmap->range.start = pci_resource_start(pdev, bar) + offset;
   366		pgmap->range.end = pgmap->range.start + size - 1;
   367		pgmap->nr_range = 1;
   368		pgmap->type = MEMORY_DEVICE_PCI_P2PDMA;
   369		pgmap->ops = &p2pdma_pgmap_ops;
   370		p2p_pgmap->mem = mem;
   371	
   372		addr = devm_memremap_pages(&pdev->dev, pgmap);
   373		if (IS_ERR(addr)) {
   374			error = PTR_ERR(addr);
   375			goto pgmap_free;
   376		}
   377	
   378		error = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_unmap_mappings,
   379						 p2p_pgmap);
   380		if (error)
   381			goto pages_free;
   382	
   383		error = gen_pool_add_owner(p2pdma->pool, (unsigned long)addr,
   384				pci_bus_address(pdev, bar) + offset,
   385				range_len(&pgmap->range), dev_to_node(&pdev->dev),
   386				&pgmap->ref);
   387		if (error)
   388			goto pages_free;
   389	
   390		pci_info(pdev, "added peer-to-peer DMA memory %#llx-%#llx\n",
   391			 pgmap->range.start, pgmap->range.end);
   392	
   393		return 0;
   394	
   395	pages_free:
   396		devm_memunmap_pages(&pdev->dev, pgmap);
   397	pgmap_free:
   398		devm_kfree(&pdev->dev, p2p_pgmap);
   399	free_pool:
 > 400		sysfs_rmeove_group(&pdev->dev.kobj, &p2pmem_group);
 > 401		gen_pool_destroy(p2p->pool);
   402		return error;
   403	}
   404	EXPORT_SYMBOL_GPL(pci_p2pdma_add_resource);
   405	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-17 13:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 13:56 [leon-rdma:dmabuf-vfio 18/24] drivers/pci/p2pdma.c:272:16: error: too few arguments to function call, expected 2, have 1 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.