Skip to contentSkip to conversation

ARM, earlyconsole and io mapping

DISCUSSION Robert Jarzmik 3 participants 5 messages Mar 30, 2015 – Mar 31, 2015

lore
Share & tools
lore
#0 lore raw

Hi,

I was wondering how the earlyconsole was supposed to work in order to add support to the pxa architecture. More specifically, I don't understand how the memory mapping is supposed to be available at the early parameters parsing.

The thing I don't understand is that :
- in kernel initialization, parse_early_param() is called before machine_desc->map_io()
- as a consequence, the architecture didn't add the vm early mapping for serial peripheral (which is added in pxa_map_io())
- as a consequence, earlycon_map() will fail to map the serial MMIO (as in stack showed in [1])

Therefore, are there non-DT earlycon users on the list, and could they tell me what way they get earlycon support in their arm boards please ?

Cheers.

Signature · 16 lines
Robert

[1] Call stack
#0  __arm_ioremap_pfn_caller (pfn=262400, offset=0, size=64, mtype=0, caller=0xc041d66c) at arch/arm/mm/ioremap.c:260
#1  0xc0015d34 in __arm_ioremap_caller (phys_addr=<value optimized out>, size=<value optimized out>, mtype=0, caller=<value optimized out>) at arch/arm/mm/ioremap.c:354
#2  0xc0015868 in __arm_ioremap (phys_addr=<value optimized out>, size=<value optimized out>, mtype=<value optimized out>) at arch/arm/mm/ioremap.c:383
#3  0xc041d66c in earlycon_map (buf=0x0, match=0x0, setup=0x40) at drivers/tty/serial/earlycon.c:48
#4  setup_earlycon (buf=0x0, match=0x0, setup=0x40) at drivers/tty/serial/earlycon.c:138
#5  0xc040a52c in do_early_param (param=0xc0424bf6 "earlycon", val=0xc0424bff "pxa,mmio,0x40100000,115200n8", unused=<value optimized out>) at init/main.c:420
#6  0xc00306bc in parse_one (doing=0xc0393668 "early options", args=0xc0424c1b "", params=<value optimized out>, num=<value optimized out>, min_level=0, max_level=0, unknown=0) at kernel/params.c:131
#7  parse_args (doing=0xc0393668 "early options", args=0xc0424c1b "", params=<value optimized out>, num=<value optimized out>, min_level=0, max_level=0, unknown=0) at kernel/params.c:216
#8  0xc040a854 in parse_early_options (cmdline=<value optimized out>) at init/main.c:430
#9  0xc040a890 in parse_early_param () at init/main.c:444
#10 0xc040d950 in setup_arch (cmdline_p=0xc07f3fd4) at arch/arm/kernel/setup.c:922
#11 0xc040a918 in start_kernel () at init/main.c:520
  => Here get_vm_area_caller() will fail in __arm_ioremap_pfn_caller().
#1 lore raw

Dear Robert Jarzmik,

Quoted 12 lines · Robert Jarzmik

I was wondering how the earlyconsole was supposed to work in order to add support to the pxa architecture. More specifically, I don't understand how the memory mapping is supposed to be available at the early parameters parsing.

The thing I don't understand is that :
- in kernel initialization, parse_early_param() is called before machine_desc->map_io()
- as a consequence, the architecture didn't add the vm early mapping for serial peripheral (which is added in pxa_map_io())
- as a consequence, earlycon_map() will fail to map the serial MMIO (as in stack showed in [1])

Quoted 2 lines

Therefore, are there non-DT earlycon users on the list, and could they tell me what way they get earlycon support in their arm boards please ?

A very early mapping of the I/O space is done in head.S, way before you get into C code:

http://lxr.free-electrons.com/source/arch/arm/kernel/head.S#L277

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw
Quoted 7 lines · Thomas Petazzoni

Dear Robert Jarzmik,

On Mon, 30 Mar 2015 14:05:33 +0200, Robert Jarzmik wrote:
A very early mapping of the I/O space is done in head.S, way before you get into C code:

http://lxr.free-electrons.com/source/arch/arm/kernel/head.S#L277

That's DEBUG_LL, right ? If that's what you mean, then I already have DEBUG_LL, but that doesn't answer my question, as DEBUG_LL stops spitting logs after the decompressor, and the errors I want to trap are between end of decompressor and drivers probe.

And my question about earlycon remains, DEBUG_LL is not earlycon.

Cheers.

Signature · 1 line
Robert
#3 lore raw
In reply to Robert Jarzmik

Hi Robert,

Quoted 14 lines · Robert Jarzmik

Hi,

I was wondering how the earlyconsole was supposed to work in order to add support to the pxa architecture. More specifically, I don't understand how the memory mapping is supposed to be available at the early parameters parsing.

The thing I don't understand is that :
- in kernel initialization, parse_early_param() is called before machine_desc->map_io()
- as a consequence, the architecture didn't add the vm early mapping for serial peripheral (which is added in pxa_map_io())
- as a consequence, earlycon_map() will fail to map the serial MMIO (as in stack showed in [1])

Quoted 2 lines

Therefore, are there non-DT earlycon users on the list, and could they tell me what way they get earlycon support in their arm boards please ?

Fixmap support has not been upstreamed yet, but if you're desperate, here's the latest patch version:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/318372.html

If you're using /chosen/stdout-path, earlycon gets turned off at dummy VT console load, so for right now, specify your earlycon and consoles on the command line.

Regards,
Peter Hurley

#4 lore raw
Quoted 11 lines · Peter Hurley

Hi Robert,

Quoted 5 lines · Robert Jarzmik

Hi,

I was wondering how the earlyconsole was supposed to work in order to add support to the pxa architecture. More specifically, I don't understand how the memory mapping is supposed to be available at the early parameters parsing.

Fixmap support has not been upstreamed yet, but if you're desperate, here's the latest patch version:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/318372.html

Ah I'm not desperate, that would be nice to have tool on my automation platform. I've gone the DEBUG_LL + JTAG/__log_buf memory dump so far.

And yet I remember viewing early concole patches a few monthes back, and I wondered how the authors could make them work ... And as my memory didn't serve me well, I couldn't remember your name.

Quoted 3 lines

If you're using /chosen/stdout-path, earlycon gets turned off at dummy VT console load, so for right now, specify your earlycon and consoles on the command line.

Ah I'm using device-tree in only 1/3rd of the PXA tests :
- 1/3rd for legacy platform_data tests
- 1/3rd for device-tree pxa platforms
- 1/3rd for multiplatform kernel

Anyway, I hope you'll have Russell's comments addressed, and that your patch will make it upstream. Thanks for the information, it is exactly what I was asking for.

Cheers.

Signature · 1 line
Robert