From: mina86@mina86.com (Michal Nazarewicz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 1/2] ARM: dma-mapping: add support for CMA regions placed in highmem zone
Date: Mon, 04 Feb 2013 14:51:52 +0100 [thread overview]
Message-ID: <xa1tlib4b30n.fsf@mina86.com> (raw)
In-Reply-To: <1359984182-6307-1-git-send-email-m.szyprowski@samsung.com>
On Mon, Feb 04 2013, Marek Szyprowski wrote:
> @@ -186,13 +186,24 @@ static u64 get_coherent_dma_mask(struct device *dev)
>
> static void __dma_clear_buffer(struct page *page, size_t size)
> {
> - void *ptr;
> /*
> * Ensure that the allocated pages are zeroed, and that any data
> * lurking in the kernel direct-mapped region is invalidated.
> */
> - ptr = page_address(page);
> - if (ptr) {
> + if (PageHighMem(page)) {
> + phys_addr_t base = __pfn_to_phys(page_to_pfn(page));
> + phys_addr_t end = base + size;
> + while (size > 0) {
> + void *ptr = kmap_atomic(page);
> + memset(ptr, 0, PAGE_SIZE);
> + dmac_flush_range(ptr, ptr + PAGE_SIZE);
> + kunmap_atomic(ptr);
> + page++;
> + size -= PAGE_SIZE;
> + }
> + outer_flush_range(base, end);
> + } else {
> + void *ptr = page_address(page);
There used to be a ?if (ptr)? check which is now missing. Why is that?
> memset(ptr, 0, size);
> dmac_flush_range(ptr, ptr + size);
> outer_flush_range(__pa(ptr), __pa(ptr) + size);
--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Micha? ?mina86? Nazarewicz (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130204/c8c84ff1/attachment.sig>
next prev parent reply other threads:[~2013-02-04 13:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 15:31 [PATCH 0/2] ARM: dma-mapping: add highmem support for coherent allocation Marek Szyprowski
2013-01-16 15:31 ` [PATCH 1/2] ARM: dma-mapping: add support for CMA regions placed in highmem zone Marek Szyprowski
2013-02-04 13:23 ` [PATCHv2 " Marek Szyprowski
2013-02-04 13:51 ` Michal Nazarewicz [this message]
2013-02-04 14:10 ` Russell King - ARM Linux
2013-02-04 14:24 ` Michal Nazarewicz
2013-02-04 14:34 ` Russell King - ARM Linux
2013-02-04 14:42 ` Michal Nazarewicz
2013-02-04 15:11 ` Russell King - ARM Linux
2013-02-04 14:41 ` Michal Nazarewicz
2013-02-07 14:59 ` [PATCHv3 " Marek Szyprowski
2013-01-16 15:31 ` [PATCH 2/2] ARM: dma-mapping: use himem for DMA buffers for IOMMU-mapped devices Marek Szyprowski
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=xa1tlib4b30n.fsf@mina86.com \
--to=mina86@mina86.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.