aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/xen
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-02-03 12:31:40 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-02-03 12:31:40 +0000
commit4100a344eb3d50d88f9da85cae334afc47aee134 (patch)
tree42156e1fd553310e3735f16f92e3d3930bce677b /hw/i386/xen
parent77e217d1bf63c4d042c17f7d55b0816a7d386bf3 (diff)
parente9dcbc86d614018923e26e31319b0a54c9e5abac (diff)
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20170202' into staging
Xen 2017/02/02 # gpg: Signature made Thu 02 Feb 2017 18:26:58 GMT # gpg: using RSA key 0x894F8F4870E1AE90 # gpg: Good signature from "Stefano Stabellini <sstabellini@kernel.org>" # gpg: aka "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" # Primary key fingerprint: D04E 33AB A51F 67BA 07D3 0AEA 894F 8F48 70E1 AE90 * remotes/sstabellini/tags/xen-20170202: xen: use qdev_unplug() instead of g_free() in xen_pv_find_xendev() MAINTAINERS: Update xen-devel mailing list address xen-platform: add missing disk unplug option xen-platform: add support for unplugging NVMe disks... xen-platform: re-structure unplug_disks Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/i386/xen')
-rw-r--r--hw/i386/xen/xen_platform.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 2e1e543881..6010f35266 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -88,7 +88,7 @@ static void log_writeb(PCIXenPlatformState *s, char val)
}
/* Xen Platform, Fixed IOPort */
-#define UNPLUG_ALL_IDE_DISKS 1
+#define UNPLUG_ALL_DISKS 1
#define UNPLUG_ALL_NICS 2
#define UNPLUG_AUX_IDE_DISKS 4
@@ -107,23 +107,37 @@ static void pci_unplug_nics(PCIBus *bus)
pci_for_each_device(bus, 0, unplug_nic, NULL);
}
-static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)
+static void unplug_disks(PCIBus *b, PCIDevice *d, void *opaque)
{
+ uint32_t flags = *(uint32_t *)opaque;
+ bool aux = (flags & UNPLUG_AUX_IDE_DISKS) &&
+ !(flags & UNPLUG_ALL_DISKS);
+
/* We have to ignore passthrough devices */
- if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
- PCI_CLASS_STORAGE_IDE
- && strcmp(d->name, "xen-pci-passthrough") != 0) {
- pci_piix3_xen_ide_unplug(DEVICE(d));
- } else if (pci_get_word(d->config + PCI_CLASS_DEVICE) ==
- PCI_CLASS_STORAGE_SCSI
- && strcmp(d->name, "xen-pci-passthrough") != 0) {
- object_unparent(OBJECT(d));
+ if (!strcmp(d->name, "xen-pci-passthrough")) {
+ return;
+ }
+
+ switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) {
+ case PCI_CLASS_STORAGE_IDE:
+ pci_piix3_xen_ide_unplug(DEVICE(d), aux);
+ break;
+
+ case PCI_CLASS_STORAGE_SCSI:
+ case PCI_CLASS_STORAGE_EXPRESS:
+ if (!aux) {
+ object_unparent(OBJECT(d));
+ }
+ break;
+
+ default:
+ break;
}
}
-static void pci_unplug_disks(PCIBus *bus)
+static void pci_unplug_disks(PCIBus *bus, uint32_t flags)
{
- pci_for_each_device(bus, 0, unplug_disks, NULL);
+ pci_for_each_device(bus, 0, unplug_disks, &flags);
}
static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
@@ -134,19 +148,16 @@ static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t v
case 0: {
PCIDevice *pci_dev = PCI_DEVICE(s);
/* Unplug devices. Value is a bitmask of which devices to
- unplug, with bit 0 the IDE devices, bit 1 the network
+ unplug, with bit 0 the disk devices, bit 1 the network
devices, and bit 2 the non-primary-master IDE devices. */
- if (val & UNPLUG_ALL_IDE_DISKS) {
+ if (val & (UNPLUG_ALL_DISKS | UNPLUG_AUX_IDE_DISKS)) {
DPRINTF("unplug disks\n");
- pci_unplug_disks(pci_dev->bus);
+ pci_unplug_disks(pci_dev->bus, val);
}
if (val & UNPLUG_ALL_NICS) {
DPRINTF("unplug nics\n");
pci_unplug_nics(pci_dev->bus);
}
- if (val & UNPLUG_AUX_IDE_DISKS) {
- DPRINTF("unplug auxiliary disks not supported\n");
- }
break;
}
case 2:
@@ -327,14 +338,14 @@ static void xen_platform_ioport_writeb(void *opaque, hwaddr addr,
* If VMDP was to control both disk and LAN it would use 4.
* If it controlled just disk or just LAN, it would use 8 below.
*/
- pci_unplug_disks(pci_dev->bus);
+ pci_unplug_disks(pci_dev->bus, UNPLUG_ALL_DISKS);
pci_unplug_nics(pci_dev->bus);
}
break;
case 8:
switch (val) {
case 1:
- pci_unplug_disks(pci_dev->bus);
+ pci_unplug_disks(pci_dev->bus, UNPLUG_ALL_DISKS);
break;
case 2:
pci_unplug_nics(pci_dev->bus);