]> rtime.felk.cvut.cz Git - jailhouse.git/blob - hypervisor/arch/x86/include/asm/cell.h
x86: Introduce AMD-V code skeleton
[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                 struct {
36                         /** I/O Permissions Map. */
37                         u8 *iopm;
38                         /** Paging structures used for cell CPUs. */
39                         struct paging_structures npt_structs;
40                 } svm; /**< AMD SVM-specific fields. */
41         };
42
43         union {
44                 struct {
45                         /** Paging structures used for DMA requests. */
46                         struct paging_structures pg_structs;
47                         /** True if interrupt remapping support is emulated for this
48                          * cell. */
49                         bool ir_emulation;
50                 } vtd; /**< Intel VT-d specific fields. */
51                 /* TODO: No struct vtd equivalent for SVM code yet. */
52         };
53
54         /** ID of the cell. */
55         unsigned int id;
56         /** Number of pages used for storing cell-specific states and
57          * configuration data. */
58         unsigned int data_pages;
59         /** Pointer to static cell description. */
60         struct jailhouse_cell_desc *config;
61
62         /** Pointer to cell's CPU set. */
63         struct cpu_set *cpu_set;
64         /** Stores the cell's CPU set if small enough. */
65         struct cpu_set small_cpu_set;
66
67         /** True while the cell can be loaded by the root cell. */
68         bool loadable;
69
70         /** Pointer to next cell in the system. */
71         struct cell *next;
72
73         /** List of PCI devices assigned to this cell. */
74         struct pci_device *pci_devices;
75         /** List of PCI devices assigned to this cell that support MSI-X. */
76         struct pci_device *msix_device_list;
77         /** Shadow value of PCI config space address port register. */
78         u32 pci_addr_port_val;
79
80         /** Shadow value of IOAPIC index register. */
81         u32 ioapic_index_reg_val;
82         /** IOAPIC ID as used for interrupt remapping. */
83         u16 ioapic_id;
84         /** IOMMU unit responsible for the IOAPIC. */
85         u8 ioapic_iommu;
86         /** Bitmap of IOAPIC pins assigned to this cell. */
87         u64 ioapic_pin_bitmap;
88
89         union {
90                 /** Communication region. */
91                 struct jailhouse_comm_region comm_region;
92                 /** Padding to full page size. */
93                 u8 padding[PAGE_SIZE];
94         } __attribute__((aligned(PAGE_SIZE))) comm_page;
95         /**< Page containing the communication region (shared with cell). */
96 };
97
98 extern struct cell root_cell;
99
100 #endif /* !_JAILHOUSE_ASM_CELL_H */