[2.6.26] ehea: Add DLPAR memory remove support
Subsystems (2)
PATCH 3/3 [2.6.26] ehea: Add DLPAR memory remove support
The eHEA driver uses the recently modified walk_memory_resource for powerpc functionality to detect the memory layout. It further uses the memory hotplug notifiers to catch memory hotplug events.
Signed-off-by Hannes Hering <[email protected]>
---
drivers/net/ehea/ehea.h +22 -5
@@ -40,7 +40,7 @@#include <asm/io.h> #define DRV_NAME "ehea" -#define DRV_VERSION "EHEA_0090" +#define DRV_VERSION "EHEA_0091"/* eHEA capability flags */ #define DLPAR_PORT_ADD_REM 1
@@ -118,6 +118,13 @@#define EHEA_MR_ACC_CTRL 0x00800000#define EHEA_BUSMAP_START 0x8000000000000000ULL +#define EHEA_INVAL_ADDR 0xFFFFFFFFFFFFFFFFULL +#define EHEA_DIR_INDEX_SHIFT 13/* 8k Entries in 64k block */ +#define EHEA_TOP_INDEX_SHIFT (EHEA_DIR_INDEX_SHIFT * 2) +#define EHEA_MAP_ENTRIES (1 << EHEA_DIR_INDEX_SHIFT) +#define EHEA_MAP_SIZE (0x10000)/* currently fixed map size */ +#define EHEA_INDEX_MASK (EHEA_MAP_ENTRIES - 1) +#define EHEA_WATCH_DOG_TIMEOUT 10*HZ
@@ -192,10 +199,20 @@ struct h_epas {set to 0 if unused */ }; -struct ehea_busmap { -unsigned int entries;/* total number of entries */ -unsigned int valid_sections;/* number of valid sections */ -u64 *vaddr; +/* +* Memory map data structures +*/ +struct ehea_dir_bmap +{ +u64 ent[EHEA_MAP_ENTRIES ]; +}; +struct ehea_top_bmap +{ +struct ehea_dir_bmap *dir[EHEA_MAP_ENTRIES ]; +}; +struct ehea_bmap +{ +struct ehea_top_bmap *top[EHEA_MAP_ENTRIES ]; };struct ehea_qp ;
drivers/net/ehea/ehea_main.c +25 -0
@@ -35,6 +35,7 @@#include <linux/if_ether.h> #include <linux/notifier.h> #include <linux/reboot.h> +#include <linux/memory.h> #include <asm/kexec.h> #include <linux/mutex.h>
@@ -3503,6 +3504,24 @@ void ehea_crash_handler(void) 0, H_DEREG_BCMC); } +static int ehea_mem_notifier (struct notifier_block *nb, +unsigned long action,void *data) +{ +switch (action) { +case MEM_OFFLINE : +ehea_info ("memory has been removed" ); +ehea_rereg_mrs (NULL ); +break ; +default : +break ; + } +return NOTIFY_OK ; +} + +static struct notifier_block ehea_mem_nb = { + .notifier_call = ehea_mem_notifier, +}; +static int ehea_reboot_notifier (struct notifier_block *nb,unsigned long action,void *unused) {
@@ -3581,6 +3600,10 @@ int __init ehea_module_init(void)if (ret)ehea_info ("failed registering reboot notifier" ); + ret =register_memory_notifier (&ehea_mem_nb); +if (ret) +ehea_info ("failed registering memory remove notifier" ); + ret =crash_shutdown_register (&ehea_crash_handler);if (ret)ehea_info ("failed registering crash handler" );
@@ -3604,6 +3627,7 @@ int __init ehea_module_init(void) out3:ibmebus_unregister_driver (&ehea_driver); out2: +unregister_memory_notifier (&ehea_mem_nb);unregister_reboot_notifier (&ehea_reboot_nb);crash_shutdown_unregister (&ehea_crash_handler); out:
@@ -3621,6 +3645,7 @@ static void __exit ehea_module_exit(void ret =crash_shutdown_unregister (&ehea_crash_handler);if (ret)ehea_info ("failed unregistering crash handler" ); +unregister_memory_notifier (&ehea_mem_nb);kfree (ehea_fw_handles.arr);kfree (ehea_bcmc_regs.arr);ehea_destroy_busmap ();
drivers/net/ehea/ehea_qmr.c +206 -78
339 lines not on this page · raw message