From patchwork Mon Jul 25 16:11:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 106713 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 851C5B6F9F for ; Tue, 26 Jul 2011 02:11:41 +1000 (EST) Received: from localhost ([::1]:57821 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlNkm-0007TE-RC for incoming@patchwork.ozlabs.org; Mon, 25 Jul 2011 12:11:36 -0400 Received: from eggs.gnu.org ([140.186.70.92]:52975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlNkg-0007Su-UN for qemu-devel@nongnu.org; Mon, 25 Jul 2011 12:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlNkf-0003tu-L2 for qemu-devel@nongnu.org; Mon, 25 Jul 2011 12:11:30 -0400 Received: from thoth.sbs.de ([192.35.17.2]:28190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlNkf-0003tJ-Br for qemu-devel@nongnu.org; Mon, 25 Jul 2011 12:11:29 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id p6PGBKCn001053; Mon, 25 Jul 2011 18:11:22 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p6PGBK3l021240; Mon, 25 Jul 2011 18:11:20 +0200 Message-ID: <4E2D95A8.4060303@siemens.com> Date: Mon, 25 Jul 2011 18:11:20 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Markus Armbruster , "Richard W.M. Jones" , Anthony Liguori References: <4E2AA4AD.2080608@web.de> <20110725094156.GD21852@amd.home.annexia.org> <4E2D465D.7030502@siemens.com> <20110725104542.GR2532@amd.home.annexia.org> <4E2D4CA1.1080504@siemens.com> <4E2D5801.9020904@siemens.com> In-Reply-To: <4E2D5801.9020904@siemens.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Anthony PERARD , Ian Campbell , qemu-devel Subject: [Qemu-devel] [PATCH] Allow to leave type on default in -machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 2011-07-25 13:48, Jan Kiszka wrote: > On 2011-07-25 13:39, Markus Armbruster wrote: >> Jan Kiszka writes: >> >>> On 2011-07-25 12:45, Richard W.M. Jones wrote: >>>> On Mon, Jul 25, 2011 at 12:33:01PM +0200, Jan Kiszka wrote: >>>>> On 2011-07-25 11:41, Richard W.M. Jones wrote: >>>>>> On Sat, Jul 23, 2011 at 12:38:37PM +0200, Jan Kiszka wrote: >>>>>>> From: Jan Kiszka >>>>>>> >>>>>>> -machine somehow suggests that it selects the machine, but it doesn't. >>>>>>> Fix that before this command is set in stone. >>>>>>> >>>>>>> Actually, -machine should supersede -M and allow to introduce arbitrary >>>>>>> per-machine options to the command line. That will change the internal >>>>>>> realization again, but we will be able to keep the user interface >>>>>>> stable. >>>>>> >>>>>> This breaks libguestfs which was doing: >>>>>> >>>>>> qemu -machine accel=kvm:tcg ... >>>>>> >>>>>> We are not passing any -M option at all. We don't particularly care >>>>>> about the machine type since we're not that performance sensitive and >>>>>> we don't need to serialize the machine state. >>>>>> >>>>>> I have checked, and this works: >>>>>> >>>>>> qemu -machine pc,accel=kvm:tcg ... >>>>>> >>>>>> "pc" is the default, right? What about for other architectures? >>>>> >>>>> Yes, pc is the right default. Other arch have other defaults. >>>> >>>> So what you're saying is we have to parse qemu -machine \? output by >>>> looking for the string '(default)'? eg: >>>> >>>> $ ./arm-softmmu/qemu-system-arm -machine \?|fgrep '(default)' >>>> integratorcp ARM Integrator/CP (ARM926EJ-S) (default) >>>> >>>> $ ./i386-softmmu/qemu -machine \?|fgrep '(default)' >>>> pc-0.14 Standard PC (default) >>> >>> I understand, this is clumsy. Will see if we can do better. >> >> Is there a technical reason why type isn't optional with -machine? >> >> [...] > > Maybe it's just the > > assert(!permit_abbrev || list->implied_opt_name); > > in qemu_opts_parse, but I haven't looked at all details (and all other > users) yet. I was incorrectly pointing the core, the problem is solvable at the level where we parse -machine: -------8<-------- This allows to specify -machine options without setting an explicit machine type. We will pick the default machine in this case. Requesting the list of available machines is still possible via '-machine ?' e.g. Signed-off-by: Jan Kiszka --- vl.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/vl.c b/vl.c index 8256504..5e53ddc 100644 --- a/vl.c +++ b/vl.c @@ -2720,7 +2720,10 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "parse error: %s\n", optarg); exit(1); } - machine = machine_parse(qemu_opt_get(opts, "type")); + optarg = qemu_opt_get(opts, "type"); + if (optarg) { + machine = machine_parse(optarg); + } break; case QEMU_OPTION_usb: usb_enabled = 1;