]> rtime.felk.cvut.cz Git - jailhouse.git/blob - hypervisor/arch/x86/include/asm/cell.h
x86: Prepare for AMD-V data structures
[jailhouse.git] / hypervisor / arch / x86 / include / asm / cell.h
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2013
5  * Copyright (c) Valentine Sinitsyn, 2014
6  *
7  * Authors:
8  *  Jan Kiszka <jan.kiszka@siemens.com>
9  *  Valentine Sinitsyn <valentine.sinitsyn@gmail.com>
10  *
11  * This work is licensed under the terms of the GNU GPL, version 2.  See
12  * the COPYING file in the top-level directory.
13  */
14
15 #ifndef _JAILHOUSE_ASM_CELL_H
16 #define _JAILHOUSE_ASM_CELL_H
17
18 #include <jailhouse/paging.h>
19
20 #include <jailhouse/cell-config.h>
21 #include <jailhouse/hypercall.h>
22
23 struct pci_device;
24
25 /** Cell-related states. */
26 /* TODO: factor out arch-independent bits, define struct arch_cell */
27 struct cell {
28         union {
29                 struct {
30                         /** PIO access bitmap. */
31                         u8 *io_bitmap;
32                         /** Paging structures used for cell CPUs. */
33                         struct paging_structures ept_structs;
34                 } vmx; /**< Intel VMX-specific fields. */
35         };
36
37         union {
38                 struct {
39                         /** Paging structures used for DMA requests. */
40                         struct paging_structures pg_structs;
41                         /** True if interrupt remapping support is emulated for this
42                          * cell. */
43                         bool ir_emulation;
44                 } vtd; /**< Intel VT-d specific fields. */
45         };
46
47         /** ID of the cell. */
48         unsigned int id;
49         /** Number of pages used for storing cell-specific states and
50          * configuration data. */
51         unsigned int data_pages;
52         /** Pointer to static cell description. */
53         struct jailhouse_cell_desc *config;
54
55         /** Pointer to cell's CPU set. */
56         struct cpu_set *cpu_set;
57         /** Stores the cell's CPU set if small enough. */
58         struct cpu_set small_cpu_set;
59
60         /** True while the cell can be loaded by the root cell. */
61         bool loadable;
62
63         /** Pointer to next cell in the system. */
64         struct cell *next;
65
66         /** List of PCI devices assigned to this cell. */
67         struct pci_device *pci_devices;
68         /** List of PCI devices assigned to this cell that support MSI-X. */
69         struct pci_device *msix_device_list;
70         /** Shadow value of PCI config space address port register. */
71         u32 pci_addr_port_val;
72
73         /** Shadow value of IOAPIC index register. */
74         u32 ioapic_index_reg_val;
75         /** IOAPIC ID as used for interrupt remapping. */
76         u16 ioapic_id;
77         /** IOMMU unit responsible for the IOAPIC. */
78         u8 ioapic_iommu;
79         /** Bitmap of IOAPIC pins assigned to this cell. */
80         u64 ioapic_pin_bitmap;
81
82         union {
83                 /** Communication region. */
84                 struct jailhouse_comm_region comm_region;
85                 /** Padding to full page size. */
86                 u8 padding[PAGE_SIZE];
87         } __attribute__((aligned(PAGE_SIZE))) comm_page;
88         /**< Page containing the communication region (shared with cell). */
89 };
90
91 extern struct cell root_cell;
92
93 #endif /* !_JAILHOUSE_ASM_CELL_H */