From: Olaf Hering <oher...@suse.de> Implement SUSE specific unplug protocol for emulated PCI devices in PVonHVM guests. Its a simple 'outl(1, (ioaddr + 4));'. This protocol was implemented and used since Xen 3.0.4. It is used in all SUSE/SLES/openSUSE releases up to SLES11SP3 and openSUSE 12.3. In addition old (pre-2011) VMDP versions are handled as well.
Upstream commit 35132016dc1c27de2b1354b161df6cc22f3ac5bf Signed-off-by: Olaf Hering <oher...@suse.de> --- hw/xen_platform.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/hw/xen_platform.c b/hw/xen_platform.c index 0a94e0d..3c2fc0e 100644 --- a/hw/xen_platform.c +++ b/hw/xen_platform.c @@ -337,9 +337,42 @@ static void xen_platform_ioport_writeb(void *opaque, uint32_t addr, uint32_t val } } +static void suse_platform_ioport_writel(void *opaque, uint32_t addr, uint32_t val) +{ + addr &= 0x0f; + switch (addr) { + case 4: + /* + * SUSE unplug for Xenlinux + * xen-kmp used this since xen-3.0.4, instead the official protocol + * from xen-3.3+ It did an unconditional "outl(1, (ioaddr + 4));" + * Pre VMDP 1.7 used 4 and 8 depending on how VMDP was configured. + * 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. + * */ + ide_unplug_harddisks(); + pci_unplug_scsi(); + pci_unplug_netifs(); + net_tap_shutdown_all(); + break; + case 8: + if (val ==1 ) { + ide_unplug_harddisks(); + pci_unplug_scsi(); + } else if (val == 2) { + pci_unplug_netifs(); + net_tap_shutdown_all(); + } + break; + default: + break; + } +} + static void platform_ioport_map(PCIDevice *pci_dev, int region_num, uint32_t addr, uint32_t size, int type) { PCIXenPlatformState *d = (PCIXenPlatformState *)pci_dev; + register_ioport_write(addr, 16, 4, suse_platform_ioport_writel, d); register_ioport_write(addr, size, 1, xen_platform_ioport_writeb, d); register_ioport_read(addr, size, 1, xen_platform_ioport_readb, d); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel