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