From d0360aae8c68688c6b72f52955dd8e59961facb0 Mon Sep 17 00:00:00 2001
Message-Id: <d0360aae8c68688c6b72f52955dd8e59961facb0.1367330031.git.minovotn@redhat.com>
In-Reply-To: <aefb5be5bb2e1e9cff25a846b497bc0d4368f495.1367330031.git.minovotn@redhat.com>
References: <aefb5be5bb2e1e9cff25a846b497bc0d4368f495.1367330031.git.minovotn@redhat.com>
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 4 Apr 2013 09:45:35 +0200
Subject: [PATCH 3/4] usb: tag usb host adapters as not hotpluggable.

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <1365068735-28607-1-git-send-email-kraxel@redhat.com>
Patchwork-id: 50083
O-Subject: [RHEL-6.4 qemu-kvm PATCH] usb: tag usb host adapters as not hotpluggable.
Bugzilla: 879096
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Amos Kong <akong@redhat.com>
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>

Hotplugging them simply doesn't work, so tag them accordingly to
avoid users trying and then crashing qemu.

For xhci there is nothing fundamental which prevents hotplug from
working, we'll "only" need a exit() function which cleans up
everything properly.  That isn't for 1.3 though.

For ehci+uhci+ohci hotplug can't be supported until qemu gains the
capability to hotplug multifunction pci devices.

https://bugzilla.redhat.com/show_bug.cgi?id=879096

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 6c2d1c32d084320081b0cd047f8cacd6e722d03a)

[ rhel6: basically rewrite in pre-qom style ]

Conflicts:

	hw/usb-ohci.c
	hw/usb-uhci.c
	hw/usb/hcd-ehci-pci.c
	hw/usb/hcd-xhci.c
---
 hw/usb-ehci.c |    2 ++
 hw/usb-ohci.c |    1 +
 hw/usb-uhci.c |    5 +++++
 3 files changed, 8 insertions(+)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 hw/usb-ehci.c | 2 ++
 hw/usb-ohci.c | 1 +
 hw/usb-uhci.c | 5 +++++
 3 files changed, 8 insertions(+)

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index a52814b..9aaccf5 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -2364,12 +2364,14 @@ static PCIDeviceInfo ehci_info[] = {
         .qdev.name    = "usb-ehci",
         .qdev.size    = sizeof(EHCIState),
         .qdev.vmsd    = &vmstate_ehci,
+        .no_hotplug   = 1,
         .init         = usb_ehci_initfn,
         .qdev.props   = ehci_properties,
     },{
         .qdev.name    = "ich9-usb-ehci1",
         .qdev.size    = sizeof(EHCIState),
         .qdev.vmsd    = &vmstate_ehci,
+        .no_hotplug   = 1,
         .init         = usb_ehci_initfn_ich9,
         .qdev.props   = ehci_properties,
     },{
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 7ba9d1b..b1ba73d 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1779,6 +1779,7 @@ static PCIDeviceInfo ohci_info = {
     .qdev.name    = "pci-ohci",
     .qdev.desc    = "Apple USB Controller",
     .qdev.size    = sizeof(OHCIPCIState),
+    .no_hotplug   = 1,
     .init         = usb_ohci_initfn_pci,
 };
 
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 8cfe64e..65390d0 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1249,30 +1249,35 @@ static PCIDeviceInfo uhci_info[] = {
         .qdev.name    = "piix3-usb-uhci",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
+        .no_hotplug   = 1,
         .init         = usb_uhci_piix3_initfn,
         .qdev.props   = uhci_properties,
     },{
         .qdev.name    = "piix4-usb-uhci",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
+        .no_hotplug   = 1,
         .init         = usb_uhci_piix4_initfn,
         .qdev.props   = uhci_properties,
     },{
         .qdev.name    = "ich9-usb-uhci1",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
+        .no_hotplug   = 1,
         .init         = usb_uhci_ich9_1_initfn,
         .qdev.props   = uhci_properties,
     },{
         .qdev.name    = "ich9-usb-uhci2",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
+        .no_hotplug   = 1,
         .init         = usb_uhci_ich9_2_initfn,
         .qdev.props   = uhci_properties,
     },{
         .qdev.name    = "ich9-usb-uhci3",
         .qdev.size    = sizeof(UHCIState),
         .qdev.vmsd    = &vmstate_uhci,
+        .no_hotplug   = 1,
         .init         = usb_uhci_ich9_3_initfn,
         .qdev.props   = uhci_properties,
     },{
-- 
1.7.11.7

