]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/qemu-vm.c
configs/x86: Add check for VT-d existence
[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                         .dmar_unit_base = {
44                                 0xfed90000,
45                         },
46                 },
47                 .interrupt_limit = 256,
48                 .root_cell = {
49                         .name = "QEMU Linux VM",
50
51                         .cpu_set_size = sizeof(config.cpus),
52                         .num_memory_regions = ARRAY_SIZE(config.mem_regions),
53                         .num_irqchips = ARRAY_SIZE(config.irqchips),
54                         .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap),
55                         .num_pci_devices = ARRAY_SIZE(config.pci_devices),
56                         .num_pci_caps = ARRAY_SIZE(config.pci_caps),
57                 },
58         },
59
60         .cpus = {
61                 0xf,
62         },
63
64         .mem_regions = {
65                 /* RAM */ {
66                         .phys_start = 0x0,
67                         .virt_start = 0x0,
68                         .size = 0x3c000000,
69                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
70                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
71                 },
72                 /* ACPI */ {
73                         .phys_start = 0x3ffdf000,
74                         .virt_start = 0x3ffdf000,
75                         .size = 0x30000,
76                         .flags = JAILHOUSE_MEM_READ,
77                 },
78                 /* PCI */ {
79                         .phys_start = 0xc0000000,
80                         .virt_start = 0xc0000000,
81                         .size = 0x3ec00000,
82                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
83                 },
84                 /* not safe until we catch MSIs via interrupt remapping */
85                 /* HPET */ {
86                         .phys_start = 0xfed00000,
87                         .virt_start = 0xfed00000,
88                         .size = 0x1000,
89                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
90                 },
91         },
92
93         .irqchips = {
94                 /* IOAPIC */ {
95                         .address = 0xfec00000,
96                         .id = 0xff01,
97                         .pin_bitmap = 0xffffff,
98                 },
99         },
100
101         .pio_bitmap = {
102                 [     0/8 ...   0x3f/8] = -1,
103                 [  0x40/8 ...   0x47/8] = 0xf0, /* PIT */
104                 [  0x48/8 ...   0x5f/8] = -1,
105                 [  0x60/8 ...   0x67/8] = 0xec, /* HACK: 8042, PC speaker - and more */
106                 [  0x68/8 ...   0x6f/8] = -1,
107                 [  0x70/8 ...   0x77/8] = 0xfc, /* rtc */
108                 [  0x78/8 ...   0x7f/8] = -1,
109                 [  0x80/8 ...   0x87/8] = 0xfe, /* port 80 (delays) */
110                 [  0x88/8 ...  0x2f7/8] = -1,
111                 [ 0x2f8/8 ...  0x2ff/8] = 0, /* serial2 */
112                 [ 0x300/8 ...  0x3af/8] = -1,
113                 [ 0x3b0/8 ...  0x3df/8] = 0, /* VGA */
114                 [ 0x3e0/8 ... 0x5657/8] = -1,
115                 [0x5658/8 ... 0x565f/8] = 0xf0, /* vmport */
116                 [0x5660/8 ... 0xbfff/8] = -1,
117                 [0xc000/8 ... 0xc0ff/8] = 0, /* PCI devices */
118                 [0xc100/8 ... 0xffff/8] = -1,
119         },
120
121         .pci_devices = {
122                 { /* VGA */
123                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
124                         .domain = 0x0000,
125                         .bdf = 0x0008,
126                 },
127                 { /* e1000 */
128                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
129                         .domain = 0x0000,
130                         .bdf = 0x0010,
131                 },
132                 { /* virtio-9p-pci */
133                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
134                         .domain = 0x0000,
135                         .bdf = 0x0018,
136                         .caps_start = 0,
137                         .num_caps = 1,
138                 },
139                 { /* ISA bridge */
140                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
141                         .domain = 0x0000,
142                         .bdf = 0x00f8,
143                 },
144                 { /* AHCI */
145                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
146                         .domain = 0x0000,
147                         .bdf = 0x00fa,
148                         .caps_start = 2,
149                         .num_caps = 2,
150                         .num_msi_vectors = 1,
151                         .msi_64bits = 1,
152                 },
153                 { /* SMBus */
154                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
155                         .domain = 0x0000,
156                         .bdf = 0x00fb,
157                 },
158         },
159
160         .pci_caps = {
161                 { /* virtio-9p-pci */
162                         .id = 0x11,
163                         .start = 0x40,
164                         .len = 12,
165                         .flags = JAILHOUSE_PCICAPS_WRITE,
166                 },
167                 { /* AHCI */
168                         .id = 0x12,
169                         .start = 0xa8,
170                         .len = 2,
171                         .flags = 0,
172                 },
173                 {
174                         .id = 0x5,
175                         .start = 0x50,
176                         .len = 14,
177                         .flags = JAILHOUSE_PCICAPS_WRITE,
178                 },
179         },
180 };