From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jan Weitzel <j.weitzel@phytec.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] ARM: mmu: Use PAGE_ALIGN in dma_free_coherent
Date: Sat, 27 Apr 2013 00:13:02 +0200 [thread overview]
Message-ID: <20130426221302.GD32299@pengutronix.de> (raw)
In-Reply-To: <1366984338-6649-1-git-send-email-j.weitzel@phytec.de>
On Fri, Apr 26, 2013 at 03:52:18PM +0200, Jan Weitzel wrote:
> We PAGE_ALIGN the size in dma_alloc_coherent so do it also when free the memory.
> Use PAGE_SIZE instead of magic numbers.
>
> Signed-off-by: Jan Weitzel <j.weitzel@phytec.de>
Applied, thanks
Sascha
> ---
> arch/arm/cpu/mmu.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
> index 34fe5c3..e3ea3b6 100644
> --- a/arch/arm/cpu/mmu.c
> +++ b/arch/arm/cpu/mmu.c
> @@ -189,7 +189,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
> ptes, ttb_start, ttb_end);
>
> for (i = 0; i < num_ptes; i++) {
> - ptes[i] = (phys + i * 4096) | PTE_TYPE_SMALL |
> + ptes[i] = (phys + i * PAGE_SIZE) | PTE_TYPE_SMALL |
> pte_flags_cached;
> }
>
> @@ -300,7 +300,7 @@ static int mmu_init(void)
> asm volatile ("mcr p15,0,%0,c3,c0,0" : : "r"(i) /*:*/);
>
> /* create a flat mapping using 1MiB sections */
> - create_sections(0, 0, 4096, PMD_SECT_AP_WRITE | PMD_SECT_AP_READ |
> + create_sections(0, 0, PAGE_SIZE, PMD_SECT_AP_WRITE | PMD_SECT_AP_READ |
> PMD_TYPE_SECT);
>
> vectors_init();
> @@ -332,7 +332,7 @@ void *dma_alloc_coherent(size_t size)
> void *ret;
>
> size = PAGE_ALIGN(size);
> - ret = xmemalign(4096, size);
> + ret = xmemalign(PAGE_SIZE, size);
>
> dma_inv_range((unsigned long)ret, (unsigned long)ret + size);
>
> @@ -353,6 +353,7 @@ void *phys_to_virt(unsigned long phys)
>
> void dma_free_coherent(void *mem, size_t size)
> {
> + size = PAGE_ALIGN(size);
> remap_range(mem, size, pte_flags_cached);
>
> free(mem);
> --
> 1.7.0.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2013-04-26 22:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 13:52 Jan Weitzel
2013-04-26 22:13 ` Sascha Hauer [this message]
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=20130426221302.GD32299@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=j.weitzel@phytec.de \
/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