qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.a@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, gleb@redhat.com, mst@redhat.com,
	hutao@cn.fujitsu.com, Marcel Apfelbaum <marcel.a@redhat.com>,
	kraxel@redhat.com, pbonzini@redhat.com, afaerber@suse.de,
	vrozenfe@redhat.com
Subject: [Qemu-devel] [PATCH for-1.6 V2 2/2] hw/misc: make pvpanic known to user
Date: Sun, 11 Aug 2013 18:10:43 +0300	[thread overview]
Message-ID: <1376233843-19410-3-git-send-email-marcel.a@redhat.com> (raw)
In-Reply-To: <1376233843-19410-1-git-send-email-marcel.a@redhat.com>

This patch is based on Hu Tao's:
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.html

The pvpanic device may be enabled now with "-device pvpanic"
from command line.

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
---
Changes from V1:
 - Addressed Andreas Färber review (removed bus type)
 - Small changes to be posible to enable pvpanic
   both from command line and from machine_init
 - Added pvpanic to MISC category

 hw/misc/pvpanic.c | 25 ++++++++++---------------
 1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 7bb49a5..b64e3bb 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -97,29 +97,24 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error **errp)
 {
     ISADevice *d = ISA_DEVICE(dev);
     PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
+    FWCfgState *fw_cfg = fw_cfg_find();
+    uint16_t *pvpanic_port;
 
-    isa_register_ioport(d, &s->io, s->ioport);
-}
+    if (!fw_cfg) {
+        return;
+    }
 
-static void pvpanic_fw_cfg(ISADevice *dev, FWCfgState *fw_cfg)
-{
-    PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
-    uint16_t *pvpanic_port = g_malloc(sizeof(*pvpanic_port));
+    pvpanic_port = g_malloc(sizeof(*pvpanic_port));
     *pvpanic_port = cpu_to_le16(s->ioport);
-
     fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port,
                     sizeof(*pvpanic_port));
+
+    isa_register_ioport(d, &s->io, s->ioport);
 }
 
 void pvpanic_init(ISABus *bus)
 {
-    ISADevice *dev;
-    FWCfgState *fw_cfg = fw_cfg_find();
-    if (!fw_cfg) {
-        return;
-    }
-    dev = isa_create_simple (bus, TYPE_ISA_PVPANIC_DEVICE);
-    pvpanic_fw_cfg(dev, fw_cfg);
+    isa_create_simple(bus, TYPE_ISA_PVPANIC_DEVICE);
 }
 
 static Property pvpanic_isa_properties[] = {
@@ -132,8 +127,8 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     dc->realize = pvpanic_isa_realizefn;
-    dc->no_user = 1;
     dc->props = pvpanic_isa_properties;
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static TypeInfo pvpanic_isa_info = {
-- 
1.8.3.1

  parent reply	other threads:[~2013-08-11 15:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-11 15:10 [Qemu-devel] [PATCH for-1.6 V2 0/2] pvpanic: Separate pvpanic from machine type Marcel Apfelbaum
2013-08-11 15:10 ` [Qemu-devel] [PATCH for-1.6 V2 1/2] hw/misc: don't create pvpanic device by default Marcel Apfelbaum
2013-08-12  3:06   ` Hu Tao
2013-08-12 15:59   ` Andreas Färber
2013-08-13 11:26   ` Markus Armbruster
2013-08-11 15:10 ` Marcel Apfelbaum [this message]
2013-08-12  3:07   ` [Qemu-devel] [PATCH for-1.6 V2 2/2] hw/misc: make pvpanic known to user Hu Tao
2013-08-12 15:53 ` [Qemu-devel] [PATCH for-1.6 V2 0/2] pvpanic: Separate pvpanic from machine type Eric Blake
2013-08-12 16:26   ` Marcel Apfelbaum
2013-08-14  7:02 ` Ronen Hod
2013-08-21  8:03   ` Marcel Apfelbaum
2013-08-21  8:18     ` Paolo Bonzini
2013-08-21  9:42       ` Michael S. Tsirkin
2013-08-21  9:56         ` Hu Tao
2013-08-21  9:59         ` Paolo Bonzini
2013-08-21 10:16           ` Michael S. Tsirkin
2013-08-21 10:37             ` Paolo Bonzini
2013-08-14 16:27 ` Anthony Liguori

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=1376233843-19410-3-git-send-email-marcel.a@redhat.com \
    --to=marcel.a@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=gleb@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vrozenfe@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).