qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Li Zhang <zhlcindy@gmail.com>
To: Benjamin Herrenschmidt <benh@au1.ibm.com>
Cc: aliguori@us.ibm.com, "Alexander Graf" <agraf@suse.de>,
	zhlcindy@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	qemu-ppc <qemu-ppc@nongnu.org>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 1/1] Add usb option in machine options.
Date: Fri, 15 Jun 2012 10:34:37 +0800	[thread overview]
Message-ID: <CAD8of+obPxivvTH2YfPfvG4STEbKFjPNBMQL=g87wjUTJTuXyA@mail.gmail.com> (raw)
In-Reply-To: <1339711491.9220.168.camel@pasglop>

[-- Attachment #1: Type: text/plain, Size: 4496 bytes --]

OK,sorry for my fault.

best regards

Li Zhang
在 2012-6-15 上午6:05,"Benjamin Herrenschmidt" <benh@au1.ibm.com>写道:
>
> On Thu, 2012-06-14 at 16:27 +0200, Andreas Färber wrote:
> > Am 14.06.2012 07:17, schrieb zhlcindy@gmail.com:
> > > From: Li Zhang <zhlcindy@linux.vnet.ibm.com>
> > >
> > > For pseries machine, it needs to enable usb
> > > to add kbd or usb mouse. -usb option won't
> > > be used in the future, and machine options
> > > is a better way to enable usb.
> > >
> > > So this patch is to add usb option to machine
> > > options (-machine type=psereis,usb=on/off)
> > > to enable/disable usb controller.
> > >
> > > In this patch, usb_opt is an global option
> > > which can be checked by machines. For example,
> > > on pseries, it will check if usb_opt is on, if
> > > it is on, it will create one usb ohci controller.
> > > As the following:
> > > if (usb_opts && strcmp(usb_opts, "on") == 0)
> > >      pci_create_simple(bus, -1, "pci-ohci");
> > >
> > > In this patch, usb is on by default.
> > > So, for -nodefault, usb should be set off in the
> > > command line as the following:
> > >  -machine type=pseries,usb=off.
> > >
> > > Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
> > > reviewed-by:   Anthony Liguori <aliguori@us.ibm.com>
> > > reviewed-by:   Benjamin Herrenschmidt <benh@au1.ibm.com>
>
> I have not reviewed that patch. Li, you must -never- make up such
> reviewed-by: lines ! You put them in if and only if you've had them
> given to you by the reviewer who has actually reviewed the patch in
> details.
>
> Ben.
>
> > > ---
> > >  qemu-config.c |    4 ++++
> > >  sysemu.h      |    1 +
> > >  vl.c          |   12 ++++++++++++
> > >  3 files changed, 17 insertions(+)
> > >
> > > diff --git a/qemu-config.c b/qemu-config.c
> > > index bb3bff4..258712a 100644
> > > --- a/qemu-config.c
> > > +++ b/qemu-config.c
> > > @@ -583,6 +583,10 @@ static QemuOptsList qemu_machine_opts = {
> > >              .name = "dtb",
> > >              .type = QEMU_OPT_STRING,
> > >              .help = "Linux kernel device tree file",
> > > +        }, {
> > > +            .name = "usb",
> > > +            .type = QEMU_OPT_BOOL,
> > > +            .help = "Set on/off to enable/disable usb",
> > >          },
> > >          { /* End of list */ }
> > >      },
> > > diff --git a/sysemu.h b/sysemu.h
> > > index bc2c788..c5ea10d 100644
> > > --- a/sysemu.h
> > > +++ b/sysemu.h
> > > @@ -13,6 +13,7 @@
> > >  /* vl.c */
> > >
> > >  extern const char *bios_name;
> > > +extern const char *usb_opt;
> > >
> > >  extern const char *qemu_name;
> > >  extern uint8_t qemu_uuid[];
> > > diff --git a/vl.c b/vl.c
> > > index 204d85b..10f8e4c 100644
> > > --- a/vl.c
> > > +++ b/vl.c
> > > @@ -171,6 +171,7 @@ int main(int argc, char **argv)
> > >
> > >  static const char *data_dir;
> > >  const char *bios_name = NULL;
> > > +const char *usb_opt = NULL;
> > >  enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
> > >  DisplayType display_type = DT_DEFAULT;
> > >  int display_remote = 0;
> >
> > I'd be very surprised if Anthony has actually reviewed this...
> >
> > The point of using machine options is so that you can use the QemuOpts
> > infrastructure to inquire this value, not to save more global state.
> > Especially not a string when all you want is a boolean value.
> >
> > Further, in this patch it's only being assigned, not used anywhere.
> >
> > Andreas
> >
> > > @@ -758,6 +759,15 @@ static int bt_parse(const char *opt)
> > >      return 1;
> > >  }
> > >
> > > +static int default_enable_usb(QemuOpts *opts)
> > > +{
> > > +    if (NULL == qemu_opt_get(opts, "usb")) {
> > > +        qemu_opt_set(opts, "usb", "on");
> > > +    }
> > > +
> > > +    return 0;
> > > +}
> > > +
> > >  /***********************************************************/
> > >  /* QEMU Block devices */
> > >
> > > @@ -3356,6 +3366,8 @@ int main(int argc, char **argv, char **envp)
> > >          kernel_filename = qemu_opt_get(machine_opts, "kernel");
> > >          initrd_filename = qemu_opt_get(machine_opts, "initrd");
> > >          kernel_cmdline = qemu_opt_get(machine_opts, "append");
> > > +        default_enable_usb(machine_opts);
> > > +        usb_opt = qemu_opt_get(machine_opts, "usb");
> > >      } else {
> > >          kernel_filename = initrd_filename = kernel_cmdline = NULL;
> > >      }
> >
> >
>
>

[-- Attachment #2: Type: text/html, Size: 6596 bytes --]

  reply	other threads:[~2012-06-15  2:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14  5:17 [Qemu-devel] [PATCH 1/1] Add usb option in machine options zhlcindy
2012-06-14 14:27 ` Andreas Färber
2012-06-14 22:04   ` Benjamin Herrenschmidt
2012-06-15  2:34     ` Li Zhang [this message]
2012-06-15  3:06   ` Li Zhang
2012-06-15  5:15     ` Peter Crosthwaite
2012-06-15  6:00       ` Benjamin Herrenschmidt
2012-06-15  6:21       ` Li Zhang
2012-06-15 11:09     ` Andreas Färber
2012-06-15 12:46       ` Li Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD8of+obPxivvTH2YfPfvG4STEbKFjPNBMQL=g87wjUTJTuXyA@mail.gmail.com' \
    --to=zhlcindy@gmail.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=benh@au1.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=zhlcindy@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).