* [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n
@ 2015-01-15 6:24 Magnus Damm
2015-01-15 9:47 ` Geert Uytterhoeven
2015-01-15 9:51 ` Magnus Damm
0 siblings, 2 replies; 4+ messages in thread
From: Magnus Damm @ 2015-01-15 6:24 UTC (permalink / raw)
To: linux-sh
From: Magnus Damm <damm+renesas@opensource.se>
Allow R-Car Gen2 platforms to boot with CMA enabled
and HIGHMEM disabled. This patch adds code to check
if the R-Car Gen2 specific memory reservation window
is included in the kernel memory range or not. When
HIGHMEM is disabled the R-Car Gen2 reservation area is
outside the kernel memory range and in such case the
memory reservation is simply skipped over.
Without this patch the kernel boot hangs when CMA is
enabled and HIGHMEM is disabled on the r8a7791 Koelsch
hardware platform.
In the current shmobile_defconfig HIGHMEM is enabled
while CMA is disabled, so to trigger this the kernel
configuration for both CMA and HIGHMEM needs to be
adjusted.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---
Written on top of renesas-devel-20150114v2-v3.19-rc4
arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- 0001/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ work/arch/arm/mach-shmobile/setup-rcar-gen2.c 2015-01-15 14:20:47.089397114 +0900
@@ -21,6 +21,7 @@
#include <linux/dma-contiguous.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/memblock.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <asm/mach/arch.h>
@@ -197,7 +198,7 @@ void __init rcar_gen2_reserve(void)
of_scan_flat_dt(rcar_gen2_scan_mem, &mrc);
#ifdef CONFIG_DMA_CMA
- if (mrc.size)
+ if (mrc.size && memblock_is_region_memory(mrc.base, mrc.size))
dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
&rcar_gen2_dma_contiguous, true);
#endif
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n
2015-01-15 6:24 [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n Magnus Damm
@ 2015-01-15 9:47 ` Geert Uytterhoeven
2015-01-15 9:51 ` Magnus Damm
1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-01-15 9:47 UTC (permalink / raw)
To: linux-sh
Hi Magnus,
On Thu, Jan 15, 2015 at 7:24 AM, Magnus Damm <magnus.damm@gmail.com> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Allow R-Car Gen2 platforms to boot with CMA enabled
> and HIGHMEM disabled. This patch adds code to check
> if the R-Car Gen2 specific memory reservation window
> is included in the kernel memory range or not. When
> HIGHMEM is disabled the R-Car Gen2 reservation area is
> outside the kernel memory range and in such case the
> memory reservation is simply skipped over.
>
> Without this patch the kernel boot hangs when CMA is
> enabled and HIGHMEM is disabled on the r8a7791 Koelsch
> hardware platform.
Please describe the failure mode in the description, so it becomes
Google-able. E.g.
WARNING: CPU: 1 PID: 1 at mm/cma.c:113 cma_init_reserved_areas+0x88/0x1d4()
...
WARNING: CPU: 1 PID: 1 at mm/cma.c:121 cma_init_reserved_areas+0xf8/0x1d4()
...
Unable to handle kernel NULL pointer dereference at virtual address 00000160
pgd = c0003000
[00000160] *pgd€000040004003, *pmd\0000000
Internal error: Oops: 206 [#1] SMP ARM
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W
3.19.0-rc4-koelsch-01450-g7f9b6075ce12c3ea-dirty #735
Hardware name: Generic R8A7791 (Flattened Device Tree)
task: edc553c0 ti: edc56000 task.ti: edc56000
PC is at set_pfnblock_flags_mask+0x54/0xa0
LR is at 0x440
> In the current shmobile_defconfig HIGHMEM is enabled
> while CMA is disabled, so to trigger this the kernel
> configuration for both CMA and HIGHMEM needs to be
> adjusted.
Thanks for fixing this!
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n
2015-01-15 6:24 [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n Magnus Damm
2015-01-15 9:47 ` Geert Uytterhoeven
@ 2015-01-15 9:51 ` Magnus Damm
1 sibling, 0 replies; 4+ messages in thread
From: Magnus Damm @ 2015-01-15 9:51 UTC (permalink / raw)
To: linux-sh
Hi Geert,
On Thu, Jan 15, 2015 at 6:47 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Magnus,
>
> On Thu, Jan 15, 2015 at 7:24 AM, Magnus Damm <magnus.damm@gmail.com> wrote:
>> From: Magnus Damm <damm+renesas@opensource.se>
>>
>> Allow R-Car Gen2 platforms to boot with CMA enabled
>> and HIGHMEM disabled. This patch adds code to check
>> if the R-Car Gen2 specific memory reservation window
>> is included in the kernel memory range or not. When
>> HIGHMEM is disabled the R-Car Gen2 reservation area is
>> outside the kernel memory range and in such case the
>> memory reservation is simply skipped over.
>>
>> Without this patch the kernel boot hangs when CMA is
>> enabled and HIGHMEM is disabled on the r8a7791 Koelsch
>> hardware platform.
>
> Please describe the failure mode in the description, so it becomes
> Google-able. E.g.
>
> WARNING: CPU: 1 PID: 1 at mm/cma.c:113 cma_init_reserved_areas+0x88/0x1d4()
> ...
> WARNING: CPU: 1 PID: 1 at mm/cma.c:121 cma_init_reserved_areas+0xf8/0x1d4()
> ...
> Unable to handle kernel NULL pointer dereference at virtual address 00000160
> pgd = c0003000
> [00000160] *pgd€000040004003, *pmd\0000000
> Internal error: Oops: 206 [#1] SMP ARM
> Modules linked in:
> CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W
> 3.19.0-rc4-koelsch-01450-g7f9b6075ce12c3ea-dirty #735
> Hardware name: Generic R8A7791 (Flattened Device Tree)
> task: edc553c0 ti: edc56000 task.ti: edc56000
> PC is at set_pfnblock_flags_mask+0x54/0xa0
> LR is at 0x440
Good idea, thanks for supplying additional information.
>> In the current shmobile_defconfig HIGHMEM is enabled
>> while CMA is disabled, so to trigger this the kernel
>> configuration for both CMA and HIGHMEM needs to be
>> adjusted.
>
> Thanks for fixing this!
>
>> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
>
> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Thanks!
/ magnus
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n
2015-03-03 0:24 [GIT PULL v2] Renesas ARM Based SoC Updates for v4.1 Simon Horman
@ 2015-03-03 0:24 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2015-03-03 0:24 UTC (permalink / raw)
To: linux-arm-kernel
From: Magnus Damm <damm+renesas@opensource.se>
Allow R-Car Gen2 platforms to boot with CMA enabled
and HIGHMEM disabled. This patch adds code to check
if the R-Car Gen2 specific memory reservation window
is included in the kernel memory range or not. When
HIGHMEM is disabled the R-Car Gen2 reservation area is
outside the kernel memory range and in such case the
memory reservation is simply skipped over.
Without this patch the kernel boot hangs when CMA is
enabled and HIGHMEM is disabled on the r8a7791 Koelsch
hardware platform:
WARNING: CPU: 1 PID: 1 at mm/cma.c:113 cma_init_reserved_areas+0x88/0x1d4()
...
WARNING: CPU: 1 PID: 1 at mm/cma.c:121 cma_init_reserved_areas+0xf8/0x1d4()
...
Unable to handle kernel NULL pointer dereference at virtual address 00000160
pgd = c0003000
[00000160] *pgd€000040004003, *pmd\0000000
Internal error: Oops: 206 [#1] SMP ARM
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W
3.19.0-rc4-koelsch-01450-g7f9b6075ce12c3ea-dirty #735
Hardware name: Generic R8A7791 (Flattened Device Tree)
task: edc553c0 ti: edc56000 task.ti: edc56000
PC is at set_pfnblock_flags_mask+0x54/0xa0
LR is at 0x440
In the current shmobile_defconfig HIGHMEM is enabled
while CMA is disabled, so to trigger this the kernel
configuration for both CMA and HIGHMEM needs to be
adjusted.
Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
index d1fa625..8c7ec93 100644
--- a/arch/arm/mach-shmobile/setup-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -21,6 +21,7 @@
#include <linux/dma-contiguous.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/memblock.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <asm/mach/arch.h>
@@ -199,7 +200,7 @@ void __init rcar_gen2_reserve(void)
of_scan_flat_dt(rcar_gen2_scan_mem, &mrc);
#ifdef CONFIG_DMA_CMA
- if (mrc.size)
+ if (mrc.size && memblock_is_region_memory(mrc.base, mrc.size))
dma_contiguous_reserve_area(mrc.size, mrc.base, 0,
&rcar_gen2_dma_contiguous, true);
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-03 0:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-15 6:24 [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n Magnus Damm
2015-01-15 9:47 ` Geert Uytterhoeven
2015-01-15 9:51 ` Magnus Damm
-- strict thread matches above, loose matches on Subject: below --
2015-03-03 0:24 [GIT PULL v2] Renesas ARM Based SoC Updates for v4.1 Simon Horman
2015-03-03 0:24 ` [PATCH] ARM: shmobile: No R-Car Gen2 CMA reservation when HIGHMEM=n Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox