vhost-device-sound recipe
[AGL/meta-agl-devel.git] / meta-agl-jailhouse / recipes-extended / jailhouse / files / agl-pci-demo.c
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Minimal configuration for PCI demo inmate:
5  * 1 CPU, 1 MB RAM, serial ports, 1 Intel HDA PCI device
6  *
7  * Copyright (c) Siemens AG, 2014
8  *
9  * Authors:
10  *  Jan Kiszka <jan.kiszka@siemens.com>
11  *
12  * This work is licensed under the terms of the GNU GPL, version 2.  See
13  * the COPYING file in the top-level directory.
14  */
15
16 #include <jailhouse/types.h>
17 #include <jailhouse/cell-config.h>
18
19 struct {
20         struct jailhouse_cell_desc cell;
21         __u64 cpus[1];
22         struct jailhouse_memory mem_regions[3];
23         struct jailhouse_pio pio_regions[1];        /* ttyS0 is host -> ttyS1 */
24         struct jailhouse_pci_device pci_devices[1];
25         struct jailhouse_pci_capability pci_caps[1];
26 } __attribute__((packed)) config = {
27         .cell = {
28                 .signature = JAILHOUSE_CELL_DESC_SIGNATURE,
29                 .revision = JAILHOUSE_CONFIG_REVISION,
30                 .name = "agl-pci-demo",
31                 .flags = JAILHOUSE_CELL_PASSIVE_COMMREG |
32                         JAILHOUSE_CELL_VIRTUAL_CONSOLE_PERMITTED,
33
34                 .cpu_set_size = sizeof(config.cpus),
35                 .num_memory_regions = ARRAY_SIZE(config.mem_regions),
36                 .num_irqchips = 0,
37                 .num_pio_regions = ARRAY_SIZE(config.pio_regions),
38                 .num_pci_devices = ARRAY_SIZE(config.pci_devices),
39                 .num_pci_caps = ARRAY_SIZE(config.pci_caps),
40
41
42                 .console = {
43                         .type = JAILHOUSE_CON_TYPE_8250,
44                         .flags = JAILHOUSE_CON_ACCESS_PIO,
45                         .address = 0x2f8,
46                 },
47         },
48
49         .cpus = {
50                 0x4,
51         },
52
53         .mem_regions = {
54                 /* RAM */ {
55                         .phys_start = 0x26f00000,/*to 0x27000000| apic-demo @0x26e00000-@0x26f00000 */
56                         .virt_start = 0,
57                         .size = 0x00100000,
58                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
59                                 JAILHOUSE_MEM_EXECUTE | JAILHOUSE_MEM_LOADABLE,
60                 },
61                 /* communication region */ {
62                         .virt_start = 0x00100000,
63                         .size = 0x00001000,
64                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
65                                 JAILHOUSE_MEM_COMM_REGION,
66                 },
67                 /* HDA BAR0 */ {
68                         .phys_start = 0xfebd4000,
69                         .virt_start = 0xfebd4000,
70                         .size = 0x00004000,
71                         .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE,
72                 },
73         },
74
75
76         .pio_regions = {
77                 PIO_RANGE(0x2f8, 8), /* serial 2 */
78                 //PIO_RANGE(0x3f8, 8), /* serial 1 */
79                 PIO_RANGE(0xe010, 8), /* OXPCIe952 serial2 */
80         },
81
82
83         .pci_devices = {
84                 { /* Intel HDA @00:1b.0 */
85                         .type = JAILHOUSE_PCI_TYPE_DEVICE,
86                         .domain = 0x0000,
87                         .bdf = 0x00d8,
88                         .caps_start = 0,
89                         .num_caps = 1,
90                         .num_msi_vectors = 1,
91                         .msi_64bits = 1,
92                 },
93         },
94
95         .pci_caps = {
96                 { /* Intel HDA @00:1b.0 */
97                         .id = PCI_CAP_ID_MSI,
98                         .start = 0x60,
99                         .len = 14,
100                         .flags = JAILHOUSE_PCICAPS_WRITE,
101                 },
102         },
103 };