lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140923172339.32ad4301@canb.auug.org.au>
Date:	Tue, 23 Sep 2014 17:23:39 +1000
From:	Stephen Rothwell <sfr@...b.auug.org.au>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Catalin Marinas <catalin.marinas@....com>
Cc:	linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
	Laura Abbott <lauraa@...eaurora.org>
Subject: linux-next: manual merge of the akpm-current tree with the arm64
 tree

Hi Andrew,

Today's linux-next merge of the akpm-current tree got a conflict in
arch/arm64/mm/dma-mapping.c between commit 2189064795dc ("arm64:
Implement set_arch_dma_coherent_ops() to replace bus notifiers") from
the arm64 tree and commit 50a477611cc9 ("arm64: add atomic pool for
non-coherent and CMA allocations") from the akpm-current tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@...b.auug.org.au

diff --cc arch/arm64/mm/dma-mapping.c
index d6ceb3df0047,90bb7b34d058..000000000000
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@@ -22,8 -22,12 +22,9 @@@
  #include <linux/slab.h>
  #include <linux/dma-mapping.h>
  #include <linux/dma-contiguous.h>
 -#include <linux/of.h>
 -#include <linux/platform_device.h>
  #include <linux/vmalloc.h>
  #include <linux/swiotlb.h>
 -#include <linux/amba/bus.h>
+ #include <linux/genalloc.h>
  
  #include <asm/cacheflush.h>
  
@@@ -305,8 -363,91 +360,69 @@@ struct dma_map_ops coherent_swiotlb_dma
  };
  EXPORT_SYMBOL(coherent_swiotlb_dma_ops);
  
 -static int dma_bus_notifier(struct notifier_block *nb,
 -			    unsigned long event, void *_dev)
 -{
 -	struct device *dev = _dev;
 -
 -	if (event != BUS_NOTIFY_ADD_DEVICE)
 -		return NOTIFY_DONE;
 -
 -	if (of_property_read_bool(dev->of_node, "dma-coherent"))
 -		set_dma_ops(dev, &coherent_swiotlb_dma_ops);
 -
 -	return NOTIFY_OK;
 -}
 -
 -static struct notifier_block platform_bus_nb = {
 -	.notifier_call = dma_bus_notifier,
 -};
 -
 -static struct notifier_block amba_bus_nb = {
 -	.notifier_call = dma_bus_notifier,
 -};
 -
  extern int swiotlb_late_init_with_default_size(size_t default_size);
  
+ static int __init atomic_pool_init(void)
+ {
+ 	pgprot_t prot = __pgprot(PROT_NORMAL_NC);
+ 	unsigned long nr_pages = atomic_pool_size >> PAGE_SHIFT;
+ 	struct page *page;
+ 	void *addr;
+ 	unsigned int pool_size_order = get_order(atomic_pool_size);
+ 
+ 	if (dev_get_cma_area(NULL))
+ 		page = dma_alloc_from_contiguous(NULL, nr_pages,
+ 							pool_size_order);
+ 	else
+ 		page = alloc_pages(GFP_DMA, pool_size_order);
+ 
+ 	if (page) {
+ 		int ret;
+ 		void *page_addr = page_address(page);
+ 
+ 		memset(page_addr, 0, atomic_pool_size);
+ 		__dma_flush_range(page_addr, page_addr + atomic_pool_size);
+ 
+ 		atomic_pool = gen_pool_create(PAGE_SHIFT, -1);
+ 		if (!atomic_pool)
+ 			goto free_page;
+ 
+ 		addr = dma_common_contiguous_remap(page, atomic_pool_size,
+ 					VM_USERMAP, prot, atomic_pool_init);
+ 
+ 		if (!addr)
+ 			goto destroy_genpool;
+ 
+ 		ret = gen_pool_add_virt(atomic_pool, (unsigned long)addr,
+ 					page_to_phys(page),
+ 					atomic_pool_size, -1);
+ 		if (ret)
+ 			goto remove_mapping;
+ 
+ 		gen_pool_set_algo(atomic_pool,
+ 				  gen_pool_first_fit_order_align,
+ 				  (void *)PAGE_SHIFT);
+ 
+ 		pr_info("DMA: preallocated %zu KiB pool for atomic allocations\n",
+ 			atomic_pool_size / 1024);
+ 		return 0;
+ 	}
+ 	goto out;
+ 
+ remove_mapping:
+ 	dma_common_free_remap(addr, atomic_pool_size, VM_USERMAP);
+ destroy_genpool:
+ 	gen_pool_destroy(atomic_pool);
+ 	atomic_pool = NULL;
+ free_page:
+ 	if (!dma_release_from_contiguous(NULL, page, nr_pages))
+ 		__free_pages(page, pool_size_order);
+ out:
+ 	pr_err("DMA: failed to allocate %zu KiB pool for atomic coherent allocation\n",
+ 		atomic_pool_size / 1024);
+ 	return -ENOMEM;
+ }
+ 
  static int __init swiotlb_late_init(void)
  {
  	size_t swiotlb_size = min(SZ_64M, MAX_ORDER_NR_PAGES << PAGE_SHIFT);

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ