Skip to contentSkip to conversation

xen: initialize platform_pci even if xen_emul_unplug=never

PATCH In review Igor Mammedov 3 participants 3 messages Mar 21, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: initialize platform_pci even if xen_emul_unplug=never

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_pcii to ignore xen_emul_unplug=never, and do not intialize xen_[blk|net]front instead.

---
 drivers/block/xen-blkfront.c |    3 +++
 drivers/net/xen-netfront.c   |    4 ++++
 drivers/xen/platform-pci.c   |    5 -----
 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/block/xen-blkfront.c +3 -0
index 2f22874..d5e1ab9 100644
@@ -1475,6 +1475,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);
drivers/net/xen-netfront.c +4 -0
index b161750..663b32c 100644
@@ -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>
@@ -1964,6 +1965,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);
drivers/xen/platform-pci.c +0 -5
index 319dd0a..2389e58 100644
@@ -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);
 }
 
Signature · 1 line
1.7.5
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Igor Mammedov

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_pcii to ignore xen_emul_unplug=never, and do not intialize xen_[blk|net]front instead.

#2 lore raw
In reply to Igor Mammedov
Quoted 5 lines · Igor Mammedov

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.

Oh, good catch. Thx!

Quoted 71 lines

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

---
 drivers/block/xen-blkfront.c |    3 +++
 drivers/net/xen-netfront.c   |    4 ++++
 drivers/xen/platform-pci.c   |    5 -----
 3 files changed, 7 insertions(+), 5 deletions(-)
drivers/block/xen-blkfront.c +3 -0
index 2f22874..d5e1ab9 100644
@@ -1475,6 +1475,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);
drivers/net/xen-netfront.c +4 -0
index b161750..663b32c 100644
@@ -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>
@@ -1964,6 +1965,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);
drivers/xen/platform-pci.c +0 -5
index 319dd0a..2389e58 100644
@@ -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);
 }
 
Signature · 7 lines
1.7.5


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel