From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59696) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Edc-0002lg-Vc for qemu-devel@nongnu.org; Tue, 14 Aug 2012 06:46:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Eda-0007Ch-Mz for qemu-devel@nongnu.org; Tue, 14 Aug 2012 06:46:16 -0400 Message-ID: <502A2C73.9070201@suse.de> Date: Tue, 14 Aug 2012 12:46:11 +0200 From: Alexander Graf MIME-Version: 1.0 References: <1344307320-25094-1-git-send-email-zhlcindy@linux.vnet.ibm.com> <1344307320-25094-2-git-send-email-zhlcindy@linux.vnet.ibm.com> In-Reply-To: <1344307320-25094-2-git-send-email-zhlcindy@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Qemu-ppc][PATCH v7 1/3] Add USB option in machine options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Li Zhang Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, Li Zhang , qemu-ppc@nongnu.org, afaerber@suse.de, david@gibson.dropbear.id.au On 08/07/2012 04:41 AM, Li Zhang wrote: > When -usb option is used, global varible usb_enabled is set. > And all the plafrom will create one USB controller according > to this variable. In fact, global varibles make code hard > to read. > > So this patch is to remove global variable usb_enabled and > add USB option in machine options. All the plaforms will get > USB option value from machine options. > > USB option of machine options will be set either by: > * -usb > * -machine type=pseries,usb=on > > Both these ways can work now. They both set USB option in > machine options. In the future, the first way will be removed. > > Signed-off-by: Li Zhang > --- > hw/nseries.c | 9 +++++++++ > hw/pc_piix.c | 6 ++++++ > hw/ppc_newworld.c | 10 +++++++++- > hw/ppc_oldworld.c | 8 ++++++++ > hw/ppc_prep.c | 7 +++++++ > hw/pxa2xx.c | 15 +++++++++++++++ > hw/realview.c | 8 ++++++++ > hw/spapr.c | 12 ++++++++++++ > hw/versatilepb.c | 8 ++++++++ > qemu-config.c | 4 ++++ > sysemu.h | 1 - > vl.c | 29 +++++++++++++++++++++++------ > 12 files changed, 109 insertions(+), 8 deletions(-) > [...] > diff --git a/hw/spapr.c b/hw/spapr.c > index 81c9343..4dc5e59 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 *mach_opts; > + bool usb_enabled = true; > > spapr = g_malloc0(sizeof(*spapr)); > QLIST_INIT(&spapr->phbs); > @@ -710,6 +712,16 @@ static void ppc_spapr_init(ram_addr_t ram_size, > spapr_vscsi_create(spapr->vio_bus); > } > > + mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); > + if (mach_opts) { > + usb_enabled = qemu_opt_get_bool(mach_opts, "usb", true); > + } > + > + if (usb_enabled) { > + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, > + -1, "pci-ohci"); > + } > + This needs to go into a separate patch. This patch is about moving the global usb_enabled variable towards a machine opt. It shouldn't modify any code outside of that scope, least of all add usb_enabled support for a new platform! Alex