~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to target-arm/machine.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "hw/hw.h"
2
2
#include "hw/boards.h"
 
3
#include "sysemu/kvm.h"
 
4
#include "kvm_arm.h"
3
5
 
4
6
static bool vfp_needed(void *opaque)
5
7
{
148
150
    .put = put_cpsr,
149
151
};
150
152
 
 
153
static void cpu_pre_save(void *opaque)
 
154
{
 
155
    ARMCPU *cpu = opaque;
 
156
 
 
157
    if (kvm_enabled()) {
 
158
        if (!write_kvmstate_to_list(cpu)) {
 
159
            /* This should never fail */
 
160
            abort();
 
161
        }
 
162
    } else {
 
163
        if (!write_cpustate_to_list(cpu)) {
 
164
            /* This should never fail. */
 
165
            abort();
 
166
        }
 
167
    }
 
168
 
 
169
    cpu->cpreg_vmstate_array_len = cpu->cpreg_array_len;
 
170
    memcpy(cpu->cpreg_vmstate_indexes, cpu->cpreg_indexes,
 
171
           cpu->cpreg_array_len * sizeof(uint64_t));
 
172
    memcpy(cpu->cpreg_vmstate_values, cpu->cpreg_values,
 
173
           cpu->cpreg_array_len * sizeof(uint64_t));
 
174
}
 
175
 
 
176
static int cpu_post_load(void *opaque, int version_id)
 
177
{
 
178
    ARMCPU *cpu = opaque;
 
179
    int i, v;
 
180
 
 
181
    /* Update the values list from the incoming migration data.
 
182
     * Anything in the incoming data which we don't know about is
 
183
     * a migration failure; anything we know about but the incoming
 
184
     * data doesn't specify retains its current (reset) value.
 
185
     * The indexes list remains untouched -- we only inspect the
 
186
     * incoming migration index list so we can match the values array
 
187
     * entries with the right slots in our own values array.
 
188
     */
 
189
 
 
190
    for (i = 0, v = 0; i < cpu->cpreg_array_len
 
191
             && v < cpu->cpreg_vmstate_array_len; i++) {
 
192
        if (cpu->cpreg_vmstate_indexes[v] > cpu->cpreg_indexes[i]) {
 
193
            /* register in our list but not incoming : skip it */
 
194
            continue;
 
195
        }
 
196
        if (cpu->cpreg_vmstate_indexes[v] < cpu->cpreg_indexes[i]) {
 
197
            /* register in their list but not ours: fail migration */
 
198
            return -1;
 
199
        }
 
200
        /* matching register, copy the value over */
 
201
        cpu->cpreg_values[i] = cpu->cpreg_vmstate_values[v];
 
202
        v++;
 
203
    }
 
204
 
 
205
    if (kvm_enabled()) {
 
206
        if (!write_list_to_kvmstate(cpu)) {
 
207
            return -1;
 
208
        }
 
209
        /* Note that it's OK for the TCG side not to know about
 
210
         * every register in the list; KVM is authoritative if
 
211
         * we're using it.
 
212
         */
 
213
        write_list_to_cpustate(cpu);
 
214
    } else {
 
215
        if (!write_list_to_cpustate(cpu)) {
 
216
            return -1;
 
217
        }
 
218
    }
 
219
 
 
220
    return 0;
 
221
}
 
222
 
151
223
const VMStateDescription vmstate_arm_cpu = {
152
224
    .name = "cpu",
153
 
    .version_id = 12,
154
 
    .minimum_version_id = 12,
155
 
    .minimum_version_id_old = 12,
 
225
    .version_id = 13,
 
226
    .minimum_version_id = 13,
 
227
    .minimum_version_id_old = 13,
 
228
    .pre_save = cpu_pre_save,
 
229
    .post_load = cpu_post_load,
156
230
    .fields = (VMStateField[]) {
157
231
        VMSTATE_UINT32_ARRAY(env.regs, ARMCPU, 16),
158
232
        {
169
243
        VMSTATE_UINT32_ARRAY(env.banked_r14, ARMCPU, 7),
170
244
        VMSTATE_UINT32_ARRAY(env.usr_regs, ARMCPU, 5),
171
245
        VMSTATE_UINT32_ARRAY(env.fiq_regs, ARMCPU, 5),
172
 
        VMSTATE_UINT32(env.cp15.c0_cpuid, ARMCPU),
173
 
        VMSTATE_UINT32(env.cp15.c0_cssel, ARMCPU),
174
 
        VMSTATE_UINT32(env.cp15.c1_sys, ARMCPU),
175
 
        VMSTATE_UINT32(env.cp15.c1_coproc, ARMCPU),
176
 
        VMSTATE_UINT32(env.cp15.c1_xscaleauxcr, ARMCPU),
177
 
        VMSTATE_UINT32(env.cp15.c1_scr, ARMCPU),
178
 
        VMSTATE_UINT32(env.cp15.c1_sedbg, ARMCPU),
179
 
        VMSTATE_UINT32(env.cp15.c1_nseac, ARMCPU),
180
 
        VMSTATE_UINT32(env.cp15.c2_base0, ARMCPU),
181
 
        VMSTATE_UINT32(env.cp15.c2_base0_hi, ARMCPU),
182
 
        VMSTATE_UINT32(env.cp15.c2_base1, ARMCPU),
183
 
        VMSTATE_UINT32(env.cp15.c2_base1_hi, ARMCPU),
184
 
        VMSTATE_UINT32(env.cp15.c2_control, ARMCPU),
185
 
        VMSTATE_UINT32(env.cp15.c2_mask, ARMCPU),
186
 
        VMSTATE_UINT32(env.cp15.c2_base_mask, ARMCPU),
187
 
        VMSTATE_UINT32(env.cp15.c2_data, ARMCPU),
188
 
        VMSTATE_UINT32(env.cp15.c2_insn, ARMCPU),
189
 
        VMSTATE_UINT32(env.cp15.c3, ARMCPU),
190
 
        VMSTATE_UINT32(env.cp15.c5_insn, ARMCPU),
191
 
        VMSTATE_UINT32(env.cp15.c5_data, ARMCPU),
192
 
        VMSTATE_UINT32_ARRAY(env.cp15.c6_region, ARMCPU, 8),
193
 
        VMSTATE_UINT32(env.cp15.c6_insn, ARMCPU),
194
 
        VMSTATE_UINT32(env.cp15.c6_data, ARMCPU),
195
 
        VMSTATE_UINT32(env.cp15.c7_par, ARMCPU),
196
 
        VMSTATE_UINT32(env.cp15.c7_par_hi, ARMCPU),
197
 
        VMSTATE_UINT32(env.cp15.c9_insn, ARMCPU),
198
 
        VMSTATE_UINT32(env.cp15.c9_data, ARMCPU),
199
 
        VMSTATE_UINT32(env.cp15.c9_pmcr, ARMCPU),
200
 
        VMSTATE_UINT32(env.cp15.c9_pmcnten, ARMCPU),
201
 
        VMSTATE_UINT32(env.cp15.c9_pmovsr, ARMCPU),
202
 
        VMSTATE_UINT32(env.cp15.c9_pmxevtyper, ARMCPU),
203
 
        VMSTATE_UINT32(env.cp15.c9_pmuserenr, ARMCPU),
204
 
        VMSTATE_UINT32(env.cp15.c9_pminten, ARMCPU),
205
 
        VMSTATE_UINT32(env.cp15.c13_fcse, ARMCPU),
206
 
        VMSTATE_UINT32(env.cp15.c13_context, ARMCPU),
207
 
        VMSTATE_UINT32(env.cp15.c13_tls1, ARMCPU),
208
 
        VMSTATE_UINT32(env.cp15.c13_tls2, ARMCPU),
209
 
        VMSTATE_UINT32(env.cp15.c13_tls3, ARMCPU),
210
 
        VMSTATE_UINT32(env.cp15.c15_cpar, ARMCPU),
211
 
        VMSTATE_UINT32(env.cp15.c15_ticonfig, ARMCPU),
212
 
        VMSTATE_UINT32(env.cp15.c15_i_max, ARMCPU),
213
 
        VMSTATE_UINT32(env.cp15.c15_i_min, ARMCPU),
214
 
        VMSTATE_UINT32(env.cp15.c15_threadid, ARMCPU),
215
 
        VMSTATE_UINT32(env.cp15.c15_power_control, ARMCPU),
216
 
        VMSTATE_UINT32(env.cp15.c15_diagnostic, ARMCPU),
217
 
        VMSTATE_UINT32(env.cp15.c15_power_diagnostic, ARMCPU),
 
246
        /* The length-check must come before the arrays to avoid
 
247
         * incoming data possibly overflowing the array.
 
248
         */
 
249
        VMSTATE_INT32_LE(cpreg_vmstate_array_len, ARMCPU),
 
250
        VMSTATE_VARRAY_INT32(cpreg_vmstate_indexes, ARMCPU,
 
251
                             cpreg_vmstate_array_len,
 
252
                             0, vmstate_info_uint64, uint64_t),
 
253
        VMSTATE_VARRAY_INT32(cpreg_vmstate_values, ARMCPU,
 
254
                             cpreg_vmstate_array_len,
 
255
                             0, vmstate_info_uint64, uint64_t),
218
256
        VMSTATE_UINT32(env.exclusive_addr, ARMCPU),
219
257
        VMSTATE_UINT32(env.exclusive_val, ARMCPU),
220
258
        VMSTATE_UINT32(env.exclusive_high, ARMCPU),
221
259
        VMSTATE_UINT64(env.features, ARMCPU),
 
260
        VMSTATE_TIMER(gt_timer[GTIMER_PHYS], ARMCPU),
 
261
        VMSTATE_TIMER(gt_timer[GTIMER_VIRT], ARMCPU),
222
262
        VMSTATE_END_OF_LIST()
223
263
    },
224
264
    .subsections = (VMStateSubsection[]) {