aboutsummaryrefslogtreecommitdiff
path: root/target-arm/machine.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2013-06-25 18:16:07 +0100
committerPeter Maydell <peter.maydell@linaro.org>2013-06-25 18:16:10 +0100
commitff047453f56713aa627e63aade1a9046ccd3bdfd (patch)
tree73e237d31b1d8e1941b406fbd44bb1e47e5e509c /target-arm/machine.c
parent721fae125369deba8c12a37f5824138686fb6e4e (diff)
target-arm: Initialize cpreg list from KVM when using KVM
When using KVM, use the kernel's initial state to set up the cpreg list, and sync to and from the kernel when doing migration. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target-arm/machine.c')
-rw-r--r--target-arm/machine.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/target-arm/machine.c b/target-arm/machine.c
index 076dc1672d..6d4c2d4ed0 100644
--- a/target-arm/machine.c
+++ b/target-arm/machine.c
@@ -1,5 +1,7 @@
#include "hw/hw.h"
#include "hw/boards.h"
+#include "sysemu/kvm.h"
+#include "kvm_arm.h"
static bool vfp_needed(void *opaque)
{
@@ -152,9 +154,16 @@ static void cpu_pre_save(void *opaque)
{
ARMCPU *cpu = opaque;
- if (!write_cpustate_to_list(cpu)) {
- /* This should never fail. */
- abort();
+ if (kvm_enabled()) {
+ if (!write_kvmstate_to_list(cpu)) {
+ /* This should never fail */
+ abort();
+ }
+ } else {
+ if (!write_cpustate_to_list(cpu)) {
+ /* This should never fail. */
+ abort();
+ }
}
cpu->cpreg_vmstate_array_len = cpu->cpreg_array_len;
@@ -193,8 +202,19 @@ static int cpu_post_load(void *opaque, int version_id)
v++;
}
- if (!write_list_to_cpustate(cpu)) {
- return -1;
+ if (kvm_enabled()) {
+ if (!write_list_to_kvmstate(cpu)) {
+ return -1;
+ }
+ /* Note that it's OK for the TCG side not to know about
+ * every register in the list; KVM is authoritative if
+ * we're using it.
+ */
+ write_list_to_cpustate(cpu);
+ } else {
+ if (!write_list_to_cpustate(cpu)) {
+ return -1;
+ }
}
return 0;