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 <fengwei.yin@intel.com>
This commit is contained in:
Yin Fengwei 2018-03-15 16:58:35 +08:00 committed by Jack Ren
parent 66ddb67bdd
commit 23efb5a0e9

View File

@ -71,6 +71,11 @@ reset_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
error = vm_suspend(ctx, VM_SUSPEND_RESET); error = vm_suspend(ctx, VM_SUSPEND_RESET);
assert(error == 0 || errno == EALREADY); assert(error == 0 || errno == EALREADY);
} }
/* cold reset should clear the value in 0xcf9 */
if (reset_control & 0x8) {
reset_control = 0;
}
} }
return 0; return 0;
} }