xen: initialize platform-pci even if xen_emul_unplug=never
authorIgor Mammedov <imammedo@redhat.com>
Wed, 21 Mar 2012 14:08:38 +0000 (15:08 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 22 Mar 2012 15:37:11 +0000 (11:37 -0400)
When xen_emul_unplug=never is specified on kernel command line
reading files from /sys/hypervisor is broken (returns -EBUSY).
It is caused by xen_bus dependency on platform-pci and
platform-pci isn't initialized when xen_emul_unplug=never is
specified.

Fix it by allowing platform-pci to ignore xen_emul_unplug=never,
and do not intialize xen_[blk|net]front instead.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/block/xen-blkfront.c
drivers/net/xen-netfront.c
drivers/xen/platform-pci.c

index 9fd3ee203b1e7b5e450c3e32737e61a64f9cc6b1..4276ab035e006a80cd0283a5f591a03f4de4b289 100644 (file)
@@ -1452,6 +1452,9 @@ static int __init xlblk_init(void)
        if (!xen_domain())
                return -ENODEV;
 
+       if (!xen_platform_pci_unplug)
+               return -ENODEV;
+
        if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
                printk(KERN_WARNING "xen_blk: can't get major %d with name %s\n",
                       XENVBD_MAJOR, DEV_NAME);
index fa679057630f9152f418e9e2f9b60f549dded7e3..8cc0914b9f9210eb96fe5f1c115ceb59e9d70cd1 100644 (file)
@@ -47,6 +47,7 @@
 #include <xen/xenbus.h>
 #include <xen/events.h>
 #include <xen/page.h>
+#include <xen/platform_pci.h>
 #include <xen/grant_table.h>
 
 #include <xen/interface/io/netif.h>
@@ -1956,6 +1957,9 @@ static int __init netif_init(void)
        if (xen_initial_domain())
                return 0;
 
+       if (!xen_platform_pci_unplug)
+               return -ENODEV;
+
        printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n");
 
        return xenbus_register_frontend(&netfront_driver);
index 319dd0a94d5135389ff7f932ef68872f0936f5e0..2389e581e23c00c21982e97658c87fe5200689a0 100644 (file)
@@ -186,11 +186,6 @@ static struct pci_driver platform_driver = {
 
 static int __init platform_pci_module_init(void)
 {
-       /* no unplug has been done, IGNORE hasn't been specified: just
-        * return now */
-       if (!xen_platform_pci_unplug)
-               return -ENODEV;
-
        return pci_register_driver(&platform_driver);
 }