]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/qemu-vm.c
core/configs/driver: Rename jailhouse_system::system to root_cell
[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         struct jailhouse_irqchip irqchips[1];
29         __u8 pio_bitmap[0x2000];
30         struct jailhouse_pci_device pci_devices[7];
31 } __attribute__((packed)) config = {
32         .header = {
33                 .hypervisor_memory = {
34                         .phys_start = 0x3c000000,
35                         .size = 0x4000000 - 0x2000,
36                 },
37                 .config_memory = {
38                         .phys_start = 0x3fffe000,
39                         .size = 0x2000,
40                 },
41                 .root_cell = {
42                         .name = "QEMU Linux VM",
43
44                         .cpu_set_size = sizeof(config.cpus),
45                         .num_memory_regions = ARRAY_SIZE(config.mem_regions),
46                         .num_irqchips = ARRAY_SIZE(config.irqchips),
47                         .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
48                         .num_pci_devices = ARRAY_SIZE(config.pci_devices),
49                 },
50         },
51
52         .cpus = {
53                 0xf,
54         },
55
56         .mem_regions = {
57                 /* RAM */ {
58                         .phys_start = 0x0,
59                         .virt_start = 0x0,
60                         .size = 0x3c000000,
61                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
62                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
63                 },
64                 /* ACPI */ {
65                         .phys_start = 0x3fffe000,
66                         .virt_start = 0x3fffe000,
67                         .size = 0x2000,
68                         .flags = JAILHOUSE_MEM_READ,
69                 },
70                 /* PCI */ {
71                         .phys_start = 0x40000000,
72                         .virt_start = 0x40000000,
73                         .size = 0xbec00000,
74                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
75                 },
76                 /* not safe until we catch MSIs via interrupt remapping */
77                 /* HPET */ {
78                         .phys_start = 0xfed00000,
79                         .virt_start = 0xfed00000,
80                         .size = 0x1000,
81                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
82                 },
83         },
84
85         .irqchips = {
86                 /* IOAPIC */ {
87                         .address = 0xfec00000,
88                         .pin_bitmap = 0xffffff,
89                 },
90         },
91
92         .pio_bitmap = {
93                 [     0/8 ...   0x1f/8] = -1,
94                 [  0x20/8 ...   0x27/8] = 0xfc, /* HACK: PIC */
95                 [  0x28/8 ...   0x3f/8] = -1,
96                 [  0x40/8 ...   0x47/8] = 0xf0, /* PIT */
97                 [  0x48/8 ...   0x5f/8] = -1,
98                 [  0x60/8 ...   0x67/8] = 0xec, /* HACK: 8042, PC speaker - and more */
99                 [  0x68/8 ...   0x6f/8] = -1,
100                 [  0x70/8 ...   0x77/8] = 0xfc, /* rtc */
101                 [  0x78/8 ...   0x7f/8] = -1,
102                 [  0x80/8 ...   0x87/8] = 0xfe, /* port 80 (delays) */
103                 [  0x88/8 ...  0x16f/8] = -1,
104                 [ 0x170/8 ...  0x177/8] = 0, /* ide */
105                 [ 0x178/8 ...  0x1ef/8] = -1,
106                 [ 0x1f0/8 ...  0x1f7/8] = 0, /* ide */
107                 [ 0x1f8/8 ...  0x2f7/8] = -1,
108                 [ 0x2f8/8 ...  0x2ff/8] = 0, /* serial2 */
109                 [ 0x300/8 ...  0x36f/8] = -1,
110                 [ 0x370/8 ...  0x377/8] = 0xbf, /* ide */
111                 [ 0x378/8 ...  0x3af/8] = -1,
112                 [ 0x3b0/8 ...  0x3df/8] = 0, /* VGA */
113                 [ 0x3e0/8 ...  0x3ef/8] = -1,
114                 [ 0x3f0/8 ...  0x3f7/8] = 0xbf, /* ide */
115                 [ 0x3f8/8 ... 0x5657/8] = -1,
116                 [0x5658/8 ... 0x565f/8] = 0xf0, /* vmport */
117                 [0x5660/8 ... 0xbfff/8] = -1,
118                 [0xc000/8 ... 0xc03f/8] = 0, /* e1000 */
119                 [0xc040/8 ... 0xc07f/8] = 0, /* virtio-9p-pci */
120                 [0xc080/8 ... 0xc08f/8] = 0, /* piix bmdma */
121                 [0xc090/8 ... 0xffff/8] = -1,
122         },
123
124         .pci_devices = {
125                 {
126                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
127                         .domain = 0x0000,
128                         .bus = 0x00,
129                         .devfn = 0x00,
130                 },
131                 {
132                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
133                         .domain = 0x0000,
134                         .bus = 0x00,
135                         .devfn = 0x08,
136                 },
137                 {
138                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
139                         .domain = 0x0000,
140                         .bus = 0x00,
141                         .devfn = 0x09,
142                 },
143                 {
144                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
145                         .domain = 0x0000,
146                         .bus = 0x00,
147                         .devfn = 0x0b,
148                 },
149                 {
150                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
151                         .domain = 0x0000,
152                         .bus = 0x00,
153                         .devfn = 0x10,
154                 },
155                 {
156                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
157                         .domain = 0x0000,
158                         .bus = 0x00,
159                         .devfn = 0x18,
160                 },
161                 {
162                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
163                         .domain = 0x0000,
164                         .bus = 0x00,
165                         .devfn = 0x20,
166                 },
167         },
168 };