From patchwork Mon Jul 2 05:25:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Li Zhang X-Patchwork-Id: 168493 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 5814E2C01E0 for ; Mon, 2 Jul 2012 15:29:21 +1000 (EST) Received: from localhost ([::1]:34868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlZCJ-0005Zw-FV for incoming@patchwork.ozlabs.org; Mon, 02 Jul 2012 01:29:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlZCC-0005Yi-4q for qemu-devel@nongnu.org; Mon, 02 Jul 2012 01:29:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SlZCA-0001qa-6l for qemu-devel@nongnu.org; Mon, 02 Jul 2012 01:29:11 -0400 Received: from e36.co.us.ibm.com ([32.97.110.154]:43038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlZC9-0001e5-Vj for qemu-devel@nongnu.org; Mon, 02 Jul 2012 01:29:10 -0400 Received: from /spool/local by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 1 Jul 2012 23:29:06 -0600 Received: from d03relay02.boulder.ibm.com (9.17.195.227) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 1 Jul 2012 23:28:47 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q625Qt4E157214; Sun, 1 Jul 2012 23:27:10 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q625QdOo009568; Sun, 1 Jul 2012 23:26:39 -0600 Received: from zhlbj-host (zhlbj-host.cn.ibm.com [9.115.122.179] (may be forged)) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q625QcHf009559; Sun, 1 Jul 2012 23:26:38 -0600 Received: by zhlbj-host (Postfix, from userid 1000) id 1BB523C0B5A; Mon, 2 Jul 2012 13:26:16 +0800 (CST) From: zhlcindy@gmail.com To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Date: Mon, 2 Jul 2012 13:25:33 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 x-cbid: 12070205-7606-0000-0000-000001A614D7 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 32.97.110.154 Cc: shangw@linux.vnet.ibm.com, benh@au1.ibm.com, afaerber@suse.de, Li Zhang , agraf@suse.de Subject: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options 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 From: Li Zhang pSeries machine needs to enable USB to add a USB keyboard or USB mouse. -usb option won't be used in the future, and machine options are a better way to enable USB. So this patch is to add USB option to machine options (-machine type=pseries,usb=on/off) to enable/disable USB controller. And machines will get the machine option and create a USB controller if USB is on. By the way, USB is on by default on pSeries machine. So USB controller should be turned off explicitly through the command line for "-nodefault" case as the following: -machine type=pseries,usb=off. Signed-off-by: Li Zhang Reviewed-by: Andreas Färber --- hw/spapr.c | 11 +++++++++++ qemu-config.c | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/hw/spapr.c b/hw/spapr.c index 81c9343..973de1b 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -575,6 +575,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 add_usb = true; spapr = g_malloc0(sizeof(*spapr)); QLIST_INIT(&spapr->phbs); @@ -710,6 +712,15 @@ 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) { + add_usb = qemu_opt_get_bool(machine_opts, "usb", true); + } + + if (add_usb) { + 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 5c3296b..b86ee36 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -595,6 +595,10 @@ static QemuOptsList qemu_machine_opts = { .name = "dt_compatible", .type = QEMU_OPT_STRING, .help = "Overrides the \"compatible\" property of the dt root node", + },{ + .name = "usb", + .type = QEMU_OPT_BOOL, + .help = "Set on/off to enable/disable usb", }, { /* End of list */ } },