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 v16 5/6] pc_piix, pc_q35: export fw_cfg
Date: Mon, 1 Apr 2013 16:47:15 +0800	[thread overview]
Message-ID: <20130401084715.GI3060@localhost.localdomain> (raw)
In-Reply-To: <51555EA7.7080308@redhat.com>

On Fri, Mar 29, 2013 at 10:28:07AM +0100, Paolo Bonzini wrote:
> Il 29/03/2013 09:16, Hu Tao ha scritto:
> > diff --git a/hw/pc.h b/hw/pc.h
> > index 8e1dd4c..d42b76b 100644
> > --- a/hw/pc.h
> > +++ b/hw/pc.h
> > @@ -145,6 +145,12 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn,
> >  extern PCIDevice *piix4_dev;
> >  int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
> >  
> > +/* pc_piix.c */
> > +extern void *fw_cfg_piix;
> > +
> > +/* pc_q35.c */
> > +extern void *fw_cfg_q35;
> > +
> >  /* vga.c */
> >  enum vga_retrace_method {
> >      VGA_RETRACE_DUMB,
> > 
> 
> Hu, this is not what I suggested in the review...
> 
> Please do not ignore comments without answer, otherwise we'll just run
> in circles.

Sorry about that.

I have to float up object_property_add_child() because fw_cfg has path
'/machine/unattached/device[4]' (in my test) by default, the path seems
to vary so we can use it.

Please review, if no problem I'll post v17 shortly:

>From 5071f4bc6ff640637826d8ed7af9668d7bc1a642 Mon Sep 17 00:00:00 2001
From: Hu Tao <hutao@cn.fujitsu.com>
Date: Mon, 1 Apr 2013 15:51:59 +0800
Subject: [PATCH v16.1 5/5] pvpanic: pass configurable ioport to seabios

This lets seabios patch the corresponding SSDT entry.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/fw_cfg.c  |  6 +++++-
 hw/fw_cfg.h  |  2 ++
 hw/pvpanic.c | 14 ++++++++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index 63a1998..712856c 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -489,11 +489,15 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
     dev = qdev_create(NULL, "fw_cfg");
     qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port);
     qdev_prop_set_uint32(dev, "data_iobase", data_port);
-    qdev_init_nofail(dev);
     d = SYS_BUS_DEVICE(dev);
 
     s = DO_UPCAST(FWCfgState, busdev.qdev, dev);
 
+    if (!object_resolve_path("/machine/fw_cfg", NULL))
+        object_property_add_child(qdev_get_machine(), "fw_cfg", OBJECT(s), NULL);
+
+    qdev_init_nofail(dev);
+
     if (ctl_addr) {
         sysbus_mmio_map(d, 0, ctl_addr);
     }
diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
index 05c8df1..07cc941 100644
--- a/hw/fw_cfg.h
+++ b/hw/fw_cfg.h
@@ -1,6 +1,8 @@
 #ifndef FW_CFG_H
 #define FW_CFG_H
 
+#include "exec/hwaddr.h"
+
 #define FW_CFG_SIGNATURE        0x00
 #define FW_CFG_ID               0x01
 #define FW_CFG_UUID             0x02
diff --git a/hw/pvpanic.c b/hw/pvpanic.c
index ff0a116..4384831 100644
--- a/hw/pvpanic.c
+++ b/hw/pvpanic.c
@@ -18,6 +18,8 @@
 #include <sysemu/sysemu.h>
 #include <sysemu/kvm.h>
 
+#include "hw/fw_cfg.h"
+
 /* The bit of supported pv event */
 #define PVPANIC_F_PANICKED      0
 
@@ -79,10 +81,22 @@ static const MemoryRegionOps pvpanic_ops = {
 static int pvpanic_isa_initfn(ISADevice *dev)
 {
     PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
+    static bool port_configured = false;
+    void *fw_cfg;
 
     memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
     isa_register_ioport(dev, &s->io, s->ioport);
 
+    if (!port_configured) {
+        fw_cfg = object_resolve_path("/machine/fw_cfg", NULL);
+        if (fw_cfg) {
+            fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
+                            g_memdup(&s->ioport, sizeof(s->ioport)),
+                            sizeof(s->ioport));
+            port_configured = true;
+        }
+    }
+
     return 0;
 }
 
-- 
1.8.1.4

  reply	other threads:[~2013-04-01  9:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29  8:16 [Qemu-devel] [PATCH v16 0/6] Add pvpanic device to deal with guest panic event Hu Tao
2013-03-29  8:16 ` [Qemu-devel] [PATCH v16 1/6] add a new runstate: RUN_STATE_GUEST_PANICKED Hu Tao
2013-03-29  8:16 ` [Qemu-devel] [PATCH v16 2/6] add a new qevent: QEVENT_GUEST_PANICKED Hu Tao
2013-03-29  8:16 ` [Qemu-devel] [PATCH v16 3/6] introduce a new qom device to deal with panicked event Hu Tao
2013-03-29  8:16 ` [Qemu-devel] [PATCH v16 4/6] pvpanic: add document of pvpanic Hu Tao
2013-03-29  8:16 ` [Qemu-devel] [PATCH v16 5/6] pc_piix, pc_q35: export fw_cfg Hu Tao
2013-03-29  9:28   ` Paolo Bonzini
2013-04-01  8:47     ` Hu Tao [this message]
2013-03-29  8:16 ` [Qemu-devel] [PATCH v16 6/6] pvpanic: pass configurable ioport to seabios Hu Tao
2013-03-29  8:18 ` [Qemu-devel] [PATCH v16] Add pvpanic device driver Hu Tao
2013-03-29  9:28   ` Paolo Bonzini
2013-03-29 13:33   ` [Qemu-devel] [SeaBIOS] " Kevin O'Connor
2013-03-29 13:49     ` Paolo Bonzini
2013-03-30 13:20       ` Kevin O'Connor
2013-03-30 15:36         ` Paolo Bonzini
2013-03-31 14:34         ` Gleb Natapov
2013-04-02  0:22           ` Kevin O'Connor
2013-04-02  9:07             ` Gleb Natapov
2013-04-10  0:37               ` Kevin O'Connor
2013-04-10  5:06                 ` Hu Tao
2013-03-29  8:34 ` [Qemu-devel] [PATCH v16] pvpanic: " Hu Tao
2013-03-29  9:31   ` Paolo Bonzini

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=20130401084715.GI3060@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).