Commit b4a26be9f6f8bb72998e445cc75fc6dc0c29513a

Authored by Benjamin Herrenschmidt
1 parent 4b83c330b4

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>

Showing 3 changed files with 13 additions and 0 deletions Side-by-side Diff

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