Blame SOURCES/kvm-piix3-piix4-Clean-up-use-of-cannot_instantiate_with_.patch

218e99
From 3a10d87d90ff5f2aeaf02addac57f5a3346f263c Mon Sep 17 00:00:00 2001
218e99
From: Kevin Wolf <kwolf@redhat.com>
218e99
Date: Wed, 6 Nov 2013 14:41:18 +0100
218e99
Subject: [PATCH 42/81] piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet
218e99
218e99
RH-Author: Kevin Wolf <kwolf@redhat.com>
218e99
Message-id: <1383748882-22831-14-git-send-email-kwolf@redhat.com>
218e99
Patchwork-id: 55539
218e99
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 13/17] piix3 piix4: Clean up use of cannot_instantiate_with_device_add_yet
218e99
Bugzilla: 1001216
218e99
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
218e99
From: Markus Armbruster <armbru@redhat.com>
218e99
218e99
A PIIX3/PIIX4 southbridge has multiple functions.  We model each
218e99
function as a separate qdev.  Two of them need some special wiring set
218e99
up in pc_init1() or mips_malta_init() to work: the ISA bridge at 01.0,
218e99
and the SMBus controller at 01.3.
218e99
218e99
The IDE controller at 01.1 (piix3-ide, piix3-ide-xen, piix4-ide) has
218e99
always had cannot_instantiate_with_device_add_yet set, but there is no
218e99
obvious reason why device_add could not work for them.  Drop it.
218e99
(cherry picked from pending upstream submission)
218e99
218e99
Signed-off-by: Markus Armbruster <armbru@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
---
218e99
 hw/acpi/piix4.c    |  6 +++++-
218e99
 hw/ide/piix.c      |  3 ---
218e99
 hw/isa/piix4.c     |  6 +++++-
218e99
 hw/pci-host/piix.c | 12 ++++++++++--
218e99
 4 files changed, 20 insertions(+), 7 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 hw/acpi/piix4.c    |    6 +++++-
218e99
 hw/ide/piix.c      |    3 ---
218e99
 hw/isa/piix4.c     |    6 +++++-
218e99
 hw/pci-host/piix.c |   12 ++++++++++--
218e99
 4 files changed, 20 insertions(+), 7 deletions(-)
218e99
218e99
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
218e99
index 46685b7..d79a7b0 100644
218e99
--- a/hw/acpi/piix4.c
218e99
+++ b/hw/acpi/piix4.c
218e99
@@ -494,9 +494,13 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data)
218e99
     k->revision = 0x03;
218e99
     k->class_id = PCI_CLASS_BRIDGE_OTHER;
218e99
     dc->desc = "PM";
218e99
-    dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
218e99
     dc->vmsd = &vmstate_acpi;
218e99
     dc->props = piix4_pm_properties;
218e99
+    /*
218e99
+     * Reason: part of PIIX4 southbridge, needs to be wired up,
218e99
+     * e.g. by mips_malta_init()
218e99
+     */
218e99
+    dc->cannot_instantiate_with_device_add_yet = true;
218e99
 }
218e99
 
218e99
 static const TypeInfo piix4_pm_info = {
218e99
diff --git a/hw/ide/piix.c b/hw/ide/piix.c
218e99
index e6864b1..304cab0 100644
218e99
--- a/hw/ide/piix.c
218e99
+++ b/hw/ide/piix.c
218e99
@@ -249,7 +249,6 @@ static void piix3_ide_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
218e99
     k->class_id = PCI_CLASS_STORAGE_IDE;
218e99
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
-    dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
218e99
 }
218e99
 
218e99
 static const TypeInfo piix3_ide_info = {
218e99
@@ -269,7 +268,6 @@ static void piix3_ide_xen_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82371SB_1;
218e99
     k->class_id = PCI_CLASS_STORAGE_IDE;
218e99
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
-    dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
218e99
     dc->unplug = pci_piix3_xen_ide_unplug;
218e99
 }
218e99
 
218e99
@@ -292,7 +290,6 @@ static void piix4_ide_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82371AB;
218e99
     k->class_id = PCI_CLASS_STORAGE_IDE;
218e99
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
218e99
-    dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
218e99
 }
218e99
 
218e99
 static const TypeInfo piix4_ide_info = {
218e99
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
218e99
index 10bf8ff..e7c75f1 100644
218e99
--- a/hw/isa/piix4.c
218e99
+++ b/hw/isa/piix4.c
218e99
@@ -113,8 +113,12 @@ static void piix4_class_init(ObjectClass *klass, void *data)
218e99
     k->device_id = PCI_DEVICE_ID_INTEL_82371AB_0;
218e99
     k->class_id = PCI_CLASS_BRIDGE_ISA;
218e99
     dc->desc = "ISA bridge";
218e99
-    dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
218e99
     dc->vmsd = &vmstate_piix4;
218e99
+    /*
218e99
+     * Reason: part of PIIX4 southbridge, needs to be wired up,
218e99
+     * e.g. by mips_malta_init()
218e99
+     */
218e99
+    dc->cannot_instantiate_with_device_add_yet = true;
218e99
 }
218e99
 
218e99
 static const TypeInfo piix4_info = {
218e99
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
218e99
index 56fc7be..c89b76b 100644
218e99
--- a/hw/pci-host/piix.c
218e99
+++ b/hw/pci-host/piix.c
218e99
@@ -564,7 +564,6 @@ static void piix3_class_init(ObjectClass *klass, void *data)
218e99
 
218e99
     dc->desc        = "ISA bridge";
218e99
     dc->vmsd        = &vmstate_piix3;
218e99
-    dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
218e99
     k->no_hotplug   = 1;
218e99
     k->init         = piix3_initfn;
218e99
     k->config_write = piix3_write_config;
218e99
@@ -572,6 +571,11 @@ static void piix3_class_init(ObjectClass *klass, void *data)
218e99
     /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
218e99
     k->device_id    = PCI_DEVICE_ID_INTEL_82371SB_0;
218e99
     k->class_id     = PCI_CLASS_BRIDGE_ISA;
218e99
+    /*
218e99
+     * Reason: part of PIIX3 southbridge, needs to be wired up by
218e99
+     * pc_piix.c's pc_init1()
218e99
+     */
218e99
+    dc->cannot_instantiate_with_device_add_yet = true;
218e99
 }
218e99
 
218e99
 static const TypeInfo piix3_info = {
218e99
@@ -588,7 +592,6 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data)
218e99
 
218e99
     dc->desc        = "ISA bridge";
218e99
     dc->vmsd        = &vmstate_piix3;
218e99
-    dc->cannot_instantiate_with_device_add_yet = true; /* FIXME explain why */
218e99
     k->no_hotplug   = 1;
218e99
     k->init         = piix3_initfn;
218e99
     k->config_write = piix3_write_config_xen;
218e99
@@ -596,6 +599,11 @@ static void piix3_xen_class_init(ObjectClass *klass, void *data)
218e99
     /* 82371SB PIIX3 PCI-to-ISA bridge (Step A1) */
218e99
     k->device_id    = PCI_DEVICE_ID_INTEL_82371SB_0;
218e99
     k->class_id     = PCI_CLASS_BRIDGE_ISA;
218e99
+    /*
218e99
+     * Reason: part of PIIX3 southbridge, needs to be wired up by
218e99
+     * pc_piix.c's pc_init1()
218e99
+     */
218e99
+    dc->cannot_instantiate_with_device_add_yet = true;
218e99
 };
218e99
 
218e99
 static const TypeInfo piix3_xen_info = {
218e99
-- 
218e99
1.7.1
218e99