]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/qemu-vm.c
configs/tools: Provide MSI parameters via config
[jailhouse.git] / configs / qemu-vm.c
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Test configuration for QEMU Q35 VM, 1 GB RAM, 64 MB hypervisor (-192K ACPI)
5  * Command line:
6  * qemu-system-x86_64 -machine q35 -m 1G -enable-kvm -smp 4 \
7  *  -drive file=/path/to/image,id=disk,if=none -device ide-hd,drive=disk \
8  *  -virtfs local,path=/local/path,security_model=passthrough,mount_tag=host \
9  *  -cpu kvm64,-kvm_pv_eoi,-kvm_steal_time,-kvm_asyncpf,-kvmclock,+vmx,+x2apic
10  *
11  * Copyright (c) Siemens AG, 2013
12  *
13  * Authors:
14  *  Jan Kiszka <jan.kiszka@siemens.com>
15  *
16  * This work is licensed under the terms of the GNU GPL, version 2.  See
17  * the COPYING file in the top-level directory.
18  */
19
20 #include <linux/types.h>
21 #include <jailhouse/cell-config.h>
22
23 #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
24
25 struct {
26         struct jailhouse_system header;
27         __u64 cpus[1];
28         struct jailhouse_memory mem_regions[5];
29         struct jailhouse_irqchip irqchips[1];
30         __u8 pio_bitmap[0x2000];
31         struct jailhouse_pci_device pci_devices[6];
32         struct jailhouse_pci_capability pci_caps[3];
33 } __attribute__((packed)) config = {
34         .header = {
35                 .hypervisor_memory = {
36                         .phys_start = 0x3c000000,
37                         .size = 0x4000000 - 0x30000,
38                 },
39                 .platform_info.x86 = {
40                         .mmconfig_base = 0xb0000000,
41                         .mmconfig_end_bus = 0xff,
42                         .pm_timer_address = 0x608,
43                 },
44                 .root_cell = {
45                         .name = "QEMU Linux VM",
46
47                         .cpu_set_size = sizeof(config.cpus),
48                         .num_memory_regions = ARRAY_SIZE(config.mem_regions),
49                         .num_irqchips = ARRAY_SIZE(config.irqchips),
50                         .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
51                         .num_pci_devices = ARRAY_SIZE(config.pci_devices),
52                         .num_pci_caps = ARRAY_SIZE(config.pci_caps),
53                 },
54         },
55
56         .cpus = {
57                 0xf,
58         },
59
60         .mem_regions = {
61                 /* RAM */ {
62                         .phys_start = 0x0,
63                         .virt_start = 0x0,
64                         .size = 0x3c000000,
65                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
66                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
67                 },
68                 /* ACPI */ {
69                         .phys_start = 0x3ffdf000,
70                         .virt_start = 0x3ffdf000,
71                         .size = 0x30000,
72                         .flags = JAILHOUSE_MEM_READ,
73                 },
74                 /* PCI */ {
75                         .phys_start = 0xc0000000,
76                         .virt_start = 0xc0000000,
77                         .size = 0x3ec00000,
78                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
79                 },
80                 /* not safe until we catch MSIs via interrupt remapping */
81                 /* HPET */ {
82                         .phys_start = 0xfed00000,
83                         .virt_start = 0xfed00000,
84                         .size = 0x1000,
85                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
86                 },
87         },
88
89         .irqchips = {
90                 /* IOAPIC */ {
91                         .address = 0xfec00000,
92                         .pin_bitmap = 0xffffff,
93                 },
94         },
95
96         .pio_bitmap = {
97                 [     0/8 ...   0x3f/8] = -1,
98                 [  0x40/8 ...   0x47/8] = 0xf0, /* PIT */
99                 [  0x48/8 ...   0x5f/8] = -1,
100                 [  0x60/8 ...   0x67/8] = 0xec, /* HACK: 8042, PC speaker - and more */
101                 [  0x68/8 ...   0x6f/8] = -1,
102                 [  0x70/8 ...   0x77/8] = 0xfc, /* rtc */
103                 [  0x78/8 ...   0x7f/8] = -1,
104                 [  0x80/8 ...   0x87/8] = 0xfe, /* port 80 (delays) */
105                 [  0x88/8 ...  0x2f7/8] = -1,
106                 [ 0x2f8/8 ...  0x2ff/8] = 0, /* serial2 */
107                 [ 0x300/8 ...  0x3af/8] = -1,
108                 [ 0x3b0/8 ...  0x3df/8] = 0, /* VGA */
109                 [ 0x3e0/8 ... 0x5657/8] = -1,
110                 [0x5658/8 ... 0x565f/8] = 0xf0, /* vmport */
111                 [0x5660/8 ... 0xbfff/8] = -1,
112                 [0xc000/8 ... 0xc0ff/8] = 0, /* PCI devices */
113                 [0xc100/8 ... 0xffff/8] = -1,
114         },
115
116         .pci_devices = {
117                 { /* VGA */
118                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
119                         .domain = 0x0000,
120                         .bdf = 0x0008,
121                 },
122                 { /* e1000 */
123                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
124                         .domain = 0x0000,
125                         .bdf = 0x0010,
126                 },
127                 { /* virtio-9p-pci */
128                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
129                         .domain = 0x0000,
130                         .bdf = 0x0018,
131                         .caps_start = 0,
132                         .num_caps = 1,
133                 },
134                 { /* ISA bridge */
135                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
136                         .domain = 0x0000,
137                         .bdf = 0x00f8,
138                 },
139                 { /* AHCI */
140                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
141                         .domain = 0x0000,
142                         .bdf = 0x00fa,
143                         .caps_start = 2,
144                         .num_caps = 2,
145                         .num_msi_vectors = 1,
146                         .msi_64bits = 1,
147                 },
148                 { /* SMBus */
149                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
150                         .domain = 0x0000,
151                         .bdf = 0x00fb,
152                 },
153         },
154
155         .pci_caps = {
156                 { /* virtio-9p-pci */
157                         .id = 0x11,
158                         .start = 0x40,
159                         .len = 12,
160                         .flags = JAILHOUSE_PCICAPS_WRITE,
161                 },
162                 { /* AHCI */
163                         .id = 0x12,
164                         .start = 0xa8,
165                         .len = 2,
166                         .flags = 0,
167                 },
168                 {
169                         .id = 0x5,
170                         .start = 0x50,
171                         .len = 14,
172                         .flags = JAILHOUSE_PCICAPS_WRITE,
173                 },
174         },
175 };