]> rtime.felk.cvut.cz Git - jailhouse.git/blob - configs/qemu-vm.c
configs: Specify PM timer addresses
[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                 .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 ...   0x1f/8] = -1,
97                 [  0x20/8 ...   0x27/8] = 0xfc, /* HACK: PIC */
98                 [  0x28/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 ... 0xc03f/8] = 0, /* e1000 */
122                 [0xc040/8 ... 0xc07f/8] = 0, /* virtio-9p-pci */
123                 [0xc080/8 ... 0xc08f/8] = 0, /* piix bmdma */
124                 [0xc090/8 ... 0xffff/8] = -1,
125         },
126
127         .pci_devices = {
128                 {
129                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
130                         .domain = 0x0000,
131                         .bus = 0x00,
132                         .devfn = 0x00,
133                 },
134                 {
135                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
136                         .domain = 0x0000,
137                         .bus = 0x00,
138                         .devfn = 0x08,
139                 },
140                 {
141                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
142                         .domain = 0x0000,
143                         .bus = 0x00,
144                         .devfn = 0x09,
145                 },
146                 {
147                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
148                         .domain = 0x0000,
149                         .bus = 0x00,
150                         .devfn = 0x0b,
151                 },
152                 {
153                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
154                         .domain = 0x0000,
155                         .bus = 0x00,
156                         .devfn = 0x10,
157                 },
158                 {
159                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
160                         .domain = 0x0000,
161                         .bus = 0x00,
162                         .devfn = 0x18,
163                 },
164                 {
165                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
166                         .domain = 0x0000,
167                         .bus = 0x00,
168                         .devfn = 0x20,
169                 },
170         },
171 };