From patchwork Mon Jun 18 09:22:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zhang X-Patchwork-Id: 165425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 04E3AB7049 for ; Mon, 18 Jun 2012 19:23:01 +1000 (EST) Received: from localhost ([::1]:56394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgYAk-0003Ov-NJ for incoming@patchwork.ozlabs.org; Mon, 18 Jun 2012 05:22:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgYAc-0003Oi-Ul for qemu-devel@nongnu.org; Mon, 18 Jun 2012 05:22:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgYAV-0006pq-M4 for qemu-devel@nongnu.org; Mon, 18 Jun 2012 05:22:50 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:41232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgYAV-0006pR-DT; Mon, 18 Jun 2012 05:22:43 -0400 Received: by wibhn14 with SMTP id hn14so1316487wib.10 for ; Mon, 18 Jun 2012 02:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=dqVjD01UwprbnFGXdpv2b9HSCCFmkUKXsRediVzw+54=; b=008YT/+2B7aX0dA/TFDKtmCZkVWn5QJSwtAIB7Ly6escuXJzk5aScAQmLfoIgjrB/8 DZRt4maTVs1Z1fFONdtoEgLi+Dnr85yT8T7lMdtA4FXVmcbL+M1/UGMa0pSQ8++4K1LF jSkh24Fl9UqtQnrqZJlXiS8oa7bmaBkVZOwiI8yNnOWUyJz6/7EfVKheR35xUE40Hupt oQV9cqxX14FSFdeqaEvKmvLZ7rGWB/oKepfNDC2w1GvXRza9EwLYDzBsrauT4llRhXq6 EUy8BUeh6dBorBf5JWCiiL9XRIwEGJr2psOh8uY7BFlFPeyqFHie/k8MIlWEqbVE6ck7 36JA== MIME-Version: 1.0 Received: by 10.216.211.19 with SMTP id v19mr8222328weo.89.1340011360649; Mon, 18 Jun 2012 02:22:40 -0700 (PDT) Received: by 10.216.59.69 with HTTP; Mon, 18 Jun 2012 02:22:40 -0700 (PDT) In-Reply-To: References: <1339754783-14341-1-git-send-email-zhlcindy@linux.vnet.ibm.com> Date: Mon, 18 Jun 2012 17:22:40 +0800 Message-ID: From: Li Zhang To: qemu-devel@nongnu.org, qemu-ppc X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.181 Cc: Anthony Liguori , Benjamin Herrenschmidt , =?UTF-8?Q?Andreas_F=C3=A4rber?= , Li Zhang , Markus Armbruster Subject: [Qemu-devel] [PATCH 1/2] Add usb option in machine options to enable/disable usb 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 For pseries machine, it needs to enable usb to add keyboard or usb mouse. -usb option won't be used in the future, and machine options is a better way to enable usb. So this patch is to add usb option to machine options (-machine type=psereis,usb=on/off)to enable/disable usb controller. For specific machines, they will get the machine option and then create usb controller according to usb option. In this patch, usb is on by default on pseries. So, for -nodefault,usb should be set off in the command line as the following: -machine type=pseries,usb=off. Signed-off-by: Li Zhang --- hw/spapr.c | 10 ++++++++++ qemu-config.c | 4 ++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/hw/spapr.c b/hw/spapr.c index d0bddbc..8d158d7 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -529,6 +529,8 @@ static void ppc_spapr_init(ram_addr_t ram_size, long load_limit, rtas_limit, fw_size; long pteg_shift = 17; char *filename; + QemuOpts * machine_opts; + bool usb_on = false; spapr = g_malloc0(sizeof(*spapr)); QLIST_INIT(&spapr->phbs); @@ -661,6 +663,14 @@ static void ppc_spapr_init(ram_addr_t ram_size, spapr_vscsi_create(spapr->vio_bus); } + machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); + if (machine_opts) + usb_on = qemu_opt_get_bool(machine_opts, "usb", true); + + if (usb_on) { + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, + -1, "pci-ohci"); + } if (rma_size < (MIN_RMA_SLOF << 20)) { fprintf(stderr, "qemu: pSeries SLOF firmware requires >= " "%ldM guest RMA (Real Mode Area memory)\n", MIN_RMA_SLOF); diff --git a/qemu-config.c b/qemu-config.c index bb3bff4..cdab765 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -583,6 +583,10 @@ static QemuOptsList qemu_machine_opts = { .name = "dtb", .type = QEMU_OPT_STRING, .help = "Linux kernel device tree file", + },{ + .name = "usb", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable/disable usb", }, { /* End of list */ } },