It's useful to see whether the state is currently active or not.
Signed-off-by: Veaceslav Falico <
veacesla...@huawei.com>
---
hypervisor/control.c | 3 +--
hypervisor/include/jailhouse/hypercall.h | 4 ++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/hypervisor/control.c b/hypervisor/control.c
index 695c8c1..5973eb5 100644
--- a/hypervisor/control.c
+++ b/hypervisor/control.c
@@ -108,8 +108,7 @@ static bool cell_send_message(struct cell *cell, u32 message,
u32 reply = cell->comm_page.comm_region.reply_from_cell;
u32 cell_state = cell->comm_page.comm_region.cell_state;
- if (cell_state == JAILHOUSE_CELL_SHUT_DOWN ||
- cell_state == JAILHOUSE_CELL_FAILED)
+ if (!JAILHOUSE_CELL_IS_ONLINE(cell_state))
return true;
if ((type == MSG_REQUEST &&
diff --git a/hypervisor/include/jailhouse/hypercall.h b/hypervisor/include/jailhouse/hypercall.h
index 0087d66..649afc0 100644
--- a/hypervisor/include/jailhouse/hypercall.h
+++ b/hypervisor/include/jailhouse/hypercall.h
@@ -88,6 +88,10 @@
#define JAILHOUSE_CELL_SHUT_DOWN 2 /* terminal state */
#define JAILHOUSE_CELL_FAILED 3 /* terminal state */
+/* cell state macros for online/offline state */
+#define JAILHOUSE_CELL_IS_ONLINE(state) (state == JAILHOUSE_CELL_RUNNING || \
+ state == JAILHOUSE_CELL_RUNNING_LOCKED)
+
#define COMM_REGION_GENERIC_HEADER \
volatile __u32 msg_to_cell; \
volatile __u32 reply_from_cell; \
--
2.4.3