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] [xen-unstable] PV-on-HVM: Fixes for save/restore. Also g

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] PV-on-HVM: Fixes for save/restore. Also gets rid of separate modules
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Apr 2007 14:00:36 -0700
Delivery-date: Tue, 10 Apr 2007 14:00:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1176215513 -3600
# Node ID ed4311db1cf6e2998d88b9a72001acceafe955ec
# Parent  099593da38cba5bba3b90f2ea44dfd060e94cb1f
PV-on-HVM: Fixes for save/restore. Also gets rid of separate modules
reboot.ko and xenbus.ko. These are now part of xen-platform-pci.ko.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 unmodified_drivers/linux-2.6/util/Kbuild                   |    3 
 unmodified_drivers/linux-2.6/util/Makefile                 |    3 
 unmodified_drivers/linux-2.6/xenbus/Kbuild                 |   10 
 unmodified_drivers/linux-2.6/xenbus/Makefile               |    3 
 linux-2.6-xen-sparse/drivers/xen/core/reboot.c             |   62 ++--
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c       |    3 
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c     |   11 
 linux-2.6-xen-sparse/include/xen/xenbus.h                  |    2 
 unmodified_drivers/linux-2.6/Makefile                      |    2 
 unmodified_drivers/linux-2.6/mkbuildtree                   |    2 
 unmodified_drivers/linux-2.6/platform-pci/Kbuild           |   11 
 unmodified_drivers/linux-2.6/platform-pci/evtchn.c         |  162 ++++++++++---
 unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c |   24 +
 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c   |   95 +++----
 unmodified_drivers/linux-2.6/platform-pci/platform-pci.h   |   40 +--
 15 files changed, 263 insertions(+), 170 deletions(-)

diff -r 099593da38cb -r ed4311db1cf6 
linux-2.6-xen-sparse/drivers/xen/core/reboot.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Tue Apr 10 13:46:28 
2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/reboot.c    Tue Apr 10 15:31:53 
2007 +0100
@@ -34,28 +34,7 @@ static void __shutdown_handler(void *unu
 static void __shutdown_handler(void *unused);
 static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
 
-#ifdef CONFIG_XEN
 int __xen_suspend(int fast_suspend);
-#else
-extern void xenbus_suspend(void);
-extern void xenbus_resume(void);
-extern void platform_pci_suspend(void);
-extern void platform_pci_resume(void);
-int __xen_suspend(int fast_suspend)
-{
-       xenbus_suspend();
-       platform_pci_suspend();
-
-       /* pvdrv sleep in this hyper-call when save */
-       HYPERVISOR_shutdown(SHUTDOWN_suspend);
-
-       platform_pci_resume();
-       xenbus_resume();
-       printk("PV stuff on HVM resume successfully!\n");
-
-       return 0;
-}
-#endif
 
 static int shutdown_process(void *__unused)
 {
@@ -210,13 +189,11 @@ static struct xenbus_watch shutdown_watc
 };
 
 static struct xenbus_watch sysrq_watch = {
-       .node ="control/sysrq",
+       .node = "control/sysrq",
        .callback = sysrq_handler
 };
 
-static int setup_shutdown_watcher(struct notifier_block *notifier,
-                                 unsigned long event,
-                                 void *data)
+static int setup_shutdown_watcher(void)
 {
        int err;
 
@@ -225,17 +202,29 @@ static int setup_shutdown_watcher(struct
                     "%d", &fast_suspend);
 
        err = register_xenbus_watch(&shutdown_watch);
-       if (err)
+       if (err) {
                printk(KERN_ERR "Failed to set shutdown watcher\n");
-       else
-               xenbus_write(XBT_NIL, "control", "feature-reboot", "1");
+               return err;
+       }
+       xenbus_write(XBT_NIL, "control", "feature-reboot", "1");
 
        err = register_xenbus_watch(&sysrq_watch);
-       if (err)
+       if (err) {
                printk(KERN_ERR "Failed to set sysrq watcher\n");
-       else
-               xenbus_write(XBT_NIL, "control", "feature-sysrq", "1");
-
+               return err;
+       }
+       xenbus_write(XBT_NIL, "control", "feature-sysrq", "1");
+
+       return 0;
+}
+
+#ifdef CONFIG_XEN
+
+static int shutdown_event(struct notifier_block *notifier,
+                         unsigned long event,
+                         void *data)
+{
+       setup_shutdown_watcher();
        return NOTIFY_DONE;
 }
 
@@ -250,3 +239,12 @@ static int __init setup_shutdown_event(v
 }
 
 subsys_initcall(setup_shutdown_event);
+
+#else /* !defined(CONFIG_XEN) */
+
+int xen_reboot_init(void)
+{
+       return setup_shutdown_watcher();
+}
+
+#endif /* !defined(CONFIG_XEN) */
diff -r 099593da38cb -r ed4311db1cf6 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Tue Apr 10 
13:46:28 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Tue Apr 10 
15:31:53 2007 +0100
@@ -394,8 +394,7 @@ static const struct file_operations xenb
        .poll = xenbus_dev_poll,
 };
 
-int __init
-xenbus_dev_init(void)
+int xenbus_dev_init(void)
 {
        xenbus_dev_intf = create_xen_proc_entry("xenbus", 0400);
        if (xenbus_dev_intf)
diff -r 099593da38cb -r ed4311db1cf6 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Tue Apr 10 
13:46:28 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Tue Apr 10 
15:31:53 2007 +0100
@@ -863,7 +863,7 @@ static int xsd_port_read(char *page, cha
 }
 #endif
 
-static int __init xenbus_probe_init(void)
+static int xenbus_probe_init(void)
 {
        int err = 0;
        unsigned long page = 0;
@@ -978,10 +978,15 @@ static int __init xenbus_probe_init(void
        return err;
 }
 
+#ifdef CONFIG_XEN
 postcore_initcall(xenbus_probe_init);
-
 MODULE_LICENSE("Dual BSD/GPL");
-
+#else
+int xenbus_init(void)
+{
+       return xenbus_probe_init();
+}
+#endif
 
 static int is_disconnected_device(struct device *dev, void *data)
 {
diff -r 099593da38cb -r ed4311db1cf6 linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Tue Apr 10 13:46:28 2007 +0100
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Tue Apr 10 15:31:53 2007 +0100
@@ -293,7 +293,7 @@ void xenbus_dev_fatal(struct xenbus_devi
 void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
                      ...);
 
-int __init xenbus_dev_init(void);
+int xenbus_dev_init(void);
 
 const char *xenbus_strstate(enum xenbus_state state);
 int xenbus_dev_is_online(struct xenbus_device *dev);
diff -r 099593da38cb -r ed4311db1cf6 unmodified_drivers/linux-2.6/Makefile
--- a/unmodified_drivers/linux-2.6/Makefile     Tue Apr 10 13:46:28 2007 +0100
+++ b/unmodified_drivers/linux-2.6/Makefile     Tue Apr 10 15:31:53 2007 +0100
@@ -1,8 +1,6 @@ include $(M)/overrides.mk
 include $(M)/overrides.mk
 
 obj-m += platform-pci/
-obj-m += xenbus/
 obj-m += balloon/
 obj-m += blkfront/
 obj-m += netfront/
-obj-m += util/
diff -r 099593da38cb -r ed4311db1cf6 unmodified_drivers/linux-2.6/mkbuildtree
--- a/unmodified_drivers/linux-2.6/mkbuildtree  Tue Apr 10 13:46:28 2007 +0100
+++ b/unmodified_drivers/linux-2.6/mkbuildtree  Tue Apr 10 15:31:53 2007 +0100
@@ -25,7 +25,7 @@ ln -sf ${XL}/drivers/xen/core/gnttab.c p
 ln -sf ${XL}/drivers/xen/core/gnttab.c platform-pci
 ln -sf ${XL}/drivers/xen/core/features.c platform-pci
 ln -sf ${XL}/drivers/xen/core/xen_proc.c xenbus
-ln -sf ${XL}/drivers/xen/core/reboot.c util
+ln -sf ${XL}/drivers/xen/core/reboot.c platform-pci
 
 mkdir -p include/asm include/xen
 
diff -r 099593da38cb -r ed4311db1cf6 
unmodified_drivers/linux-2.6/platform-pci/Kbuild
--- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild  Tue Apr 10 13:46:28 
2007 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild  Tue Apr 10 15:31:53 
2007 +0100
@@ -4,7 +4,16 @@ obj-m := xen-platform-pci.o
 
 EXTRA_CFLAGS += -I$(M)/platform-pci
 
-xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o 
features.o platform-compat.o
+xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o
+xen-platform-pci-objs += features.o platform-compat.o
+xen-platform-pci-objs += reboot.o machine_reboot.o
+
+xen-platform-pci-objs += ../xenbus/xenbus_comms.o
+xen-platform-pci-objs += ../xenbus/xenbus_xs.o
+xen-platform-pci-objs += ../xenbus/xenbus_probe.o 
+xen-platform-pci-objs += ../xenbus/xenbus_dev.o 
+xen-platform-pci-objs += ../xenbus/xenbus_client.o 
+xen-platform-pci-objs += ../xenbus/xen_proc.o
 
 # Can we do better ?
 ifeq ($(ARCH),ia64)
diff -r 099593da38cb -r ed4311db1cf6 
unmodified_drivers/linux-2.6/platform-pci/evtchn.c
--- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c        Tue Apr 10 
13:46:28 2007 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c        Tue Apr 10 
15:31:53 2007 +0100
@@ -41,16 +41,42 @@
 
 void *shared_info_area;
 
-#define MAX_EVTCHN 256
+static DEFINE_MUTEX(irq_evtchn_mutex);
+
+#define is_valid_evtchn(x)     ((x) != 0)
+#define evtchn_from_irq(x)     (irq_evtchn[irq].evtchn)
+
 static struct {
        irqreturn_t(*handler) (int, void *, struct pt_regs *);
        void *dev_id;
-       int close; /* close on unbind_from_irqhandler()? */
-} evtchns[MAX_EVTCHN];
+       int evtchn;
+       int close:1; /* close on unbind_from_irqhandler()? */
+       int inuse:1;
+} irq_evtchn[256];
+static int evtchn_to_irq[NR_EVENT_CHANNELS] = {
+       [0 ...  NR_EVENT_CHANNELS-1] = -1 };
+
+static int find_unbound_irq(void)
+{
+       static int warned;
+       int irq;
+
+       for (irq = 0; irq < ARRAY_SIZE(irq_evtchn); irq++)
+               if (!irq_evtchn[irq].inuse)
+                       return irq;
+
+       if (!warned) {
+               warned = 1;
+               printk(KERN_WARNING "No available IRQ to bind to: "
+                      "increase irq_evtchn[] size in evtchn.c.\n");
+       }
+
+       return -ENOSPC;
+}
 
 int irq_to_evtchn_port(int irq)
 {
-       return irq;
+       return irq_evtchn[irq].evtchn;
 }
 EXPORT_SYMBOL(irq_to_evtchn_port);
 
@@ -107,21 +133,37 @@ int bind_listening_port_to_irqhandler(
        void *dev_id)
 {
        struct evtchn_alloc_unbound alloc_unbound;
-       int err;
+       int err, irq;
+
+       mutex_lock(&irq_evtchn_mutex);
+
+       irq = find_unbound_irq();
+       if (irq < 0) {
+               mutex_unlock(&irq_evtchn_mutex);
+               return irq;
+       }
 
        alloc_unbound.dom        = DOMID_SELF;
        alloc_unbound.remote_dom = remote_domain;
-
        err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
                                          &alloc_unbound);
-       if (err)
+       if (err) {
+               mutex_unlock(&irq_evtchn_mutex);
                return err;
-
-       evtchns[alloc_unbound.port].handler = handler;
-       evtchns[alloc_unbound.port].dev_id  = dev_id;
-       evtchns[alloc_unbound.port].close   = 1;
+       }
+
+       irq_evtchn[irq].handler = handler;
+       irq_evtchn[irq].dev_id  = dev_id;
+       irq_evtchn[irq].evtchn  = alloc_unbound.port;
+       irq_evtchn[irq].close   = 1;
+       irq_evtchn[irq].inuse   = 1;
+
+       evtchn_to_irq[alloc_unbound.port] = irq;
+
        unmask_evtchn(alloc_unbound.port);
-       return alloc_unbound.port;
+
+       mutex_unlock(&irq_evtchn_mutex);
+       return irq;
 }
 EXPORT_SYMBOL(bind_listening_port_to_irqhandler);
 
@@ -132,35 +174,59 @@ int bind_caller_port_to_irqhandler(
        const char *devname,
        void *dev_id)
 {
-       if (caller_port >= MAX_EVTCHN)
-               return -EINVAL;
-       evtchns[caller_port].handler = handler;
-       evtchns[caller_port].dev_id  = dev_id;
-       evtchns[caller_port].close   = 0;
+       int irq;
+
+       mutex_lock(&irq_evtchn_mutex);
+
+       irq = find_unbound_irq();
+       if (irq < 0) {
+               mutex_unlock(&irq_evtchn_mutex);
+               return irq;
+       }
+
+       irq_evtchn[irq].handler = handler;
+       irq_evtchn[irq].dev_id  = dev_id;
+       irq_evtchn[irq].evtchn  = caller_port;
+       irq_evtchn[irq].close   = 0;
+       irq_evtchn[irq].inuse   = 1;
+
+       evtchn_to_irq[caller_port] = irq;
+
        unmask_evtchn(caller_port);
-       return caller_port;
+
+       mutex_unlock(&irq_evtchn_mutex);
+       return irq;
 }
 EXPORT_SYMBOL(bind_caller_port_to_irqhandler);
 
-void unbind_from_irqhandler(unsigned int evtchn, void *dev_id)
-{
-       if (evtchn >= MAX_EVTCHN)
-               return;
-
-       mask_evtchn(evtchn);
-       evtchns[evtchn].handler = NULL;
-
-       if (evtchns[evtchn].close) {
-               struct evtchn_close close = { .port = evtchn };
-               HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
-       }
+void unbind_from_irqhandler(unsigned int irq, void *dev_id)
+{
+       int evtchn = evtchn_from_irq(irq);
+
+       mutex_lock(&irq_evtchn_mutex);
+
+       if (is_valid_evtchn(evtchn)) {
+               evtchn_to_irq[irq] = -1;
+               mask_evtchn(evtchn);
+               if (irq_evtchn[irq].close) {
+                       struct evtchn_close close = { .port = evtchn };
+                       HYPERVISOR_event_channel_op(EVTCHNOP_close, &close);
+               }
+       }
+
+       irq_evtchn[irq].handler = NULL;
+       irq_evtchn[irq].evtchn  = 0;
+       irq_evtchn[irq].inuse   = 0;
+
+       mutex_unlock(&irq_evtchn_mutex);
 }
 EXPORT_SYMBOL(unbind_from_irqhandler);
 
 void notify_remote_via_irq(int irq)
 {
-       int evtchn = irq;
-       notify_remote_via_evtchn(evtchn);
+       int evtchn = evtchn_from_irq(irq);
+       if (is_valid_evtchn(evtchn))
+               notify_remote_via_evtchn(evtchn);
 }
 EXPORT_SYMBOL(notify_remote_via_irq);
 
@@ -183,9 +249,10 @@ irqreturn_t evtchn_interrupt(int irq, vo
                while ((l2 = s->evtchn_pending[l1i] & ~s->evtchn_mask[l1i])) {
                        port = (l1i * BITS_PER_LONG) + __ffs(l2);
                        synch_clear_bit(port, &s->evtchn_pending[0]);
-                       if ((handler = evtchns[port].handler) != NULL)
-                               handler(port, evtchns[port].dev_id,
-                                       regs);
+                       irq = evtchn_to_irq[port];
+                       if ((irq >= 0) &&
+                           ((handler = irq_evtchn[irq].handler) != NULL))
+                               handler(irq, irq_evtchn[irq].dev_id, regs);
                        else
                                printk(KERN_WARNING "unexpected event channel "
                                       "upcall on port %d!\n", port);
@@ -200,3 +267,28 @@ void force_evtchn_callback(void)
        (void)HYPERVISOR_xen_version(0, NULL);
 }
 EXPORT_SYMBOL(force_evtchn_callback);
+
+void irq_suspend(void)
+{
+       mutex_lock(&irq_evtchn_mutex);
+}
+
+void irq_suspend_cancel(void)
+{
+       mutex_unlock(&irq_evtchn_mutex);
+}
+
+void irq_resume(void)
+{
+       int evtchn, irq;
+
+       for (evtchn = 0; evtchn < NR_EVENT_CHANNELS; evtchn++) {
+               mask_evtchn(evtchn);
+               evtchn_to_irq[evtchn] = -1;
+       }
+
+       for (irq = 0; irq < ARRAY_SIZE(irq_evtchn); irq++)
+               irq_evtchn[irq].evtchn = 0;
+
+       mutex_unlock(&irq_evtchn_mutex);
+}
diff -r 099593da38cb -r ed4311db1cf6 
unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/platform-pci/machine_reboot.c        Tue Apr 
10 15:31:53 2007 +0100
@@ -0,0 +1,24 @@
+#include <linux/config.h>
+#include <xen/xenbus.h>
+#include "platform-pci.h"
+#include <asm/hypervisor.h>
+
+int __xen_suspend(int fast_suspend)
+{
+       int suspend_cancelled;
+
+       xenbus_suspend();
+       platform_pci_suspend();
+
+       suspend_cancelled = HYPERVISOR_shutdown(SHUTDOWN_suspend);
+
+       if (suspend_cancelled) {
+               platform_pci_suspend_cancel();
+               xenbus_suspend_cancel();
+       } else {
+               platform_pci_resume();
+               xenbus_resume();
+       }
+
+       return 0;
+}
diff -r 099593da38cb -r ed4311db1cf6 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Tue Apr 10 
13:46:28 2007 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Tue Apr 10 
15:31:53 2007 +0100
@@ -1,7 +1,9 @@
 /******************************************************************************
  * platform-pci.c
+ * 
  * Xen platform PCI device driver
- * Copyright (C) 2005, Intel Corporation.
+ * Copyright (c) 2005, Intel Corporation.
+ * Copyright (c) 2007, XenSource Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -35,7 +37,9 @@
 #include <asm/hypervisor.h>
 #include <asm/pgtable.h>
 #include <xen/interface/memory.h>
+#include <xen/interface/hvm/params.h>
 #include <xen/features.h>
+#include <xen/evtchn.h>
 #include <xen/gnttab.h>
 #ifdef __ia64__
 #include <asm/xen/xencomm.h>
@@ -54,13 +58,9 @@ char *hypercall_stubs;
 char *hypercall_stubs;
 EXPORT_SYMBOL(hypercall_stubs);
 
-// Used to be xiaofeng.ling@xxxxxxxxx
 MODULE_AUTHOR("ssmith@xxxxxxxxxxxxx");
 MODULE_DESCRIPTION("Xen platform PCI device");
 MODULE_LICENSE("GPL");
-
-unsigned long *phys_to_machine_mapping;
-EXPORT_SYMBOL(phys_to_machine_mapping);
 
 static unsigned long shared_info_frame;
 static uint64_t callback_via;
@@ -89,28 +89,9 @@ static int __devinit init_xen_info(void)
        if (shared_info_area == NULL)
                panic("can't map shared info\n");
 
-       phys_to_machine_mapping = NULL;
-
        gnttab_init();
 
        return 0;
-}
-
-static void __devexit platform_pci_remove(struct pci_dev *pdev)
-{
-       long ioaddr, iolen;
-       long mmio_addr, mmio_len;
-
-       ioaddr = pci_resource_start(pdev, 0);
-       iolen = pci_resource_len(pdev, 0);
-       mmio_addr = pci_resource_start(pdev, 1);
-       mmio_len = pci_resource_len(pdev, 1);
-
-       release_region(ioaddr, iolen);
-       release_mem_region(mmio_addr, mmio_len);
-
-       pci_set_drvdata(pdev, NULL);
-       free_irq(pdev->irq, pdev);
 }
 
 static unsigned long platform_mmio;
@@ -208,6 +189,19 @@ static uint64_t get_callback_via(struct 
                ((uint64_t)(pin - 1) & 3));
 }
 
+static int set_callback_via(uint64_t via)
+{
+       struct xen_hvm_param a;
+
+       a.domid = DOMID_SELF;
+       a.index = HVM_PARAM_CALLBACK_IRQ;
+       a.value = via;
+       return HYPERVISOR_hvm_op(HVMOP_set_param, &a);
+}
+
+int xenbus_init(void);
+int xen_reboot_init(void);
+
 static int __devinit platform_pci_init(struct pci_dev *pdev,
                                       const struct pci_device_id *ent)
 {
@@ -232,15 +226,13 @@ static int __devinit platform_pci_init(s
                return -ENOENT;
        }
 
-       if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL)
-       {
+       if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL) {
                printk(KERN_ERR ":MEM I/O resource 0x%lx @ 0x%lx busy\n",
                       mmio_addr, mmio_len);
                return -EBUSY;
        }
 
-       if (request_region(ioaddr, iolen, DRV_NAME) == NULL)
-       {
+       if (request_region(ioaddr, iolen, DRV_NAME) == NULL) {
                printk(KERN_ERR DRV_NAME ":I/O resource 0x%lx @ 0x%lx busy\n",
                       iolen, ioaddr);
                release_mem_region(mmio_addr, mmio_len);
@@ -263,6 +255,12 @@ static int __devinit platform_pci_init(s
                goto out;
 
        if ((ret = set_callback_via(callback_via)))
+               goto out;
+
+       if ((ret = xenbus_init()))
+               goto out;
+
+       if ((ret = xen_reboot_init()))
                goto out;
 
  out:
@@ -289,7 +287,6 @@ static struct pci_driver platform_driver
 static struct pci_driver platform_driver = {
        name:     DRV_NAME,
        probe:    platform_pci_init,
-       remove:   __devexit_p(platform_pci_remove),
        id_table: platform_pci_tbl,
 };
 
@@ -298,13 +295,18 @@ void platform_pci_suspend(void)
 void platform_pci_suspend(void)
 {
        gnttab_suspend();
-}
-EXPORT_SYMBOL_GPL(platform_pci_suspend);
+       irq_suspend();
+}
+
+void platform_pci_suspend_cancel(void)
+{
+       irq_suspend_cancel();
+       gnttab_resume();
+}
 
 void platform_pci_resume(void)
 {
        struct xen_add_to_physmap xatp;
-       phys_to_machine_mapping = NULL;
 
        /* do 2 things for PV driver restore on HVM
         * 1: rebuild share info
@@ -317,34 +319,27 @@ void platform_pci_resume(void)
        if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
                BUG();
 
-       if (( set_callback_via(callback_via)))
+       irq_resume();
+
+       if (set_callback_via(callback_via))
                printk("platform_pci_resume failure!\n");
 
        gnttab_resume();
 }
-EXPORT_SYMBOL_GPL(platform_pci_resume);
 
 static int __init platform_pci_module_init(void)
 {
        int rc;
 
        rc = pci_module_init(&platform_driver);
-       if (rc)
-               printk(KERN_INFO DRV_NAME ":No platform pci device model 
found\n");
-       else
-               pci_device_registered = 1;
-
-       return rc;
-}
-
-static void __exit platform_pci_module_cleanup(void)
-{
-       printk(KERN_INFO DRV_NAME ":Do platform module cleanup\n");
-       /* disable hypervisor for callback irq */
-       set_callback_via(0);
-       if (pci_device_registered)
-               pci_unregister_driver(&platform_driver);
+       if (rc) {
+               printk(KERN_INFO DRV_NAME
+                      ": No platform pci device model found\n");
+               return rc;
+       }
+
+       pci_device_registered = 1;
+       return 0;
 }
 
 module_init(platform_pci_module_init);
-module_exit(platform_pci_module_cleanup);
diff -r 099593da38cb -r ed4311db1cf6 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.h
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h  Tue Apr 10 
13:46:28 2007 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.h  Tue Apr 10 
15:31:53 2007 +0100
@@ -1,7 +1,9 @@
 /******************************************************************************
- * evtchn-pci.h
- * module driver support in unmodified Linux
- * Copyright (C) 2004, Intel Corporation. <xiaofeng.ling@xxxxxxxxx>
+ * platform-pci.h
+ * 
+ * Xen platform PCI device driver
+ * Copyright (c) 2004, Intel Corporation. <xiaofeng.ling@xxxxxxxxx>
+ * Copyright (c) 2007, XenSource Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -15,31 +17,21 @@
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  * Place - Suite 330, Boston, MA 02111-1307 USA.
- *
  */
 
-#ifndef __XEN_SUPPORT_H
-#define __XEN_SUPPORT_H
-#include <linux/version.h>
+#ifndef _XEN_PLATFORM_PCI_H
+#define _XEN_PLATFORM_PCI_H
+
 #include <linux/interrupt.h>
-#include <xen/interface/hvm/params.h>
-
-static inline int set_callback_via(uint64_t via)
-{
-       struct xen_hvm_param a;
-
-       a.domid = DOMID_SELF;
-       a.index = HVM_PARAM_CALLBACK_IRQ;
-       a.value = via;
-       return HYPERVISOR_hvm_op(HVMOP_set_param, &a);
-}
 
 unsigned long alloc_xen_mmio(unsigned long len);
+int gnttab_init(void);
+irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+void irq_suspend(void);
+void irq_suspend_cancel(void);
 
-int gnttab_init(void);
+void platform_pci_suspend(void);
+void platform_pci_suspend_cancel(void);
+void platform_pci_resume(void);
 
-void setup_xen_features(void);
-
-irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-
-#endif
+#endif /* _XEN_PLATFORM_PCI_H */
diff -r 099593da38cb -r ed4311db1cf6 unmodified_drivers/linux-2.6/util/Kbuild
--- a/unmodified_drivers/linux-2.6/util/Kbuild  Tue Apr 10 13:46:28 2007 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-include $(M)/overrides.mk
-
-obj-m := reboot.o
diff -r 099593da38cb -r ed4311db1cf6 unmodified_drivers/linux-2.6/util/Makefile
--- a/unmodified_drivers/linux-2.6/util/Makefile        Tue Apr 10 13:46:28 
2007 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif
diff -r 099593da38cb -r ed4311db1cf6 unmodified_drivers/linux-2.6/xenbus/Kbuild
--- a/unmodified_drivers/linux-2.6/xenbus/Kbuild        Tue Apr 10 13:46:28 
2007 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-include $(M)/overrides.mk
-
-obj-m  += xenbus.o
-xenbus-objs =
-xenbus-objs += xenbus_comms.o
-xenbus-objs += xenbus_xs.o
-xenbus-objs += xenbus_probe.o 
-xenbus-objs += xenbus_dev.o 
-xenbus-objs += xenbus_client.o 
-xenbus-objs += xen_proc.o
diff -r 099593da38cb -r ed4311db1cf6 
unmodified_drivers/linux-2.6/xenbus/Makefile
--- a/unmodified_drivers/linux-2.6/xenbus/Makefile      Tue Apr 10 13:46:28 
2007 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-ifneq ($(KERNELRELEASE),)
-include $(src)/Kbuild
-endif

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] PV-on-HVM: Fixes for save/restore. Also gets rid of separate modules, Xen patchbot-unstable <=