From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=32787 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Phi8R-0004Nr-Pr for qemu-devel@nongnu.org; Tue, 25 Jan 2011 07:36:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Phi8Q-0002uv-ES for qemu-devel@nongnu.org; Tue, 25 Jan 2011 07:36:35 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:56436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Phi8Q-0002tp-Ae for qemu-devel@nongnu.org; Tue, 25 Jan 2011 07:36:34 -0500 From: anthony.perard@citrix.com Date: Tue, 25 Jan 2011 12:36:09 +0000 Message-Id: <1295958969-28755-3-git-send-email-anthony.perard@citrix.com> In-Reply-To: <1295958969-28755-1-git-send-email-anthony.perard@citrix.com> References: <1295958969-28755-1-git-send-email-anthony.perard@citrix.com> Subject: [Qemu-devel] [RESEND PATCH V3 2/2] machine, Add default_machine_opts to QEMUMachine. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU-devel Cc: Anthony PERARD , Stefano Stabellini From: Anthony PERARD With this new field, we can specified which accelerator use to run the machine, if the accelerator is not already specified by either a configuration file or the command line options. Currently, the only use will be made in the xenfv machine. Signed-off-by: Anthony PERARD --- hw/boards.h | 1 + vl.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/hw/boards.h b/hw/boards.h index 6f0f0d7..716fd7b 100644 --- a/hw/boards.h +++ b/hw/boards.h @@ -27,6 +27,7 @@ typedef struct QEMUMachine { no_cdrom:1, no_sdcard:1; int is_default; + const char *default_machine_opts; GlobalProperty *compat_props; struct QEMUMachine *next; } QEMUMachine; diff --git a/vl.c b/vl.c index 6a62728..626f4e1 100644 --- a/vl.c +++ b/vl.c @@ -2853,6 +2853,28 @@ int main(int argc, char **argv, char **envp) exit(1); } + /* + * Get the default machine options from the machine if it is not already + * specified either by the configuration file or by the command line. + */ + if (machine->default_machine_opts) { + QemuOptsList *list = qemu_find_opts("machine"); + const char *p = NULL; + + if (!QTAILQ_EMPTY(&list->head)) { + p = qemu_opt_get(QTAILQ_FIRST(&list->head), "accel"); + } + if (p == NULL) { + opts = qemu_opts_parse(qemu_find_opts("machine"), + machine->default_machine_opts, 0); + if (!opts) { + fprintf(stderr, "parse error for machine %s: %s\n", + machine->name, machine->default_machine_opts); + exit(1); + } + } + } + qemu_opts_foreach(qemu_find_opts("device"), default_driver_check, NULL, 0); qemu_opts_foreach(qemu_find_opts("global"), default_driver_check, NULL, 0); -- 1.7.1