From patchwork Mon May 5 19:03:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 4116751 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1906FBFF02 for ; Mon, 5 May 2014 19:04:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18E632024F for ; Mon, 5 May 2014 19:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E6CEE2020F for ; Mon, 5 May 2014 19:04:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751656AbaEETEK (ORCPT ); Mon, 5 May 2014 15:04:10 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48268 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbaEETEJ (ORCPT ); Mon, 5 May 2014 15:04:09 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3A6F5AC7A; Mon, 5 May 2014 19:04:07 +0000 (UTC) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paolo Bonzini , Anthony Liguori , Stefano Stabellini , kvm@vger.kernel.org (open list:Overall), xen-devel@lists.xensource.com (open list:X86) Subject: [PULL 05/20] machine: Replace QEMUMachine by MachineClass in accelerator configuration Date: Mon, 5 May 2014 21:03:49 +0200 Message-Id: <1399316644-20700-6-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1399316644-20700-1-git-send-email-afaerber@suse.de> References: <1399316644-20700-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marcel Apfelbaum This minimizes QEMUMachine usage, as part of machine QOM-ification. Signed-off-by: Marcel Apfelbaum Signed-off-by: Andreas Färber --- include/hw/boards.h | 3 +-- include/hw/xen/xen.h | 2 +- include/qemu/typedefs.h | 1 + include/sysemu/kvm.h | 2 +- include/sysemu/qtest.h | 2 +- kvm-all.c | 6 +++--- kvm-stub.c | 2 +- qtest.c | 2 +- vl.c | 10 +++++----- xen-all.c | 2 +- xen-stub.c | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index be2e432..8f53334 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -3,12 +3,11 @@ #ifndef HW_BOARDS_H #define HW_BOARDS_H +#include "qemu/typedefs.h" #include "sysemu/blockdev.h" #include "hw/qdev.h" #include "qom/object.h" -typedef struct MachineClass MachineClass; - typedef struct QEMUMachineInitArgs { const MachineClass *machine; ram_addr_t ram_size; diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index 9d549fc..85fda3d 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -36,7 +36,7 @@ void xen_cmos_set_s3_resume(void *opaque, int irq, int level); qemu_irq *xen_interrupt_controller_init(void); -int xen_init(QEMUMachine *machine); +int xen_init(MachineClass *mc); int xen_hvm_init(MemoryRegion **ram_memory); void xenstore_store_pv_console_info(int i, struct CharDriverState *chr); diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index bf8daac..86bab12 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -31,6 +31,7 @@ typedef struct MemoryListener MemoryListener; typedef struct MemoryMappingList MemoryMappingList; typedef struct QEMUMachine QEMUMachine; +typedef struct MachineClass MachineClass; typedef struct NICInfo NICInfo; typedef struct HCIInfo HCIInfo; typedef struct AudioState AudioState; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 192fe89..5ad4e0e 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -152,7 +152,7 @@ extern KVMState *kvm_state; /* external API */ -int kvm_init(QEMUMachine *machine); +int kvm_init(MachineClass *mc); int kvm_has_sync_mmu(void); int kvm_has_vcpu_events(void); diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index 224131f..95c9ade 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -26,7 +26,7 @@ static inline bool qtest_enabled(void) bool qtest_driver(void); -int qtest_init_accel(QEMUMachine *machine); +int qtest_init_accel(MachineClass *mc); void qtest_init(const char *qtest_chrdev, const char *qtest_log, Error **errp); static inline int qtest_available(void) diff --git a/kvm-all.c b/kvm-all.c index 82a9119..5cb7f26 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1341,7 +1341,7 @@ static int kvm_max_vcpus(KVMState *s) return (ret) ? ret : kvm_recommended_vcpus(s); } -int kvm_init(QEMUMachine *machine) +int kvm_init(MachineClass *mc) { static const char upgrade_note[] = "Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n" @@ -1433,8 +1433,8 @@ int kvm_init(QEMUMachine *machine) } kvm_type = qemu_opt_get(qemu_get_machine_opts(), "kvm-type"); - if (machine->kvm_type) { - type = machine->kvm_type(kvm_type); + if (mc->kvm_type) { + type = mc->kvm_type(kvm_type); } else if (kvm_type) { fprintf(stderr, "Invalid argument kvm-type=%s\n", kvm_type); goto err; diff --git a/kvm-stub.c b/kvm-stub.c index ccdba62..8acda86 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -34,7 +34,7 @@ int kvm_init_vcpu(CPUState *cpu) return -ENOSYS; } -int kvm_init(QEMUMachine *machine) +int kvm_init(MachineClass *mc) { return -ENOSYS; } diff --git a/qtest.c b/qtest.c index 0ac9f42..2aba20d 100644 --- a/qtest.c +++ b/qtest.c @@ -500,7 +500,7 @@ static void qtest_event(void *opaque, int event) } } -int qtest_init_accel(QEMUMachine *machine) +int qtest_init_accel(MachineClass *mc) { configure_icount("0"); diff --git a/vl.c b/vl.c index 2c2b625..f423b2e 100644 --- a/vl.c +++ b/vl.c @@ -2725,7 +2725,7 @@ static MachineClass *machine_parse(const char *name) exit(!name || !is_help_option(name)); } -static int tcg_init(QEMUMachine *machine) +static int tcg_init(MachineClass *mc) { tcg_exec_init(tcg_tb_size * 1024 * 1024); return 0; @@ -2735,7 +2735,7 @@ static struct { const char *opt_name; const char *name; int (*available)(void); - int (*init)(QEMUMachine *); + int (*init)(MachineClass *mc); bool *allowed; } accel_list[] = { { "tcg", "tcg", tcg_available, tcg_init, &tcg_allowed }, @@ -2744,7 +2744,7 @@ static struct { { "qtest", "QTest", qtest_available, qtest_init_accel, &qtest_allowed }, }; -static int configure_accelerator(QEMUMachine *machine) +static int configure_accelerator(MachineClass *mc) { const char *p; char buf[10]; @@ -2771,7 +2771,7 @@ static int configure_accelerator(QEMUMachine *machine) break; } *(accel_list[i].allowed) = true; - ret = accel_list[i].init(machine); + ret = accel_list[i].init(mc); if (ret < 0) { init_failed = true; fprintf(stderr, "failed to initialize %s: %s\n", @@ -4222,7 +4222,7 @@ int main(int argc, char **argv, char **envp) exit(0); } - configure_accelerator(machine); + configure_accelerator(machine_class); if (qtest_chrdev) { Error *local_err = NULL; diff --git a/xen-all.c b/xen-all.c index ba34739..a63b531 100644 --- a/xen-all.c +++ b/xen-all.c @@ -1001,7 +1001,7 @@ static void xen_exit_notifier(Notifier *n, void *data) xs_daemon_close(state->xenstore); } -int xen_init(QEMUMachine *machine) +int xen_init(MachineClass *mc) { xen_xc = xen_xc_interface_open(0, 0, 0); if (xen_xc == XC_HANDLER_INITIAL_VALUE) { diff --git a/xen-stub.c b/xen-stub.c index 59927cb..de26583 100644 --- a/xen-stub.c +++ b/xen-stub.c @@ -47,7 +47,7 @@ qemu_irq *xen_interrupt_controller_init(void) return NULL; } -int xen_init(QEMUMachine *machine) +int xen_init(MachineClass *mc) { return -ENOSYS; }