]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/ivshmem-demo.c
591d9eab43c16080f8e36eebe70df30d38e1a1d5
[jailhouse.git] / configs / ivshmem-demo.c
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2013, 2014
5  *
6  * Authors:
7  *  Henning Schild <henning.schild@siemens.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #include <linux/types.h>
14 #include <jailhouse/cell-config.h>
15
16 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
17
18 struct {
19         struct jailhouse_cell_desc cell;
20         __u64 cpus[1];
21         struct jailhouse_memory mem_regions[3];
22         __u8 pio_bitmap[0x2000];
23         struct jailhouse_pci_device pci_devices[1];
24         struct jailhouse_pci_capability pci_caps[0];
25 } __attribute__((packed)) config = {
26         .cell = {
27                 .name = "ivshmem-demo",
28                 .flags = JAILHOUSE_CELL_PASSIVE_COMMREG,
29
30                 .cpu_set_size = sizeof(config.cpus),
31                 .num_memory_regions = ARRAY_SIZE(config.mem_regions),
32                 .num_irqchips = 0,
33                 .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
34                 .num_pci_devices = ARRAY_SIZE(config.pci_devices),
35                 .num_pci_caps = ARRAY_SIZE(config.pci_caps),
36         },
37
38         .cpus = {
39                 0b0100,
40         },
41
42         .mem_regions = {
43                 /* RAM */ {
44                         .phys_start = 0x3f000000,
45                         .virt_start = 0,
46                         .size = 0x00100000,
47                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
48                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
49                 },
50                 /* communication region */ {
51                         .virt_start = 0x00100000,
52                         .size = 0x00001000,
53                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
54                                 JAILHOUSE_MEM_COMM_REGION,
55                 },
56                 /* IVSHMEM shared memory region */
57                 {
58                         .phys_start = 0x3f1ff000,
59                         .virt_start = 0x3f1ff000,
60                         .size = 0x1000,
61                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
62                                 JAILHOUSE_MEM_ROOTSHARED,
63                 },
64         },
65
66         .pio_bitmap = {
67                 [     0/8 ...  0x3f7/8] = -1,
68                 [ 0x3f8/8 ...  0x3ff/8] = 0, /* serial1 */
69                 [ 0x400/8 ... 0xffff/8] = -1,
70         },
71
72         .pci_devices = {
73                 {
74                         .type = JAILHOUSE_PCI_TYPE_IVSHMEM,
75                         .domain = 0x0,
76                         .bdf = (0x0f<<3),
77                         .bar_mask = {
78                                 0xffffff00, 0xffffffff, 0x00000000,
79                                 0x00000000, 0xffffffe0, 0xffffffff,
80                         },
81                         .shmem_region = 2,
82                         .num_msix_vectors = 1,
83                 },
84         },
85 };