From 23efb5a0e9e1e2aabd7d8d1841fd0dc87dbee7fb Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Thu, 15 Mar 2018 16:58:35 +0800 Subject: [PATCH] DM: reboot: clear the data of 0xcf9 if cold reboot Linux kernel CF9 reboot is doing things like: - read value from 0xcf9 - mask out the value according to the reboot type (warm vs cold) - BIT OR the value with reboot code - write the value to 0xcf9 If there are two reboot event and the first one is cold reboot and the second one is warm reboot, vsbl query reboot type after the second one and will get code reboot instead of warm reboot. We should clear the data of 0xcf9 if guest request cold reboot. Signed-off-by: Yin Fengwei --- devicemodel/hw/platform/pm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/devicemodel/hw/platform/pm.c b/devicemodel/hw/platform/pm.c index 606aa267a..77268d744 100644 --- a/devicemodel/hw/platform/pm.c +++ b/devicemodel/hw/platform/pm.c @@ -71,6 +71,11 @@ reset_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, error = vm_suspend(ctx, VM_SUSPEND_RESET); assert(error == 0 || errno == EALREADY); } + + /* cold reset should clear the value in 0xcf9 */ + if (reset_control & 0x8) { + reset_control = 0; + } } return 0; }