Re: [PATCH 1/2] mm: dmapool: Align to ARCH_DMA_MINALIGN in non-coherent DMA mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Huacai,

[auto build test ERROR on mmotm/master]
[also build test ERROR on v4.13 next-20170908]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Huacai-Chen/mm-dmapool-Align-to-ARCH_DMA_MINALIGN-in-non-coherent-DMA-mode/20170909-230504
base:   git://git.cmpxchg.org/linux-mmotm.git master
config: i386-tinyconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   mm/dmapool.c: In function 'dma_pool_create':
>> mm/dmapool.c:143:7: error: implicit declaration of function 'plat_device_is_coherent' [-Werror=implicit-function-declaration]
     if (!plat_device_is_coherent(dev))
          ^~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/plat_device_is_coherent +143 mm/dmapool.c

   109	
   110	/**
   111	 * dma_pool_create - Creates a pool of consistent memory blocks, for dma.
   112	 * @name: name of pool, for diagnostics
   113	 * @dev: device that will be doing the DMA
   114	 * @size: size of the blocks in this pool.
   115	 * @align: alignment requirement for blocks; must be a power of two
   116	 * @boundary: returned blocks won't cross this power of two boundary
   117	 * Context: !in_interrupt()
   118	 *
   119	 * Returns a dma allocation pool with the requested characteristics, or
   120	 * null if one can't be created.  Given one of these pools, dma_pool_alloc()
   121	 * may be used to allocate memory.  Such memory will all have "consistent"
   122	 * DMA mappings, accessible by the device and its driver without using
   123	 * cache flushing primitives.  The actual size of blocks allocated may be
   124	 * larger than requested because of alignment.
   125	 *
   126	 * If @boundary is nonzero, objects returned from dma_pool_alloc() won't
   127	 * cross that size boundary.  This is useful for devices which have
   128	 * addressing restrictions on individual DMA transfers, such as not crossing
   129	 * boundaries of 4KBytes.
   130	 */
   131	struct dma_pool *dma_pool_create(const char *name, struct device *dev,
   132					 size_t size, size_t align, size_t boundary)
   133	{
   134		struct dma_pool *retval;
   135		size_t allocation;
   136		bool empty = false;
   137	
   138		if (align == 0)
   139			align = 1;
   140		else if (align & (align - 1))
   141			return NULL;
   142	
 > 143		if (!plat_device_is_coherent(dev))
   144			align = max_t(size_t, align, dma_get_cache_alignment());
   145	
   146		if (size == 0)
   147			return NULL;
   148		else if (size < 4)
   149			size = 4;
   150	
   151		if ((size % align) != 0)
   152			size = ALIGN(size, align);
   153	
   154		allocation = max_t(size_t, size, PAGE_SIZE);
   155	
   156		if (!boundary)
   157			boundary = allocation;
   158		else if ((boundary < size) || (boundary & (boundary - 1)))
   159			return NULL;
   160	
   161		retval = kmalloc_node(sizeof(*retval), GFP_KERNEL, dev_to_node(dev));
   162		if (!retval)
   163			return retval;
   164	
   165		strlcpy(retval->name, name, sizeof(retval->name));
   166	
   167		retval->dev = dev;
   168	
   169		INIT_LIST_HEAD(&retval->page_list);
   170		spin_lock_init(&retval->lock);
   171		retval->size = size;
   172		retval->boundary = boundary;
   173		retval->allocation = allocation;
   174	
   175		INIT_LIST_HEAD(&retval->pools);
   176	
   177		/*
   178		 * pools_lock ensures that the ->dma_pools list does not get corrupted.
   179		 * pools_reg_lock ensures that there is not a race between
   180		 * dma_pool_create() and dma_pool_destroy() or within dma_pool_create()
   181		 * when the first invocation of dma_pool_create() failed on
   182		 * device_create_file() and the second assumes that it has been done (I
   183		 * know it is a short window).
   184		 */
   185		mutex_lock(&pools_reg_lock);
   186		mutex_lock(&pools_lock);
   187		if (list_empty(&dev->dma_pools))
   188			empty = true;
   189		list_add(&retval->pools, &dev->dma_pools);
   190		mutex_unlock(&pools_lock);
   191		if (empty) {
   192			int err;
   193	
   194			err = device_create_file(dev, &dev_attr_pools);
   195			if (err) {
   196				mutex_lock(&pools_lock);
   197				list_del(&retval->pools);
   198				mutex_unlock(&pools_lock);
   199				mutex_unlock(&pools_reg_lock);
   200				kfree(retval);
   201				return NULL;
   202			}
   203		}
   204		mutex_unlock(&pools_reg_lock);
   205		return retval;
   206	}
   207	EXPORT_SYMBOL(dma_pool_create);
   208	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]