yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
218e99
From b3f60a169126dd6a4ef7c64442494d943f9ffbd2 Mon Sep 17 00:00:00 2001
218e99
From: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
Date: Wed, 6 Nov 2013 16:32:33 +0100
218e99
Subject: [PATCH 74/81] hw/misc: make pvpanic known to user
218e99
218e99
RH-Author: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
Message-id: <1383755557-21590-6-git-send-email-marcel.a@redhat.com>
218e99
Patchwork-id: 55550
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH v3 5/9] hw/misc: make pvpanic known to user
218e99
Bugzilla: 990601
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
218e99
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>
218e99
218e99
This patch is based on Hu Tao's:
218e99
http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg00125.html
218e99
218e99
The pvpanic device may be enabled now with "-device pvpanic"
218e99
from command line.
218e99
218e99
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
Reviewed-by: Hu Tao <hutao@cn.fujitsu.com>
218e99
Message-id: 1376233843-19410-3-git-send-email-marcel.a@redhat.com
218e99
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
218e99
(cherry picked from commit a5d3f640a0fa56eaed712c9361150568e32e1d08)
218e99
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
218e99
Conflicts:
218e99
	hw/misc/pvpanic.c
218e99
218e99
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
---
218e99
 hw/misc/pvpanic.c | 28 ++++++++++++----------------
218e99
 1 file changed, 12 insertions(+), 16 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/misc/pvpanic.c |   28 ++++++++++++----------------
218e99
 1 files changed, 12 insertions(+), 16 deletions(-)
218e99
218e99
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
218e99
index 1aab787..1d3178d 100644
218e99
--- a/hw/misc/pvpanic.c
218e99
+++ b/hw/misc/pvpanic.c
218e99
@@ -89,32 +89,28 @@ static const MemoryRegionOps pvpanic_ops = {
218e99
 static int pvpanic_isa_initfn(ISADevice *dev)
218e99
 {
218e99
     PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
218e99
+    FWCfgState *fw_cfg = fw_cfg_find();
218e99
+    uint16_t *pvpanic_port;
218e99
 
218e99
-    memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
218e99
-    isa_register_ioport(dev, &s->io, s->ioport);
218e99
+    if (!fw_cfg) {
218e99
+        return -1;
218e99
+    }
218e99
 
218e99
-    return 0;
218e99
-}
218e99
+    memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
218e99
 
218e99
-static void pvpanic_fw_cfg(ISADevice *dev, FWCfgState *fw_cfg)
218e99
-{
218e99
-    PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
218e99
-    uint16_t *pvpanic_port = g_malloc(sizeof(*pvpanic_port));
218e99
+    pvpanic_port = g_malloc(sizeof(*pvpanic_port));
218e99
     *pvpanic_port = cpu_to_le16(s->ioport);
218e99
-
218e99
     fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port,
218e99
                     sizeof(*pvpanic_port));
218e99
+
218e99
+    isa_register_ioport(dev, &s->io, s->ioport);
218e99
+
218e99
+    return 0;
218e99
 }
218e99
 
218e99
 void pvpanic_init(ISABus *bus)
218e99
 {
218e99
-    ISADevice *dev;
218e99
-    FWCfgState *fw_cfg = fw_cfg_find();
218e99
-    if (!fw_cfg) {
218e99
-        return;
218e99
-    }
218e99
-    dev = isa_create_simple (bus, TYPE_ISA_PVPANIC_DEVICE);
218e99
-    pvpanic_fw_cfg(dev, fw_cfg);
218e99
+    isa_create_simple(bus, TYPE_ISA_PVPANIC_DEVICE);
218e99
 }
218e99
 
218e99
 static Property pvpanic_isa_properties[] = {
218e99
-- 
218e99
1.7.1
218e99