Skip to content

Commit 53ecd93

Browse files
taoyuhonglijinxia
authored andcommitted
Tools: acrn-manager: add definitions of message sturcts
We define messages into three types, accroding to which component is responsible to handle it: 1. message handled by sos lifecycle service, from vm manager; 2. message handled by vm manager, from sos lifecycle service&dm; 3. message handled by dm, from vm manager. Reviewed-by: Kaige Fu <kaige.fu@intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Wang, Yu <yu1.wang@intel.com> signed-off-by: Yan Like <like.yan@intel.com> Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
1 parent 7d7cf30 commit 53ecd93

File tree

1 file changed

+203
-0
lines changed

1 file changed

+203
-0
lines changed

tools/acrn-manager/acrn_mngr.h

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,209 @@ enum msgid {
2828
MSG_MAX,
2929
};
3030

31+
/* For test, generate a message who carry a string
32+
* eg., VMM_MSG_STR(hello_msg, "Hello\n") will create hello_msg,
33+
* then you can write(sock_fd, hello_msg, sizeof(hello_msg))
34+
*/
35+
#define MNGR_MSG_STR(var, str) \
36+
struct mngr_msg_##var { \
37+
struct mngr_msg msg; \
38+
char raw[sizeof(str)]; \
39+
} var = { \
40+
.msg = { \
41+
.magic = MNGR_MSG_MAGIC, \
42+
.msgid = MSG_STR, \
43+
.len = sizeof(struct mngr_msg_##var), \
44+
}, \
45+
.raw = str, \
46+
}
47+
48+
/* DM handled message event types */
49+
enum dm_msgid {
50+
DM_STOP = MSG_MAX + 1, /* Stop this UOS */
51+
DM_SUSPEND, /* Suspend this UOS from running state */
52+
DM_RESUME, /* Resume this UOS from suspend state */
53+
DM_PAUSE, /* Freeze this virtual machine */
54+
DM_CONTINUE, /* Unfreeze this virtual machine */
55+
DM_QUERY, /* Ask power state of this UOS */
56+
DM_MAX,
57+
};
58+
59+
/* DM handled message req/ack pairs */
60+
61+
struct req_dm_stop {
62+
struct mngr_msg msg; /* req DM_STOP */
63+
};
64+
65+
struct ack_dm_stop {
66+
struct mngr_msg msg; /* ack DM_STOP */
67+
int err;
68+
};
69+
70+
struct req_dm_suspend {
71+
struct mngr_msg msg; /* req DM_SUSPEND */
72+
};
73+
74+
struct ack_dm_suspend {
75+
struct mngr_msg msg; /* ack DM_SUSPEND */
76+
int err;
77+
};
78+
79+
struct req_dm_resume {
80+
struct mngr_msg msg; /* req DM_RESUME */
81+
int reason;
82+
};
83+
84+
struct ack_dm_resume {
85+
struct mngr_msg msg; /* ack DM_RESUME */
86+
int err;
87+
};
88+
89+
struct req_dm_pause {
90+
struct mngr_msg msg; /* req DM_PAUSE */
91+
};
92+
93+
struct ack_dm_pause {
94+
struct mngr_msg msg; /* ack DM_PAUSE */
95+
int err;
96+
};
97+
98+
struct req_dm_continue {
99+
struct mngr_msg msg; /* req DM_CONTINUE */
100+
};
101+
102+
struct ack_dm_continue {
103+
struct mngr_msg msg; /* ack DM_CONTINUE */
104+
int err;
105+
};
106+
107+
struct req_dm_query {
108+
struct mngr_msg msg; /* req DM_QUERY */
109+
};
110+
111+
struct ack_dm_query {
112+
struct mngr_msg msg; /* ack DM_QUERY */
113+
int state;
114+
};
115+
116+
/* Acrnd handled message event types */
117+
enum acrnd_msgid {
118+
/* DM -> Acrnd */
119+
ACRND_TIMER = DM_MAX + 1, /* DM request to setup a launch timer */
120+
ACRND_REASON, /* DM ask for updating wakeup reason */
121+
DM_NOTIFY, /* DM notify Acrnd that state is changed */
122+
123+
/* SOS-LCS ->Acrnd */
124+
ACRND_STOP, /* SOS-LCS request to Stop all UOS */
125+
ACRND_RESUME, /* SOS-LCS request to Resume UOS */
126+
ACRND_SUSPEND, /* SOS-LCS request to Suspend all UOS */
127+
128+
ACRND_MAX,
129+
};
130+
131+
/* Acrnd handled message req/ack pairs */
132+
133+
struct req_acrnd_timer {
134+
struct mngr_msg msg; /* req ACRND_TIMER */
135+
char name[VMNAME_LEN];
136+
time_t t;
137+
};
138+
139+
struct ack_acrnd_timer {
140+
struct mngr_msg msg; /* ack ACRND_TIMER */
141+
int err;
142+
};
143+
144+
struct req_acrnd_reason {
145+
struct mngr_msg msg; /* req ACRND_REASON */
146+
};
147+
148+
struct ack_acrnd_reason {
149+
struct mngr_msg msg; /* ack ACRND_REASON */
150+
int reason;
151+
};
152+
153+
struct req_dm_notify {
154+
struct mngr_msg msg; /* req DM_NOTIFY */
155+
int state;
156+
};
157+
158+
struct ack_dm_notify {
159+
struct mngr_msg msg; /* ack DM_NOTIFY */
160+
int err;
161+
};
162+
163+
struct req_acrnd_stop {
164+
struct mngr_msg msg; /* req ACRND_STOP */
165+
int force;
166+
unsigned timeout;
167+
};
168+
169+
struct ack_acrnd_stop {
170+
struct mngr_msg msg; /* ack ACRND_STOP */
171+
int err;
172+
};
173+
174+
struct req_acrnd_suspend {
175+
struct mngr_msg msg; /* req ACRND_SUSPEND */
176+
int force;
177+
unsigned timeout;
178+
};
179+
180+
struct ack_acrnd_suspend {
181+
struct mngr_msg msg; /* ack ACRND_SUSPEND */
182+
int err;
183+
};
184+
185+
struct req_acrnd_resume {
186+
struct mngr_msg msg; /* req ACRND_RESUME */
187+
};
188+
189+
struct ack_acrnd_resume {
190+
struct mngr_msg msg; /* ack ACRND_RESUME */
191+
int err;
192+
};
193+
194+
/* SOS-LCS handled message event types */
195+
enum sos_lcs_msgid {
196+
WAKEUP_REASON = ACRND_MAX + 1, /* Acrnd/Acrnctl request wakeup reason */
197+
RTC_TIMER, /* Acrnd request to setup RTC timer */
198+
SUSPEND,
199+
SHUTDOWN,
200+
REBOOT,
201+
};
202+
203+
/* SOS-LCS handled message req/ack pairs */
204+
205+
struct req_wakeup_reason {
206+
struct mngr_msg msg;
207+
};
208+
209+
struct ack_wakeup_reason {
210+
struct mngr_msg msg;
211+
int reason;
212+
};
213+
214+
struct req_rtc_timer {
215+
struct mngr_msg msg;
216+
char vmname[VMNAME_LEN];
217+
time_t t;
218+
};
219+
220+
struct ack_rtc_timer {
221+
struct mngr_msg msg;
222+
int err;
223+
};
224+
225+
struct req_power_state {
226+
struct mngr_msg msg;
227+
};
228+
229+
struct ack_power_state {
230+
struct mngr_msg msg;
231+
int err;
232+
};
233+
31234
/* helper functions */
32235
#define MNGR_SERVER 1 /* create a server fd, which you can add handlers onto it */
33236
#define MNGR_CLIENT 0 /* create a client, just send req and read ack */

0 commit comments

Comments
 (0)