aboutsummaryrefslogtreecommitdiffstats
path: root/unmodified_drivers
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2008-02-14 09:34:27 -0700
committerAlex Williamson <alex.williamson@hp.com>2008-02-14 09:34:27 -0700
commite38c4f55fe6ef6c393388ae181630ab3a92f77dd (patch)
tree24970faea32f21f96b9048f8a36c8e8d9dafe2b2 /unmodified_drivers
parent03c9b741df33f676c99c7885ca7f795190df37d5 (diff)
parentdf5b25e9af9248d8e00d0ef7e4ce3eec9eb44f97 (diff)
downloadxen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.tar.gz
xen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.tar.bz2
xen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.zip
merge with xen-unstable.hg
Diffstat (limited to 'unmodified_drivers')
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/Kbuild1
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/panic-handler.c54
-rw-r--r--unmodified_drivers/linux-2.6/platform-pci/platform-pci.c4
3 files changed, 59 insertions, 0 deletions
diff --git a/unmodified_drivers/linux-2.6/platform-pci/Kbuild b/unmodified_drivers/linux-2.6/platform-pci/Kbuild
index 50951f94fd..7b332ee804 100644
--- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild
+++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild
@@ -7,6 +7,7 @@ EXTRA_CFLAGS += -I$(M)/platform-pci
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 += panic-handler.o
xen-platform-pci-objs += ../xenbus/xenbus_comms.o
xen-platform-pci-objs += ../xenbus/xenbus_xs.o
diff --git a/unmodified_drivers/linux-2.6/platform-pci/panic-handler.c b/unmodified_drivers/linux-2.6/platform-pci/panic-handler.c
new file mode 100644
index 0000000000..91bc03549b
--- /dev/null
+++ b/unmodified_drivers/linux-2.6/platform-pci/panic-handler.c
@@ -0,0 +1,54 @@
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/notifier.h>
+#include <asm/hypervisor.h>
+
+MODULE_LICENSE("GPL");
+
+#ifdef __ia64__
+static void
+xen_panic_hypercall(struct unw_frame_info *info, void *arg)
+{
+ current->thread.ksp = (__u64)info->sw - 16;
+ HYPERVISOR_shutdown(SHUTDOWN_crash);
+ /* we're never actually going to get here... */
+}
+#endif
+
+static int
+xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
+{
+#ifdef __ia64__
+ unw_init_running(xen_panic_hypercall, NULL);
+#else /* !__ia64__ */
+ HYPERVISOR_shutdown(SHUTDOWN_crash);
+#endif
+ /* we're never actually going to get here... */
+ return NOTIFY_DONE;
+}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+static struct notifier_block xen_panic_block = {
+ xen_panic_event, NULL, 0 /* try to go last */
+};
+#else
+static struct notifier_block xen_panic_block = {
+ .notifier_call= xen_panic_event,
+ .next= NULL,
+ .priority= 0/* try to go last */
+};
+#endif /*LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)*/
+
+static int __init setup_panic_event(void)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+ notifier_chain_register(&panic_notifier_list, &xen_panic_block);
+#else
+ atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
+#endif /*LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)*/
+ return 0;
+}
+
+int xen_panic_handler_init(void)
+{
+ return setup_panic_event();
+}
diff --git a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
index 7a512073d2..3d3a4c79a1 100644
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
@@ -249,6 +249,7 @@ static int set_callback_via(uint64_t via)
int xen_irq_init(struct pci_dev *pdev);
int xenbus_init(void);
int xen_reboot_init(void);
+int xen_panic_handler_init(void);
int gnttab_init(void);
static int __devinit platform_pci_init(struct pci_dev *pdev,
@@ -317,6 +318,9 @@ static int __devinit platform_pci_init(struct pci_dev *pdev,
if ((ret = xen_reboot_init()))
goto out;
+ if ((ret = xen_panic_handler_init()))
+ goto out;
+
out:
if (ret) {
release_mem_region(mmio_addr, mmio_len);