qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hu Tao <hutao@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Gleb Natapov <gleb@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>,
	Blue Swirl <blauwirbel@gmail.com>,
	Orit Wasserman <owasserm@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Andrew Jones <drjones@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Sasha Levin <levinsasha928@gmail.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v17 5/6] pvpanic: create pvpanic device by default
Date: Mon, 8 Apr 2013 10:50:10 +0800	[thread overview]
Message-ID: <20130408025010.GA6796@localhost.localdomain> (raw)
In-Reply-To: <515EB208.7050006@redhat.com>

On Fri, Apr 05, 2013 at 01:14:16PM +0200, Paolo Bonzini wrote:
> Il 05/04/2013 08:36, Hu Tao ha scritto:
> > Also parse command line options for ioport and set
> > it accordingly.
> 
> This does not do the correct thing for versioned machine types like "-M
> pc-1.4".  Also, adding stuff to vl.c is really something you cannot do.
>  Please don't be afraid to ask!
> 
> See the attached patch, untested.  Feel free to take it with my S-o-b line.

Thanks. But you forgot the attachment?

> 
> Patches 1-4 and 6 are okay.
> 
> Paolo
> 
> > Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> > ---
> >  hw/i386/pc_piix.c |  2 ++
> >  hw/i386/pc_q35.c  |  1 +
> >  hw/pc.h           |  4 ++++
> >  hw/pvpanic.c      | 42 ++++++++++++++++++++++++++++++++++++++++++
> >  vl.c              |  2 ++
> >  5 files changed, 51 insertions(+)
> > 
> > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> > index 0abc9f1..897254a 100644
> > --- a/hw/i386/pc_piix.c
> > +++ b/hw/i386/pc_piix.c
> > @@ -217,6 +217,8 @@ static void pc_init1(MemoryRegion *system_memory,
> >      if (pci_enabled) {
> >          pc_pci_device_init(pci_bus);
> >      }
> > +
> > +    pvpanic_init(isa_bus);
> >  }
> >  
> >  static void pc_init_pci(QEMUMachineInitArgs *args)
> > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> > index 4f5f347..fd9ab01 100644
> > --- a/hw/i386/pc_q35.c
> > +++ b/hw/i386/pc_q35.c
> > @@ -204,6 +204,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
> >      pc_vga_init(isa_bus, host_bus);
> >      audio_init(isa_bus, host_bus);
> >      pc_nic_init(isa_bus, host_bus);
> > +    pvpanic_init(isa_bus);
> >      if (pci_enabled) {
> >          pc_pci_device_init(host_bus);
> >      }
> > diff --git a/hw/pc.h b/hw/pc.h
> > index 8e1dd4c..1311037 100644
> > --- a/hw/pc.h
> > +++ b/hw/pc.h
> > @@ -178,6 +178,10 @@ static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
> >  /* pc_sysfw.c */
> >  void pc_system_firmware_init(MemoryRegion *rom_memory);
> >  
> > +/* pvpanic.c */
> > +int pvpanic_init(ISABus *bus);
> > +int pvpanic_ioport(QemuOpts *opts, void *opaque);
> > +
> >  /* e820 types */
> >  #define E820_RAM        1
> >  #define E820_RESERVED   2
> > diff --git a/hw/pvpanic.c b/hw/pvpanic.c
> > index b3d10e2..2e237a4 100644
> > --- a/hw/pvpanic.c
> > +++ b/hw/pvpanic.c
> > @@ -19,6 +19,8 @@
> >  #include <sysemu/kvm.h>
> >  
> >  #include "hw/fw_cfg.h"
> > +#include "hw/pc.h"
> > +#include "qapi/string-input-visitor.h"
> >  
> >  /* The bit of supported pv event */
> >  #define PVPANIC_F_PANICKED      0
> > @@ -57,6 +59,36 @@ typedef struct PVPanicState {
> >      uint16_t ioport;
> >  } PVPanicState;
> >  
> > +static uint16_t ioport;
> > +
> > +static int set_ioport(const char *name, const char *value, void *opaque)
> > +{
> > +    StringInputVisitor *mi;
> > +
> > +    if (strcmp(name, "ioport") == 0) {
> > +        mi = string_input_visitor_new(value);
> > +        visit_type_uint16(string_input_get_visitor(mi), &ioport, "ioport",
> > +                          NULL);
> > +        string_input_visitor_cleanup(mi);
> > +    }
> > +
> > +    return 0;
> > +}
> > +
> > +int pvpanic_ioport(QemuOpts *opts, void *opaque)
> > +{
> > +    const char *driver;
> > +
> > +    driver = qemu_opt_get(opts, "driver");
> > +    if (!driver || strcmp(driver, "pvpanic")) {
> > +        return 0;
> > +    }
> > +
> > +    qemu_opt_foreach(opts, set_ioport, NULL, 0);
> > +
> > +    return 0;
> > +}
> > +
> >  /* return supported events on read */
> >  static uint64_t pvpanic_ioport_read(void *opaque, hwaddr addr, unsigned size)
> >  {
> > @@ -84,6 +116,10 @@ static int pvpanic_isa_initfn(ISADevice *dev)
> >      static bool port_configured;
> >      void *fw_cfg;
> >  
> > +    if (ioport) {
> > +        s->ioport = ioport;
> > +    }
> > +
> >      memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
> >      isa_register_ioport(dev, &s->io, s->ioport);
> >  
> > @@ -115,6 +151,12 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
> >      dc->props = pvpanic_isa_properties;
> >  }
> >  
> > +int pvpanic_init(ISABus *bus)
> > +{
> > +    isa_create_simple(bus, TYPE_ISA_PVPANIC_DEVICE);
> > +    return 0;
> > +}
> > +
> >  static TypeInfo pvpanic_isa_info = {
> >      .name          = TYPE_ISA_PVPANIC_DEVICE,
> >      .parent        = TYPE_ISA_DEVICE,
> > diff --git a/vl.c b/vl.c
> > index c91fd4e..1a3ffa2 100644
> > --- a/vl.c
> > +++ b/vl.c
> > @@ -4302,6 +4302,8 @@ int main(int argc, char **argv, char **envp)
> >              exit (i == 1 ? 1 : 0);
> >      }
> >  
> > +    qemu_opts_foreach(qemu_find_opts("device"), pvpanic_ioport, NULL, 0);
> > +
> >      if (machine->compat_props) {
> >          qdev_prop_register_global_list(machine->compat_props);
> >      }
> > 

  reply	other threads:[~2013-04-08  2:51 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05  6:36 [Qemu-devel] [PATCH v17 0/6] Add pvpanic device to deal with guest panic event Hu Tao
2013-04-05  6:36 ` [Qemu-devel] [PATCH v17 1/6] add a new runstate: RUN_STATE_GUEST_PANICKED Hu Tao
2013-05-17  6:59   ` Christian Borntraeger
2013-05-17  7:43     ` [Qemu-devel] [PATCH] vl: new runstate transition: RUN_STATE_GUEST_PANICKED -> RUN_STATE_FINISH_MIGRATE Hu Tao
2013-05-17  8:03       ` [Qemu-devel] [PATCH for-1.5] " Paolo Bonzini
2013-05-17  8:22       ` [Qemu-devel] [PATCH] " Christian Borntraeger
2013-05-17  7:50     ` [Qemu-devel] [PATCH v17 1/6] add a new runstate: RUN_STATE_GUEST_PANICKED Markus Armbruster
2013-04-05  6:36 ` [Qemu-devel] [PATCH v17 2/6] add a new qevent: QEVENT_GUEST_PANICKED Hu Tao
2013-04-05  6:36 ` [Qemu-devel] [PATCH v17 3/6] introduce a new qom device to deal with panicked event Hu Tao
2013-04-05  6:36 ` [Qemu-devel] [PATCH v17 4/6] pvpanic: pass configurable ioport to seabios Hu Tao
2013-04-05  6:36 ` [Qemu-devel] [PATCH v17 5/6] pvpanic: create pvpanic device by default Hu Tao
2013-04-05 11:14   ` Paolo Bonzini
2013-04-08  2:50     ` Hu Tao [this message]
2013-04-09  9:06   ` [Qemu-devel] [PATCH] pvpanic: create pvpanic by default for machine 1.5 Hu Tao
2013-04-09  9:34     ` Paolo Bonzini
2013-04-05  6:36 ` [Qemu-devel] [PATCH v17 6/6] pvpanic: add document of pvpanic Hu Tao
2013-04-05  7:10 ` [Qemu-devel] [PATCH v17] pvpanic: pvpanic device driver Hu Tao
2013-04-05 11:45   ` Paolo Bonzini
2013-04-30 15:39   ` Paolo Bonzini
2013-04-05  7:17 ` [Qemu-devel] [PATCH v17] Add " Hu Tao
2013-04-30 16:00   ` Paolo Bonzini
2013-05-01  1:07     ` Kevin O'Connor
2013-05-15  7:21   ` [Qemu-devel] [SeaBIOS] " Laszlo Ersek
2013-05-15  7:27     ` Hu Tao
2013-05-15  7:30       ` Hu Tao
2013-05-15  7:36       ` Laszlo Ersek
2013-05-15 16:25       ` Laszlo Ersek
2013-05-15 16:25         ` Paolo Bonzini
2013-05-15 16:34           ` Laszlo Ersek
2013-05-15  7:32   ` [Qemu-devel] " Christian Borntraeger
2013-05-15  7:36     ` Hu Tao
2013-04-05  8:42 ` [Qemu-devel] [PATCH] [RFC] Wire up disabled wait a panicked event on s390 Christian Borntraeger
2013-04-05 13:15   ` Luiz Capitulino

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=20130408025010.GA6796@localhost.localdomain \
    --to=hutao@cn.fujitsu.com \
    --cc=agraf@suse.de \
    --cc=alex.williamson@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=borntraeger@de.ibm.com \
    --cc=drjones@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lcapitulino@redhat.com \
    --cc=levinsasha928@gmail.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=stefanha@redhat.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).