From: linux@arm.linux.org.uk (Russell King - ARM Linux)
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, 4 Feb 2013 14:34:33 +0000 [thread overview]
Message-ID: <20130204143433.GE17786@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <xa1tfw1cb1ho.fsf@mina86.com>
On Mon, Feb 04, 2013 at 03:24:51PM +0100, Michal Nazarewicz wrote:
> On Mon, Feb 04 2013, Russell King - ARM Linux wrote:
> > On Mon, Feb 04, 2013 at 02:51:52PM +0100, Michal Nazarewicz wrote:
> >> 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?
> >
> > Because lowmem pages always have an address.
>
> Perhaps it should use lowmem_page_address() then?
It's well defined that page_address() will be non-NULL for lowmem pages.
There is nothing wrong with the above.
next prev parent reply other threads:[~2013-02-04 14:34 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
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 [this message]
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=20130204143433.GE17786@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox