]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/qemu-vm.c
core/configs: Clean up config structure alignment/packing
[jailhouse.git] / configs / qemu-vm.c
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Test configuration for QEMU VM, 1 GB RAM, 64 MB hypervisor (-8 K ACPI)
5  * Command line:
6  * qemu-system-x86_64 /path/to/image -m 1G -enable-kvm -smp 4 \
7  *  -virtfs local,path=/local/path,security_model=passthrough,mount_tag=host \
8  *  -cpu kvm64,-kvm_pv_eoi,-kvm_steal_time,-kvm_asyncpf,-kvmclock,+vmx,+x2apic
9  *
10  * Copyright (c) Siemens AG, 2013
11  *
12  * Authors:
13  *  Jan Kiszka <jan.kiszka@siemens.com>
14  *
15  * This work is licensed under the terms of the GNU GPL, version 2.  See
16  * the COPYING file in the top-level directory.
17  */
18
19 #include <linux/types.h>
20 #include <jailhouse/cell-config.h>
21
22 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
23
24 struct {
25         struct jailhouse_system header;
26         __u64 cpus[1];
27         struct jailhouse_memory mem_regions[5];
28         __u8 pio_bitmap[0x2000];
29         struct jailhouse_pci_device pci_devices[7];
30 } __attribute__((packed)) config = {
31         .header = {
32                 .hypervisor_memory = {
33                         .phys_start = 0x3c000000,
34                         .size = 0x4000000 - 0x2000,
35                 },
36                 .config_memory = {
37                         .phys_start = 0x3fffe000,
38                         .size = 0x2000,
39                 },
40                 .system = {
41                         .name = "QEMU Linux VM",
42
43                         .cpu_set_size = sizeof(config.cpus),
44                         .num_memory_regions = ARRAY_SIZE(config.mem_regions),
45                         .num_irq_lines = 0,
46                         .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
47                         .num_pci_devices = ARRAY_SIZE(config.pci_devices),
48                 },
49         },
50
51         .cpus = {
52                 0xf,
53         },
54
55         .mem_regions = {
56                 /* RAM */ {
57                         .phys_start = 0x0,
58                         .virt_start = 0x0,
59                         .size = 0x3c000000,
60                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
61                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
62                 },
63                 /* ACPI */ {
64                         .phys_start = 0x3fffe000,
65                         .virt_start = 0x3fffe000,
66                         .size = 0x2000,
67                         .flags = JAILHOUSE_MEM_READ,
68                 },
69                 /* PCI */ {
70                         .phys_start = 0x40000000,
71                         .virt_start = 0x40000000,
72                         .size = 0xbec00000,
73                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
74                 },
75                 /* yeah, that's not really safe... */
76                 /* IOAPIC */ {
77                         .phys_start = 0xfec00000,
78                         .virt_start = 0xfec00000,
79                         .size = 0x1000,
80                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
81                 },
82                 /* the same here until we catch MSIs via interrupt remapping */
83                 /* HPET */ {
84                         .phys_start = 0xfed00000,
85                         .virt_start = 0xfed00000,
86                         .size = 0x1000,
87                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
88                 },
89         },
90
91         .pio_bitmap = {
92                 [     0/8 ...   0x1f/8] = -1,
93                 [  0x20/8 ...   0x27/8] = 0xfc, /* HACK: PIC */
94                 [  0x28/8 ...   0x3f/8] = -1,
95                 [  0x40/8 ...   0x47/8] = 0xf0, /* PIT */
96                 [  0x48/8 ...   0x5f/8] = -1,
97                 [  0x60/8 ...   0x67/8] = 0xec, /* HACK: 8042, PC speaker - and more */
98                 [  0x68/8 ...   0x6f/8] = -1,
99                 [  0x70/8 ...   0x77/8] = 0xfc, /* rtc */
100                 [  0x78/8 ...   0x7f/8] = -1,
101                 [  0x80/8 ...   0x87/8] = 0xfe, /* port 80 (delays) */
102                 [  0x88/8 ...  0x16f/8] = -1,
103                 [ 0x170/8 ...  0x177/8] = 0, /* ide */
104                 [ 0x178/8 ...  0x1ef/8] = -1,
105                 [ 0x1f0/8 ...  0x1f7/8] = 0, /* ide */
106                 [ 0x1f8/8 ...  0x2f7/8] = -1,
107                 [ 0x2f8/8 ...  0x2ff/8] = 0, /* serial2 */
108                 [ 0x300/8 ...  0x36f/8] = -1,
109                 [ 0x370/8 ...  0x377/8] = 0xbf, /* ide */
110                 [ 0x378/8 ...  0x3af/8] = -1,
111                 [ 0x3b0/8 ...  0x3df/8] = 0, /* VGA */
112                 [ 0x3e0/8 ...  0x3ef/8] = -1,
113                 [ 0x3f0/8 ...  0x3f7/8] = 0xbf, /* ide */
114                 [ 0x3f8/8 ... 0x5657/8] = -1,
115                 [0x5658/8 ... 0x565f/8] = 0xf0, /* vmport */
116                 [0x5660/8 ... 0xbfff/8] = -1,
117                 [0xc000/8 ... 0xc03f/8] = 0, /* e1000 */
118                 [0xc040/8 ... 0xc07f/8] = 0, /* virtio-9p-pci */
119                 [0xc080/8 ... 0xc08f/8] = 0, /* piix bmdma */
120                 [0xc090/8 ... 0xffff/8] = -1,
121         },
122
123         .pci_devices = {
124                 {
125                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
126                         .domain = 0x0000,
127                         .bus = 0x00,
128                         .devfn = 0x00,
129                 },
130                 {
131                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
132                         .domain = 0x0000,
133                         .bus = 0x00,
134                         .devfn = 0x08,
135                 },
136                 {
137                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
138                         .domain = 0x0000,
139                         .bus = 0x00,
140                         .devfn = 0x09,
141                 },
142                 {
143                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
144                         .domain = 0x0000,
145                         .bus = 0x00,
146                         .devfn = 0x0b,
147                 },
148                 {
149                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
150                         .domain = 0x0000,
151                         .bus = 0x00,
152                         .devfn = 0x10,
153                 },
154                 {
155                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
156                         .domain = 0x0000,
157                         .bus = 0x00,
158                         .devfn = 0x18,
159                 },
160                 {
161                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
162                         .domain = 0x0000,
163                         .bus = 0x00,
164                         .devfn = 0x20,
165                 },
166         },
167 };