]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/qemu-vm.c
configs: Adjust qemu-vm regarding ACPI region size
[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[9];
31         struct jailhouse_pci_capability pci_caps[3];
32 } __attribute__((packed)) config = {
33         .header = {
34                 .hypervisor_memory = {
35                         .phys_start = 0x3c000000,
36                         .size = 0x4000000 - 0x30000,
37                 },
38                 .config_memory = {
39                         .phys_start = 0x3ffdf000,
40                         .size = 0x30000,
41                 },
42                 .platform_info.x86 = {
43                         .pm_timer_address = 0x608,
44                 },
45                 .root_cell = {
46                         .name = "QEMU Linux VM",
47
48                         .cpu_set_size = sizeof(config.cpus),
49                         .num_memory_regions = ARRAY_SIZE(config.mem_regions),
50                         .num_irqchips = ARRAY_SIZE(config.irqchips),
51                         .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
52                         .num_pci_devices = ARRAY_SIZE(config.pci_devices),
53                         .num_pci_caps = ARRAY_SIZE(config.pci_caps),
54                 },
55         },
56
57         .cpus = {
58                 0xf,
59         },
60
61         .mem_regions = {
62                 /* RAM */ {
63                         .phys_start = 0x0,
64                         .virt_start = 0x0,
65                         .size = 0x3c000000,
66                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
67                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
68                 },
69                 /* ACPI */ {
70                         .phys_start = 0x3ffdf000,
71                         .virt_start = 0x3ffdf000,
72                         .size = 0x30000,
73                         .flags = JAILHOUSE_MEM_READ,
74                 },
75                 /* PCI */ {
76                         .phys_start = 0xc0000000,
77                         .virt_start = 0xc0000000,
78                         .size = 0x3ec00000,
79                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
80                 },
81                 /* not safe until we catch MSIs via interrupt remapping */
82                 /* HPET */ {
83                         .phys_start = 0xfed00000,
84                         .virt_start = 0xfed00000,
85                         .size = 0x1000,
86                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
87                 },
88         },
89
90         .irqchips = {
91                 /* IOAPIC */ {
92                         .address = 0xfec00000,
93                         .pin_bitmap = 0xffffff,
94                 },
95         },
96
97         .pio_bitmap = {
98                 [     0/8 ...   0x3f/8] = -1,
99                 [  0x40/8 ...   0x47/8] = 0xf0, /* PIT */
100                 [  0x48/8 ...   0x5f/8] = -1,
101                 [  0x60/8 ...   0x67/8] = 0xec, /* HACK: 8042, PC speaker - and more */
102                 [  0x68/8 ...   0x6f/8] = -1,
103                 [  0x70/8 ...   0x77/8] = 0xfc, /* rtc */
104                 [  0x78/8 ...   0x7f/8] = -1,
105                 [  0x80/8 ...   0x87/8] = 0xfe, /* port 80 (delays) */
106                 [  0x88/8 ...  0x16f/8] = -1,
107                 [ 0x170/8 ...  0x177/8] = 0, /* ide */
108                 [ 0x178/8 ...  0x1ef/8] = -1,
109                 [ 0x1f0/8 ...  0x1f7/8] = 0, /* ide */
110                 [ 0x1f8/8 ...  0x2f7/8] = -1,
111                 [ 0x2f8/8 ...  0x2ff/8] = 0, /* serial2 */
112                 [ 0x300/8 ...  0x36f/8] = -1,
113                 [ 0x370/8 ...  0x377/8] = 0xbf, /* ide */
114                 [ 0x378/8 ...  0x3af/8] = -1,
115                 [ 0x3b0/8 ...  0x3df/8] = 0, /* VGA */
116                 [ 0x3e0/8 ...  0x3ef/8] = -1,
117                 [ 0x3f0/8 ...  0x3f7/8] = 0xbf, /* ide */
118                 [ 0x3f8/8 ... 0x5657/8] = -1,
119                 [0x5658/8 ... 0x565f/8] = 0xf0, /* vmport */
120                 [0x5660/8 ... 0xbfff/8] = -1,
121                 [0xc000/8 ... 0xc0ff/8] = 0, /* PCI devices */
122                 [0xc100/8 ... 0xffff/8] = -1,
123         },
124
125         .pci_devices = {
126                 { /* 440fx: ISA bridge, q35: VGA */
127                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
128                         .domain = 0x0000,
129                         .bdf = 0x0008,
130                 },
131                 { /* 440fx: IDE */
132                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
133                         .domain = 0x0000,
134                         .bdf = 0x0009,
135                 },
136                 { /* 440fx: SMBus */
137                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
138                         .domain = 0x0000,
139                         .bdf = 0x000b,
140                 },
141                 { /* 440fx: VGA, q35: e1000 */
142                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
143                         .domain = 0x0000,
144                         .bdf = 0x0010,
145                 },
146                 { /* 44fx: e1000, q35: virtio-9p-pci */
147                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
148                         .domain = 0x0000,
149                         .bdf = 0x0018,
150                         .caps_start = 0, /* for q35 */
151                         .num_caps = 1,
152                 },
153                 { /* 440fx: virtio-9p-pci */
154                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
155                         .domain = 0x0000,
156                         .bdf = 0x0020,
157                         .caps_start = 0,
158                         .num_caps = 1,
159                 },
160                 { /* q35: ISA bridge */
161                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
162                         .domain = 0x0000,
163                         .bdf = 0x00f8,
164                 },
165                 { /* q35: AHCI */
166                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
167                         .domain = 0x0000,
168                         .bdf = 0x00fa,
169                         .caps_start = 2,
170                         .num_caps = 2,
171                 },
172                 { /* q35: SMBus */
173                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
174                         .domain = 0x0000,
175                         .bdf = 0x00fb,
176                 },
177         },
178
179         .pci_caps = {
180                 { /* virtio-9p-pci */
181                         .id = 0x11,
182                         .start = 0x40,
183                         .len = 12,
184                         .flags = JAILHOUSE_PCICAPS_WRITE,
185                 },
186                 { /* AHCI */
187                         .id = 0x12,
188                         .start = 0xa8,
189                         .len = 2,
190                         .flags = 0,
191                 },
192                 {
193                         .id = 0x5,
194                         .start = 0x50,
195                         .len = 14,
196                         .flags = JAILHOUSE_PCICAPS_WRITE,
197                 },
198         },
199 };