Hi,
  I am trying to run jailhouse Linux demo on imx8mm board (
https://www.compulab.com/products/iot-gateways/iot-gate-imx8-industrial-arm-iot-gateway/
)

After the dts patch and kernel re-build, I am able to run the jailhouse
inmate demo (gic-demo.bin) without any issues.

When i tried to run jailhouse Linux demo on imx8mm board, i face the
following challenge,

#Enable Jailhouse:
export PATH=$PATH:/usr/share/jailhouse/tools
insmod /lib/modules/5.15.32-iot-gate-imx8m-3.2.1+/extra/driver/jailhouse.ko
jailhouse enable /usr/share/jailhouse/cells/imx8mm.cell
jailhouse cell list

#try to run Linux
jailhouse cell linux imx8mm-linux-demo.cell /home/root/jailhouse/vmlinux -d
/home/root/jailhouse/sb-iotgimx8.dtb -c "clk_ignore_unused
console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 net.ifnames=0
root=/dev/sda2 rootwait rw"

imx8mm-linux-demo.cell - file attached for reference
sb-iotgimx8.dts - file attached for reference

#jailhouse console output
root@iot-gate-imx8:~/jailhouse# jailhouse console

Initializing Jailhouse hypervisor v0.2 on CPU 0
Code location: 0x0000ffffc0200800
Page pool usage after early setup: mem 39/993, remap 0/131072
Initializing processors:
 CPU 0... OK
 CPU 3... OK
 CPU 1... OK
 CPU 2... OK
Initializing unit: irqchip
Initializing unit: ARM SMMU v3
Initializing unit: ARM SMMU
Initializing unit: PVU IOMMU
Initializing unit: PCI
Adding virtual PCI device 00:02.0 to cell "imx8mm"
Adding virtual PCI device 00:03.0 to cell "imx8mm"
Adding virtual PCI device 00:00.0 to cell "imx8mm"
Adding virtual PCI device 00:01.0 to cell "imx8mm"
Page pool usage after late setup: mem 63/993, remap 144/131072
Activating hypervisor
Adding virtual PCI device 00:02.0 to cell "linux-inmate-demo"
Shared memory connection established, peer cells:
 "imx8mm"
Adding virtual PCI device 00:03.0 to cell "linux-inmate-demo"
Shared memory connection established, peer cells:
 "imx8mm"
Adding virtual PCI device 00:00.0 to cell "linux-inmate-demo"
Shared memory connection established, peer cells:
 "imx8mm"
Adding virtual PCI device 00:01.0 to cell "linux-inmate-demo"
Shared memory connection established, peer cells:
 "imx8mm"
Created cell "linux-inmate-demo"
Page pool usage after cell creation: mem 77/993, remap 144/131072

#jailhouse cell list output
#root@iot-gate-imx8:~/jailhouse# jailhouse cell list
ID      Name                    State             Assigned CPUs
Failed CPUs
0       imx8mm                  running           0-1

1       linux-inmate-demo       shut down         2-3

#/proc/cmdline
console=ttymxc2,115200 earlycon=ec_imx6q,0x30880000,115200 net.ifnames=0
root=/dev/mmcblk2p2 rootwait rw panic=5 oops=panic

#/proc/iomem
root@iot-gate-imx8:~/jailhouse# cat /proc/iomem
00100000-00107fff : 30900000.crypto caam-sm@100000
18000000-1fefffff : pcie@33800000
  18000000-180fffff : 0000:00:00.0
  18100000-181fffff : PCI Bus 0000:01
    18100000-18103fff : 0000:01:00.0
      18100000-18103fff : iwlwifi
  18200000-1820ffff : 0000:00:00.0
1ff00000-1ff7ffff : 33800000.pcie config
30200000-3020ffff : 30200000.gpio gpio@30200000
30210000-3021ffff : 30210000.gpio gpio@30210000
30220000-3022ffff : 30220000.gpio gpio@30220000
30230000-3023ffff : 30230000.gpio gpio@30230000
30240000-3024ffff : 30240000.gpio gpio@30240000
30260000-3026ffff : 30260000.tmu tmu@30260000
30280000-3028ffff : 30280000.watchdog watchdog@30280000
302b0000-302bffff : 302b0000.dma-controller dma-controller@302b0000
302c0000-302cffff : 302c0000.dma-controller dma-controller@302c0000
30330000-3033ffff : 30330000.pinctrl pinctrl@30330000
30350000-3035ffff : 30350000.efuse efuse@30350000
30380000-3038ffff : 30380000.clock-controller clock-controller@30380000
30820000-3082ffff : 30820000.spi spi@30820000
30860000-3086ffff : 30860000.serial serial@30860000
30880000-3088ffff : 30880000.serial serial@30880000
30900000-3093ffff : 30900000.crypto crypto@30900000
30a20000-30a2ffff : 30a20000.i2c i2c@30a20000
30a30000-30a3ffff : 30a30000.i2c i2c@30a30000
30a60000-30a6ffff : 30a60000.serial serial@30a60000
30aa0000-30aaffff : 30aa0000.mailbox mailbox@30aa0000
30b50000-30b5ffff : 30b50000.mmc mmc@30b50000
30b60000-30b6ffff : 30b60000.mmc mmc@30b60000
30bd0000-30bdffff : 30bd0000.dma-controller dma-controller@30bd0000
30be0000-30beffff : 30be0000.ethernet ethernet@30be0000
32e28000-32e28003 : 32e28000.dispmix-sft-rstn dispmix-sft-rstn@32e28000
32e28004-32e28007 : 32e28004.dispmix-clk-en dispmix-clk-en@32e28004
32e28008-32e2800b : 32e28008.dispmix-mipi-rst dispmix-mipi-rst@32e28008
32e40000-32e401ff : usb@32e40000
  32e40000-32e401ff : ci_hdrc.0 usb@32e40000
32e40200-32e403ff : 32e40200.usbmisc usbmisc@32e40200
32e50000-32e501ff : usb@32e50000
  32e50000-32e501ff : ci_hdrc.1 usb@32e50000
32e50200-32e503ff : 32e50200.usbmisc usbmisc@32e50200
32f00000-32f0ffff : 33800000.pcie pcie-phy@32f00000
33000000-33001fff : 33000000.dma-controller dma-controller@33000000
33800000-33bfffff : 33800000.pcie dbi
3d800000-3dbfffff : 3d800000.ddr-pmu ddr-pmu@3d800000
40000000-55ffffff : System RAM
  40610000-41ceffff : Kernel code
  41cf0000-4206ffff : reserved
  42070000-423bffff : Kernel data
  43000000-4300afff : reserved
58000000-93bfffff : System RAM
  6a000000-91ffffff : reserved
93c00000-b83fffff : reserved
  b7c00000-b7ffffff : Jailhouse hypervisor
b8400000-bb6fffff : System RAM
bb700000-bbbfffff : reserved
bbc00000-bfffffff : System RAM
  bd900000-bfbfffff : reserved
  bfc6d000-bfc6dfff : reserved
  bfc6e000-bfce5fff : reserved
  bfce8000-bfce9fff : reserved
  bfcea000-bfceafff : reserved
  bfceb000-bfcfefff : reserved
  bfcff000-bfcfffff : reserved
  bfd00000-bfd35fff : reserved
  bfd36000-bfffffff : reserved


#dts patch

>From aaee5eb45ada7121c7c34af7049c0db11ea2b572 Mon Sep 17 00:00:00 2001
From: Bharathiraja Nallathambi <[email protected]>
Date: Mon, 31 Jul 2023 17:14:42 +0000
Subject: [PATCH] adding reserved memory for jailhouse

- adding reserved memory for jailhouse imx8mm

Signed-off-by: Bharathiraja Nallathambi <[email protected]
>
---
 arch/arm64/boot/dts/compulab/sb-iotgimx8.dts | 38 ++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/arch/arm64/boot/dts/compulab/sb-iotgimx8.dts
b/arch/arm64/boot/dts/compulab/sb-iotgimx8.dts
index 08de87e55d0b..6539aa8c83f6 100644
--- a/arch/arm64/boot/dts/compulab/sb-iotgimx8.dts
+++ b/arch/arm64/boot/dts/compulab/sb-iotgimx8.dts
@@ -315,3 +315,41 @@ MX8MM_IOMUXC_SAI5_RXC_GPIO3_IO20 0x140
  };
  };
 };
+
+&{/reserved-memory} {
+
+ ivshmem_reserved: ivshmem@bbb00000 {
+ no-map;
+ reg = <0 0xbbb00000 0x0 0x00100000>;
+ };
+
+ ivshmem2_reserved: ivshmem2@bba00000 {
+ no-map;
+ reg = <0 0xbba00000 0x0 0x00100000>;
+ };
+
+ pci_reserved: pci@bb800000 {
+ no-map;
+ reg = <0 0xbb800000 0x0 0x00200000>;
+ };
+
+ loader_reserved: loader@bb700000 {
+ no-map;
+ reg = <0 0xbb700000 0x0 0x00100000>;
+ };
+
+ jh_reserved: jh@b7c00000 {
+ no-map;
+ reg = <0 0xb7c00000 0x0 0x00400000>;
+ };
+
+ /* 512MB */
+ inmate_reserved: inmate@93c00000 {
+ no-map;
+ reg = <0 0x93c00000 0x0 0x24000000>;
+ };
+};
+
+&{/reserved-memory/linux,cma} {
+ alloc-ranges = <0 0x40000000 0 0x60000000>;
+};
-- 
2.34.1


There is no console output. The terminal froze.

Can someone help me here please.



-- 
Thanks and Regards,
Bharathiraja Nallathambi


-- 
Thanks and Regards,
Bharathiraja Nallathambi

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/CAGA%3DGbz2Ex86ay715NTjSCDYhqAeOgfO%2BPemStDzjNOoS%2B8NWw%40mail.gmail.com.
/*
 * iMX8MM target - linux-demo
 *
 * Copyright 2020 NXP
 *
 * Authors:
 *  Peng Fan <[email protected]>
 *
 * This work is licensed under the terms of the GNU GPL, version 2.  See
 * the COPYING file in the top-level directory.
 */
/*
 * Boot 2nd Linux cmdline:
 * export PATH=$PATH:/usr/share/jailhouse/tools/
 * jailhouse cell linux imx8mm-linux-demo.cell Image -d fsl-imx8mm-evk-inmate.dtb -c "clk_ignore_unused console=ttymxc3,115200 earlycon=ec_imx6q,0x30890000,115200  root=/dev/mmcblk2p2 rootwait rw"
 */
#include <jailhouse/types.h>
#include <jailhouse/cell-config.h>

struct {
	struct jailhouse_cell_desc cell;
	__u64 cpus[1];
	struct jailhouse_memory mem_regions[23];
	struct jailhouse_irqchip irqchips[2];
	struct jailhouse_pci_device pci_devices[4];
} __attribute__((packed)) config = {
	.cell = {
		.signature = JAILHOUSE_CELL_DESC_SIGNATURE,
		.revision = JAILHOUSE_CONFIG_REVISION,
		.name = "linux-inmate-demo",
		.flags = JAILHOUSE_CELL_PASSIVE_COMMREG,

		.cpu_set_size = sizeof(config.cpus),
		.num_memory_regions = ARRAY_SIZE(config.mem_regions),
		.num_irqchips = ARRAY_SIZE(config.irqchips),
		.num_pci_devices = ARRAY_SIZE(config.pci_devices),
		.vpci_irq_base = 74, /* Not include 32 base */
	},

	.cpus = {
		0xc,
	},

	.mem_regions = {
		/* IVSHMEM shared memory region (virtio-blk front) */
		{
			.phys_start = 0xbba00000,
			.virt_start = 0xbba00000,
			.size = 0x1000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
		},
		{
			.phys_start = 0xbba01000,
			.virt_start = 0xbba01000,
			.size = 0xdf000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_ROOTSHARED,
		},
		{ 0 },
		{ 0 },
		/* IVSHMEM shared memory region (virtio-con front) */
		{
			.phys_start = 0xbbae0000,
			.virt_start = 0xbbae0000,
			.size = 0x1000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
		},
		{
			.phys_start = 0xbbae1000,
			.virt_start = 0xbbae1000,
			.size = 0xf000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_ROOTSHARED,
		},
		{ 0 },
		{ 0 },
		/* IVHSMEM shared memory region for 00:00.0 (demo )*/
		{
			.phys_start = 0xbbaf0000,
			.virt_start = 0xbbaf0000,
			.size = 0x1000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
		},
		{
			.phys_start = 0xbbaf1000,
			.virt_start = 0xbbaf1000,
			.size = 0x9000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_ROOTSHARED,
		},
		{
			.phys_start = 0xbbafa000,
			.virt_start = 0xbbafa000,
			.size = 0x2000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
		},
		{
			.phys_start = 0xbbafc000,
			.virt_start = 0xbbafc000,
			.size = 0x2000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
		},
		{
			.phys_start = 0xbbafe000,
			.virt_start = 0xbbafe000,
			.size = 0x2000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_ROOTSHARED,
		},
		/* IVSHMEM shared memory regions for 00:01.0 (networking) */
		JAILHOUSE_SHMEM_NET_REGIONS(0xbbb00000, 1),
	
		/* UART4 */ {
			.phys_start = 0x30a60000,
			.virt_start = 0x30a60000,
			.size = 0x1000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_IO | JAILHOUSE_MEM_ROOTSHARED,
		},
		/* SHDC1 */ {
			.phys_start = 0x30b50000,
			.virt_start = 0x30b50000,
			.size = 0x10000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_IO,
		},
		/* RAM: Top at 4GB Space */ {
			.phys_start = 0xbb700000,
			.virt_start = 0,
			.size = 0x10000, /* 64KB */
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
		},
		/* RAM */ {
			/*
			 * We could not use 0x80000000 which conflicts with
			 * COMM_REGION_BASE
			 */
			.phys_start = 0x93c00000,
			.virt_start = 0x93c00000,
			.size = 0x24000000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA |
				JAILHOUSE_MEM_LOADABLE,
		},
		/* communication region */ {
			.virt_start = 0x80000000,
			.size = 0x00001000,
			.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
				JAILHOUSE_MEM_COMM_REGION,
		},
	},

	.irqchips = {
		/* uart2/sdhc1 */ {
			.address = 0x38800000,
			.pin_base = 32,
			.pin_bitmap = {
				(1 << (24 + 32 - 32)) | (1 << (29 + 32 - 32))
			},
		},
		/* IVSHMEM */ {
			.address = 0x38800000,
			.pin_base = 96,
			.pin_bitmap = {
				0xf << (74 + 32 - 96)
			},
		},
	},

	.pci_devices = {
		{
			.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
			.domain = 1,
			.bdf = 2 << 3,
			.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
			.shmem_regions_start = 0,
			.shmem_dev_id = 1,
			.shmem_peers = 2,
			.shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_FRONT +
				VIRTIO_DEV_BLOCK,
		},
		{
			.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
			.domain = 1,
			.bdf = 3 << 3,
			.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
			.shmem_regions_start = 4,
			.shmem_dev_id = 1,
			.shmem_peers = 2,
			.shmem_protocol = JAILHOUSE_SHMEM_PROTO_VIRTIO_FRONT +
				VIRTIO_DEV_CONSOLE,
		},
		{ /* IVSHMEM 00:00.0 (demo) */
			.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
			.domain = 1,
			.bdf = 0 << 3,
			.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
			.shmem_regions_start = 8,
			.shmem_dev_id = 2,
			.shmem_peers = 3,
			.shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
		},
		{ /* IVSHMEM 00:01.0 (networking) */
			.type = JAILHOUSE_PCI_TYPE_IVSHMEM,
			.domain = 1,
			.bdf = 1 << 3,
			.bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX,
			.shmem_regions_start = 13,
			.shmem_dev_id = 1,
			.shmem_peers = 2,
			.shmem_protocol = JAILHOUSE_SHMEM_PROTO_VETH,
		},
	},
};

Attachment: sb-iotgimx8.dts
Description: Binary data

Reply via email to