Re: Jetson TX2 - access to peripherals from inmate

2022-04-02 Thread Ralf Ramsauer




On 02/04/2022 10:14, Jan Kiszka wrote:

On 25.03.22 16:11, 'johannes lex' via Jailhouse wrote:

Hello everybody,

i'm investigating the jailhouse hypervisor for a research project of an
automotive company.

As a first step, i want to set up the Jetson TX2 Board and add an inmate
which toggels one GPIO Pin. I used the VM from the ERIKA V3
(https://www.erika-enterprise.com/index.php/download/virtual-machines.html)
as a base development platform.
So far, Jailhouse is running and my configs seem to work.

However, I can't access (not even read) the registers of the GPIO or any
other peripheral which i assign to my cell, except the already
configured UART.
The cell config and assignment of the registers themself seems to work:
i can, for example, read the register 0x02210890 from the Linux host
before creating the cell. After creating the cell, a read attempt from
the Linux host leads to a system crash.
Unfortunately, i can't read that register from the inmate as well :/

Do you have a clue why i can't read the register in my setup? I've
attached my configs and the source code for the bare metal application
of the inmate.

Or do you have any examples in which you access the GPIOs (or other
peripherals) of the Jetson TX2 from an inmate which you could share?


Already checked your configs for undesired overlaps (jailhouse config
check)?

Looking at the jetson-tx2-demo.c config you shared, the GPIO range is
exclusively assigned from the root cell to the non-root demo. So, any
further accesses from the Linux root cell should indeed trigger a
violation. But accesses from the demo cell must be possible. However,
I'm not seeing any violation reports regarding that cell.


We had a offlist converstation - map_range in inmate + ROOTSHARED solved 
the issue.


Thanks
  Ralf



Jan



--
Ralf Ramsauer
PGP: 0xC85252CC

--
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/bd0cbbc1-7abb-8924-5228-da22e2aa51c5%40vmexit.de.


Re: Jetson TX2 - access to peripherals from inmate

2022-04-02 Thread Jan Kiszka
On 25.03.22 16:11, 'johannes lex' via Jailhouse wrote:
> Hello everybody,
>
> i'm investigating the jailhouse hypervisor for a research project of an
> automotive company.
>
> As a first step, i want to set up the Jetson TX2 Board and add an inmate
> which toggels one GPIO Pin. I used the VM from the ERIKA V3
> (https://www.erika-enterprise.com/index.php/download/virtual-machines.html)
> as a base development platform.
> So far, Jailhouse is running and my configs seem to work. 
>
> However, I can't access (not even read) the registers of the GPIO or any
> other peripheral which i assign to my cell, except the already
> configured UART.
> The cell config and assignment of the registers themself seems to work:
> i can, for example, read the register 0x02210890 from the Linux host
> before creating the cell. After creating the cell, a read attempt from
> the Linux host leads to a system crash.
> Unfortunately, i can't read that register from the inmate as well :/
>
> Do you have a clue why i can't read the register in my setup? I've
> attached my configs and the source code for the bare metal application
> of the inmate.
>
> Or do you have any examples in which you access the GPIOs (or other
> peripherals) of the Jetson TX2 from an inmate which you could share?

Already checked your configs for undesired overlaps (jailhouse config
check)?

Looking at the jetson-tx2-demo.c config you shared, the GPIO range is
exclusively assigned from the root cell to the non-root demo. So, any
further accesses from the Linux root cell should indeed trigger a
violation. But accesses from the demo cell must be possible. However,
I'm not seeing any violation reports regarding that cell.

Jan

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/27e635ef-500f-6f19-a461-9a5e88d12c8d%40web.de.


Jetson TX2 - access to peripherals from inmate

2022-03-25 Thread 'johannes lex' via Jailhouse
Hello everybody,

i'm investigating the jailhouse hypervisor for a research project of an 
automotive company.

As a first step, i want to set up the Jetson TX2 Board and add an inmate 
which toggels one GPIO Pin. I used the VM from the ERIKA V3 
(https://www.erika-enterprise.com/index.php/download/virtual-machines.html) 
as a base development platform.
So far, Jailhouse is running and my configs seem to work. 

However, I can't access (not even read) the registers of the GPIO or any 
other peripheral which i assign to my cell, except the already configured 
UART.
The cell config and assignment of the registers themself seems to work: i 
can, for example, read the register 0x02210890 from the Linux host before 
creating the cell. After creating the cell, a read attempt from the Linux 
host leads to a system crash.
Unfortunately, i can't read that register from the inmate as well :/

Do you have a clue why i can't read the register in my setup? I've attached 
my configs and the source code for the bare metal application of the inmate.

Or do you have any examples in which you access the GPIOs (or other 
peripherals) of the Jetson TX2 from an inmate which you could share?

Thank you in advance,
Johannes

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/b708cd52-3034-4d11-a61c-1e4c992c096dn%40googlegroups.com.
nvidia@tegra-ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 16.04.7 LTS
Release:16.04
Codename:   xenial
nvidia@tegra-ubuntu:~$ sudo devmem2 0x02210890
/dev/mem opened.
Memory mapped at address 0x7fb51ba000.
Value at address 0x2210890 (0x7fb51ba890): 0x0
nvidia@tegra-ubuntu:~$ sudo jailhouse cell create jetson-tx2-gpio-demo.cell
[ 1019.958463] CPU0: shutdown
[ 1019.961171] psci: CPU0 killed.
Shared memory connection established: "jetson-tx2-demo" <--> "Jetson-TX2"
Shared memory connection established: "jetson-tx2-demo" <--> "Jetson-TX2"
Created cell "jetson-tx2-demo"
Page pool usage after cell creation: mem 119/16355, remap 101/131072
[ 1020.034356] Created Jailhouse cell "jetson-tx2-demo"
nvidia@tegra-ubuntu:~$ sudo jailhouse cell load jetson-tx2-demo 
read_register.bin
Cell "jetson-tx2-demo" can be loaded
nvidia@tegra-ubuntu:~$ sudo jailhouse cell start jetson-tx2-demo
Started cell "jetson-tx2-demo"
Hello, inmate started
reading UART: 13 address: 310
address gpio: 2210890
nvidia@tegra-ubuntu:~$ sudo devmem2 0x02210890
/dev/mem opened.
Memory mappUed nhandled data read at 0x2210890(8)

FATAL: unhandled trap (exception class 0x24)
Cell state before exception:
 pc: 00400c04   lr: 00400ba8 spsr: 6000 EL0
 sp: 007fe76ad8b0  esr: 24 1 1c08007
 x0: 007fb28bb890   x1: 007fb28bb000   x2: 0001
 x3:    x4:    x5: 00405404
 x6: 00413037   x7:    x8: 0040
 x9: ff80ffc8  x10: 007fe76ad8b0  x11: 007fe76ad8b0
x12: 03f3  x13:   x14: 
x15: 007fb28c  x16: 00412058  x17: 007fb278dd70
x18: 0a03  x19: 00400da0  x20: 
x21:   x22:   x23: 
x24:   x25:   x26: 
x27:   x28:   x29: 007fe76ad8b0

Parking CPU 4 (Cell: "Jetson-TX2")
at address 0x7fb28bb000.
/*
 * Jailhouse, a Linux-based partitioning hypervisor
 *
 * Copyright (c) ARM Limited, 2014
 *
 * Authors:
 *  Jean-Philippe Brucker 
 *
 * This work is licensed under the terms of the GNU GPL, version 2.  See
 * the COPYING file in the top-level directory.
 */

#include 

//Registers for configuration of Pin I4 
#define GPIO_I4_CONFIG 0x02210880UL
//Register for output value of Pin I4 
#define GPIO_I4_OUTPUT 0x02210890UL

volatile unsigned int* uart_dummy; 
volatile unsigned int* gpio_output;

void inmate_main(void)
{
	int i;
	
	//this is the address for the debug console (UART A). Printk writes to this console so it is accessable
	uart_dummy = (unsigned int*) 0x0310UL; 
	
	gpio_output= (unsigned int*)  GPIO_I4_OUTPUT; //i want to read the current GPIO Port I4 
printk("Hello, inmate started\n");


	//the registers of the debug console can be read as expected
	printk("reading UART: %d address: %x\n", *uart_dummy, uart_dummy);

	printk("address gpio: %x \n", gpio_output);
	
	//
	//THE GPIO REGISTER CAN NOT BE READ///
	printk("reading GPIO: %d \n", *gpio_output);//i want to read the current GPIO Port I4 
	//THIS POINT IS NEVER REACHED///
	
	
	while(++i); 

}
/*
 * Jailhouse, a Linux-based partitioning