Merge branch 'fixes' into next
authorMichael Ellerman <mpe@ellerman.id.au>
Sat, 9 Jul 2022 09:29:34 +0000 (19:29 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 9 Jul 2022 09:29:34 +0000 (19:29 +1000)
Merge our fixes branch. In particular this brings in commit
986481618023 ("powerpc/book3e: Fix PUD allocation size in
map_kernel_page()") which fixes a build failure in next, because commit
2db2008e6363 ("powerpc/64e: Rewrite p4d_populate() as a static inline
function") depends on it.

1  2 
arch/powerpc/Kconfig
arch/powerpc/kernel/prom_init.c
arch/powerpc/mm/mem.c
arch/powerpc/platforms/pseries/setup.c

diff --combined arch/powerpc/Kconfig
@@@ -11,7 -11,7 +11,7 @@@ config 64BI
  
  config LIVEPATCH_64
        def_bool PPC64
 -      depends on LIVEPATCH
 +      depends on LIVEPATCH
  
  config MMU
        bool
@@@ -193,7 -193,6 +193,7 @@@ config PP
        select HAVE_ARCH_JUMP_LABEL_RELATIVE
        select HAVE_ARCH_KASAN                  if PPC32 && PPC_PAGE_SHIFT <= 14
        select HAVE_ARCH_KASAN                  if PPC_RADIX_MMU
 +      select HAVE_ARCH_KASAN                  if PPC_BOOK3E_64
        select HAVE_ARCH_KASAN_VMALLOC          if HAVE_ARCH_KASAN
        select HAVE_ARCH_KFENCE                 if PPC_BOOK3S_32 || PPC_8xx || 40x
        select HAVE_ARCH_KGDB
        select IOMMU_HELPER                     if PPC64
        select IRQ_DOMAIN
        select IRQ_FORCED_THREADING
 +      select KASAN_VMALLOC                    if KASAN && MODULES
        select MMU_GATHER_PAGE_SIZE
        select MMU_GATHER_RCU_TABLE_FREE
        select MODULES_USE_ELF_RELA
@@@ -360,6 -358,10 +360,10 @@@ config ARCH_SUSPEND_NONZERO_CP
        def_bool y
        depends on PPC_POWERNV || PPC_PSERIES
  
+ config ARCH_HAS_ADD_PAGES
+       def_bool y
+       depends on ARCH_ENABLE_MEMORY_HOTPLUG
  config PPC_DCR_NATIVE
        bool
  
@@@ -447,7 -449,7 +451,7 @@@ choic
        default MATH_EMULATION_FULL
        depends on MATH_EMULATION
  
 -config        MATH_EMULATION_FULL
 +config MATH_EMULATION_FULL
        bool "Emulate all the floating point instructions"
        help
          Select this option will enable the kernel to support to emulate
@@@ -1250,7 -1252,7 +1254,7 @@@ config PHYSICAL_STAR
        default "0x00000000"
  endif
  
 -config        ARCH_RANDOM
 +config ARCH_RANDOM
        def_bool n
  
  config PPC_LIB_RHEAP
@@@ -42,7 -42,7 +42,7 @@@
  #include <asm/iommu.h>
  #include <asm/btext.h>
  #include <asm/sections.h>
 -#include <asm/machdep.h>
 +#include <asm/setup.h>
  #include <asm/asm-prototypes.h>
  #include <asm/ultravisor-api.h>
  
@@@ -2302,7 -2302,7 +2302,7 @@@ static void __init prom_init_stdout(voi
  
  static int __init prom_find_machine_type(void)
  {
-       char compat[256];
+       static char compat[256] __prombss;
        int len, i = 0;
  #ifdef CONFIG_PPC64
        phandle rtas;
diff --combined arch/powerpc/mm/mem.c
@@@ -25,7 -25,6 +25,7 @@@
  #include <asm/mmzone.h>
  #include <asm/ftrace.h>
  #include <asm/code-patching.h>
 +#include <asm/setup.h>
  
  #include <mm/mmu_decl.h>
  
@@@ -106,6 -105,37 +106,37 @@@ void __ref arch_remove_linear_mapping(u
        vm_unmap_aliases();
  }
  
+ /*
+  * After memory hotplug the variables max_pfn, max_low_pfn and high_memory need
+  * updating.
+  */
+ static void update_end_of_memory_vars(u64 start, u64 size)
+ {
+       unsigned long end_pfn = PFN_UP(start + size);
+       if (end_pfn > max_pfn) {
+               max_pfn = end_pfn;
+               max_low_pfn = end_pfn;
+               high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
+       }
+ }
+ int __ref add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
+                   struct mhp_params *params)
+ {
+       int ret;
+       ret = __add_pages(nid, start_pfn, nr_pages, params);
+       if (ret)
+               return ret;
+       /* update max_pfn, max_low_pfn and high_memory */
+       update_end_of_memory_vars(start_pfn << PAGE_SHIFT,
+                                 nr_pages << PAGE_SHIFT);
+       return ret;
+ }
  int __ref arch_add_memory(int nid, u64 start, u64 size,
                          struct mhp_params *params)
  {
        rc = arch_create_linear_mapping(nid, start, size, params);
        if (rc)
                return rc;
-       rc = __add_pages(nid, start_pfn, nr_pages, params);
+       rc = add_pages(nid, start_pfn, nr_pages, params);
        if (rc)
                arch_remove_linear_mapping(start, size);
        return rc;
@@@ -72,7 -72,6 +72,7 @@@
  #include <asm/svm.h>
  #include <asm/dtl.h>
  #include <asm/hvconsole.h>
 +#include <asm/setup.h>
  
  #include "pseries.h"
  
@@@ -803,8 -802,9 +803,8 @@@ static void __init pSeries_setup_arch(v
        fwnmi_init();
  
        pseries_setup_security_mitigations();
 -#ifdef CONFIG_PPC_64S_HASH_MMU
 -      pseries_lpar_read_hblkrm_characteristics();
 -#endif
 +      if (!radix_enabled())
 +              pseries_lpar_read_hblkrm_characteristics();
  
        /* By default, only probe PCI (can be overridden by rtas_pci) */
        pci_add_flags(PCI_PROBE_ONLY);
        }
  
        ppc_md.pcibios_root_bridge_prepare = pseries_root_bridge_prepare;
+       pseries_rng_init();
  }
  
  static void pseries_panic(char *str)