WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Allow pciback to be built as a module.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Allow pciback to be built as a module.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 08 Mar 2006 19:58:07 +0000
Delivery-date: Wed, 08 Mar 2006 19:58:51 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID f527a18cc8c341b2eb836d65b957b225bcfc8f27
# Parent  42a1f6ffd0e9567a04175f1899c033f6e1d4d2df
Allow pciback to be built as a module.

From: Jan Beulich
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 42a1f6ffd0e9 -r f527a18cc8c3 linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig  Wed Mar  8 16:32:36 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig  Wed Mar  8 17:41:12 2006
@@ -30,9 +30,9 @@
        default !XEN_PRIVILEGED_GUEST
 
 config XEN_PCIDEV_BACKEND
-       bool "PCI device backend driver"
-       select PCI
-       default y if XEN_PRIVILEGED_GUEST
+       tristate "PCI device backend driver"
+       depends PCI
+       default XEN_PRIVILEGED_GUEST
        help
          The PCI device backend driver allows the kernel to export arbitrary
          PCI devices to other guests.
diff -r 42a1f6ffd0e9 -r f527a18cc8c3 
linux-2.6-xen-sparse/drivers/xen/pciback/Makefile
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/Makefile Wed Mar  8 16:32:36 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/Makefile Wed Mar  8 17:41:12 2006
@@ -1,9 +1,9 @@
-obj-y += pciback.o
+obj-$(CONFIG_XEN_PCIDEV_BACKEND) += pciback.o
 
 pciback-y := pci_stub.o pciback_ops.o xenbus.o
 pciback-y += conf_space.o conf_space_header.o
-pciback-${CONFIG_XEN_PCIDEV_BACKEND_VPCI} += vpci.o
-pciback-${CONFIG_XEN_PCIDEV_BACKEND_PASS} += passthrough.o
+pciback-$(CONFIG_XEN_PCIDEV_BACKEND_VPCI) += vpci.o
+pciback-$(CONFIG_XEN_PCIDEV_BACKEND_PASS) += passthrough.o
 
 ifeq ($(CONFIG_XEN_PCIDEV_BE_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
diff -r 42a1f6ffd0e9 -r f527a18cc8c3 
linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c      Wed Mar 
 8 16:32:36 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space_header.c      Wed Mar 
 8 17:41:12 2006
@@ -24,21 +24,19 @@
                if (unlikely(verbose_request))
                        printk(KERN_DEBUG "pciback: %s: enable\n",
                               pci_name(dev));
-               dev->is_enabled = 1;
-               pcibios_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1);
+               pci_enable_device(dev);
        } else if (dev->is_enabled && !is_enable_cmd(value)) {
                if (unlikely(verbose_request))
                        printk(KERN_DEBUG "pciback: %s: disable\n",
                               pci_name(dev));
-               pciback_disable_device(dev);
+               pci_disable_device(dev);
        }
 
        if (!dev->is_busmaster && is_master_cmd(value)) {
                if (unlikely(verbose_request))
                        printk(KERN_DEBUG "pciback: %s: set bus master\n",
                               pci_name(dev));
-               dev->is_busmaster = 1;
-               pcibios_set_master(dev);
+               pci_set_master(dev);
        }
 
        if (value & PCI_COMMAND_INVALIDATE) {
diff -r 42a1f6ffd0e9 -r f527a18cc8c3 
linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c       Wed Mar  8 
16:32:36 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pci_stub.c       Wed Mar  8 
17:41:12 2006
@@ -207,8 +207,6 @@
 
        return 0;
 }
-
-device_initcall(pcistub_init_devices_late);
 
 static int __devinit pcistub_seize(struct pci_dev *dev)
 {
@@ -367,6 +365,7 @@
        return -EINVAL;
 }
 
+#ifndef MODULE
 /*
  * fs_initcall happens before device_initcall
  * so pciback *should* get called first (b/c we 
@@ -375,3 +374,34 @@
  * driver to register)
  */
 fs_initcall(pcistub_init);
+#endif
+
+static int __init pciback_init(void)
+{
+#ifndef MODULE
+       int err;
+
+       err = pcistub_init();
+       if (err < 0)
+               return err;
+#endif
+
+       if (list_empty(&pci_stub_device_ids))
+               return -ENODEV;
+       pcistub_init_devices_late();
+       pciback_xenbus_register();
+
+       __unsafe(THIS_MODULE);
+
+       return 0;
+}
+
+static void pciback_cleanup(void)
+{
+       BUG();
+}
+
+module_init(pciback_init);
+module_exit(pciback_cleanup);
+
+MODULE_LICENSE("Dual BSD/GPL");
diff -r 42a1f6ffd0e9 -r f527a18cc8c3 
linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h        Wed Mar  8 
16:32:36 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pciback.h        Wed Mar  8 
17:41:12 2006
@@ -43,7 +43,6 @@
 void pcistub_put_pci_dev(struct pci_dev *dev);
 
 /* Ensure a device is turned off or reset */
-void pciback_disable_device(struct pci_dev *dev);
 void pciback_reset_device(struct pci_dev *pdev);
 
 /* Access a virtual configuration space for a PCI device */
@@ -69,5 +68,7 @@
 /* Handles events from front-end */
 irqreturn_t pciback_handle_event(int irq, void *dev_id, struct pt_regs *regs);
 
+int pciback_xenbus_register(void);
+
 extern int verbose_request;
 #endif
diff -r 42a1f6ffd0e9 -r f527a18cc8c3 
linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c    Wed Mar  8 
16:32:36 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/pciback_ops.c    Wed Mar  8 
17:41:12 2006
@@ -10,17 +10,6 @@
 int verbose_request = 0;
 module_param(verbose_request, int, 0644);
 
-/* For those architectures without a pcibios_disable_device */
-void __attribute__ ((weak)) pcibios_disable_device(struct pci_dev *dev) { }
-
-void pciback_disable_device(struct pci_dev *dev)
-{
-       if (dev->is_enabled) {
-               dev->is_enabled = 0;
-               pcibios_disable_device(dev);
-       }
-}
-
 /* Ensure a device is "turned off" and ready to be exported.
  * This also sets up the device's private data to keep track of what should
  * be in the base address registers (BARs) so that we can keep the
@@ -32,7 +21,7 @@
 
        /* Disable devices (but not bridges) */
        if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) {
-               pciback_disable_device(dev);
+               pci_disable_device(dev);
 
                pci_write_config_word(dev, PCI_COMMAND, 0);
 
diff -r 42a1f6ffd0e9 -r f527a18cc8c3 
linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Wed Mar  8 16:32:36 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/pciback/xenbus.c Wed Mar  8 17:41:12 2006
@@ -430,10 +430,7 @@
        .otherend_changed       = pciback_frontend_changed,
 };
 
-static __init int pciback_xenbus_register(void)
+int __init pciback_xenbus_register(void)
 {
        return xenbus_register_backend(&xenbus_pciback_driver);
 }
-
-/* Must only initialize our xenbus driver after the pcistub driver */
-device_initcall(pciback_xenbus_register);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Allow pciback to be built as a module., Xen patchbot -unstable <=