diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-10-09 15:09:05 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-10-09 15:09:05 +0100 |
commit | fcb2cd928f5519b8241e22411a696be1a7272b1c (patch) | |
tree | 394f049d19f8abb12c1b11f4dcc03b9036da604d /vl.c | |
parent | b6011bd8a57c1eda81a857d21adeb9b66e58b1b0 (diff) | |
parent | 5008e5b7b817b5ea2b788203122cd50e7c16e599 (diff) |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Four changes here. Polling for reconnection of character devices,
the QOMification of accelerators, a fix for -kernel support on x86, and one
for a recently-introduced virtio-scsi optimization.
# gpg: Signature made Thu 09 Oct 2014 14:36:50 BST using RSA key ID 4E6B09D7
# gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>"
# gpg: aka "Paolo Bonzini <bonzini@gnu.org>"
* remotes/bonzini/tags/for-upstream: (28 commits)
qemu-char: Fix reconnect socket error reporting
qemu-sockets: Add error to non-blocking connect handler
qemu-error: Add error_vreport()
virtio-scsi: fix use-after-free of VirtIOSCSIReq
linuxboot: compute initrd loading address
kvm: Make KVMState be the TYPE_KVM_ACCEL instance struct
accel: Create accel object when initializing machine
accel: Pass MachineState object to accel init functions
accel: Rename 'init' method to 'init_machine'
accel: Move accel init/allowed code to separate function
accel: Remove tcg_available() function
accel: Move qtest accel registration to qtest.c
accel: Move Xen registration code to xen-common.c
accel: Move KVM accel registration to kvm-all.c
accel: Report unknown accelerator as "not found" instead of "does not exist"
accel: Make AccelClass.available() optional
accel: Use QOM classes for accel types
accel: Move accel name lookup to separate function
accel: Simplify configure_accelerator() using AccelType *acc variable
accel: Create AccelType typedef
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 83 |
1 files changed, 2 insertions, 81 deletions
@@ -61,6 +61,7 @@ int main(int argc, char **argv) #include "qemu/sockets.h" #include "hw/hw.h" #include "hw/boards.h" +#include "sysemu/accel.h" #include "hw/usb.h" #include "hw/pcmcia.h" #include "hw/i386/pc.h" @@ -213,11 +214,9 @@ static NotifierList exit_notifiers = static NotifierList machine_init_done_notifiers = NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); -static bool tcg_allowed = true; bool xen_allowed; uint32_t xen_domid; enum xen_mode xen_mode = XEN_EMULATE; -static int tcg_tb_size; static int has_defaults = 1; static int default_serial = 1; @@ -2681,84 +2680,6 @@ static MachineClass *machine_parse(const char *name) exit(!name || !is_help_option(name)); } -static int tcg_init(MachineClass *mc) -{ - tcg_exec_init(tcg_tb_size * 1024 * 1024); - return 0; -} - -static struct { - const char *opt_name; - const char *name; - int (*available)(void); - int (*init)(MachineClass *mc); - bool *allowed; -} accel_list[] = { - { "tcg", "tcg", tcg_available, tcg_init, &tcg_allowed }, - { "xen", "Xen", xen_available, xen_init, &xen_allowed }, - { "kvm", "KVM", kvm_available, kvm_init, &kvm_allowed }, - { "qtest", "QTest", qtest_available, qtest_init_accel, &qtest_allowed }, -}; - -static int configure_accelerator(MachineClass *mc) -{ - const char *p; - char buf[10]; - int i, ret; - bool accel_initialised = false; - bool init_failed = false; - - p = qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (p == NULL) { - /* Use the default "accelerator", tcg */ - p = "tcg"; - } - - while (!accel_initialised && *p != '\0') { - if (*p == ':') { - p++; - } - p = get_opt_name(buf, sizeof (buf), p, ':'); - for (i = 0; i < ARRAY_SIZE(accel_list); i++) { - if (strcmp(accel_list[i].opt_name, buf) == 0) { - if (!accel_list[i].available()) { - printf("%s not supported for this target\n", - accel_list[i].name); - break; - } - *(accel_list[i].allowed) = true; - ret = accel_list[i].init(mc); - if (ret < 0) { - init_failed = true; - fprintf(stderr, "failed to initialize %s: %s\n", - accel_list[i].name, - strerror(-ret)); - *(accel_list[i].allowed) = false; - } else { - accel_initialised = true; - } - break; - } - } - if (i == ARRAY_SIZE(accel_list)) { - fprintf(stderr, "\"%s\" accelerator does not exist.\n", buf); - } - } - - if (!accel_initialised) { - if (!init_failed) { - fprintf(stderr, "No accelerator found!\n"); - } - exit(1); - } - - if (init_failed) { - fprintf(stderr, "Back to %s accelerator.\n", accel_list[i].name); - } - - return !accel_initialised; -} - void qemu_add_exit_notifier(Notifier *notify) { notifier_list_add(&exit_notifiers, notify); @@ -4264,7 +4185,7 @@ int main(int argc, char **argv, char **envp) exit(1); } - configure_accelerator(machine_class); + configure_accelerator(current_machine); if (qtest_chrdev) { Error *local_err = NULL; |