From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Qjk-0008UB-9a for qemu-devel@nongnu.org; Tue, 14 Aug 2012 19:41:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Qji-0003P2-De for qemu-devel@nongnu.org; Tue, 14 Aug 2012 19:41:24 -0400 Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <20120814231021.GB8136@truffula.fritz.box> Date: Wed, 15 Aug 2012 01:41:16 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <512FE11A-4B24-4215-A686-9FFDBD90432A@suse.de> References: <1344307320-25094-1-git-send-email-zhlcindy@linux.vnet.ibm.com> <1344307320-25094-2-git-send-email-zhlcindy@linux.vnet.ibm.com> <502A2C73.9070201@suse.de> <20120814231021.GB8136@truffula.fritz.box> 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: David Gibson Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, Li Zhang , qemu-ppc@nongnu.org, Li Zhang , afaerber@suse.de On 15.08.2012, at 01:10, David Gibson wrote: > On Tue, Aug 14, 2012 at 11:01:19PM +0800, Li Zhang wrote: >> On Tue, Aug 14, 2012 at 6:46 PM, Alexander Graf = wrote: >>> On 08/07/2012 04:41 AM, Li Zhang wrote: >>>>=20 >>>> 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. >>>>=20 >>>> 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. >>>>=20 >>>> USB option of machine options will be set either by: >>>> * -usb >>>> * -machine type=3Dpseries,usb=3Don >>>>=20 >>>> Both these ways can work now. They both set USB option in >>>> machine options. In the future, the first way will be removed. >>>>=20 >>>> 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(-) >>>>=20 >>>=20 >>> [...] >>>=20 >>>=20 >>>> 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 =3D 17; >>>> char *filename; >>>> + QemuOpts *mach_opts; >>>> + bool usb_enabled =3D true; >>>> spapr =3D 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 =3D qemu_opts_find(qemu_find_opts("machine"), 0); >>>> + if (mach_opts) { >>>> + usb_enabled =3D qemu_opt_get_bool(mach_opts, "usb", true); >>>> + } >>>> + >>>> + if (usb_enabled) { >>>> + = pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, >>>> + -1, "pci-ohci"); >>>> + } >>>> + >>>=20 >>>=20 >>> 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! >>>=20 >> I see. I will redo this patch. Send out it later. :) >> Thanks for your comments. >=20 > When you do that, please also change the default to make spapr _not_ > have usb. I thought the idea was to default to usb=3Don when -vga is used? Alex