diff options
author | Paresh Bhagat <p-bhagat@ti.com> | 2023-05-03 17:24:22 +0530 |
---|---|---|
committer | Ryan Eatmon <reatmon@ti.com> | 2023-05-08 11:17:40 -0500 |
commit | 31eb1aa2b7a437d90c1bc525afcf5603fa884650 (patch) | |
tree | f4f209940fcd93f4e8561e444dc6d82b37f4f130 /meta-ti-extras/recipes-ti/jailhouse | |
parent | d3c2c6e8097c9913982a4d0746956949da81e058 (diff) | |
download | meta-ti-31eb1aa2b7a437d90c1bc525afcf5603fa884650.tar.gz |
recipes-ti: Add recipe and patches for jailhouse support for am62xx
Add and enable Jailhouse support for TI's k3-am625-sk similarly to how other
TI platforms were added and enabled in the past by adding platform-specific
configuration variables for the root cell DTB overlay, and the Linux demo inmate
DTB, configuration, and Kernel command line settings.
Migrate the jailhouse recipe to kirkstone from dunfell.
Switch to latest upstream source tree for jailhouse. The TI Jailhouse repo has
gone stale and now upstream is really the happening place where new development
happens including for new devices such as AM62x. Hence go ahead and switch to
using the upstream repo.
Update the platform-specific config files to such that the root cell DTB overlay
gets included in the file system images.
Enable additional console on ttyS3 (usually mapped to main_uart1) and ttyS2 for
the Linux demo inmate to use.
Add patches for the Jailhouse source tree for am62xx.
Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
Signed-off-by: Paresh Bhagat <p-bhagat@ti.com>
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
Diffstat (limited to 'meta-ti-extras/recipes-ti/jailhouse')
7 files changed, 521 insertions, 0 deletions
diff --git a/meta-ti-extras/recipes-ti/jailhouse/files/0001-configs-arm64-k3-am625-sk-Add-crypto-memory-region.patch b/meta-ti-extras/recipes-ti/jailhouse/files/0001-configs-arm64-k3-am625-sk-Add-crypto-memory-region.patch new file mode 100644 index 00000000..bfb57ae3 --- /dev/null +++ b/meta-ti-extras/recipes-ti/jailhouse/files/0001-configs-arm64-k3-am625-sk-Add-crypto-memory-region.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From 723ca87d25c1f8bac68d2608dbc3b5e8caba69ca Mon Sep 17 00:00:00 2001 | ||
2 | From: Andreas Dannenberg <dannenberg@ti.com> | ||
3 | Date: Mon, 12 Sep 2022 13:22:04 -0500 | ||
4 | Subject: [PATCH] configs: arm64: k3-am625-sk: Add crypto memory region | ||
5 | |||
6 | Add the memory region for the AM62x crypto accelerator to the device- | ||
7 | specific config file. This fixes a runtime exception when the kernel | ||
8 | accesses that memory region: | ||
9 | |||
10 | <snip> | ||
11 | Unhandled data read at 0x40910010(4) | ||
12 | |||
13 | FATAL: unhandled trap (exception class 0x24) | ||
14 | <snip> | ||
15 | |||
16 | Upstream-Status: Submitted [jailhouse-dev@googlegroups.com] | ||
17 | |||
18 | Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> | ||
19 | Signed-off-by: Paresh Bhagat <p-bhagat@ti.com> | ||
20 | --- | ||
21 | configs/arm64/k3-am625-sk.c | 9 ++++++++- | ||
22 | 1 file changed, 8 insertions(+), 1 deletion(-) | ||
23 | |||
24 | diff --git a/configs/arm64/k3-am625-sk.c b/configs/arm64/k3-am625-sk.c | ||
25 | index 2e5c3aef..4b0b8043 100644 | ||
26 | --- a/configs/arm64/k3-am625-sk.c | ||
27 | +++ b/configs/arm64/k3-am625-sk.c | ||
28 | @@ -18,7 +18,7 @@ | ||
29 | struct { | ||
30 | struct jailhouse_system header; | ||
31 | __u64 cpus[1]; | ||
32 | - struct jailhouse_memory mem_regions[31]; | ||
33 | + struct jailhouse_memory mem_regions[32]; | ||
34 | struct jailhouse_irqchip irqchips[5]; | ||
35 | struct jailhouse_pci_device pci_devices[2]; | ||
36 | } __attribute__((packed)) config = { | ||
37 | @@ -231,6 +231,13 @@ struct { | ||
38 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
39 | JAILHOUSE_MEM_IO, | ||
40 | }, | ||
41 | + /* CRYPTO */ { | ||
42 | + .phys_start = 0x40900000, | ||
43 | + .virt_start = 0x40900000, | ||
44 | + .size = 0x0030000, | ||
45 | + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
46 | + JAILHOUSE_MEM_IO, | ||
47 | + }, | ||
48 | /* First Wake Up Domain */ { | ||
49 | .phys_start = 0x2b000000, | ||
50 | .virt_start = 0x2b000000, | ||
51 | -- | ||
52 | 2.34.1 | ||
diff --git a/meta-ti-extras/recipes-ti/jailhouse/files/0001-configs-k3-use-intx-for-bar_mask.patch b/meta-ti-extras/recipes-ti/jailhouse/files/0001-configs-k3-use-intx-for-bar_mask.patch new file mode 100644 index 00000000..c29baed5 --- /dev/null +++ b/meta-ti-extras/recipes-ti/jailhouse/files/0001-configs-k3-use-intx-for-bar_mask.patch | |||
@@ -0,0 +1,72 @@ | |||
1 | From 84ea5e9f65fc8082d520267258784cae32c8b499 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ricardo Salveti <ricardo@foundries.io> | ||
3 | Date: Wed, 1 Mar 2023 22:14:35 -0300 | ||
4 | Subject: [PATCH] configs/k3: use intx for bar_mask | ||
5 | |||
6 | Fixes pci probe failure: | ||
7 | |||
8 | [ 46.795840] pci 0001:00:00.0: BAR 0: no space for [mem size 0x00010000] | ||
9 | [ 46.802516] pci 0001:00:00.0: BAR 0: failed to assign [mem size 0x00010000] | ||
10 | [ 46.809512] pci 0001:00:01.0: BAR 0: no space for [mem size 0x00010000] | ||
11 | [ 46.816158] pci 0001:00:01.0: BAR 0: failed to assign [mem size 0x00010000] | ||
12 | |||
13 | Upstream-Status: Pending | ||
14 | |||
15 | Signed-off-by: Ricardo Salveti <ricardo@foundries.io> | ||
16 | |||
17 | This patch was imported from foundriesio/meta-lmp | ||
18 | (https://github.com/foundriesio/meta-lmp) as of commit id | ||
19 | 70d419bfd54a99d3591e5a22622fc67f7de82b94. | ||
20 | |||
21 | Signed-off-by: Paresh Bhagat <p-bhagat@ti.com> | ||
22 | --- | ||
23 | configs/arm64/k3-am625-sk-linux-demo.c | 4 ++-- | ||
24 | configs/arm64/k3-am625-sk.c | 4 ++-- | ||
25 | 2 files changed, 4 insertions(+), 4 deletions(-) | ||
26 | |||
27 | diff --git a/configs/arm64/k3-am625-sk-linux-demo.c b/configs/arm64/k3-am625-sk-linux-demo.c | ||
28 | index 6dac8859..dcc5f026 100644 | ||
29 | --- a/configs/arm64/k3-am625-sk-linux-demo.c | ||
30 | +++ b/configs/arm64/k3-am625-sk-linux-demo.c | ||
31 | @@ -197,7 +197,7 @@ struct { | ||
32 | /* 00:00.0 */ { | ||
33 | .type = JAILHOUSE_PCI_TYPE_IVSHMEM, | ||
34 | .bdf = 0 << 3, | ||
35 | - .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K, | ||
36 | + .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, | ||
37 | .shmem_regions_start = 0, | ||
38 | .shmem_dev_id = 2, | ||
39 | .shmem_peers = 3, | ||
40 | @@ -206,7 +206,7 @@ struct { | ||
41 | /* 00:01.0 */ { | ||
42 | .type = JAILHOUSE_PCI_TYPE_IVSHMEM, | ||
43 | .bdf = 1 << 3, | ||
44 | - .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K, | ||
45 | + .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, | ||
46 | .shmem_regions_start = 5, | ||
47 | .shmem_dev_id = 1, | ||
48 | .shmem_peers = 2, | ||
49 | diff --git a/configs/arm64/k3-am625-sk.c b/configs/arm64/k3-am625-sk.c | ||
50 | index 69ab12a4..dcea42e0 100644 | ||
51 | --- a/configs/arm64/k3-am625-sk.c | ||
52 | +++ b/configs/arm64/k3-am625-sk.c | ||
53 | @@ -325,7 +325,7 @@ struct { | ||
54 | .type = JAILHOUSE_PCI_TYPE_IVSHMEM, | ||
55 | .domain = 1, | ||
56 | .bdf = 0 << 3, | ||
57 | - .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K, | ||
58 | + .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, | ||
59 | .shmem_regions_start = 0, | ||
60 | .shmem_dev_id = 0, | ||
61 | .shmem_peers = 3, | ||
62 | @@ -335,7 +335,7 @@ struct { | ||
63 | .type = JAILHOUSE_PCI_TYPE_IVSHMEM, | ||
64 | .domain = 1, | ||
65 | .bdf = 1 << 3, | ||
66 | - .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX_64K, | ||
67 | + .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_INTX, | ||
68 | .shmem_regions_start = 5, | ||
69 | .shmem_dev_id = 0, | ||
70 | .shmem_peers = 2, | ||
71 | -- | ||
72 | 2.34.1 | ||
diff --git a/meta-ti-extras/recipes-ti/jailhouse/files/0002-configs-arm64-k3-am625-sk-Switch-inmate-boot-console.patch b/meta-ti-extras/recipes-ti/jailhouse/files/0002-configs-arm64-k3-am625-sk-Switch-inmate-boot-console.patch new file mode 100644 index 00000000..3634c415 --- /dev/null +++ b/meta-ti-extras/recipes-ti/jailhouse/files/0002-configs-arm64-k3-am625-sk-Switch-inmate-boot-console.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From dbc02104bb469f68034b84f293583df413b8ca56 Mon Sep 17 00:00:00 2001 | ||
2 | From: Andreas Dannenberg <dannenberg@ti.com> | ||
3 | Date: Mon, 12 Sep 2022 16:08:12 -0500 | ||
4 | Subject: [PATCH] configs: arm64: k3-am625-sk: Switch inmate boot console alias | ||
5 | to serial3 | ||
6 | |||
7 | Traditionally the serial3 DTS alias is used for the 2nd main-domain UART | ||
8 | on K3 devices so go ahead and update the alias and its usage accordingly | ||
9 | for better consistency. | ||
10 | |||
11 | While at it also do a minor cleanup of the UART's DTS node to use the | ||
12 | TISCI standard definitions as used in the corresponding Kernel DTS files. | ||
13 | |||
14 | Upstream-Status: Submitted [jailhouse-dev@googlegroups.com] | ||
15 | |||
16 | Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> | ||
17 | Signed-off-by: Paresh Bhagat <p-bhagat@ti.com> | ||
18 | --- | ||
19 | configs/arm64/dts/inmate-k3-am625-sk.dts | 11 ++++++----- | ||
20 | 1 file changed, 6 insertions(+), 5 deletions(-) | ||
21 | |||
22 | diff --git a/configs/arm64/dts/inmate-k3-am625-sk.dts b/configs/arm64/dts/inmate-k3-am625-sk.dts | ||
23 | index c1455073..8e1bebb8 100644 | ||
24 | --- a/configs/arm64/dts/inmate-k3-am625-sk.dts | ||
25 | +++ b/configs/arm64/dts/inmate-k3-am625-sk.dts | ||
26 | @@ -1,6 +1,7 @@ | ||
27 | /dts-v1/; | ||
28 | |||
29 | #include <dt-bindings/interrupt-controller/arm-gic.h> | ||
30 | +#include <dt-bindings/soc/ti,sci_pm_domain.h> | ||
31 | |||
32 | / { | ||
33 | model = "Texas Instruments AM625 Inmate Model"; | ||
34 | @@ -10,11 +11,11 @@ | ||
35 | #size-cells = <2>; | ||
36 | |||
37 | aliases { | ||
38 | - serial1 = &main_uart1; | ||
39 | + serial3 = &main_uart1; | ||
40 | }; | ||
41 | |||
42 | chosen { | ||
43 | - stdout-path = "serial1:115200n8"; | ||
44 | + stdout-path = "serial3:115200n8"; | ||
45 | }; | ||
46 | |||
47 | memory@e0000000 { | ||
48 | @@ -91,9 +92,9 @@ | ||
49 | compatible = "ti,am64-uart", "ti,am654-uart"; | ||
50 | reg = <0x00 0x02810000 0x00 0x100>; | ||
51 | interrupts = <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>; | ||
52 | - power-domains = <&k3_pds 152 1>; | ||
53 | - current-speed = <115200>; | ||
54 | - clock-frequency = <48000000>; | ||
55 | + power-domains = <&k3_pds 152 TI_SCI_PD_EXCLUSIVE>; | ||
56 | + clocks = <&k3_clks 152 0>; | ||
57 | + clock-names = "fclk"; | ||
58 | }; | ||
59 | |||
60 | pci@76000000 { | ||
61 | -- | ||
62 | 2.34.1 | ||
diff --git a/meta-ti-extras/recipes-ti/jailhouse/files/0003-configs-arm64-k3-am625-sk-Add-VTM-memory-region.patch b/meta-ti-extras/recipes-ti/jailhouse/files/0003-configs-arm64-k3-am625-sk-Add-VTM-memory-region.patch new file mode 100644 index 00000000..c2b68e8d --- /dev/null +++ b/meta-ti-extras/recipes-ti/jailhouse/files/0003-configs-arm64-k3-am625-sk-Add-VTM-memory-region.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 9c9bba78b5635531fc8946914233af8c8ac8a6f3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Andreas Dannenberg <dannenberg@ti.com> | ||
3 | Date: Fri, 4 Nov 2022 12:58:48 -0500 | ||
4 | Subject: [PATCH] configs: arm64: k3-am625-sk: Add VTM memory region | ||
5 | |||
6 | Add the memory region for VTM to the device-specific config | ||
7 | file. This fixes a runtime exception when the kernel accesses | ||
8 | that memory region: | ||
9 | |||
10 | <snip> | ||
11 | Unhandled data read at 0xb00308(4) | ||
12 | |||
13 | FATAL: unhandled trap (exception class 0x24) | ||
14 | <snip> | ||
15 | |||
16 | Upstream-Status: Submitted [jailhouse-dev@googlegroups.com] | ||
17 | |||
18 | written by: Ricardo Salveti <ricardo@foundries.io> | ||
19 | Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> | ||
20 | Signed-off-by: Paresh Bhagat <p-bhagat@ti.com> | ||
21 | --- | ||
22 | configs/arm64/k3-am625-sk.c | 9 ++++++++- | ||
23 | 1 file changed, 8 insertions(+), 1 deletion(-) | ||
24 | |||
25 | diff --git a/configs/arm64/k3-am625-sk.c b/configs/arm64/k3-am625-sk.c | ||
26 | index 4b0b8043..fac4eaa6 100644 | ||
27 | --- a/configs/arm64/k3-am625-sk.c | ||
28 | +++ b/configs/arm64/k3-am625-sk.c | ||
29 | @@ -18,7 +18,7 @@ | ||
30 | struct { | ||
31 | struct jailhouse_system header; | ||
32 | __u64 cpus[1]; | ||
33 | - struct jailhouse_memory mem_regions[32]; | ||
34 | + struct jailhouse_memory mem_regions[33]; | ||
35 | struct jailhouse_irqchip irqchips[5]; | ||
36 | struct jailhouse_pci_device pci_devices[2]; | ||
37 | } __attribute__((packed)) config = { | ||
38 | @@ -154,6 +154,13 @@ struct { | ||
39 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
40 | JAILHOUSE_MEM_IO, | ||
41 | }, | ||
42 | + /* Wake Up Domain VTM0 */ { | ||
43 | + .phys_start = 0x00b00000, | ||
44 | + .virt_start = 0x00b00000, | ||
45 | + .size = 0x00001000, | ||
46 | + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
47 | + JAILHOUSE_MEM_IO, | ||
48 | + }, | ||
49 | /* First peripheral window, 1 of 2 */ { | ||
50 | .phys_start = 0x01000000, | ||
51 | .virt_start = 0x01000000, | ||
52 | -- | ||
53 | 2.34.1 | ||
diff --git a/meta-ti-extras/recipes-ti/jailhouse/files/0004-configs-arm64-k3-am625-sk-Add-GPMC-memory-region.patch b/meta-ti-extras/recipes-ti/jailhouse/files/0004-configs-arm64-k3-am625-sk-Add-GPMC-memory-region.patch new file mode 100644 index 00000000..800470bf --- /dev/null +++ b/meta-ti-extras/recipes-ti/jailhouse/files/0004-configs-arm64-k3-am625-sk-Add-GPMC-memory-region.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From c0e85959637a1de61170d1025e1bac8da283ddb9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Andreas Dannenberg <dannenberg@ti.com> | ||
3 | Date: Thu, 19 Jan 2023 09:43:55 -0600 | ||
4 | Subject: [PATCH] configs: arm64: k3-am625-sk: Add GPMC memory region | ||
5 | |||
6 | Add the memory region for GPMC, used by the AM62Q NAND card. | ||
7 | |||
8 | Upstream-Status: Submitted [jailhouse-dev@googlegroups.com] | ||
9 | |||
10 | Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> | ||
11 | Signed-off-by: Paresh Bhagat <p-bhagat@ti.com> | ||
12 | --- | ||
13 | configs/arm64/k3-am625-sk.c | 16 +++++++++++++++- | ||
14 | 1 file changed, 15 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/configs/arm64/k3-am625-sk.c b/configs/arm64/k3-am625-sk.c | ||
17 | index fac4eaa6..10b5a8f3 100644 | ||
18 | --- a/configs/arm64/k3-am625-sk.c | ||
19 | +++ b/configs/arm64/k3-am625-sk.c | ||
20 | @@ -18,7 +18,7 @@ | ||
21 | struct { | ||
22 | struct jailhouse_system header; | ||
23 | __u64 cpus[1]; | ||
24 | - struct jailhouse_memory mem_regions[33]; | ||
25 | + struct jailhouse_memory mem_regions[35]; | ||
26 | struct jailhouse_irqchip irqchips[5]; | ||
27 | struct jailhouse_pci_device pci_devices[2]; | ||
28 | } __attribute__((packed)) config = { | ||
29 | @@ -231,6 +231,20 @@ struct { | ||
30 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
31 | JAILHOUSE_MEM_IO, | ||
32 | }, | ||
33 | + /* GPMC */ { | ||
34 | + .phys_start = 0x3b000000, | ||
35 | + .virt_start = 0x3b000000, | ||
36 | + .size = 0x00001000, | ||
37 | + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
38 | + JAILHOUSE_MEM_IO, | ||
39 | + }, | ||
40 | + /* GPMC */ { | ||
41 | + .phys_start = 0x50000000, | ||
42 | + .virt_start = 0x50000000, | ||
43 | + .size = 0x08000000, | ||
44 | + .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
45 | + JAILHOUSE_MEM_IO, | ||
46 | + }, | ||
47 | /* CPSW */ { | ||
48 | .phys_start = 0x08000000, | ||
49 | .virt_start = 0x08000000, | ||
50 | -- | ||
51 | 2.34.1 | ||
diff --git a/meta-ti-extras/recipes-ti/jailhouse/jailhouse-arch.inc b/meta-ti-extras/recipes-ti/jailhouse/jailhouse-arch.inc new file mode 100644 index 00000000..498b25ed --- /dev/null +++ b/meta-ti-extras/recipes-ti/jailhouse/jailhouse-arch.inc | |||
@@ -0,0 +1,22 @@ | |||
1 | # Set jailhouse architecture JH_ARCH variable | ||
2 | # | ||
3 | # return value must match one of architectures supported by jailhouse | ||
4 | # | ||
5 | valid_jh_archs = "x86 arm" | ||
6 | |||
7 | def map_jh_arch(a, d): | ||
8 | import re | ||
9 | |||
10 | valid_jh_archs = d.getVar('valid_jh_archs', True).split() | ||
11 | |||
12 | if re.match('(i.86|athlon|x86.64)$', a): return 'x86' | ||
13 | elif re.match('armeb$', a): return 'arm' | ||
14 | elif re.match('aarch64$', a): return 'arm64' | ||
15 | elif re.match('aarch64_be$', a): return 'arm64' | ||
16 | elif a in valid_jh_archs: return a | ||
17 | else: | ||
18 | bb.error("cannot map '%s' to a jailhouse supported architecture" % a) | ||
19 | |||
20 | export JH_ARCH = "${@map_jh_arch(d.getVar('TARGET_ARCH', True), d)}" | ||
21 | |||
22 | COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux" | ||
diff --git a/meta-ti-extras/recipes-ti/jailhouse/jailhouse_git.bb b/meta-ti-extras/recipes-ti/jailhouse/jailhouse_git.bb new file mode 100644 index 00000000..05cc21b3 --- /dev/null +++ b/meta-ti-extras/recipes-ti/jailhouse/jailhouse_git.bb | |||
@@ -0,0 +1,209 @@ | |||
1 | SUMMARY = "Linux-based partitioning hypervisor" | ||
2 | DESCRIPTION = "Jailhouse is a partitioning Hypervisor based on Linux. It is able to run bare-metal applications or (adapted) \ | ||
3 | operating systems besides Linux. For this purpose, it configures CPU and device virtualization features of the hardware \ | ||
4 | platform in a way that none of these domains, called 'cells' here, can interfere with each other in an unacceptable way." | ||
5 | HOMEPAGE = "https://github.com/siemens/jailhouse" | ||
6 | SECTION = "jailhouse" | ||
7 | LICENSE = "GPL-2.0-only & BSD-2-Clause" | ||
8 | |||
9 | LIC_FILES_CHKSUM = " \ | ||
10 | file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \ | ||
11 | " | ||
12 | |||
13 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
14 | |||
15 | PV = "0.12+git${SRCPV}" | ||
16 | SRCREV = "e57d1eff6d55aeed5f977fe4e2acfb6ccbdd7560" | ||
17 | BRANCH = "master" | ||
18 | |||
19 | SRC_URI = " \ | ||
20 | git://github.com/siemens/jailhouse.git;protocol=https;branch=${BRANCH} \ | ||
21 | file://0001-configs-arm64-k3-am625-sk-Add-crypto-memory-region.patch \ | ||
22 | file://0002-configs-arm64-k3-am625-sk-Switch-inmate-boot-console.patch \ | ||
23 | file://0003-configs-arm64-k3-am625-sk-Add-VTM-memory-region.patch \ | ||
24 | file://0001-configs-k3-use-intx-for-bar_mask.patch \ | ||
25 | file://0004-configs-arm64-k3-am625-sk-Add-GPMC-memory-region.patch \ | ||
26 | " | ||
27 | |||
28 | DEPENDS = "virtual/kernel dtc-native python3-mako-native python3-mako make-native" | ||
29 | RDEPENDS:${PN} += "\ | ||
30 | python3-curses\ | ||
31 | python3-datetime\ | ||
32 | python3-mmap\ | ||
33 | " | ||
34 | |||
35 | require jailhouse-arch.inc | ||
36 | inherit module python3native bash-completion deploy setuptools3 | ||
37 | |||
38 | S = "${WORKDIR}/git" | ||
39 | B = "${S}" | ||
40 | |||
41 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
42 | COMPATIBLE_MACHINE = "(ti-soc)" | ||
43 | |||
44 | JH_DATADIR ?= "${datadir}/jailhouse" | ||
45 | JH_EXEC_DIR ?= "${libexecdir}/jailhouse" | ||
46 | CELL_DIR ?= "${JH_DATADIR}/cells" | ||
47 | CELLCONF_DIR ?= "${JH_DATADIR}/configs" | ||
48 | INMATES_DIR ?= "${JH_DATADIR}/inmates" | ||
49 | |||
50 | JH_CELL_FILES ?= "*.cell" | ||
51 | JH_CELL_FILES:k3 ?= "k3-*.cell" | ||
52 | |||
53 | JH_INMATE_DTB ?= "" | ||
54 | JH_INMATE_DTB:am62xx ?= "inmate-k3-am625-sk.dtb" | ||
55 | JH_INMATE_DTB:am65xx ?= "inmate-k3-am654-idk.dtb" | ||
56 | JH_INMATE_DTB:j7 ?= "inmate-k3-j721e-evm.dtb" | ||
57 | JH_INMATE_DTB:j7200-evm ?= "inmate-k3-j7200-evm.dtb" | ||
58 | |||
59 | JH_LINUX_DEMO_CELL ?= "" | ||
60 | JH_LINUX_DEMO_CELL:am62xx ?= "k3-am625-sk-linux-demo.cell" | ||
61 | JH_LINUX_DEMO_CELL:am65xx ?= "k3-am654-idk-linux-demo.cell" | ||
62 | JH_LINUX_DEMO_CELL:j7 ?= "k3-j721e-evm-linux-demo.cell" | ||
63 | JH_LINUX_DEMO_CELL:j7200-evm ?= "k3-j7200-evm-linux-demo.cell" | ||
64 | |||
65 | JH_SYSCONFIG_CELL ?= "" | ||
66 | JH_SYSCONFIG_CELL:am62xx ?= "k3-am625-sk.cell" | ||
67 | JH_SYSCONFIG_CELL:am65xx ?= "k3-am654-idk.cell" | ||
68 | JH_SYSCONFIG_CELL:j7 ?= "k3-j721e-evm.cell" | ||
69 | JH_SYSCONFIG_CELL:j7200-evm ?= "k3-j7200-evm.cell" | ||
70 | |||
71 | INITRAMFS_IMAGE ?= "" | ||
72 | JH_RAMFS_IMAGE ?= "${INITRAMFS_IMAGE}" | ||
73 | |||
74 | JH_CMDLINE ?= "" | ||
75 | JH_CMDLINE:am62xx ?= "console=ttyS3,115200n8 earlycon=ns16550a,mmio32,0x02810000" | ||
76 | JH_CMDLINE:am65xx ?= "console=ttyS1,115200n8" | ||
77 | JH_CMDLINE:j7 ?= "console=ttyS3,115200n8" | ||
78 | JH_CMDLINE:j7200-evm ?= "console=ttyS3,115200n8" | ||
79 | |||
80 | do_configure() { | ||
81 | if [ -d ${STAGING_DIR_HOST}/${CELLCONF_DIR} ]; | ||
82 | then | ||
83 | cp ${STAGING_DIR_HOST}/${CELLCONF_DIR}/*.c ${S}/configs/ | ||
84 | fi | ||
85 | } | ||
86 | |||
87 | USER_SPACE_CFLAGS = '${CFLAGS} -DLIBEXECDIR=\\\"${libexecdir}\\\" \ | ||
88 | -DJAILHOUSE_VERSION=\\\"$JAILHOUSE_VERSION\\\" \ | ||
89 | -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \ | ||
90 | -I../driver' | ||
91 | |||
92 | TOOLS_SRC_DIR = "${S}/tools" | ||
93 | |||
94 | EXTRA_OEMAKE = "ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}" KDIR=${STAGING_KERNEL_BUILDDIR}" | ||
95 | |||
96 | do_compile() { | ||
97 | oe_runmake V=1 | ||
98 | } | ||
99 | |||
100 | do_install() { | ||
101 | # Install pyjailhouse python modules needed by the tools | ||
102 | # distutils3_do_install | ||
103 | |||
104 | # We want to install the python tools, but we do not want to use pip... | ||
105 | # At least with v0.10, we can work around this with | ||
106 | # 'PIP=":" PYTHON_PIP_USEABLE=yes' | ||
107 | oe_runmake PIP=: PYTHON=python3 PYTHON_PIP_USEABLE=yes DESTDIR=${D} install | ||
108 | |||
109 | install -d ${D}${CELL_DIR} | ||
110 | install -m 0644 ${B}/configs/${JH_ARCH}/${JH_CELL_FILES} ${D}${CELL_DIR}/ | ||
111 | |||
112 | install -d ${D}${INMATES_DIR} | ||
113 | install -m 0644 ${B}/inmates/demos/${JH_ARCH}/*.bin ${D}${INMATES_DIR} | ||
114 | |||
115 | install -d ${D}/boot | ||
116 | if [ -n "${JH_RAMFS_IMAGE}" ] | ||
117 | then | ||
118 | if [ -f ${DEPLOY_DIR_IMAGE}/${JH_RAMFS_IMAGE}-${MACHINE}.cpio ] | ||
119 | then | ||
120 | install -m 0644 ${DEPLOY_DIR_IMAGE}/${JH_RAMFS_IMAGE}-${MACHINE}.cpio ${D}/boot | ||
121 | else | ||
122 | bberror "Could not find JH_RAMFS_IMAGE (${JH_RAMFS_IMAGE}-${MACHINE}.cpio)!" | ||
123 | bberror "Please make sure that \"cpio\" is in IMAGE_FSTYPES." | ||
124 | fi | ||
125 | fi | ||
126 | |||
127 | if [ -n "${JH_INMATE_DTB}" -a -n "${JH_LINUX_DEMO_CELL}" ]; then | ||
128 | cd ${TOOLS_SRC_DIR} | ||
129 | |||
130 | echo "#! /bin/sh" > ${D}${JH_DATADIR}/linux-demo.sh | ||
131 | echo "jailhouse enable ${CELL_DIR}/${JH_SYSCONFIG_CELL}" >> ${D}${JH_DATADIR}/linux-demo.sh | ||
132 | ./jailhouse-cell-linux -w ${D}${JH_DATADIR}/${JH_INMATE_DTB} \ | ||
133 | -a ${JH_ARCH} -c "${JH_CMDLINE}" \ | ||
134 | -d ../configs/${JH_ARCH}/dts/${JH_INMATE_DTB} \ | ||
135 | -i ${D}/boot/${JH_RAMFS_IMAGE}-${MACHINE}.cpio \ | ||
136 | ${D}${CELL_DIR}/${JH_LINUX_DEMO_CELL} \ | ||
137 | ${DEPLOY_DIR_IMAGE}/Image \ | ||
138 | | tr -cd '\11\12\15\40-\176' \ | ||
139 | >> ${D}${JH_DATADIR}/linux-demo.sh | ||
140 | |||
141 | sed -i -e 's,^Modified device tree written.*,,g' ${D}${JH_DATADIR}/linux-demo.sh | ||
142 | sed -i -e 's,\${D},,g' ${D}${JH_DATADIR}/linux-demo.sh | ||
143 | sed -i -e 's, linux-loader.bin, ${JH_EXEC_DIR}/linux-loader.bin,g' ${D}${JH_DATADIR}/linux-demo.sh | ||
144 | sed -i -e 's,\${DEPLOY_DIR_IMAGE},/boot,g' ${D}${JH_DATADIR}/linux-demo.sh | ||
145 | sed -i -e '/^\s*$/d' ${D}${JH_DATADIR}/linux-demo.sh | ||
146 | chmod +x ${D}${JH_DATADIR}/linux-demo.sh | ||
147 | fi | ||
148 | |||
149 | } | ||
150 | |||
151 | PACKAGE_BEFORE_PN = "kernel-module-jailhouse pyjailhouse ${PN}-tools" | ||
152 | FILES:${PN} = "${base_libdir}/firmware ${libexecdir} ${sbindir} ${JH_DATADIR} /boot" | ||
153 | FILES:pyjailhouse = "${PYTHON_SITEPACKAGES_DIR}" | ||
154 | FILES:${PN}-tools = "${libexecdir}/${BPN}/${BPN}-*" | ||
155 | |||
156 | RDEPENDS:${PN}-tools = "pyjailhouse python3-mmap python3-math python3-datetime python3-curses python3-compression" | ||
157 | RDEPENDS:pyjailhouse = "python3-core python3-ctypes python3-fcntl python3-shell" | ||
158 | |||
159 | RRECOMMENDS:${PN} = "${PN}-tools" | ||
160 | |||
161 | INSANE_SKIP:${PN} = "ldflags" | ||
162 | |||
163 | KERNEL_MODULE_AUTOLOAD += "jailhouse" | ||
164 | |||
165 | # Any extra cells/inmates from external recipes/packages | ||
166 | CELLS = "" | ||
167 | |||
168 | python __anonymous () { | ||
169 | d.appendVarFlag('do_install', 'depends', ' virtual/kernel:do_deploy') | ||
170 | ramfs = d.getVar('JH_RAMFS_IMAGE', True) | ||
171 | if ramfs: | ||
172 | d.appendVarFlag('do_install', 'depends', ' ${JH_RAMFS_IMAGE}:do_image_complete') | ||
173 | |||
174 | # Setup DEPENDS and RDEPENDS to included cells | ||
175 | cells = d.getVar('CELLS', True) or "" | ||
176 | for cell in cells.split(): | ||
177 | d.appendVar('DEPENDS', ' ' + cell) | ||
178 | d.appendVar('RDEPENDS_${PN}', ' ' + cell) | ||
179 | } | ||
180 | |||
181 | |||
182 | FILES:${PN} = " \ | ||
183 | /boot \ | ||
184 | /usr/libexec \ | ||
185 | /usr/sbin/ivshmem-demo \ | ||
186 | /usr/sbin/jailhouse \ | ||
187 | /usr/libexec/jailhouse \ | ||
188 | /usr/libexec/jailhouse/jailhouse-config-check \ | ||
189 | /usr/libexec/jailhouse/jailhouse-config-collect \ | ||
190 | /usr/libexec/jailhouse/jailhouse-hardware-check \ | ||
191 | /usr/libexec/jailhouse/jailhouse-cell-stats \ | ||
192 | /usr/libexec/jailhouse/linux-loader.bin \ | ||
193 | /usr/libexec/jailhouse/jailhouse-cell-linux \ | ||
194 | /usr/libexec/jailhouse/jailhouse-config-create \ | ||
195 | /usr/share/jailhouse \ | ||
196 | /usr/share/jailhouse/linux-demo.sh \ | ||
197 | /usr/share/jailhouse/inmate-k3-am625-sk.dtb \ | ||
198 | /usr/share/jailhouse/inmates \ | ||
199 | /usr/share/jailhouse/cells \ | ||
200 | /usr/share/jailhouse/inmates/gic-demo.bin \ | ||
201 | /usr/share/jailhouse/inmates/ivshmem-demo.bin \ | ||
202 | /usr/share/jailhouse/inmates/uart-demo.bin \ | ||
203 | /usr/share/jailhouse/cells/k3-am625-sk.cell \ | ||
204 | /usr/share/jailhouse/cells/k3-am625-sk-inmate-demo.cell \ | ||
205 | /usr/share/jailhouse/cells/k3-am625-sk-linux-demo.cell \ | ||
206 | /lib/firmware \ | ||
207 | /lib/firmware/jailhouse.bin \ | ||
208 | /boot/tisdk-tiny-image-am62xx-evm.cpio \ | ||
209 | " | ||