From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SnsqN-0003ha-K9 for qemu-devel@nongnu.org; Sun, 08 Jul 2012 10:52:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SnsqL-0000N9-Kc for qemu-devel@nongnu.org; Sun, 08 Jul 2012 10:52:15 -0400 MIME-Version: 1.0 In-Reply-To: <44EB932B-44D7-4433-80E2-DF1C56273954@suse.de> References: <8035D2DA-91B8-4F15-890A-EAC2113847BF@suse.de> <44EB932B-44D7-4433-80E2-DF1C56273954@suse.de> Date: Sun, 8 Jul 2012 22:52:10 +0800 Message-ID: From: Li Zhang Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-ppc][PATCH v5 1/4] Add usb option in machine options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: "benh@au1.ibm.com" , "shangw@linux.vnet.ibm.com" , "qemu-devel@nongnu.org" , Li Zhang , "qemu-ppc@nongnu.org" , "afaerber@suse.de" On Sun, Jul 8, 2012 at 10:45 PM, Alexander Graf wrote: > > > On 08.07.2012, at 16:21, Li Zhang wrote: > >> On Fri, Jul 6, 2012 at 9:43 PM, Alexander Graf wrote: >>> >>> On 02.07.2012, at 07:25, zhlcindy@gmail.com wrote: >>> >>>> 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=3Dpseries,usb=3Don/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=3Dpseries,usb=3Doff. >>>> >>>> Signed-off-by: Li Zhang >>>> Reviewed-by: Andreas F=C3=A4rber >>> >>> Shouldn't you also convert -usb over to the new syntax, so that -usb ba= sically is the same as -machine x,usb=3Don? >>> >> Assumely, -usb and -machine x, usb=3Don shouldn't be used at the same = time. >> When using -usb, and -machine x, usb=3Doff, it's a little like to >> disable the default USB of machine, >> and use another specific USB with -usb option. >> >> That's what my understanding. :) > > It's not about passing them in at the same time, but about having a singl= e semantic instance where "Do we expose USB?" gets stored. That makes the c= ode easier. > > Also if you change things the way I suggested, every platform will be abl= e to use -usb and -machine usb=3Dx. So things become a lot more logical fro= m the command line perspective as well, since a management app can always p= ass in -machine usb=3Dx and have the same semantics, regardless of the mach= ine we're running on. > Got it. I will change it. > > Alex > >> >>> >>> Alex >>> >>>> --- >>>> 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 =3D 17; >>>> char *filename; >>>> + QemuOpts *machine_opts; >>>> + bool add_usb =3D true; >>>> >>>> spapr =3D 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 =3D qemu_opts_find(qemu_find_opts("machine"), 0); >>>> + if (machine_opts) { >>>> + add_usb =3D qemu_opt_get_bool(machine_opts, "usb", true); >>>> + } >>>> + >>>> + if (add_usb) { >>>> + pci_create_simple(QLIST_FIRST(&spapr->phbs)->host_state.bus, >>>> + -1, "pci-ohci"); >>>> + } >>> >>> Didn't I ask you to extract this out to generic code? I don't want to h= ave a "usb" machine opt that is only available for -M pseries. >>> >> OK. I will do that. :) >>> >>> Alex >>> >> >> >> >> -- >> >> Best Regards >> -Li --=20 Best Regards -Li