Commit 2a6f4e49 authored by Jan-Bernd Themann's avatar Jan-Bernd Themann Committed by Jeff Garzik

ehea: add kexec support

eHEA resources that are allocated via H_CALLs have a unique identifier each.
These identifiers are necessary to free the resources. A reboot notifier
is used to free all eHEA resources before the indentifiers get lost, i.e
before kexec starts a new kernel.
Signed-off-by: default avatarJan-Bernd Themann <themann@de.ibm.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent f920c186
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <asm/io.h> #include <asm/io.h>
#define DRV_NAME "ehea" #define DRV_NAME "ehea"
#define DRV_VERSION "EHEA_0079" #define DRV_VERSION "EHEA_0080"
/* eHEA capability flags */ /* eHEA capability flags */
#define DLPAR_PORT_ADD_REM 1 #define DLPAR_PORT_ADD_REM 1
......
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
#include <linux/if.h> #include <linux/if.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <net/ip.h> #include <net/ip.h>
#include "ehea.h" #include "ehea.h"
...@@ -3295,6 +3298,20 @@ static int __devexit ehea_remove(struct of_device *dev) ...@@ -3295,6 +3298,20 @@ static int __devexit ehea_remove(struct of_device *dev)
return 0; return 0;
} }
static int ehea_reboot_notifier(struct notifier_block *nb,
unsigned long action, void *unused)
{
if (action == SYS_RESTART) {
ehea_info("Reboot: freeing all eHEA resources");
ibmebus_unregister_driver(&ehea_driver);
}
return NOTIFY_DONE;
}
static struct notifier_block ehea_reboot_nb = {
.notifier_call = ehea_reboot_notifier,
};
static int check_module_parm(void) static int check_module_parm(void)
{ {
int ret = 0; int ret = 0;
...@@ -3351,6 +3368,8 @@ int __init ehea_module_init(void) ...@@ -3351,6 +3368,8 @@ int __init ehea_module_init(void)
if (ret) if (ret)
goto out; goto out;
register_reboot_notifier(&ehea_reboot_nb);
ret = ibmebus_register_driver(&ehea_driver); ret = ibmebus_register_driver(&ehea_driver);
if (ret) { if (ret) {
ehea_error("failed registering eHEA device driver on ebus"); ehea_error("failed registering eHEA device driver on ebus");
...@@ -3362,6 +3381,7 @@ int __init ehea_module_init(void) ...@@ -3362,6 +3381,7 @@ int __init ehea_module_init(void)
if (ret) { if (ret) {
ehea_error("failed to register capabilities attribute, ret=%d", ehea_error("failed to register capabilities attribute, ret=%d",
ret); ret);
unregister_reboot_notifier(&ehea_reboot_nb);
ibmebus_unregister_driver(&ehea_driver); ibmebus_unregister_driver(&ehea_driver);
goto out; goto out;
} }
...@@ -3375,6 +3395,7 @@ static void __exit ehea_module_exit(void) ...@@ -3375,6 +3395,7 @@ static void __exit ehea_module_exit(void)
flush_scheduled_work(); flush_scheduled_work();
driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities); driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
ibmebus_unregister_driver(&ehea_driver); ibmebus_unregister_driver(&ehea_driver);
unregister_reboot_notifier(&ehea_reboot_nb);
ehea_destroy_busmap(); ehea_destroy_busmap();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment