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

« back to all changes in this revision

Viewing changes to qom/cpu.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:
18
18
 * <http://www.gnu.org/licenses/gpl-2.0.html>
19
19
 */
20
20
 
 
21
#include "qemu-common.h"
21
22
#include "qom/cpu.h"
22
 
#include "qemu-common.h"
23
23
#include "sysemu/kvm.h"
24
24
#include "qemu/notify.h"
 
25
#include "qemu/log.h"
25
26
#include "sysemu/sysemu.h"
26
27
 
27
28
typedef struct CPUExistsArgs {
50
51
    return data.found;
51
52
}
52
53
 
 
54
bool cpu_paging_enabled(const CPUState *cpu)
 
55
{
 
56
    CPUClass *cc = CPU_GET_CLASS(cpu);
 
57
 
 
58
    return cc->get_paging_enabled(cpu);
 
59
}
 
60
 
 
61
static bool cpu_common_get_paging_enabled(const CPUState *cpu)
 
62
{
 
63
    return false;
 
64
}
 
65
 
 
66
void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
 
67
                            Error **errp)
 
68
{
 
69
    CPUClass *cc = CPU_GET_CLASS(cpu);
 
70
 
 
71
    return cc->get_memory_mapping(cpu, list, errp);
 
72
}
 
73
 
 
74
static void cpu_common_get_memory_mapping(CPUState *cpu,
 
75
                                          MemoryMappingList *list,
 
76
                                          Error **errp)
 
77
{
 
78
    error_setg(errp, "Obtaining memory mappings is unsupported on this CPU.");
 
79
}
 
80
 
53
81
/* CPU hot-plug notifiers */
54
82
static NotifierList cpu_added_notifiers =
55
83
    NOTIFIER_LIST_INITIALIZER(cpu_add_notifiers);
64
92
    cpu->interrupt_request &= ~mask;
65
93
}
66
94
 
 
95
void cpu_exit(CPUState *cpu)
 
96
{
 
97
    cpu->exit_request = 1;
 
98
    cpu->tcg_exit_req = 1;
 
99
}
 
100
 
67
101
int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
68
102
                             void *opaque)
69
103
{
123
157
}
124
158
 
125
159
 
 
160
static int cpu_common_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg)
 
161
{
 
162
    return 0;
 
163
}
 
164
 
 
165
static int cpu_common_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg)
 
166
{
 
167
    return 0;
 
168
}
 
169
 
 
170
 
 
171
void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
 
172
                    int flags)
 
173
{
 
174
    CPUClass *cc = CPU_GET_CLASS(cpu);
 
175
 
 
176
    if (cc->dump_state) {
 
177
        cc->dump_state(cpu, f, cpu_fprintf, flags);
 
178
    }
 
179
}
 
180
 
 
181
void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
 
182
                         int flags)
 
183
{
 
184
    CPUClass *cc = CPU_GET_CLASS(cpu);
 
185
 
 
186
    if (cc->dump_statistics) {
 
187
        cc->dump_statistics(cpu, f, cpu_fprintf, flags);
 
188
    }
 
189
}
 
190
 
126
191
void cpu_reset(CPUState *cpu)
127
192
{
128
193
    CPUClass *klass = CPU_GET_CLASS(cpu);
134
199
 
135
200
static void cpu_common_reset(CPUState *cpu)
136
201
{
 
202
    CPUClass *cc = CPU_GET_CLASS(cpu);
 
203
 
 
204
    if (qemu_loglevel_mask(CPU_LOG_RESET)) {
 
205
        qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index);
 
206
        log_cpu_state(cpu, cc->reset_dump_flags);
 
207
    }
 
208
 
137
209
    cpu->exit_request = 0;
138
210
    cpu->interrupt_request = 0;
139
211
    cpu->current_tb = NULL;
163
235
    }
164
236
}
165
237
 
 
238
static void cpu_common_initfn(Object *obj)
 
239
{
 
240
    CPUState *cpu = CPU(obj);
 
241
    CPUClass *cc = CPU_GET_CLASS(obj);
 
242
 
 
243
    cpu->gdb_num_regs = cpu->gdb_num_g_regs = cc->gdb_num_core_regs;
 
244
}
 
245
 
166
246
static int64_t cpu_common_get_arch_id(CPUState *cpu)
167
247
{
168
248
    return cpu->cpu_index;
176
256
    k->class_by_name = cpu_common_class_by_name;
177
257
    k->reset = cpu_common_reset;
178
258
    k->get_arch_id = cpu_common_get_arch_id;
 
259
    k->get_paging_enabled = cpu_common_get_paging_enabled;
 
260
    k->get_memory_mapping = cpu_common_get_memory_mapping;
179
261
    k->write_elf32_qemunote = cpu_common_write_elf32_qemunote;
180
262
    k->write_elf32_note = cpu_common_write_elf32_note;
181
263
    k->write_elf64_qemunote = cpu_common_write_elf64_qemunote;
182
264
    k->write_elf64_note = cpu_common_write_elf64_note;
 
265
    k->gdb_read_register = cpu_common_gdb_read_register;
 
266
    k->gdb_write_register = cpu_common_gdb_write_register;
183
267
    dc->realize = cpu_common_realizefn;
184
268
    dc->no_user = 1;
185
269
}
188
272
    .name = TYPE_CPU,
189
273
    .parent = TYPE_DEVICE,
190
274
    .instance_size = sizeof(CPUState),
 
275
    .instance_init = cpu_common_initfn,
191
276
    .abstract = true,
192
277
    .class_size = sizeof(CPUClass),
193
278
    .class_init = cpu_class_init,