void xen_unplug_emulated_devices(void) { int r; if (xen_emul_unplug & XEN_UNPLUG_NEVER) return; r = check_platform_magic(); if (r && !(r == XEN_PLATFORM_ERR_MAGIC && (xen_emul_unplug & XEN_UNPLUG_UNNECESSARY))) return; if (!xen_emul_unplug) { if (xen_must_unplug_nics()) { printk(KERN_INFO "Netfront and the Xen platform PCI driver have " "been compiled for this kernel: unplug emulated NICs.\n"); xen_emul_unplug |= XEN_UNPLUG_ALL_NICS; } if (xen_must_unplug_disks()) { printk(KERN_INFO "Blkfront and the Xen platform PCI driver have " "been compiled for this kernel: unplug emulated disks.\n" "You might have to change the root device\n" "from /dev/hd[a-d] to /dev/xvd[a-d]\n" "in your root= kernel command line option\n"); xen_emul_unplug |= XEN_UNPLUG_ALL_IDE_DISKS; } } if (!(xen_emul_unplug & XEN_UNPLUG_UNNECESSARY)) outw(xen_emul_unplug, XEN_IOPORT_UNPLUG); xen_platform_pci_unplug = xen_emul_unplug; }
void xen_unplug_emulated_devices(void) { int r; /* not valid unless in HVM case or sysadmin explicit told not to unplug */ if (xen_emul_unplug & XEN_UNPLUG_NEVER) return; /* check the version of the xen platform PCI device */ r = check_platform_magic(); /* If the version matches enable the Xen platform PCI driver. * Also enable the Xen platform PCI driver if the host does * not support the unplug protocol (XEN_PLATFORM_ERR_MAGIC) * but the user told us that unplugging is unnecessary, i.e., * the user has set the disk spec to vbd & vif spec to type=netfront */ if (r && !(r == XEN_PLATFORM_ERR_MAGIC && (xen_emul_unplug & XEN_UNPLUG_UNNECESSARY))) return; /* Set the default value of xen_emul_unplug depending on whether or * not the Xen PV frontends and the Xen platform PCI driver have * been compiled for this kernel (modules or built-in are both OK). */ if (!xen_emul_unplug) { if (xen_must_unplug_nics()) { printk(KERN_INFO "Netfront and the Xen platform PCI driver have " "been compiled for this kernel: unplug emulated NICs.\n"); xen_emul_unplug |= XEN_UNPLUG_ALL_NICS; } if (xen_must_unplug_disks()) { printk(KERN_INFO "Blkfront and the Xen platform PCI driver have " "been compiled for this kernel: unplug emulated disks.\n" "You might have to change the root device\n" "from /dev/hd[a-d] to /dev/xvd[a-d]\n" "in your root= kernel command line option\n"); xen_emul_unplug |= XEN_UNPLUG_ALL_IDE_DISKS; } } /* Now unplug the emulated devices */ if (!(xen_emul_unplug & XEN_UNPLUG_UNNECESSARY)) outw(xen_emul_unplug, XEN_IOPORT_UNPLUG); else xen_ide_unplug_unsupported = 0; if (xen_emul_unplug & XEN_UNPLUG_ALL_IDE_DISKS) xen_ide_unplug_unsupported = 0; xen_platform_pci_unplug = xen_emul_unplug; }