From 910ac9f9177055b765fcdbea54f4ab2c582db66f Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Fri, 6 Mar 2020 00:03:25 +0800 Subject: [PATCH] dm:send shutdown to life_mngr on SOS it will send shutdown command to life_mngr on SOS after the UOS has poweroff itself Tracked-On: #4446 Signed-off-by: Mingqiang Chi Reviewed-by: Minggui Cao Reviewed-by: Shuo A Liu Reviewed-by: Yin Fengwei Acked-by: Wang, Yu1 --- devicemodel/core/pm_vuart.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devicemodel/core/pm_vuart.c b/devicemodel/core/pm_vuart.c index a5dda306d..4932f05e6 100644 --- a/devicemodel/core/pm_vuart.c +++ b/devicemodel/core/pm_vuart.c @@ -319,6 +319,21 @@ void pm_by_vuart_init(struct vmctx *ctx) void pm_by_vuart_deinit(struct vmctx *ctx) { + /* it indicates that acrn-dm has received shutdown command + * from UOS in this state, and it will send shutdown command + * to life_mngr running on SOS to shutdown system after UOS + * has poweroff itself. + */ + if (pm_monitor_state == SHUTDOWN_REQ_FROM_UOS) { + /* send shutdown command to life_mngr running on SOS */ + if (send_shutdown_to_lifemngr() != 0) { + pr_err("send shutdown to life-management failed\r\n"); + } + } + + pthread_cancel(pm_monitor_thread); + pthread_join(pm_monitor_thread, NULL); + close(node_fd); node_fd = -1; }