From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Andrew Morton <akpm@linux-foundation•org>,
Catalin Marinas <catalin.marinas@arm•com>
Cc: linux-next@vger•kernel.org, linux-kernel@vger•kernel.org,
Laura Abbott <lauraa@codeaurora•org>
Subject: linux-next: manual merge of the akpm-current tree with the arm64 tree
Date: Tue, 23 Sep 2014 17:23:39 +1000 [thread overview]
Message-ID: <20140923172339.32ad4301@canb.auug.org.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 3648 bytes --]
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@canb•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);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next reply other threads:[~2014-09-23 7:23 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 7:23 Stephen Rothwell [this message]
2014-09-23 8:36 ` linux-next: manual merge of the akpm-current tree with the arm64 tree Catalin Marinas
-- strict thread matches above, loose matches on Subject: below --
2021-10-08 6:04 Stephen Rothwell
2021-10-08 7:37 ` Will Deacon
2021-04-13 8:59 Stephen Rothwell
2021-04-13 9:14 ` Catalin Marinas
2020-12-03 8:06 Stephen Rothwell
2020-12-03 11:16 ` Catalin Marinas
2020-09-21 8:03 Stephen Rothwell
2020-09-21 8:12 ` Catalin Marinas
2020-10-13 7:34 ` Stephen Rothwell
2020-07-16 8:00 Stephen Rothwell
2020-07-16 8:23 ` Will Deacon
2020-04-30 6:26 Stephen Rothwell
2020-04-29 6:53 Stephen Rothwell
2019-08-07 6:39 Stephen Rothwell
2018-12-13 6:01 Stephen Rothwell
2018-12-13 11:12 ` Will Deacon
2018-12-11 6:11 linux-next: manual merge of the akpm-current tree with the FIXME tree Stephen Rothwell
2018-12-11 6:12 ` linux-next: manual merge of the akpm-current tree with the arm64 tree Stephen Rothwell
2018-12-11 10:39 ` Will Deacon
2018-12-11 6:02 Stephen Rothwell
2018-09-24 4:38 Stephen Rothwell
2018-09-24 9:32 ` Catalin Marinas
2018-07-27 10:55 Stephen Rothwell
2018-08-16 0:11 ` Stephen Rothwell
2017-11-06 5:33 Stephen Rothwell
2016-09-27 6:03 Stephen Rothwell
2016-06-22 4:54 Stephen Rothwell
2015-12-16 5:01 Stephen Rothwell
2015-12-16 10:14 ` Will Deacon
2014-07-24 8:42 Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140923172339.32ad4301@canb.auug.org.au \
--to=sfr@canb$(echo .)auug.org.au \
--cc=akpm@linux-foundation$(echo .)org \
--cc=catalin.marinas@arm$(echo .)com \
--cc=lauraa@codeaurora$(echo .)org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox