1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
/* $OpenBSD: ldomctl.h,v 1.3 2012/11/24 17:04:03 kettenis Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
struct guest;
struct console {
uint64_t ino;
uint64_t resource_id;
struct guest *guest;
struct ldc_endpoint *client_endpoint;
struct ldc_endpoint *server_endpoint;
struct md_node *hv_node;
TAILQ_ENTRY(console) link;
};
struct cpu {
uint64_t pid, vid, gid, partid;
uint64_t resource_id;
struct guest *guest;
struct md_node *hv_node;
TAILQ_ENTRY(cpu) link;
};
struct mblock {
uint64_t membase;
uint64_t memsize;
uint64_t realbase;
uint64_t resource_id;
struct guest *guest;
struct md_node *hv_node;
TAILQ_ENTRY(mblock) link;
};
struct ldc_endpoint {
uint64_t target_type;
uint64_t target_guest;
uint64_t channel;
uint64_t target_channel;
uint64_t tx_ino;
uint64_t rx_ino;
uint64_t resource_id;
uint64_t private_svc;
uint64_t svc_id;
struct guest *guest;
struct md_node *hv_node;
TAILQ_ENTRY(ldc_endpoint) link;
};
struct ldc_channel {
struct ldc_endpoint *client_endpoint;
struct ldc_endpoint *server_endpoint;
};
struct guest {
const char *name;
uint64_t gid;
uint64_t pid;
uint64_t resource_id;
uint64_t mdpa;
struct md_node *hv_node;
struct md *md;
uint64_t cpu_vid;
uint64_t endpoint_id;
struct console *console;
TAILQ_HEAD(, cpu) cpu_list;
int num_cpus;
TAILQ_HEAD(, mblock) mblock_list;
TAILQ_HEAD(, ldc_endpoint) endpoint_list;
struct ldc_channel domain_services;
struct ldc_channel vio[8];
int num_vios;
TAILQ_ENTRY(guest) link;
};
extern TAILQ_HEAD(guest_head, guest) guest_list;
void add_guest(struct md_node *);
extern struct md *hvmd;
extern uint64_t hv_mdpa;
extern uint64_t hv_membase;
extern uint64_t hv_memsize;
struct vdisk {
SIMPLEQ_ENTRY(vdisk) entry;
const char *path;
};
struct vnet {
SIMPLEQ_ENTRY(vnet) entry;
uint64_t mac_addr;
uint64_t mtu;
};
struct domain {
SIMPLEQ_ENTRY(domain) entry;
const char *name;
uint64_t vcpu;
uint64_t memory;
SIMPLEQ_HEAD(, vdisk) vdisk_list;
SIMPLEQ_HEAD(, vnet) vnet_list;
} *domain;
struct ldom_config {
SIMPLEQ_HEAD(, domain) domain_list;
};
int parse_config(const char *, struct ldom_config *);
void build_config(const char *);
|