Issue with correct mapping of memory regions for the jetson-tk1 root cell

107 views
Skip to first unread message

Ralf Ramsauer

unread,
Oct 23, 2015, 7:03:58 AM10/23/15
to jailho...@googlegroups.com
Hi,

after enabling CONFIG_DRM_TEGRA in the kernel config of my jetson-tk1 board, jailhouse panics immediately after enabling:
Unhandled data read at 0x542000dc(4)
FATAL: unhandled trap (exception class 0x24)
pc=0xc0365bec cpsr=0x600f0193 esr=0x93860006
r0=0x00000019 r1=0xdd235c10 r2=0x00000000 r3=0xdf900000
r4=0xdd235c10 r5=0xdd9dd824 r6=0x00000019 r7=0x00000001
r8=0xc0a62000 r9=0x00000000 r10=0x00000000 r11=0xc0afaa3c
r12=0x1d5b3000 r13=0x1d5b3000 r14=0x1d5b3000
Parking CPU 0 (Cell: "Jetson-TK1")
This is reasonable, as 0x542000dc belongs to host1x and the program counter points to some drm-related kernel function.
The current config/jetson-tk1.c root cell config doesn't map those regions. So I tried to map those regions and added the corresponding four regions to the jetson-tk1.c. (See [1] for the diff of my jetston-tk1.c)
# cat /proc/iomem|grep -i host1x
50000000-50033fff : /host1x@0,50000000
54200000-5423ffff : /host1x@0,50000000/dc@0,54200000
54240000-5427ffff : /host1x@0,50000000/dc@0,54240000
54280000-542bffff : /host1x@0,50000000/hdmi@0,54280000
Linux freezes right after invoking the jailhouse enable command. The debug UART states:
Initializing Jailhouse hypervisor v0.5 (145-g83180c1-dirty) on CPU 2
Code location: 0xf0000020
And that's it, no more output. I guess the hypervisor is stuck somewhere during early bootup. As jailhouse works fine without CONFIG_DRM_TEGRA and my additional mapping, I assume that there's something wrong with my mapping.

What am I missing?
Anything helps!

[1] http://pastebin.com/TEh5VXS5

Thanks
  Ralf
-- 
Ralf Ramsauer
GPG: 0x8F10049B

Jan Kiszka

unread,
Oct 27, 2015, 7:51:41 AM10/27/15
to Ralf Ramsauer, jailho...@googlegroups.com
> + //50000000-50033fff : /host1x@0,50000000
> + {
> + .phys_start = 0x50000000,
> + .virt_start = 0x50000000,
> + .size = 0x3400,

Regions must be page-aligned - though I'm not sure right now what
exactly could happen if some isn't.

Jan

--
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

Ralf Ramsauer

unread,
Oct 27, 2015, 8:08:30 AM10/27/15
to Jan Kiszka, jailho...@googlegroups.com
Hi Jan,

thank you, problem solved. It works now.

Ralf
Ralf Ramsauer
GPG: 0x8F10049B

n.cap...@gmail.com

unread,
Mar 31, 2016, 8:23:29 AM3/31/16
to Jailhouse, jan.k...@siemens.com, Roberto Cavicchioli
Hi,

we are also trying to run jailhouse on a jetson.
We pretty much followed the procedure in https://blog.ramses-pyramidenbau.de/?p=342#jailhouse and we are stuck with the same error displayed in the first message of this thread
(Unhandled data read at 0x542000dc(4)
FATAL: unhandled trap (exception class 0x24))

Ralf, since you said you solved it,
would you be so kind to elaborate how exactly you changed the file jetson-tk1.c to make it work?

Also why is the mapping necessary?

Thanks,
Nicola and Roberto.



Jan Kiszka

unread,
Mar 31, 2016, 9:38:40 AM3/31/16
to n.cap...@gmail.com, Jailhouse, Roberto Cavicchioli
The only change required to Ralf's patch should be .size = 0x4000 in the
first case. Just try that out.

>
> Also why is the mapping necessary?

The kernel I was testing on developing the upstream jetson-tk1.c config
for did not include support for the GPU that exposes those memory
regions, thus Linux wasn't accessing them.

Jan

--
Siemens AG, Corporate Technology, CT RDA ITP SES-DE

n.cap...@gmail.com

unread,
Mar 31, 2016, 10:52:10 AM3/31/16
to Jailhouse, n.cap...@gmail.com, roberto.c...@unimore.it

Hi thanks for your answer.

We changed the .size field to 4000 but now we have a different unhandled trap exception that I copy and paste here:

root@debian:~# jailhouse enable /home/jailhouse/configs/jetson-tk1.cell
Initializing Jailhouse hypervisor v0.5 (238-g33fbbbd-dirty) on CPU 2
Code location: 0xf0000020
Page pool usage after early setup: mem 22/16112, remap 64/32768
Initializing processors:
CPU 2... OK
CPU 1... OK
CPU 0... OK
CPU 3... OK
Page pool usage after late setup: mem 35/16112, remap 64/32768
Activating hypervisor
root@debian:~# Unhandled data read at 0x6000d514(4)


FATAL: unhandled trap (exception class 0x24)

pc=0xc025dd94 cpsr=0xa0000013 esr=0x93820007
r0=0xfe20d000 r1=0x000000aa r2=0xfe20d514 r3=0x00000504
r4=0xdd1b2800 r5=0xdd1b2c58 r6=0xdd1b6834 r7=0xdd1b2b40
r8=0xdd1b6940 r9=0x00000000 r10=0xdd1f9ed4 r11=0xdd1b6834
r12=0x00000001 r13=0x00000001 r14=0x00000001
Parking CPU 1 (Cell: "Jetson-TK1")

by taking a look at /proc/iomem it looks like that address is used by GPIO

[...]
6000d000-6000dfff : /gpio@0,6000d000
[...]

Therefore we had to map these as well. So in the pastebin link you can find a working jetson-tk1.c file:

http://pastebin.com/6wV36tgT

Ralf Ramsauer

unread,
Mar 31, 2016, 11:19:27 AM3/31/16
to n.cap...@gmail.com, Jailhouse, jan.k...@siemens.com, Roberto Cavicchioli
Hi,
wohoo, someone reads my blog! :-)
>
> Ralf, since you said you solved it,
> would you be so kind to elaborate how exactly you changed the file jetson-tk1.c to make it work?
>
> Also why is the mapping necessary?
This memory region is used by host1x. Afair, I only encountered problems
with a HDMI monitor connected.

So there are two possible solutions:
- Deactivate GPU support in your kernel, if you don't need it. This
way, you can use the config provided by jailhouse.
- Apply the correct mapping as already suggested by Jan

Cheers
Ralf

>
> Thanks,
> Nicola and Roberto.
>
>
>

--
Ralf Ramsauer
PGP: 0x8F10049B


Ralf Ramsauer

unread,
Mar 31, 2016, 11:26:17 AM3/31/16
to n.cap...@gmail.com, Jailhouse, Jan Kiszka, roberto.c...@unimore.it
Hi,
yep, I encountered the same problem right after mapping the region for
host1x. Apparently host1x tries to access some gpios afterwards.
>
> Therefore we had to map these as well. So in the pastebin link you can find a working jetson-tk1.c file:
>
> http://pastebin.com/6wV36tgT
Uhm - Jan: Just as an idea, but what about providing a working kernel
.config for each supported (embedded) platform? This could avoid
problems like this and.

Ralf

Jan Kiszka

unread,
Mar 31, 2016, 11:28:44 AM3/31/16
to Ralf Ramsauer, n.cap...@gmail.com, Jailhouse, roberto.c...@unimore.it
We can do this. We can also expand on the configuration if someone found
and successfully fixed a problem. Patches welcome.

n.cap...@gmail.com

unread,
Mar 31, 2016, 12:16:01 PM3/31/16
to Jailhouse, ra...@ramses-pyramidenbau.de, roberto.c...@unimore.it
Hi all,

the kernel .config file is autogenerated using the command

make [cross compile options] tegra_defconfig.

The kernel we used is a 4.1.0 that you can find here:
http://git.kiszka.org/?p=linux.git;a=snapshot;h=2e68ed9e59b45d04bf7146c0b18ef94716344bc0;sf=tgz

We tried an upstream 4.3.something but the board was not able to boot once we got the HYP mode activated.
everything was cross-compiled with make-3.82 and the gcc-toolchan-4.9

We boot a debian-wheezy from an sdcard and we have a monitor connected through a HDMI to VGA cable.

You can patch it using the file sent with pastebin.

if you want, we can soon send the patch (for the jetson-tk1.c file) to the github


Nicola and Roberto

Ralf Ramsauer

unread,
Mar 31, 2016, 12:24:58 PM3/31/16
to n.cap...@gmail.com, Jailhouse, roberto.c...@unimore.it
Hi,
I think I already had some 4.3 running on my jetson together with
jailhouse...
>
> We boot a debian-wheezy from an sdcard and we have a monitor connected through a HDMI to VGA cable.
>
> You can patch it using the file sent with pastebin.
>
> if you want, we can soon send the patch (for the jetson-tk1.c file) to the github
I'm just compiling a vanilla 4.5 kernel for my jetson and trying to run
jailhouse. I'll attach the .config as soon as I got it working.

But yes, that's a good point: The jailhouse jetson-tk1.c config should
be designed to work together with tegra_defconfig out of the box.

Ralf
>
>
> Nicola and Roberto

Ralf Ramsauer

unread,
Mar 31, 2016, 4:27:31 PM3/31/16
to n.cap...@gmail.com, Jailhouse, roberto.c...@unimore.it
Hi,

here's some working kernel config for 4.5.0 for the Jetson TK1 [1]. If
you're tired of compiling, you can also use my precompiled kernel and
dtb. Some adjustments were needed but nevertheless, the resulting
.config is only slightly different from tegra_defconfig:

- turn off CONFIG_CPUIDLE
- turn off CONFIG_CPUFREQ
- set
CONFIG_PGTABLE_LEVELS=3
CONFIG_ARM_LPAE=y
CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
CONFIG_ARM_PSCI=y

I was able to enable jailhouse using this configuration together with
the jetson-tk1.c config that comes with jailhouse and run the uart-demo
inmate. If you have some HDMI device connected, jailhouse will probably
crash. But as I don't have any HDMI hardware in reachable distance, I'm
not able to test it. So you still have to respect the host1x/gpio memory
regions in your system config.

For a first shot, simply try to disconnect your monitor :-)

Ralf

[1] https://ramses-pyramidenbau.de/~ralf/jetson-tk1/kernel/
Reply all
Reply to author
Forward
0 new messages