public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
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 15:24:51 +0100	[thread overview]
Message-ID: <xa1tfw1cb1ho.fsf@mina86.com> (raw)
In-Reply-To: <20130204141053.GD17786@n2100.arm.linux.org.uk>

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?

-- 
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/3e4952c3/attachment.sig>

  reply	other threads:[~2013-02-04 14:24 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 [this message]
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=xa1tfw1cb1ho.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox