meta-agl-jailhouse: Added inmates for jailhouse on agl
[AGL/meta-agl-devel.git] / meta-agl-jailhouse / recipes-extended / jailhouse / files / agl-ivshmem-demo.c
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Minimal configuration for ivshmem inmate demo:
5  * 1 CPU, 1MB RAM, serial ports, 4K shmem
6  *
7  * Copyright (c) Siemens AG, 2013, 2014
8  *
9  * Authors:
10  *  Henning Schild <henning.schild@siemens.com>
11  *
12  * This work is licensed under the terms of the GNU GPL, version 2.  See
13  * the COPYING file in the top-level directory.
14  */
15
16 #include <jailhouse/types.h>
17 #include <jailhouse/cell-config.h>
18
19 struct {
20         struct jailhouse_cell_desc cell;
21         __u64 cpus[1];
22         struct jailhouse_memory mem_regions[7];
23         struct jailhouse_pio pio_regions[1];
24         struct jailhouse_pci_device pci_devices[1];
25         struct jailhouse_pci_capability pci_caps[0];
26 } __attribute__((packed)) config = {
27         .cell = {
28                 .signature = JAILHOUSE_CELL_DESC_SIGNATURE,
29                 .revision = JAILHOUSE_CONFIG_REVISION,
30                 .name = "ivshmem-demo",
31                 .flags = JAILHOUSE_CELL_PASSIVE_COMMREG |
32                         JAILHOUSE_CELL_VIRTUAL_CONSOLE_PERMITTED,
33
34                 .cpu_set_size = sizeof(config.cpus),
35                 .num_memory_regions = ARRAY_SIZE(config.mem_regions),
36                 .num_irqchips = 0,
37                 .num_pio_regions = ARRAY_SIZE(config.pio_regions),
38                 .num_pci_devices = ARRAY_SIZE(config.pci_devices),
39                 .num_pci_caps = ARRAY_SIZE(config.pci_caps),
40
41                 .console = {
42                         .type = JAILHOUSE_CON_TYPE_8250,
43                         .flags = JAILHOUSE_CON_ACCESS_PIO,
44                         .address = 0x2f8,/* ######## ttyS0 is host -> ttyS1 */
45                 },
46         },
47
48         .cpus = {
49                 0b0010,
50         },
51
52         .mem_regions = {
53                 /* IVSHMEM shared memory regions (demo) */
54                 {
55                         .phys_start = 0x271f0000,
56                         .virt_start = 0x271f0000,
57                         .size = 0x1000,
58                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
59                 },
60                 {
61                         .phys_start = 0x271f1000,
62                         .virt_start = 0x271f1000,
63                         .size = 0x9000,
64                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
65                                 JAILHOUSE_MEM_ROOTSHARED,
66                 },
67                 {
68                         .phys_start = 0x271fa000,
69                         .virt_start = 0x271fa000,
70                         .size = 0x2000,
71                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
72                 },
73                 {
74                         .phys_start = 0x271fc000,
75                         .virt_start = 0x271fc000,
76                         .size = 0x2000,
77                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
78                                 JAILHOUSE_MEM_ROOTSHARED,
79                 },
80                 {
81                         .phys_start = 0x271fe000,
82                         .virt_start = 0x271fe000,
83                         .size = 0x2000,
84                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_ROOTSHARED,
85                 },
86                 /* RAM */ {
87                         .phys_start = 0x27200000,/* to 0x27300000 */
88                         .virt_start = 0,
89                         .size = 0x00100000,
90                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
91                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
92                 },
93                 /* communication region */ {
94                         .virt_start = 0x00100000,
95                         .size = 0x00001000,
96                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
97                                 JAILHOUSE_MEM_COMM_REGION,
98                 },
99         },
100
101         .pio_regions = {
102                 PIO_RANGE(0x2f8, 8), /* serial 2 */
103 //              PIO_RANGE(0x3f8, 8), /* serial 1 */
104         },
105
106         .pci_devices = {
107                 {
108                         .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
109                         .domain = 0x0000,
110                         .bdf = 0x0e << 3,
111                         .bar_mask = JAILHOUSE_IVSHMEM_BAR_MASK_MSIX,
112                         .num_msix_vectors = 16,
113                         .shmem_regions_start = 0,
114                         .shmem_dev_id = 1,
115                         .shmem_peers = 3,
116                         .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED,
117                 },
118         },
119 };