]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/qemu-vm.c
configs: Add Q35 machine support to QEMU VM
[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 } __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                 .platform_info.x86 = {
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                 },
53         },
54
55         .cpus = {
56                 0xf,
57         },
58
59         .mem_regions = {
60                 /* RAM */ {
61                         .phys_start = 0x0,
62                         .virt_start = 0x0,
63                         .size = 0x3c000000,
64                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
65                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_DMA,
66                 },
67                 /* ACPI */ {
68                         .phys_start = 0x3fffe000,
69                         .virt_start = 0x3fffe000,
70                         .size = 0x2000,
71                         .flags = JAILHOUSE_MEM_READ,
72                 },
73                 /* PCI */ {
74                         .phys_start = 0x40000000,
75                         .virt_start = 0x40000000,
76                         .size = 0xbec00000,
77                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
78                 },
79                 /* not safe until we catch MSIs via interrupt remapping */
80                 /* HPET */ {
81                         .phys_start = 0xfed00000,
82                         .virt_start = 0xfed00000,
83                         .size = 0x1000,
84                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
85                 },
86         },
87
88         .irqchips = {
89                 /* IOAPIC */ {
90                         .address = 0xfec00000,
91                         .pin_bitmap = 0xffffff,
92                 },
93         },
94
95         .pio_bitmap = {
96                 [     0/8 ...   0x3f/8] = -1,
97                 [  0x40/8 ...   0x47/8] = 0xf0, /* PIT */
98                 [  0x48/8 ...   0x5f/8] = -1,
99                 [  0x60/8 ...   0x67/8] = 0xec, /* HACK: 8042, PC speaker - and more */
100                 [  0x68/8 ...   0x6f/8] = -1,
101                 [  0x70/8 ...   0x77/8] = 0xfc, /* rtc */
102                 [  0x78/8 ...   0x7f/8] = -1,
103                 [  0x80/8 ...   0x87/8] = 0xfe, /* port 80 (delays) */
104                 [  0x88/8 ...  0x16f/8] = -1,
105                 [ 0x170/8 ...  0x177/8] = 0, /* ide */
106                 [ 0x178/8 ...  0x1ef/8] = -1,
107                 [ 0x1f0/8 ...  0x1f7/8] = 0, /* ide */
108                 [ 0x1f8/8 ...  0x2f7/8] = -1,
109                 [ 0x2f8/8 ...  0x2ff/8] = 0, /* serial2 */
110                 [ 0x300/8 ...  0x36f/8] = -1,
111                 [ 0x370/8 ...  0x377/8] = 0xbf, /* ide */
112                 [ 0x378/8 ...  0x3af/8] = -1,
113                 [ 0x3b0/8 ...  0x3df/8] = 0, /* VGA */
114                 [ 0x3e0/8 ...  0x3ef/8] = -1,
115                 [ 0x3f0/8 ...  0x3f7/8] = 0xbf, /* ide */
116                 [ 0x3f8/8 ... 0x5657/8] = -1,
117                 [0x5658/8 ... 0x565f/8] = 0xf0, /* vmport */
118                 [0x5660/8 ... 0xbfff/8] = -1,
119                 [0xc000/8 ... 0xc0ff/8] = 0, /* PCI devices */
120                 [0xc100/8 ... 0xffff/8] = -1,
121         },
122
123         .pci_devices = {
124                 { /* 440fx: ISA bridge, q35: VGA */
125                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
126                         .domain = 0x0000,
127                         .bus = 0x00,
128                         .devfn = 0x08,
129                 },
130                 { /* 440fx: IDE */
131                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
132                         .domain = 0x0000,
133                         .bus = 0x00,
134                         .devfn = 0x09,
135                 },
136                 { /* 440fx: SMBus */
137                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
138                         .domain = 0x0000,
139                         .bus = 0x00,
140                         .devfn = 0x0b,
141                 },
142                 { /* 440fx: VGA, q35: e1000 */
143                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
144                         .domain = 0x0000,
145                         .bus = 0x00,
146                         .devfn = 0x10,
147                 },
148                 { /* 44fx: e1000, q35: virtio-9p-pci */
149                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
150                         .domain = 0x0000,
151                         .bus = 0x00,
152                         .devfn = 0x18,
153                 },
154                 { /* 440fx: virtio-9p-pci */
155                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
156                         .domain = 0x0000,
157                         .bus = 0x00,
158                         .devfn = 0x20,
159                 },
160                 { /* q35: ISA bridge */
161                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
162                         .domain = 0x0000,
163                         .bus = 0x00,
164                         .devfn = 0xf8,
165                 },
166                 { /* q35: AHCI */
167                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
168                         .domain = 0x0000,
169                         .bus = 0x00,
170                         .devfn = 0xfa,
171                 },
172                 { /* q35: SMBus */
173                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
174                         .domain = 0x0000,
175                         .bus = 0x00,
176                         .devfn = 0xfb,
177                 },
178         },
179 };