From patchwork Wed Jan 7 15:20:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 426289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D978C1400A0 for ; Thu, 8 Jan 2015 02:40:24 +1100 (AEDT) Received: from localhost ([::1]:41325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8sid-0000O2-1T for incoming@patchwork.ozlabs.org; Wed, 07 Jan 2015 10:40:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8sPu-00063f-H3 for qemu-devel@nongnu.org; Wed, 07 Jan 2015 10:21:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y8sPk-0003ER-Lr for qemu-devel@nongnu.org; Wed, 07 Jan 2015 10:21:02 -0500 Received: from cantor2.suse.de ([195.135.220.15]:37886 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8sPk-0003CI-03; Wed, 07 Jan 2015 10:20:52 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id ECCCFADCC; Wed, 7 Jan 2015 15:20:50 +0000 (UTC) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Wed, 7 Jan 2015 16:20:43 +0100 Message-Id: <1420644048-16919-33-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1420644048-16919-1-git-send-email-agraf@suse.de> References: <1420644048-16919-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Marcel Apfelbaum , peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 32/37] hw/ppc: modified the condition for usb controllers to be created for some ppc machines 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: Marcel Apfelbaum Some ppc machines create a default usb controller based on a 'machine condition'. Until now the logic was: create the usb controller if: - the usb option was supplied in cli and value is true or - the usb option was absent and both set_defaults and the machine condition were true. Modified the logic to: Create the usb controller if: - the machine condition is true and defaults are enabled or - the usb option is supplied and true. The main for this is to simplify the usb_enabled method. Signed-off-by: Marcel Apfelbaum Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi Signed-off-by: Alexander Graf --- hw/ppc/mac_newworld.c | 3 ++- hw/ppc/spapr.c | 2 +- include/sysemu/sysemu.h | 1 + vl.c | 7 ++++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index b60a832..8ba9499 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -417,7 +417,8 @@ static void ppc_core99_init(MachineState *machine) dev = qdev_create(adb_bus, TYPE_ADB_MOUSE); qdev_init_nofail(dev); - if (usb_enabled(machine_arch == ARCH_MAC99_U3)) { + if ((machine_arch == ARCH_MAC99_U3 && defaults_enabled()) || + usb_enabled(false)) { pci_create_simple(pci_bus, -1, "pci-ohci"); /* U3 needs to use USB for input because Linux doesn't support via-cuda on PPC64 */ diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 2850624..2b2cc0c 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1530,7 +1530,7 @@ static void ppc_spapr_init(MachineState *machine) spapr->has_graphics = true; } - if (usb_enabled(spapr->has_graphics)) { + if ((spapr->has_graphics && defaults_enabled()) || usb_enabled(false)) { pci_create_simple(phb->bus, -1, "pci-ohci"); if (spapr->has_graphics) { usbdevice_create("keyboard"); diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 503e5a4..a31044c 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -227,6 +227,7 @@ void qemu_boot_set(const char *boot_order, Error **errp); QemuOpts *qemu_get_machine_opts(void); +bool defaults_enabled(void); bool usb_enabled(bool default_usb); extern QemuOptsList qemu_legacy_drive_opts; diff --git a/vl.c b/vl.c index bea9656..415535f 100644 --- a/vl.c +++ b/vl.c @@ -997,10 +997,15 @@ static int parse_name(QemuOpts *opts, void *opaque) return 0; } +bool defaults_enabled(void) +{ + return has_defaults; +} + bool usb_enabled(bool default_usb) { return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", - has_defaults && default_usb); + default_usb); } #ifndef _WIN32