powerpc/pseries: Flush lazy kernel mappings after unplug operations

This ensures that the translations for unmapped IO mappings or
unmapped memory are properly removed from the MMU hash table
before such an unplug. Without this, the hypervisor refuses the
unplug operations due to those resources still being mapped by
the partition.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

+13
+7
arch/powerpc/platforms/pseries/hotplug-memory.c
··· 11 12 #include <linux/of.h> 13 #include <linux/lmb.h> 14 #include <asm/firmware.h> 15 #include <asm/machdep.h> 16 #include <asm/pSeries_reconfig.h> ··· 55 */ 56 start = (unsigned long)__va(base); 57 ret = remove_section_mapping(start, start + lmb_size); 58 return ret; 59 } 60
··· 11 12 #include <linux/of.h> 13 #include <linux/lmb.h> 14 + #include <linux/vmalloc.h> 15 #include <asm/firmware.h> 16 #include <asm/machdep.h> 17 #include <asm/pSeries_reconfig.h> ··· 54 */ 55 start = (unsigned long)__va(base); 56 ret = remove_section_mapping(start, start + lmb_size); 57 + 58 + /* Ensure all vmalloc mappings are flushed in case they also 59 + * hit that section of memory 60 + */ 61 + vm_unmap_aliases(); 62 + 63 return ret; 64 } 65
+3
drivers/pci/hotplug/rpadlpar_core.c
··· 20 #include <linux/init.h> 21 #include <linux/pci.h> 22 #include <linux/string.h> 23 24 #include <asm/pci-bridge.h> 25 #include <linux/mutex.h> ··· 431 rc = dlpar_remove_pci_slot(drc_name, dn); 432 break; 433 } 434 printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name); 435 exit: 436 mutex_unlock(&rpadlpar_mutex);
··· 20 #include <linux/init.h> 21 #include <linux/pci.h> 22 #include <linux/string.h> 23 + #include <linux/vmalloc.h> 24 25 #include <asm/pci-bridge.h> 26 #include <linux/mutex.h> ··· 430 rc = dlpar_remove_pci_slot(drc_name, dn); 431 break; 432 } 433 + vm_unmap_aliases(); 434 + 435 printk(KERN_INFO "%s: slot %s removed\n", DLPAR_MODULE_NAME, drc_name); 436 exit: 437 mutex_unlock(&rpadlpar_mutex);
+3
drivers/pci/hotplug/rpaphp_core.c
··· 29 #include <linux/pci_hotplug.h> 30 #include <linux/smp.h> 31 #include <linux/init.h> 32 #include <asm/eeh.h> /* for eeh_add_device() */ 33 #include <asm/rtas.h> /* rtas_call */ 34 #include <asm/pci-bridge.h> /* for pci_controller */ ··· 419 return -EINVAL; 420 421 pcibios_remove_pci_devices(slot->bus); 422 slot->state = NOT_CONFIGURED; 423 return 0; 424 }
··· 29 #include <linux/pci_hotplug.h> 30 #include <linux/smp.h> 31 #include <linux/init.h> 32 + #include <linux/vmalloc.h> 33 #include <asm/eeh.h> /* for eeh_add_device() */ 34 #include <asm/rtas.h> /* rtas_call */ 35 #include <asm/pci-bridge.h> /* for pci_controller */ ··· 418 return -EINVAL; 419 420 pcibios_remove_pci_devices(slot->bus); 421 + vm_unmap_aliases(); 422 + 423 slot->state = NOT_CONFIGURED; 424 return 0; 425 }