Merge tag 'powerpc-6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Mar 2024 00:53:48 +0000 (17:53 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 16 Mar 2024 00:53:48 +0000 (17:53 -0700)
Pull powerpc updates from Michael Ellerman:

 - Add AT_HWCAP3 and AT_HWCAP4 aux vector entries for future use
   by glibc

 - Add support for recognising the Power11 architected and raw PVRs

 - Add support for nr_cpus=n on the command line where the
   boot CPU is >= n

 - Add ppcxx_allmodconfig targets for all 32-bit sub-arches

 - Other small features, cleanups and fixes

Thanks to Akanksha J N, Brian King, Christophe Leroy, Dawei Li, Geoff
Levand, Greg Kroah-Hartman, Jan-Benedict Glaw, Kajol Jain, Kunwu Chan,
Li zeming, Madhavan Srinivasan, Masahiro Yamada, Nathan Chancellor,
Nicholas Piggin, Peter Bergner, Qiheng Lin, Randy Dunlap, Ricardo B.
Marliere, Rob Herring, Sathvika Vasireddy, Shrikanth Hegde, Uwe
Kleine-König, Vaibhav Jain, and Wen Xiong.

* tag 'powerpc-6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (71 commits)
  powerpc/macio: Make remove callback of macio driver void returned
  powerpc/83xx: Fix build failure with FPU=n
  powerpc/64s: Fix get_hugepd_cache_index() build failure
  powerpc/4xx: Fix warp_gpio_leds build failure
  powerpc/amigaone: Make several functions static
  powerpc/embedded6xx: Fix no previous prototype for avr_uart_send() etc.
  macintosh/adb: make adb_dev_class constant
  powerpc: xor_vmx: Add '-mhard-float' to CFLAGS
  powerpc/fsl: Fix mfpmr() asm constraint error
  powerpc: Remove cpu-as-y completely
  powerpc/fsl: Modernise mt/mfpmr
  powerpc/fsl: Fix mfpmr build errors with newer binutils
  powerpc/64s: Use .machine power4 around dcbt
  powerpc/64s: Move dcbt/dcbtst sequence into a macro
  powerpc/mm: Code cleanup for __hash_page_thp
  powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks
  powerpc/irq: Allow softirq to hardirq stack transition
  powerpc: Stop using of_root
  powerpc/machdep: Define 'compatibles' property in ppc_md and use it
  of: Reimplement of_machine_is_compatible() using of_machine_compatible_match()
  ...

117 files changed:
arch/powerpc/Makefile
arch/powerpc/boot/simple_alloc.c
arch/powerpc/configs/40x.config [new file with mode: 0644]
arch/powerpc/configs/44x.config [new file with mode: 0644]
arch/powerpc/configs/85xx-32bit.config
arch/powerpc/configs/8xx.config [new file with mode: 0644]
arch/powerpc/configs/ps3_defconfig
arch/powerpc/include/asm/book3s/64/hash.h
arch/powerpc/include/asm/book3s/64/pgtable-64k.h
arch/powerpc/include/asm/book3s/64/pgtable.h
arch/powerpc/include/asm/book3s/64/radix.h
arch/powerpc/include/asm/cputable.h
arch/powerpc/include/asm/ibmebus.h
arch/powerpc/include/asm/interrupt.h
arch/powerpc/include/asm/machdep.h
arch/powerpc/include/asm/macio.h
arch/powerpc/include/asm/mmu.h
arch/powerpc/include/asm/mpic.h
arch/powerpc/include/asm/paca.h
arch/powerpc/include/asm/ppc_asm.h
arch/powerpc/include/asm/reg.h
arch/powerpc/include/asm/reg_fsl_emb.h
arch/powerpc/include/asm/set_memory.h
arch/powerpc/include/asm/smp.h
arch/powerpc/include/asm/switch_to.h
arch/powerpc/include/asm/trace.h
arch/powerpc/include/asm/vio.h
arch/powerpc/include/asm/vmalloc.h
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/cpu_specs_book3s_64.h
arch/powerpc/kernel/dt_cpu_ftrs.c
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/kprobes.c
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/secure_boot.c
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/syscall.c
arch/powerpc/kernel/traps.c
arch/powerpc/kexec/ranges.c
arch/powerpc/kexec/relocate_32.S
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/lib/Makefile
arch/powerpc/lib/copypage_power7.S
arch/powerpc/lib/copyuser_power7.S
arch/powerpc/lib/memcpy_power7.S
arch/powerpc/lib/sstep.c
arch/powerpc/mm/book3s64/hash_hugepage.c
arch/powerpc/mm/book3s64/hash_utils.c
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/powerpc/mm/drmem.c
arch/powerpc/mm/mmu_decl.h
arch/powerpc/mm/numa.c
arch/powerpc/mm/pageattr.c
arch/powerpc/mm/pgtable_32.c
arch/powerpc/perf/core-book3s.c
arch/powerpc/perf/hv-gpci.c
arch/powerpc/perf/internal.h
arch/powerpc/perf/power10-pmu.c
arch/powerpc/platforms/40x/ppc40x_simple.c
arch/powerpc/platforms/44x/warp.c
arch/powerpc/platforms/512x/mpc512x_generic.c
arch/powerpc/platforms/52xx/efika.c
arch/powerpc/platforms/52xx/lite5200.c
arch/powerpc/platforms/52xx/mpc5200_simple.c
arch/powerpc/platforms/83xx/mpc830x_rdb.c
arch/powerpc/platforms/83xx/mpc831x_rdb.c
arch/powerpc/platforms/83xx/mpc837x_rdb.c
arch/powerpc/platforms/83xx/suspend.c
arch/powerpc/platforms/85xx/bsc913x_qds.c
arch/powerpc/platforms/85xx/bsc913x_rdb.c
arch/powerpc/platforms/85xx/corenet_generic.c
arch/powerpc/platforms/85xx/ge_imp3a.c
arch/powerpc/platforms/85xx/sgy_cts1000.c
arch/powerpc/platforms/85xx/tqm85xx.c
arch/powerpc/platforms/amigaone/setup.c
arch/powerpc/platforms/embedded6xx/linkstation.c
arch/powerpc/platforms/embedded6xx/mpc10x.h
arch/powerpc/platforms/pasemi/gpio_mdio.c
arch/powerpc/platforms/pasemi/pci.c
arch/powerpc/platforms/powermac/Kconfig
arch/powerpc/platforms/powermac/feature.c
arch/powerpc/platforms/powernv/opal-prd.c
arch/powerpc/platforms/ps3/hvcall.S
arch/powerpc/platforms/pseries/ibmebus.c
arch/powerpc/platforms/pseries/lparcfg.c
arch/powerpc/platforms/pseries/msi.c
arch/powerpc/platforms/pseries/papr_platform_attributes.c
arch/powerpc/platforms/pseries/papr_scm.c
arch/powerpc/platforms/pseries/setup.c
arch/powerpc/platforms/pseries/vio.c
arch/powerpc/sysdev/fsl_msi.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/pmi.c
arch/powerpc/xmon/xmon.c
drivers/ata/pata_macio.c
drivers/macintosh/adb.c
drivers/macintosh/macio_asic.c
drivers/macintosh/rack-meter.c
drivers/macintosh/therm_windtunnel.c
drivers/macintosh/windfarm_pm112.c
drivers/macintosh/windfarm_pm121.c
drivers/macintosh/windfarm_pm72.c
drivers/macintosh/windfarm_pm81.c
drivers/macintosh/windfarm_pm91.c
drivers/macintosh/windfarm_rm31.c
drivers/net/ethernet/apple/bmac.c
drivers/net/ethernet/apple/mace.c
drivers/of/base.c
drivers/scsi/mac53c94.c
drivers/scsi/mesh.c
drivers/tty/serial/pmac_zilog.c
include/linux/of.h
include/uapi/linux/auxvec.h
sound/aoa/soundbus/i2sbus/core.c
tools/testing/selftests/powerpc/copyloops/asm/ppc_asm.h

index 457cee9b03ee04a908d0856de193d79479a4ff8a..65261cbe5bfdbf79c90414a5ba3a158ae58abafe 100644 (file)
@@ -219,18 +219,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 # often slow when they are implemented at all
 KBUILD_CFLAGS          += $(call cc-option,-mno-string)
 
-cpu-as-$(CONFIG_ALTIVEC)       += $(call as-option,-Wa$(comma)-maltivec)
-
-# When using '-many -mpower4' gas will first try and find a matching power4
-# mnemonic and failing that it will allow any valid mnemonic that GAS knows
-# about. GCC will pass -many to GAS when assembling, clang does not.
-# LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLinux/linux/issues/675
-# but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
-cpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many)
-
-KBUILD_AFLAGS += $(cpu-as-y)
-KBUILD_CFLAGS += $(cpu-as-y)
-
 KBUILD_AFLAGS += $(aflags-y)
 KBUILD_CFLAGS += $(cflags-y)
 
@@ -314,6 +302,26 @@ ppc32_allmodconfig:
        $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
                -f $(srctree)/Makefile allmodconfig
 
+generated_configs += ppc40x_allmodconfig
+ppc40x_allmodconfig:
+       $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/40x.config \
+               -f $(srctree)/Makefile allmodconfig
+
+generated_configs += ppc44x_allmodconfig
+ppc44x_allmodconfig:
+       $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/44x.config \
+               -f $(srctree)/Makefile allmodconfig
+
+generated_configs += ppc8xx_allmodconfig
+ppc8xx_allmodconfig:
+       $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/8xx.config \
+               -f $(srctree)/Makefile allmodconfig
+
+generated_configs += ppc85xx_allmodconfig
+ppc85xx_allmodconfig:
+       $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-32bit.config \
+               -f $(srctree)/Makefile allmodconfig
+
 generated_configs += ppc_defconfig
 ppc_defconfig:
        $(call merge_into_defconfig,book3s_32.config,)
index 267d6524caac47d5897fec42fa1873d0740bc21a..d07796fdf91aa729610b248c7f722b7834568aeb 100644 (file)
@@ -112,8 +112,11 @@ static void *simple_realloc(void *ptr, unsigned long size)
                return ptr;
 
        new = simple_malloc(size);
-       memcpy(new, ptr, p->size);
-       simple_free(ptr);
+       if (new) {
+               memcpy(new, ptr, p->size);
+               simple_free(ptr);
+       }
+
        return new;
 }
 
diff --git a/arch/powerpc/configs/40x.config b/arch/powerpc/configs/40x.config
new file mode 100644 (file)
index 0000000..82a9d58
--- /dev/null
@@ -0,0 +1,2 @@
+CONFIG_PPC64=n
+CONFIG_40x=y
diff --git a/arch/powerpc/configs/44x.config b/arch/powerpc/configs/44x.config
new file mode 100644 (file)
index 0000000..79b7b19
--- /dev/null
@@ -0,0 +1,2 @@
+CONFIG_PPC64=n
+CONFIG_44x=y
index 6b8894d727a26a9b21144188ef8c7ccd62d21174..a85310bcb1fdd442ed4a2e616ee86f1a786c8db3 100644 (file)
@@ -1,3 +1,4 @@
+CONFIG_PPC64=n
 CONFIG_HIGHMEM=y
 CONFIG_KEXEC=y
 CONFIG_PPC_85xx=y
diff --git a/arch/powerpc/configs/8xx.config b/arch/powerpc/configs/8xx.config
new file mode 100644 (file)
index 0000000..7eb3ffb
--- /dev/null
@@ -0,0 +1,2 @@
+CONFIG_PPC64=n
+CONFIG_PPC_8xx=y
index aa8bb0208bcc8f05cf4d1cbe3df49853c48a351a..2b175ddf82f0bc61c3d811a528aae13eb79ce19a 100644 (file)
@@ -24,7 +24,6 @@ CONFIG_PS3_VRAM=m
 CONFIG_PS3_LPM=m
 # CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
 CONFIG_KEXEC=y
-# CONFIG_PPC64_BIG_ENDIAN_ELF_ABI_V2 is not set
 CONFIG_PPC_4K_PAGES=y
 CONFIG_SCHED_SMT=y
 CONFIG_PM=y
index 6e70ae51163189449205a54dde22ea966df655de..faf3e3b4e4b2be4567739b9ea3b8534e3f784ebd 100644 (file)
@@ -269,8 +269,6 @@ int hash__create_section_mapping(unsigned long start, unsigned long end,
                                 int nid, pgprot_t prot);
 int hash__remove_section_mapping(unsigned long start, unsigned long end);
 
-void hash__kernel_map_pages(struct page *page, int numpages, int enable);
-
 #endif /* !__ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_BOOK3S_64_HASH_H */
index 2fce3498b000e29541c33138fc625dfe7b95d7ab..ced7ee8b42fc354b48cc9d03ebbd295433024246 100644 (file)
@@ -45,9 +45,9 @@ static inline int hugepd_ok(hugepd_t hpd)
 /*
  * This should never get called
  */
-static inline int get_hugepd_cache_index(int index)
+static __always_inline int get_hugepd_cache_index(int index)
 {
-       BUG();
+       BUILD_BUG();
 }
 
 #endif /* CONFIG_HUGETLB_PAGE */
index df66dce8306fd7604cccedf6589cbac11f6f047c..fac5615e6bc5756857a5f980c31ca14331479522 100644 (file)
@@ -1027,16 +1027,6 @@ static inline void vmemmap_remove_mapping(unsigned long start,
 }
 #endif
 
-#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
-static inline void __kernel_map_pages(struct page *page, int numpages, int enable)
-{
-       if (radix_enabled())
-               radix__kernel_map_pages(page, numpages, enable);
-       else
-               hash__kernel_map_pages(page, numpages, enable);
-}
-#endif
-
 static inline pte_t pmd_pte(pmd_t pmd)
 {
        return __pte_raw(pmd_raw(pmd));
index 357e23a403d3413108e9084f07514c643d720774..8f55ff74bb680e4a21a40e022035528ab271b777 100644 (file)
@@ -362,8 +362,6 @@ int radix__create_section_mapping(unsigned long start, unsigned long end,
 int radix__remove_section_mapping(unsigned long start, unsigned long end);
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
-void radix__kernel_map_pages(struct page *page, int numpages, int enable);
-
 #ifdef CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
 #define vmemmap_can_optimize vmemmap_can_optimize
 bool vmemmap_can_optimize(struct vmem_altmap *altmap, struct dev_pagemap *pgmap);
index 8765d5158324e510c253505a1fd9aa9fe392199b..07a204d210344204a00a0d793077e868a4d664df 100644 (file)
@@ -454,6 +454,9 @@ static inline void cpu_feature_keys_init(void) { }
            CPU_FTR_ARCH_300 | CPU_FTR_ARCH_31 | \
            CPU_FTR_DAWR | CPU_FTR_DAWR1 | \
            CPU_FTR_DEXCR_NPHIE)
+
+#define CPU_FTRS_POWER11       CPU_FTRS_POWER10
+
 #define CPU_FTRS_CELL  (CPU_FTR_LWSYNC | \
            CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
            CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -542,19 +545,20 @@ enum {
 #define CPU_FTRS_DT_CPU_BASE   (~0ul)
 #endif
 
+/* pseries may disable DBELL with ibm,pi-features */
 #ifdef CONFIG_CPU_LITTLE_ENDIAN
 #define CPU_FTRS_ALWAYS \
-           (CPU_FTRS_POSSIBLE & ~CPU_FTR_HVMODE & CPU_FTRS_POWER7 & \
-            CPU_FTRS_POWER8E & CPU_FTRS_POWER8 & CPU_FTRS_POWER9 & \
-            CPU_FTRS_POWER9_DD2_1 & CPU_FTRS_POWER9_DD2_2 & \
+           (CPU_FTRS_POSSIBLE & ~CPU_FTR_HVMODE & ~CPU_FTR_DBELL & \
+            CPU_FTRS_POWER7 & CPU_FTRS_POWER8E & CPU_FTRS_POWER8 & \
+            CPU_FTRS_POWER9 & CPU_FTRS_POWER9_DD2_1 & CPU_FTRS_POWER9_DD2_2 & \
             CPU_FTRS_POWER10 & CPU_FTRS_DT_CPU_BASE)
 #else
 #define CPU_FTRS_ALWAYS                \
            (CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & \
             CPU_FTRS_POWER6 & CPU_FTRS_POWER7 & CPU_FTRS_CELL & \
             CPU_FTRS_PA6T & CPU_FTRS_POWER8 & CPU_FTRS_POWER8E & \
-            ~CPU_FTR_HVMODE & CPU_FTRS_POSSIBLE & CPU_FTRS_POWER9 & \
-            CPU_FTRS_POWER9_DD2_1 & CPU_FTRS_POWER9_DD2_2 & \
+            ~CPU_FTR_HVMODE & ~CPU_FTR_DBELL & CPU_FTRS_POSSIBLE & \
+            CPU_FTRS_POWER9 & CPU_FTRS_POWER9_DD2_1 & CPU_FTRS_POWER9_DD2_2 & \
             CPU_FTRS_POWER10 & CPU_FTRS_DT_CPU_BASE)
 #endif /* CONFIG_CPU_LITTLE_ENDIAN */
 #endif
index 6f33253a364ac0f8d375fc2aaa5831a387322073..46fe406f461ce13930d583eb647dc6d9f8998ff0 100644 (file)
@@ -48,7 +48,7 @@
 
 struct platform_driver;
 
-extern struct bus_type ibmebus_bus_type;
+extern const struct bus_type ibmebus_bus_type;
 
 int ibmebus_register_driver(struct platform_driver *drv);
 void ibmebus_unregister_driver(struct platform_driver *drv);
index a4196ab1d0167cea664b345dbbcbf8b145d43da6..7b610864b3645eeee706a9be4e91ba8c782558f5 100644 (file)
@@ -97,7 +97,7 @@ DECLARE_STATIC_KEY_FALSE(interrupt_exit_not_reentrant);
 
 static inline bool is_implicit_soft_masked(struct pt_regs *regs)
 {
-       if (regs->msr & MSR_PR)
+       if (user_mode(regs))
                return false;
 
        if (regs->nip >= (unsigned long)__end_soft_masked)
index d31a5ec1550d4b051dfce4c1680b3d62f43af3a7..1862f94335ee89c7c6bff8758b81ac380f506630 100644 (file)
@@ -22,6 +22,7 @@ struct pci_host_bridge;
 struct machdep_calls {
        const char      *name;
        const char      *compatible;
+       const char * const *compatibles;
 #ifdef CONFIG_PPC64
 #ifdef CONFIG_PM
        void            (*iommu_restore)(void);
index 3a07c62973aab6d7625d50051066ce2cc0929b3f..9203ff6acbf6811e56892cfc1cad6ee4acd794e8 100644 (file)
@@ -6,7 +6,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 
-extern struct bus_type macio_bus_type;
+extern const struct bus_type macio_bus_type;
 
 /* MacIO device driver is defined later */
 struct macio_driver;
@@ -126,7 +126,7 @@ static inline struct pci_dev *macio_get_pci_dev(struct macio_dev *mdev)
 struct macio_driver
 {
        int     (*probe)(struct macio_dev* dev, const struct of_device_id *match);
-       int     (*remove)(struct macio_dev* dev);
+       void    (*remove)(struct macio_dev *dev);
 
        int     (*suspend)(struct macio_dev* dev, pm_message_t state);
        int     (*resume)(struct macio_dev* dev);
index 24241995f7406e7f30b3b0b2b8537fb3f59e85f1..3b72c7ed24cfdeec454af137d99d01c7f718f044 100644 (file)
 #define MMU_FTRS_POWER8                MMU_FTRS_POWER6
 #define MMU_FTRS_POWER9                MMU_FTRS_POWER6
 #define MMU_FTRS_POWER10       MMU_FTRS_POWER6
+#define MMU_FTRS_POWER11       MMU_FTRS_POWER6
 #define MMU_FTRS_CELL          MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
                                MMU_FTR_CI_LARGE_PAGE
 #define MMU_FTRS_PA6T          MMU_FTRS_DEFAULT_HPTE_ARCH_V2 | \
index 58353c5bd3fba6e2b1549e05a6b4b8928b1c92af..0c03a98986cdea583ca5235d6e8a24c301e4a323 100644 (file)
@@ -336,7 +336,7 @@ struct mpic
 #endif
 };
 
-extern struct bus_type mpic_subsys;
+extern const struct bus_type mpic_subsys;
 
 /*
  * MPIC flags (passed to mpic_alloc)
index e667d455ecb418a5a96e13464512b0506defeb3e..1d58da9467396f268a1aac8b1d9461e570a97569 100644 (file)
@@ -163,9 +163,7 @@ struct paca_struct {
        u64 kstack;                     /* Saved Kernel stack addr */
        u64 saved_r1;                   /* r1 save for RTAS calls or PM or EE=0 */
        u64 saved_msr;                  /* MSR saved here by enter_rtas */
-#ifdef CONFIG_PPC64
        u64 exit_save_r1;               /* Syscall/interrupt R1 save */
-#endif
 #ifdef CONFIG_PPC_BOOK3E_64
        u16 trap_save;                  /* Used when bad stack is encountered */
 #endif
@@ -214,8 +212,6 @@ struct paca_struct {
        /* Non-maskable exceptions that are not performance critical */
        u64 exnmi[EX_SIZE];     /* used for system reset (nmi) */
        u64 exmc[EX_SIZE];      /* used for machine checks */
-#endif
-#ifdef CONFIG_PPC_BOOK3S_64
        /* Exclusive stacks for system reset and machine check exception. */
        void *nmi_emergency_sp;
        void *mc_emergency_sp;
index e7792aa135105ab00f7a563c0520b093845eb330..1d1018c1e4820ce62f9d0526f8860c81e1057a9e 100644 (file)
 
 #ifdef CONFIG_PPC64_ELF_ABI_V2
 #define STK_GOT                24
-#define __STK_PARAM(i) (32 + ((i)-3)*8)
+#define STK_PARAM_AREA 32
 #else
 #define STK_GOT                40
-#define __STK_PARAM(i) (48 + ((i)-3)*8)
+#define STK_PARAM_AREA 48
 #endif
+
+#define __STK_PARAM(i) (STK_PARAM_AREA + ((i)-3)*8)
 #define STK_PARAM(i)   __STK_PARAM(__REG_##i)
 
 #ifdef CONFIG_PPC64_ELF_ABI_V2
@@ -506,7 +508,25 @@ END_FTR_SECTION_NESTED(CPU_FTR_CELL_TB_BUG, CPU_FTR_CELL_TB_BUG, 96)
  */
 #define DCBT_BOOK3S_STOP_ALL_STREAM_IDS(scratch)       \
        lis     scratch,0x60000000@h;                   \
-       dcbt    0,scratch,0b01010
+       .machine push;                                  \
+       .machine power4;                                        \
+       dcbt    0,scratch,0b01010;                      \
+       .machine pop;
+
+#define DCBT_SETUP_STREAMS(from, from_parms, to, to_parms, scratch)    \
+       lis     scratch,0x8000; /* GO=1 */                              \
+       clrldi  scratch,scratch,32;                                     \
+       .machine push;                                                  \
+       .machine power4;                                                \
+       /* setup read stream 0 */                                       \
+       dcbt    0,from,0b01000;         /* addr from */                 \
+       dcbt    0,from_parms,0b01010;   /* length and depth from */     \
+       /* setup write stream 1 */                                      \
+       dcbtst  0,to,0b01000;           /* addr to */                   \
+       dcbtst  0,to_parms,0b01010;     /* length and depth to */       \
+       eieio;                                                          \
+       dcbt    0,scratch,0b01010;      /* all streams GO */            \
+       .machine pop;
 
 /*
  * toreal/fromreal/tophys/tovirt macros. 32-bit BookE makes them
index bb47af9054a9545f54bf5080a14bde235ef29a30..d3d1aea009b46b59135fc71c77b3b51576d1e997 100644 (file)
 #define PVR_HX_C2000   0x0066
 #define PVR_POWER9     0x004E
 #define PVR_POWER10    0x0080
+#define PVR_POWER11    0x0082
 #define PVR_BE         0x0070
 #define PVR_PA6T       0x0090
 
 #define PVR_ARCH_207   0x0f000004
 #define PVR_ARCH_300   0x0f000005
 #define PVR_ARCH_31    0x0f000006
+#define PVR_ARCH_31_P11        0x0f000007
 
 /* Macros for setting and retrieving special purpose registers */
 #ifndef __ASSEMBLY__
index a21f529c43d96b548690aeff283820ce07a6e4a1..9893d2001b6801db5b53d802454162d75748cbcf 100644 (file)
 
 #ifndef __ASSEMBLY__
 /* Performance Monitor Registers */
-#define mfpmr(rn)      ({unsigned int rval; \
-                       asm volatile("mfpmr %0," __stringify(rn) \
-                                    : "=r" (rval)); rval;})
-#define mtpmr(rn, v)   asm volatile("mtpmr " __stringify(rn) ",%0" : : "r" (v))
+static __always_inline unsigned int mfpmr(unsigned int rn)
+{
+       unsigned int rval;
+
+       asm (".machine push; "
+            ".machine e300; "
+            "mfpmr %[rval], %[rn];"
+            ".machine pop;"
+            : [rval] "=r" (rval) : [rn] "i" (rn));
+
+       return rval;
+}
+
+static __always_inline void mtpmr(unsigned int rn, unsigned int val)
+{
+       asm (".machine push; "
+            ".machine e300; "
+            "mtpmr %[rn], %[val];"
+            ".machine pop;"
+            : [val] "=r" (val) : [rn] "i" (rn));
+}
 #endif /* __ASSEMBLY__ */
 
 /* Freescale Book E Performance Monitor APU Registers */
index 7ebc807aa8cc85bc8ca6ac6a0c9ef13fa9de4fe6..9a025b776a4b3758a0cb35204687dea807987f55 100644 (file)
@@ -8,6 +8,7 @@
 #define SET_MEMORY_X   3
 #define SET_MEMORY_NP  4       /* Set memory non present */
 #define SET_MEMORY_P   5       /* Set memory present */
+#define SET_MEMORY_ROX 6
 
 int change_memory_attr(unsigned long addr, int numpages, long action);
 
@@ -41,4 +42,10 @@ static inline int set_memory_p(unsigned long addr, int numpages)
        return change_memory_attr(addr, numpages, SET_MEMORY_P);
 }
 
+static inline int set_memory_rox(unsigned long addr, int numpages)
+{
+       return change_memory_attr(addr, numpages, SET_MEMORY_ROX);
+}
+#define set_memory_rox set_memory_rox
+
 #endif
index aaaa576d0e154edc270a4dd9ddd8bd6bb877ee4a..b77927ccb0ab00aae57cc95eac1158739dd3ce5e 100644 (file)
@@ -27,6 +27,7 @@
 
 extern int boot_cpuid;
 extern int boot_cpu_hwid; /* PPC64 only */
+extern int boot_core_hwid;
 extern int spinning_secondaries;
 extern u32 *cpu_to_phys_id;
 extern bool coregroup_enabled;
index aee25e3ebf96017a108fefa46ab95761901ccabc..fc933807ddc840ffa065fcbf3153b87d3357efbc 100644 (file)
@@ -48,6 +48,10 @@ static inline void disable_kernel_fp(void)
 #else
 static inline void save_fpu(struct task_struct *t) { }
 static inline void flush_fp_to_thread(struct task_struct *t) { }
+static inline void enable_kernel_fp(void)
+{
+       BUILD_BUG();
+}
 #endif
 
 #ifdef CONFIG_ALTIVEC
index 82cc2c6704e6e94dde79e5fe98331ffb13e04681..d9ac3a4f46e1f86b0d0ec3ae6068de49f731217b 100644 (file)
@@ -267,6 +267,7 @@ TRACE_EVENT_FN(opal_exit,
 );
 #endif
 
+#ifdef CONFIG_PPC_64S_HASH_MMU
 TRACE_EVENT(hash_fault,
 
            TP_PROTO(unsigned long addr, unsigned long access, unsigned long trap),
@@ -286,7 +287,7 @@ TRACE_EVENT(hash_fault,
            TP_printk("hash fault with addr 0x%lx and access = 0x%lx trap = 0x%lx",
                      __entry->addr, __entry->access, __entry->trap)
 );
-
+#endif
 
 TRACE_EVENT(tlbie,
 
index cc9b787627adbc2104fd9edf3e3f84f8456f0cfa..6faf2a9317552eeed67b5f942bc0a363a58db9a9 100644 (file)
@@ -39,7 +39,7 @@
  */
 #define VIO_CMO_MIN_ENT 1562624
 
-extern struct bus_type vio_bus_type;
+extern const struct bus_type vio_bus_type;
 
 struct iommu_table;
 
index 4c69ece52a31e5ef874e4694fc94b2b0f6ec42d5..59ed89890c902bca0011611733f2cc219795bb20 100644 (file)
@@ -7,14 +7,14 @@
 #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
 
 #define arch_vmap_pud_supported arch_vmap_pud_supported
-static inline bool arch_vmap_pud_supported(pgprot_t prot)
+static __always_inline bool arch_vmap_pud_supported(pgprot_t prot)
 {
        /* HPT does not cope with large pages in the vmalloc area */
        return radix_enabled();
 }
 
 #define arch_vmap_pmd_supported arch_vmap_pmd_supported
-static inline bool arch_vmap_pmd_supported(pgprot_t prot)
+static __always_inline bool arch_vmap_pmd_supported(pgprot_t prot)
 {
        return radix_enabled();
 }
index 2919433be35574eb26e687b637c19e2529e88055..d3282fbea4f2f5c3733068e950a050cb97d70bb9 100644 (file)
@@ -55,7 +55,6 @@ CFLAGS_btext.o += -DDISABLE_BRANCH_PROFILING
 endif
 
 KCSAN_SANITIZE_early_32.o := n
-KCSAN_SANITIZE_early_64.o := n
 KCSAN_SANITIZE_cputable.o := n
 KCSAN_SANITIZE_btext.o := n
 KCSAN_SANITIZE_paca.o := n
index 9f14d95b8b32fd38ce180b9abe082a42b1f51cfd..f029755f9e69af897dbf2bd456dd335e99e3ac04 100644 (file)
@@ -246,9 +246,7 @@ int main(void)
        OFFSET(PACAHWCPUID, paca_struct, hw_cpu_id);
        OFFSET(PACAKEXECSTATE, paca_struct, kexec_state);
        OFFSET(PACA_DSCR_DEFAULT, paca_struct, dscr_default);
-#ifdef CONFIG_PPC64
        OFFSET(PACA_EXIT_SAVE_R1, paca_struct, exit_save_r1);
-#endif
 #ifdef CONFIG_PPC_BOOK3E_64
        OFFSET(PACA_TRAP_SAVE, paca_struct, trap_save);
 #endif
index 3ff9757df4c0723008b655830fbed89b4e078e57..98d4274a1b6bf935239c50e6e12c63b2ba03cac3 100644 (file)
@@ -60,6 +60,9 @@
                                 PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
                                 PPC_FEATURE2_VEC_CRYPTO)
 
+#define COMMON_USER_POWER11    COMMON_USER_POWER10
+#define COMMON_USER2_POWER11   COMMON_USER2_POWER10
+
 static struct cpu_spec cpu_specs[] __initdata = {
        {       /* PPC970 */
                .pvr_mask               = 0xffff0000,
@@ -281,6 +284,20 @@ static struct cpu_spec cpu_specs[] __initdata = {
                .cpu_restore            = __restore_cpu_power10,
                .platform               = "power10",
        },
+       {       /* 3.1-compliant processor, i.e. Power11 "architected" mode */
+               .pvr_mask               = 0xffffffff,
+               .pvr_value              = 0x0f000007,
+               .cpu_name               = "Power11 (architected)",
+               .cpu_features           = CPU_FTRS_POWER11,
+               .cpu_user_features      = COMMON_USER_POWER11,
+               .cpu_user_features2     = COMMON_USER2_POWER11,
+               .mmu_features           = MMU_FTRS_POWER11,
+               .icache_bsize           = 128,
+               .dcache_bsize           = 128,
+               .cpu_setup              = __setup_cpu_power10,
+               .cpu_restore            = __restore_cpu_power10,
+               .platform               = "power11",
+       },
        {       /* Power7 */
                .pvr_mask               = 0xffff0000,
                .pvr_value              = 0x003f0000,
@@ -451,6 +468,23 @@ static struct cpu_spec cpu_specs[] __initdata = {
                .machine_check_early    = __machine_check_early_realmode_p10,
                .platform               = "power10",
        },
+       {       /* Power11 */
+               .pvr_mask               = 0xffff0000,
+               .pvr_value              = 0x00820000,
+               .cpu_name               = "Power11 (raw)",
+               .cpu_features           = CPU_FTRS_POWER11,
+               .cpu_user_features      = COMMON_USER_POWER11,
+               .cpu_user_features2     = COMMON_USER2_POWER11,
+               .mmu_features           = MMU_FTRS_POWER11,
+               .icache_bsize           = 128,
+               .dcache_bsize           = 128,
+               .num_pmcs               = 6,
+               .pmc_type               = PPC_PMC_IBM,
+               .cpu_setup              = __setup_cpu_power10,
+               .cpu_restore            = __restore_cpu_power10,
+               .machine_check_early    = __machine_check_early_realmode_p10,
+               .platform               = "power11",
+       },
        {       /* Cell Broadband Engine */
                .pvr_mask               = 0xffff0000,
                .pvr_value              = 0x00700000,
index c3fb9fdf5bd782e121571efd679e812a4540b2a5..af4263594eb2c93c5b1d1240acf4aae161c24edd 100644 (file)
@@ -458,6 +458,14 @@ static int __init feat_enable_mce_power10(struct dt_cpu_feature *f)
        return 1;
 }
 
+static int __init feat_enable_mce_power11(struct dt_cpu_feature *f)
+{
+       cur_cpu_spec->platform = "power11";
+       cur_cpu_spec->machine_check_early = __machine_check_early_realmode_p10;
+
+       return 1;
+}
+
 static int __init feat_enable_tm(struct dt_cpu_feature *f)
 {
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
@@ -648,8 +656,10 @@ static struct dt_cpu_feature_match __initdata
        {"pc-relative-addressing", feat_enable, 0},
        {"machine-check-power9", feat_enable_mce_power9, 0},
        {"machine-check-power10", feat_enable_mce_power10, 0},
+       {"machine-check-power11", feat_enable_mce_power11, 0},
        {"performance-monitor-power9", feat_enable_pmu_power9, 0},
        {"performance-monitor-power10", feat_enable_pmu_power10, 0},
+       {"performance-monitor-power11", feat_enable_pmu_power10, 0},
        {"event-based-branch-v3", feat_enable, 0},
        {"random-number-generator", feat_enable, 0},
        {"system-call-vectored", feat_disable, 0},
index 6f7d4edaa0bc1518c432eb2bfd98064fb37e0ecb..7504ceec5c58c782754113dc1e476d1b22dd8ccb 100644 (file)
@@ -284,15 +284,14 @@ static __always_inline void call_do_irq(struct pt_regs *regs, void *sp)
 void __do_IRQ(struct pt_regs *regs)
 {
        struct pt_regs *old_regs = set_irq_regs(regs);
-       void *cursp, *irqsp, *sirqsp;
+       void *cursp, *irqsp;
 
        /* Switch to the irq stack to handle this */
        cursp = (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
        irqsp = hardirq_ctx[raw_smp_processor_id()];
-       sirqsp = softirq_ctx[raw_smp_processor_id()];
 
        /* Already there ? If not switch stack and call */
-       if (unlikely(cursp == irqsp || cursp == sirqsp))
+       if (unlikely(cursp == irqsp))
                __do_irq(regs, current_stack_pointer);
        else
                call_do_irq(regs, irqsp);
index b20ee72e873a1b881283ded2c8ffef94acf187f7..bbca90a5e2ec07a59903b87bf2d50f6a194235fd 100644 (file)
@@ -134,10 +134,16 @@ void *alloc_insn_page(void)
        if (!page)
                return NULL;
 
-       if (strict_module_rwx_enabled())
-               set_memory_rox((unsigned long)page, 1);
+       if (strict_module_rwx_enabled()) {
+               int err = set_memory_rox((unsigned long)page, 1);
 
+               if (err)
+                       goto error;
+       }
        return page;
+error:
+       module_memfree(page);
+       return NULL;
 }
 
 int arch_prepare_kprobe(struct kprobe *p)
index 0b5878c3125b1cd67ff3f44cedf83d514478c262..1dc32a05815612b4fb45f64f163f6eea94438fe5 100644 (file)
@@ -151,6 +151,9 @@ static void __init move_device_tree(void)
  * pa-features property is missing, or a 1/0 to indicate if the feature
  * is supported/not supported.  Note that the bit numbers are
  * big-endian to match the definition in PAPR.
+ * Note: the 'clear' flag clears the feature if the bit is set in the
+ * ibm,pa/pi-features property, it does not set the feature if the
+ * bit is clear.
  */
 struct ibm_feature {
        unsigned long   cpu_features;   /* CPU_FTR_xxx bit */
@@ -159,7 +162,7 @@ struct ibm_feature {
        unsigned int    cpu_user_ftrs2; /* PPC_FEATURE2_xxx bit */
        unsigned char   pabyte;         /* byte number in ibm,pa/pi-features */
        unsigned char   pabit;          /* bit number (big-endian) */
-       unsigned char   invert;         /* if 1, pa bit set => clear feature */
+       unsigned char   clear;          /* if 1, pa bit set => clear feature */
 };
 
 static struct ibm_feature ibm_pa_features[] __initdata = {
@@ -193,6 +196,7 @@ static struct ibm_feature ibm_pa_features[] __initdata = {
  */
 static struct ibm_feature ibm_pi_features[] __initdata = {
        { .pabyte = 0, .pabit = 3, .mmu_features  = MMU_FTR_NX_DSI },
+       { .pabyte = 0, .pabit = 4, .cpu_features  = CPU_FTR_DBELL, .clear = 1 },
 };
 
 static void __init scan_features(unsigned long node, const unsigned char *ftrs,
@@ -220,12 +224,12 @@ static void __init scan_features(unsigned long node, const unsigned char *ftrs,
                if (fp->pabyte >= ftrs[0])
                        continue;
                bit = (ftrs[2 + fp->pabyte] >> (7 - fp->pabit)) & 1;
-               if (bit ^ fp->invert) {
+               if (bit && !fp->clear) {
                        cur_cpu_spec->cpu_features |= fp->cpu_features;
                        cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs;
                        cur_cpu_spec->cpu_user_features2 |= fp->cpu_user_ftrs2;
                        cur_cpu_spec->mmu_features |= fp->mmu_features;
-               } else {
+               } else if (bit == fp->clear) {
                        cur_cpu_spec->cpu_features &= ~fp->cpu_features;
                        cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs;
                        cur_cpu_spec->cpu_user_features2 &= ~fp->cpu_user_ftrs2;
@@ -368,13 +372,31 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
        if (found < 0)
                return 0;
 
-       DBG("boot cpu: logical %d physical %d\n", found,
-           be32_to_cpu(intserv[found_thread]));
        boot_cpuid = found;
 
        if (IS_ENABLED(CONFIG_PPC64))
                boot_cpu_hwid = be32_to_cpu(intserv[found_thread]);
 
+       if (nr_cpu_ids % nthreads != 0) {
+               set_nr_cpu_ids(ALIGN(nr_cpu_ids, nthreads));
+               pr_warn("nr_cpu_ids was not a multiple of threads_per_core, adjusted to %d\n",
+                       nr_cpu_ids);
+       }
+
+       if (boot_cpuid >= nr_cpu_ids) {
+               // Remember boot core for smp_setup_cpu_maps()
+               boot_core_hwid = be32_to_cpu(intserv[0]);
+
+               pr_warn("Boot CPU %d (core hwid %d) >= nr_cpu_ids, adjusted boot CPU to %d\n",
+                       boot_cpuid, boot_core_hwid, found_thread);
+
+               // Adjust boot CPU to appear on logical core 0
+               boot_cpuid = found_thread;
+       }
+
+       DBG("boot cpu: logical %d physical %d\n", boot_cpuid,
+           be32_to_cpu(intserv[found_thread]));
+
        /*
         * PAPR defines "logical" PVR values for cpus that
         * meet various levels of the architecture:
index e67effdba85cc03096132223ad9c4d7dbc698f58..0ef358285337412f14dcf073282bca863dc88949 100644 (file)
@@ -947,7 +947,7 @@ struct option_vector7 {
 } __packed;
 
 struct ibm_arch_vec {
-       struct { __be32 mask, val; } pvrs[14];
+       struct { __be32 mask, val; } pvrs[16];
 
        u8 num_vectors;
 
@@ -1007,6 +1007,14 @@ static const struct ibm_arch_vec ibm_architecture_vec_template __initconst = {
                        .mask = cpu_to_be32(0xffff0000), /* POWER10 */
                        .val  = cpu_to_be32(0x00800000),
                },
+               {
+                       .mask = cpu_to_be32(0xffff0000), /* POWER11 */
+                       .val  = cpu_to_be32(0x00820000),
+               },
+               {
+                       .mask = cpu_to_be32(0xffffffff), /* P11 compliant */
+                       .val  = cpu_to_be32(0x0f000007),
+               },
                {
                        .mask = cpu_to_be32(0xffffffff), /* all 3.1-compliant */
                        .val  = cpu_to_be32(0x0f000006),
index f9af305d9579dc0c359f84cfc3fee9dbd3e1fb80..9e0efb657f3937a3550d7625ba8558e49cdc8a07 100644 (file)
@@ -32,8 +32,10 @@ bool is_ppc_secureboot_enabled(void)
        if (enabled)
                goto out;
 
-       if (!of_property_read_u32(of_root, "ibm,secure-boot", &secureboot))
+       node = of_find_node_by_path("/");
+       if (!of_property_read_u32(node, "ibm,secure-boot", &secureboot))
                enabled = (secureboot > 1);
+       of_node_put(node);
 
 out:
        pr_info("Secure boot mode %s\n", enabled ? "enabled" : "disabled");
@@ -54,8 +56,10 @@ bool is_ppc_trustedboot_enabled(void)
        if (enabled)
                goto out;
 
-       if (!of_property_read_u32(of_root, "ibm,trusted-boot", &trustedboot))
+       node = of_find_node_by_path("/");
+       if (!of_property_read_u32(node, "ibm,trusted-boot", &trustedboot))
                enabled = (trustedboot > 0);
+       of_node_put(node);
 
 out:
        pr_info("Trusted boot mode %s\n", enabled ? "enabled" : "disabled");
index 733f210ffda1feab8cade96c0f7bb4b065886fdc..2add292da49432ee8db5ff5bad9b70871d7f4f48 100644 (file)
@@ -85,6 +85,7 @@ EXPORT_SYMBOL(machine_id);
 
 int boot_cpuid = -1;
 EXPORT_SYMBOL_GPL(boot_cpuid);
+int __initdata boot_core_hwid = -1;
 
 #ifdef CONFIG_PPC64
 int boot_cpu_hwid = -1;
@@ -411,6 +412,25 @@ static void __init cpu_init_thread_core_maps(int tpc)
 
 u32 *cpu_to_phys_id = NULL;
 
+static int assign_threads(unsigned int cpu, unsigned int nthreads, bool present,
+                         const __be32 *hw_ids)
+{
+       for (int i = 0; i < nthreads && cpu < nr_cpu_ids; i++) {
+               __be32 hwid;
+
+               hwid = be32_to_cpu(hw_ids[i]);
+
+               DBG("    thread %d -> cpu %d (hard id %d)\n", i, cpu, hwid);
+
+               set_cpu_present(cpu, present);
+               set_cpu_possible(cpu, true);
+               cpu_to_phys_id[cpu] = hwid;
+               cpu++;
+       }
+
+       return cpu;
+}
+
 /**
  * setup_cpu_maps - initialize the following cpu maps:
  *                  cpu_possible_mask
@@ -446,7 +466,7 @@ void __init smp_setup_cpu_maps(void)
        for_each_node_by_type(dn, "cpu") {
                const __be32 *intserv;
                __be32 cpu_be;
-               int j, len;
+               int len;
 
                DBG("  * %pOF...\n", dn);
 
@@ -468,27 +488,31 @@ void __init smp_setup_cpu_maps(void)
 
                nthreads = len / sizeof(int);
 
-               for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
-                       bool avail;
-
-                       DBG("    thread %d -> cpu %d (hard id %d)\n",
-                           j, cpu, be32_to_cpu(intserv[j]));
+               bool avail = of_device_is_available(dn);
+               if (!avail)
+                       avail = !of_property_match_string(dn,
+                                       "enable-method", "spin-table");
 
-                       avail = of_device_is_available(dn);
-                       if (!avail)
-                               avail = !of_property_match_string(dn,
-                                               "enable-method", "spin-table");
-
-                       set_cpu_present(cpu, avail);
-                       set_cpu_possible(cpu, true);
-                       cpu_to_phys_id[cpu] = be32_to_cpu(intserv[j]);
-                       cpu++;
-               }
+               if (boot_core_hwid >= 0) {
+                       if (cpu == 0) {
+                               pr_info("Skipping CPU node %pOF to allow for boot core.\n", dn);
+                               cpu = nthreads;
+                               continue;
+                       }
 
-               if (cpu >= nr_cpu_ids) {
+                       if (be32_to_cpu(intserv[0]) == boot_core_hwid) {
+                               pr_info("Renumbered boot core %pOF to logical 0\n", dn);
+                               assign_threads(0, nthreads, avail, intserv);
+                               of_node_put(dn);
+                               break;
+                       }
+               } else if (cpu >= nr_cpu_ids) {
                        of_node_put(dn);
                        break;
                }
+
+               if (cpu < nr_cpu_ids)
+                       cpu = assign_threads(cpu, nthreads, avail, intserv);
        }
 
        /* If no SMT supported, nthreads is forced to 1 */
@@ -616,6 +640,8 @@ static __init void probe_machine(void)
                DBG("  %s ...\n", machine_id->name);
                if (machine_id->compatible && !of_machine_is_compatible(machine_id->compatible))
                        continue;
+               if (machine_id->compatibles && !of_machine_compatible_match(machine_id->compatibles))
+                       continue;
                memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
                if (ppc_md.probe && !ppc_md.probe())
                        continue;
index 77fedb190c936c77eb6dcdf872721caac82b7368..f6f868e817e636f7c1327feb13935ecff49d57d5 100644 (file)
@@ -31,7 +31,7 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0)
        user_exit_irqoff();
 
        BUG_ON(regs_is_unrecoverable(regs));
-       BUG_ON(!(regs->msr & MSR_PR));
+       BUG_ON(!user_mode(regs));
        BUG_ON(arch_irq_disabled_regs(regs));
 
 #ifdef CONFIG_PPC_PKEY
index 11e062b47d3f80681cb0362f85cfa7ca7fcda7f6..f23430adb68ad7fecb70a31e1443e8a02d75f824 100644 (file)
@@ -404,7 +404,7 @@ noinstr void hv_nmi_check_nonrecoverable(struct pt_regs *regs)
                return;
        if (!(regs->msr & MSR_HV))
                return;
-       if (regs->msr & MSR_PR)
+       if (user_mode(regs))
                return;
 
        /*
@@ -1510,7 +1510,7 @@ static void do_program_check(struct pt_regs *regs)
                if (!is_kernel_addr(bugaddr) && !(regs->msr & MSR_IR))
                        bugaddr += PAGE_OFFSET;
 
-               if (!(regs->msr & MSR_PR) &&  /* not user-mode */
+               if (!user_mode(regs) &&
                    report_bug(bugaddr, regs) == BUG_TRAP_TYPE_WARN) {
                        regs_add_return_ip(regs, 4);
                        return;
index fb3e12f1521441fd9de9c84c3863a719dcb6c62b..33b780049aaf9331e798d9a660d963e583ab1a68 100644 (file)
@@ -385,14 +385,16 @@ int add_opal_mem_range(struct crash_mem **mem_ranges)
 int add_reserved_mem_ranges(struct crash_mem **mem_ranges)
 {
        int n_mem_addr_cells, n_mem_size_cells, i, len, cells, ret = 0;
+       struct device_node *root = of_find_node_by_path("/");
        const __be32 *prop;
 
-       prop = of_get_property(of_root, "reserved-ranges", &len);
+       prop = of_get_property(root, "reserved-ranges", &len);
+       n_mem_addr_cells = of_n_addr_cells(root);
+       n_mem_size_cells = of_n_size_cells(root);
+       of_node_put(root);
        if (!prop)
                return 0;
 
-       n_mem_addr_cells = of_n_addr_cells(of_root);
-       n_mem_size_cells = of_n_size_cells(of_root);
        cells = n_mem_addr_cells + n_mem_size_cells;
 
        /* Each reserved range is an (address,size) pair */
index d9f0dd9b34ffbfcb9cc6274bed12dfa3886ebef1..104c9911f40611960b8d6b077553920f4cfb9d66 100644 (file)
@@ -8,6 +8,7 @@
  *             Author: Suzuki Poulose <suzuki@in.ibm.com>
  */
 
+#include <linux/objtool.h>
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/mmu.h>
@@ -349,6 +350,7 @@ write_utlb:
        cmpwi   r10, PPC47x_TLB0_4K
        bne     0f
        li      r10, 0x1000                     /* r10 = 4k */
+       ANNOTATE_INTRA_FUNCTION_CALL
        bl      1f
 
 0:
index 0b921704da45eb6b718cac8f031c5d0c45176746..8e86eb577eb8e1462bc04e46fd23416df2c455a3 100644 (file)
@@ -444,6 +444,7 @@ static int kvmppc_set_arch_compat(struct kvm_vcpu *vcpu, u32 arch_compat)
                        guest_pcr_bit = PCR_ARCH_300;
                        break;
                case PVR_ARCH_31:
+               case PVR_ARCH_31_P11:
                        guest_pcr_bit = PCR_ARCH_31;
                        break;
                default:
index 6eac63e79a89957ae98337f407b33db3f7beff93..0ab65eeb93ee3a73346a2d9e7b4e5617f6b40ed3 100644 (file)
@@ -76,7 +76,7 @@ obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
 obj-$(CONFIG_FTR_FIXUP_SELFTEST) += feature-fixups-test.o
 
 obj-$(CONFIG_ALTIVEC)  += xor_vmx.o xor_vmx_glue.o
-CFLAGS_xor_vmx.o += -maltivec $(call cc-option,-mabi=altivec)
+CFLAGS_xor_vmx.o += -mhard-float -maltivec $(call cc-option,-mabi=altivec)
 # Enable <altivec.h>
 CFLAGS_xor_vmx.o += -isystem $(shell $(CC) -print-file-name=include)
 
index a783973f1215b526d136c49254102520ffb67a7b..07e7cec4d135fd5648ab9a0d7d93827440ebb2ac 100644 (file)
@@ -27,17 +27,7 @@ _GLOBAL(copypage_power7)
 #endif
        ori     r10,r7,1        /* stream=1 */
 
-       lis     r8,0x8000       /* GO=1 */
-       clrldi  r8,r8,32
-
-       /* setup read stream 0  */
-       dcbt    0,r4,0b01000    /* addr from */
-       dcbt    0,r7,0b01010   /* length and depth from */
-       /* setup write stream 1 */
-       dcbtst  0,r9,0b01000   /* addr to */
-       dcbtst  0,r10,0b01010  /* length and depth to */
-       eieio
-       dcbt    0,r8,0b01010    /* all streams GO */
+       DCBT_SETUP_STREAMS(r4, r7, r9, r10, r8)
 
 #ifdef CONFIG_ALTIVEC
        mflr    r0
index ac41053c3a5af09549a80db401ea5e830dc7c8fe..8474c682a17849a29a3dfcb3af6544fc1e8909c6 100644 (file)
@@ -298,17 +298,7 @@ err1;      stb     r0,0(r3)
        or      r7,r7,r0
        ori     r10,r7,1        /* stream=1 */
 
-       lis     r8,0x8000       /* GO=1 */
-       clrldi  r8,r8,32
-
-       /* setup read stream 0 */
-       dcbt    0,r6,0b01000   /* addr from */
-       dcbt    0,r7,0b01010   /* length and depth from */
-       /* setup write stream 1 */
-       dcbtst  0,r9,0b01000   /* addr to */
-       dcbtst  0,r10,0b01010  /* length and depth to */
-       eieio
-       dcbt    0,r8,0b01010    /* all streams GO */
+       DCBT_SETUP_STREAMS(r6, r7, r9, r10, r8)
 
        beq     cr1,.Lunwind_stack_nonvmx_copy
 
index 9398b2b746c4dacad1e1fc24c85f5f8fa25b22b1..b7c5e7fca8b9f5fb2fc46e7acb9d817c74b4ac24 100644 (file)
@@ -244,15 +244,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
        or      r7,r7,r0
        ori     r10,r7,1        /* stream=1 */
 
-       lis     r8,0x8000       /* GO=1 */
-       clrldi  r8,r8,32
-
-       dcbt    0,r6,0b01000
-       dcbt    0,r7,0b01010
-       dcbtst  0,r9,0b01000
-       dcbtst  0,r10,0b01010
-       eieio
-       dcbt    0,r8,0b01010    /* GO */
+       DCBT_SETUP_STREAMS(r6, r7, r9, r10, r8)
 
        beq     cr1,.Lunwind_stack_nonvmx_copy
 
index 5766180f5380a6f2b8f90c4f31de3019991bf65f..e65f3fb68d06ba34becf08157e63697fe1561050 100644 (file)
@@ -1429,7 +1429,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
                        return 1;
 
                case 18:        /* rfid, scary */
-                       if (regs->msr & MSR_PR)
+                       if (user_mode(regs))
                                goto priv;
                        op->type = RFI;
                        return 0;
@@ -1742,13 +1742,13 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
                        return 1;
 #endif
                case 83:        /* mfmsr */
-                       if (regs->msr & MSR_PR)
+                       if (user_mode(regs))
                                goto priv;
                        op->type = MFMSR;
                        op->reg = rd;
                        return 0;
                case 146:       /* mtmsr */
-                       if (regs->msr & MSR_PR)
+                       if (user_mode(regs))
                                goto priv;
                        op->type = MTMSR;
                        op->reg = rd;
@@ -1756,7 +1756,7 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
                        return 0;
 #ifdef CONFIG_PPC64
                case 178:       /* mtmsrd */
-                       if (regs->msr & MSR_PR)
+                       if (user_mode(regs))
                                goto priv;
                        op->type = MTMSR;
                        op->reg = rd;
@@ -3437,14 +3437,14 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op)
                 * stored in the thread_struct.  If the instruction is in
                 * the kernel, we must not touch the state in the thread_struct.
                 */
-               if (!(regs->msr & MSR_PR) && !(regs->msr & MSR_FP))
+               if (!user_mode(regs) && !(regs->msr & MSR_FP))
                        return 0;
                err = do_fp_load(op, ea, regs, cross_endian);
                break;
 #endif
 #ifdef CONFIG_ALTIVEC
        case LOAD_VMX:
-               if (!(regs->msr & MSR_PR) && !(regs->msr & MSR_VEC))
+               if (!user_mode(regs) && !(regs->msr & MSR_VEC))
                        return 0;
                err = do_vec_load(op->reg, ea, size, regs, cross_endian);
                break;
@@ -3459,7 +3459,7 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op)
                 */
                if (op->reg >= 32 && (op->vsx_flags & VSX_CHECK_VEC))
                        msrbit = MSR_VEC;
-               if (!(regs->msr & MSR_PR) && !(regs->msr & msrbit))
+               if (!user_mode(regs) && !(regs->msr & msrbit))
                        return 0;
                err = do_vsx_load(op, ea, regs, cross_endian);
                break;
@@ -3495,8 +3495,7 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op)
                }
 #endif
                if ((op->type & UPDATE) && size == sizeof(long) &&
-                   op->reg == 1 && op->update_reg == 1 &&
-                   !(regs->msr & MSR_PR) &&
+                   op->reg == 1 && op->update_reg == 1 && !user_mode(regs) &&
                    ea >= regs->gpr[1] - STACK_INT_FRAME_SIZE) {
                        err = handle_stack_update(ea, regs);
                        break;
@@ -3508,14 +3507,14 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op)
 
 #ifdef CONFIG_PPC_FPU
        case STORE_FP:
-               if (!(regs->msr & MSR_PR) && !(regs->msr & MSR_FP))
+               if (!user_mode(regs) && !(regs->msr & MSR_FP))
                        return 0;
                err = do_fp_store(op, ea, regs, cross_endian);
                break;
 #endif
 #ifdef CONFIG_ALTIVEC
        case STORE_VMX:
-               if (!(regs->msr & MSR_PR) && !(regs->msr & MSR_VEC))
+               if (!user_mode(regs) && !(regs->msr & MSR_VEC))
                        return 0;
                err = do_vec_store(op->reg, ea, size, regs, cross_endian);
                break;
@@ -3530,7 +3529,7 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op)
                 */
                if (op->reg >= 32 && (op->vsx_flags & VSX_CHECK_VEC))
                        msrbit = MSR_VEC;
-               if (!(regs->msr & MSR_PR) && !(regs->msr & msrbit))
+               if (!user_mode(regs) && !(regs->msr & msrbit))
                        return 0;
                err = do_vsx_store(op, ea, regs, cross_endian);
                break;
index c0fabe6c5a12d719f55162698bbace9d38e11f54..15d6f3ea717878707cbdcc4119a1c29d8b072be0 100644 (file)
@@ -59,16 +59,13 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
 
        rflags = htab_convert_pte_flags(new_pmd, flags);
 
-#if 0
-       if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
+       /*
+        * THPs are only supported on platforms that can do mixed page size
+        * segments (MPSS) and all such platforms have coherent icache. Hence we
+        * don't need to do lazy icache flush (hash_page_do_lazy_icache()) on
+        * noexecute fault.
+        */
 
-               /*
-                * No CPU has hugepages but lacks no execute, so we
-                * don't need to worry about that case
-                */
-               rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
-       }
-#endif
        /*
         * Find the slot index details for this ea, using base page size.
         */
index 0626a25b0d728be1a33aa36012327f1ddc71374f..01c3b4b652410904a06fb45721233ee84d6fbe3b 100644 (file)
@@ -2172,7 +2172,7 @@ static void kernel_unmap_linear_page(unsigned long vaddr, unsigned long lmi)
                                     mmu_kernel_ssize, 0);
 }
 
-void hash__kernel_map_pages(struct page *page, int numpages, int enable)
+int hash__kernel_map_pages(struct page *page, int numpages, int enable)
 {
        unsigned long flags, vaddr, lmi;
        int i;
@@ -2189,6 +2189,7 @@ void hash__kernel_map_pages(struct page *page, int numpages, int enable)
                        kernel_unmap_linear_page(vaddr, lmi);
        }
        local_irq_restore(flags);
+       return 0;
 }
 #endif /* CONFIG_DEBUG_PAGEALLOC || CONFIG_KFENCE */
 
index 5cc4008329be79d521c961d277df3ae79fed9093..15e88f1439ec207e762217a1f09f2f9ffa582b6a 100644 (file)
@@ -1339,20 +1339,6 @@ void __ref radix__vmemmap_free(unsigned long start, unsigned long end,
 #endif
 #endif
 
-#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
-void radix__kernel_map_pages(struct page *page, int numpages, int enable)
-{
-       unsigned long addr;
-
-       addr = (unsigned long)page_address(page);
-
-       if (enable)
-               set_memory_p(addr, numpages);
-       else
-               set_memory_np(addr, numpages);
-}
-#endif
-
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
 
 unsigned long radix__pmd_hugepage_update(struct mm_struct *mm, unsigned long addr,
index fde7790277f75045576e706909a21e89e4111658..c110ab8fa8a35e8a2ad49b64636a13eca65a1b58 100644 (file)
@@ -393,17 +393,17 @@ static const __be32 *of_get_usable_memory(struct device_node *dn)
 int walk_drmem_lmbs(struct device_node *dn, void *data,
                    int (*func)(struct drmem_lmb *, const __be32 **, void *))
 {
+       struct device_node *root = of_find_node_by_path("/");
        const __be32 *prop, *usm;
        int ret = -ENODEV;
 
-       if (!of_root)
+       if (!root)
                return ret;
 
        /* Get the address & size cells */
-       of_node_get(of_root);
-       n_root_addr_cells = of_n_addr_cells(of_root);
-       n_root_size_cells = of_n_size_cells(of_root);
-       of_node_put(of_root);
+       n_root_addr_cells = of_n_addr_cells(root);
+       n_root_size_cells = of_n_size_cells(root);
+       of_node_put(root);
 
        if (init_drmem_lmb_size(dn))
                return ret;
index 90dcc28440562954035808c3123f7b372fcf282d..8e84bc214d133c0b29cae908e048747cd5b2993b 100644 (file)
@@ -180,3 +180,5 @@ static inline bool debug_pagealloc_enabled_or_kfence(void)
 int create_section_mapping(unsigned long start, unsigned long end,
                           int nid, pgprot_t prot);
 #endif
+
+int hash__kernel_map_pages(struct page *page, int numpages, int enable);
index f6c4ace3b22197e990f47d3124f5ac800459f21d..a490724e84adbf74517bb965e7690657e205fa92 100644 (file)
@@ -1111,7 +1111,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 
 static void __init find_possible_nodes(void)
 {
-       struct device_node *rtas;
+       struct device_node *rtas, *root;
        const __be32 *domains = NULL;
        int prop_length, max_nodes;
        u32 i;
@@ -1132,10 +1132,12 @@ static void __init find_possible_nodes(void)
         * If the LPAR is migratable, new nodes might be activated after a LPM,
         * so we should consider the max number in that case.
         */
-       if (!of_get_property(of_root, "ibm,migratable-partition", NULL))
+       root = of_find_node_by_path("/");
+       if (!of_get_property(root, "ibm,migratable-partition", NULL))
                domains = of_get_property(rtas,
                                          "ibm,current-associativity-domains",
                                          &prop_length);
+       of_node_put(root);
        if (!domains) {
                domains = of_get_property(rtas, "ibm,max-associativity-domains",
                                        &prop_length);
index 6163e484bc6d4d5075385613a8788d18ce532cfb..ac22bf28086fac5c5973d29190a6adfe5caa50b8 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 
+#include <mm/mmu_decl.h>
 
 static pte_basic_t pte_update_delta(pte_t *ptep, unsigned long addr,
                                    unsigned long old, unsigned long new)
@@ -38,6 +39,10 @@ static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
                /* Don't clear DIRTY bit */
                pte_update_delta(ptep, addr, _PAGE_KERNEL_RW & ~_PAGE_DIRTY, _PAGE_KERNEL_RO);
                break;
+       case SET_MEMORY_ROX:
+               /* Don't clear DIRTY bit */
+               pte_update_delta(ptep, addr, _PAGE_KERNEL_RW & ~_PAGE_DIRTY, _PAGE_KERNEL_ROX);
+               break;
        case SET_MEMORY_RW:
                pte_update_delta(ptep, addr, _PAGE_KERNEL_RO, _PAGE_KERNEL_RW);
                break;
@@ -97,3 +102,26 @@ int change_memory_attr(unsigned long addr, int numpages, long action)
        return apply_to_existing_page_range(&init_mm, start, size,
                                            change_page_attr, (void *)action);
 }
+
+#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
+#ifdef CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC
+void __kernel_map_pages(struct page *page, int numpages, int enable)
+{
+       int err;
+       unsigned long addr = (unsigned long)page_address(page);
+
+       if (PageHighMem(page))
+               return;
+
+       if (IS_ENABLED(CONFIG_PPC_BOOK3S_64) && !radix_enabled())
+               err = hash__kernel_map_pages(page, numpages, enable);
+       else if (enable)
+               err = set_memory_p(addr, numpages);
+       else
+               err = set_memory_np(addr, numpages);
+
+       if (err)
+               panic("%s: changing memory protections failed\n", __func__);
+}
+#endif
+#endif
index 12498017da8e43dba086334f491819ec922b264f..face94977cb2fb406711b03b15486d6b64b90a46 100644 (file)
@@ -167,18 +167,3 @@ void mark_rodata_ro(void)
        set_memory_ro((unsigned long)_stext, numpages);
 }
 #endif
-
-#if defined(CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC) && defined(CONFIG_DEBUG_PAGEALLOC)
-void __kernel_map_pages(struct page *page, int numpages, int enable)
-{
-       unsigned long addr = (unsigned long)page_address(page);
-
-       if (PageHighMem(page))
-               return;
-
-       if (enable)
-               set_memory_p(addr, numpages);
-       else
-               set_memory_np(addr, numpages);
-}
-#endif /* CONFIG_DEBUG_PAGEALLOC */
index b7ff680cde9649a36350743d2ffe771564f4225b..6b5f8a94e7d890be4f8dc7fe8a4eac63125e30cf 100644 (file)
@@ -256,7 +256,7 @@ static bool regs_sipr(struct pt_regs *regs)
 
 static inline u32 perf_flags_from_msr(struct pt_regs *regs)
 {
-       if (regs->msr & MSR_PR)
+       if (user_mode(regs))
                return PERF_RECORD_MISC_USER;
        if ((regs->msr & MSR_HV) && freeze_events_kernel != MMCR0_FCHV)
                return PERF_RECORD_MISC_HYPERVISOR;
@@ -2593,6 +2593,8 @@ static int __init init_ppc64_pmu(void)
                return 0;
        else if (!init_power10_pmu())
                return 0;
+       else if (!init_power11_pmu())
+               return 0;
        else if (!init_ppc970_pmu())
                return 0;
        else
index 27f18119fda17474bb883a8e03f894239680ee1a..241551d1282f80e9a258c58d849af9443f585d39 100644 (file)
@@ -695,6 +695,20 @@ static unsigned long single_gpci_request(u32 req, u32 starting_index,
 
        ret = plpar_hcall_norets(H_GET_PERF_COUNTER_INFO,
                        virt_to_phys(arg), HGPCI_REQ_BUFFER_SIZE);
+
+       /*
+        * ret value as 'H_PARAMETER' with detail_rc as 'GEN_BUF_TOO_SMALL',
+        * specifies that the current buffer size cannot accommodate
+        * all the information and a partial buffer returned.
+        * Since in this function we are only accessing data for a given starting index,
+        * we don't need to accommodate whole data and can get required count by
+        * accessing first entry data.
+        * Hence hcall fails only incase the ret value is other than H_SUCCESS or
+        * H_PARAMETER with detail_rc value as GEN_BUF_TOO_SMALL(0x1B).
+        */
+       if (ret == H_PARAMETER && be32_to_cpu(arg->params.detail_rc) == 0x1B)
+               ret = 0;
+
        if (ret) {
                pr_devel("hcall failed: 0x%lx\n", ret);
                goto out;
@@ -759,6 +773,7 @@ static int h_gpci_event_init(struct perf_event *event)
 {
        u64 count;
        u8 length;
+       unsigned long ret;
 
        /* Not our event */
        if (event->attr.type != event->pmu->type)
@@ -789,13 +804,23 @@ static int h_gpci_event_init(struct perf_event *event)
        }
 
        /* check if the request works... */
-       if (single_gpci_request(event_get_request(event),
+       ret = single_gpci_request(event_get_request(event),
                                event_get_starting_index(event),
                                event_get_secondary_index(event),
                                event_get_counter_info_version(event),
                                event_get_offset(event),
                                length,
-                               &count)) {
+                               &count);
+
+       /*
+        * ret value as H_AUTHORITY implies that partition is not permitted to retrieve
+        * performance information, and required to set
+        * "Enable Performance Information Collection" option.
+        */
+       if (ret == H_AUTHORITY)
+               return -EPERM;
+
+       if (ret) {
                pr_devel("gpci hcall failed\n");
                return -EINVAL;
        }
index 4c18b5504326d3f8270b6f1f219d26badb81686b..a70ac471a5a5d6b8b36b8dbb068e375b5989a609 100644 (file)
@@ -10,4 +10,5 @@ int __init init_power7_pmu(void);
 int __init init_power8_pmu(void);
 int __init init_power9_pmu(void);
 int __init init_power10_pmu(void);
+int __init init_power11_pmu(void);
 int __init init_generic_compat_pmu(void);
index 9b5133e361a76b773d0ab1a2941be4dccc582ea0..62a68b6b2d4b12e5f7efadc5e85c27e0afdc6634 100644 (file)
@@ -634,3 +634,30 @@ int __init init_power10_pmu(void)
 
        return 0;
 }
+
+static struct power_pmu power11_pmu;
+
+int __init init_power11_pmu(void)
+{
+       unsigned int pvr;
+       int rc;
+
+       pvr = mfspr(SPRN_PVR);
+       if (PVR_VER(pvr) != PVR_POWER11)
+               return -ENODEV;
+
+       /* Set the PERF_REG_EXTENDED_MASK here */
+       PERF_REG_EXTENDED_MASK = PERF_REG_PMU_MASK_31;
+
+       power11_pmu = power10_pmu;
+       power11_pmu.name = "Power11";
+
+       rc = register_power_pmu(&power11_pmu);
+       if (rc)
+               return rc;
+
+       /* Tell userspace that EBB is supported */
+       cur_cpu_spec->cpu_user_features2 |= PPC_FEATURE2_EBB;
+
+       return 0;
+}
index e454e9d2eff17b575a113e8422494a9e4e17230f..294ab27285889adf42c5206ba0fb5560c195f98b 100644 (file)
@@ -59,16 +59,13 @@ static const char * const board[] __initconst = {
 
 static int __init ppc40x_probe(void)
 {
-       if (of_device_compatible_match(of_root, board)) {
-               pci_set_flags(PCI_REASSIGN_ALL_RSRC);
-               return 1;
-       }
-
-       return 0;
+       pci_set_flags(PCI_REASSIGN_ALL_RSRC);
+       return 1;
 }
 
 define_machine(ppc40x_simple) {
        .name = "PowerPC 40x Platform",
+       .compatibles = board,
        .probe = ppc40x_probe,
        .progress = udbg_progress,
        .init_IRQ = uic_init_tree,
index bf0188dcb9184d2fdeb694d7eaca3bc22394483b..a5001d32f978d72e11183739f77462b5904cdb27 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/of_platform.h>
+#include <linux/platform_device.h>
 #include <linux/kthread.h>
 #include <linux/leds.h>
 #include <linux/i2c.h>
index 0d58ab257cd93acf22c7a548d67b2258e1d2fddc..d4fa6c302ccfb0ae77ed9b222878f049cc29d9e3 100644 (file)
@@ -32,9 +32,6 @@ static const char * const board[] __initconst = {
  */
 static int __init mpc512x_generic_probe(void)
 {
-       if (!of_device_compatible_match(of_root, board))
-               return 0;
-
        mpc512x_init_early();
 
        return 1;
@@ -42,6 +39,7 @@ static int __init mpc512x_generic_probe(void)
 
 define_machine(mpc512x_generic) {
        .name                   = "MPC512x generic",
+       .compatibles            = board,
        .probe                  = mpc512x_generic_probe,
        .init                   = mpc512x_init,
        .setup_arch             = mpc512x_setup_arch,
index aa82e6b437f31a5c6c9a34c4355660e8e3ced5b8..37a67120f257ca6013d5fce43f2840181ad0a945 100644 (file)
@@ -195,8 +195,10 @@ static void __init efika_setup_arch(void)
 
 static int __init efika_probe(void)
 {
-       const char *model = of_get_property(of_root, "model", NULL);
+       struct device_node *root = of_find_node_by_path("/");
+       const char *model = of_get_property(root, "model", NULL);
 
+       of_node_put(root);
        if (model == NULL)
                return 0;
        if (strcmp(model, "EFIKA5K2"))
index 0fd67b3ffc3e83999cfc46387a0d7aed5513d3e9..0a161d82a3a8772f26fedc1fef183f811d53f13a 100644 (file)
@@ -172,17 +172,9 @@ static const char * const board[] __initconst = {
        NULL,
 };
 
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init lite5200_probe(void)
-{
-       return of_device_compatible_match(of_root, board);
-}
-
 define_machine(lite5200) {
        .name           = "lite5200",
-       .probe          = lite5200_probe,
+       .compatibles    = board,
        .setup_arch     = lite5200_setup_arch,
        .discover_phbs  = mpc52xx_setup_pci,
        .init           = mpc52xx_declare_of_platform_devices,
index f1e85e86f5e57620621db9b81e9b0f793649e77b..7e0e4c34a40be17e8cf4061faaab001c293c04f1 100644 (file)
@@ -59,17 +59,9 @@ static const char *board[] __initdata = {
        NULL
 };
 
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc5200_simple_probe(void)
-{
-       return of_device_compatible_match(of_root, board);
-}
-
 define_machine(mpc5200_simple_platform) {
        .name           = "mpc5200-simple-platform",
-       .probe          = mpc5200_simple_probe,
+       .compatibles    = board,
        .setup_arch     = mpc5200_simple_setup_arch,
        .discover_phbs  = mpc52xx_setup_pci,
        .init           = mpc52xx_declare_of_platform_devices,
index 534bb227480d25dd09a81166a818467db6db1ba2..63b6d213726a6d6ee7ca0589dcadad8de1866f93 100644 (file)
@@ -34,19 +34,11 @@ static const char *board[] __initdata = {
        NULL
 };
 
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc830x_rdb_probe(void)
-{
-       return of_device_compatible_match(of_root, board);
-}
-
 machine_device_initcall(mpc830x_rdb, mpc83xx_declare_of_platform_devices);
 
 define_machine(mpc830x_rdb) {
        .name                   = "MPC830x RDB",
-       .probe                  = mpc830x_rdb_probe,
+       .compatibles            = board,
        .setup_arch             = mpc830x_rdb_setup_arch,
        .discover_phbs          = mpc83xx_setup_pci,
        .init_IRQ               = mpc83xx_ipic_init_IRQ,
index 7b901ab3b864632b79e2185d6d0f40f7fa923cec..5c39966762e4264d2ef91b2c4ef75fdf2c2c5d65 100644 (file)
@@ -34,19 +34,11 @@ static const char *board[] __initdata = {
        NULL
 };
 
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc831x_rdb_probe(void)
-{
-       return of_device_compatible_match(of_root, board);
-}
-
 machine_device_initcall(mpc831x_rdb, mpc83xx_declare_of_platform_devices);
 
 define_machine(mpc831x_rdb) {
        .name                   = "MPC831x RDB",
-       .probe                  = mpc831x_rdb_probe,
+       .compatibles            = board,
        .setup_arch             = mpc831x_rdb_setup_arch,
        .discover_phbs          = mpc83xx_setup_pci,
        .init_IRQ               = mpc83xx_ipic_init_IRQ,
index 39e78018dd0b7fe993b5e91f61f40a9187c1673f..45823e14793311d679530ce72d93b6e204c70992 100644 (file)
@@ -61,17 +61,9 @@ static const char * const board[] __initconst = {
        NULL
 };
 
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc837x_rdb_probe(void)
-{
-       return of_device_compatible_match(of_root, board);
-}
-
 define_machine(mpc837x_rdb) {
        .name                   = "MPC837x RDB/WLAN",
-       .probe                  = mpc837x_rdb_probe,
+       .compatibles            = board,
        .setup_arch             = mpc837x_rdb_setup_arch,
        .discover_phbs          = mpc83xx_setup_pci,
        .init_IRQ               = mpc83xx_ipic_init_IRQ,
index c9664e46b03d701901107870db4ddc612b381c72..99bd4355f28e60a209c4c3c1367c599ec3295842 100644 (file)
@@ -206,7 +206,8 @@ static int mpc83xx_suspend_enter(suspend_state_t state)
                out_be32(&pmc_regs->config1,
                         in_be32(&pmc_regs->config1) | PMCCR1_POWER_OFF);
 
-               enable_kernel_fp();
+               if (IS_ENABLED(CONFIG_PPC_FPU))
+                       enable_kernel_fp();
 
                mpc83xx_enter_deep_sleep(immrbase);
 
index 2eb62bff86d48f69ff4612f8e7e46c8d642da5df..3ad8096fcf16aa7419477d161cd9b89b2e5a2690 100644 (file)
@@ -19,7 +19,7 @@
 #include "mpc85xx.h"
 #include "smp.h"
 
-void __init bsc913x_qds_pic_init(void)
+static void __init bsc913x_qds_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
          MPIC_SINGLE_DEST_CPU,
index 161f006cb3bb5d129b3b0e3757a043a554bd5a9f..dcd358c28201ff86e688a5ee51f6dfa4b0209f8d 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "mpc85xx.h"
 
-void __init bsc913x_rdb_pic_init(void)
+static void __init bsc913x_rdb_pic_init(void)
 {
        struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
          MPIC_SINGLE_DEST_CPU,
index 645fcca77cde56c3773175dbd947c0c2f635f0ab..c44400e95f5514a9307ce4d00f3663e241215bec 100644 (file)
@@ -149,7 +149,7 @@ static int __init corenet_generic_probe(void)
        extern struct smp_ops_t smp_85xx_ops;
 #endif
 
-       if (of_device_compatible_match(of_root, boards))
+       if (of_machine_compatible_match(boards))
                return 1;
 
        /* Check if we're running under the Freescale hypervisor */
index 9c3b44a1952ec4263c8e5250048bbe0511c4fe3f..477852f1a7268f817c17f37bf4e32b46457ba0ec 100644 (file)
@@ -38,7 +38,7 @@
 
 void __iomem *imp3a_regs;
 
-void __init ge_imp3a_pic_init(void)
+static void __init ge_imp3a_pic_init(void)
 {
        struct mpic *mpic;
        struct device_node *np;
index 751395cbf022270f27f77c24e2bec403878ac379..34ce21f42623f525d901c3269d5b00f2ebac19fd 100644 (file)
@@ -114,7 +114,7 @@ static int gpio_halt_probe(struct platform_device *pdev)
        return ret;
 }
 
-static int gpio_halt_remove(struct platform_device *pdev)
+static void gpio_halt_remove(struct platform_device *pdev)
 {
        free_irq(halt_irq, pdev);
        cancel_work_sync(&gpio_halt_wq);
@@ -124,8 +124,6 @@ static int gpio_halt_remove(struct platform_device *pdev)
 
        gpiod_put(halt_gpio);
        halt_gpio = NULL;
-
-       return 0;
 }
 
 static const struct of_device_id gpio_halt_match[] = {
@@ -145,7 +143,7 @@ static struct platform_driver gpio_halt_driver = {
                .of_match_table = gpio_halt_match,
        },
        .probe          = gpio_halt_probe,
-       .remove         = gpio_halt_remove,
+       .remove_new     = gpio_halt_remove,
 };
 
 module_platform_driver(gpio_halt_driver);
index 6be1b9809db6b5c47aa68da49263ae7c4deac13c..f74d446c53f085c6521ecef889a24935ae55f09d 100644 (file)
@@ -112,17 +112,9 @@ static const char * const board[] __initconst = {
        NULL
 };
 
-/*
- * Called very early, device-tree isn't unflattened
- */
-static int __init tqm85xx_probe(void)
-{
-       return of_device_compatible_match(of_root, board);
-}
-
 define_machine(tqm85xx) {
        .name                   = "TQM85xx",
-       .probe                  = tqm85xx_probe,
+       .compatibles            = board,
        .setup_arch             = tqm85xx_setup_arch,
        .init_IRQ               = tqm85xx_pic_init,
        .show_cpuinfo           = tqm85xx_show_cpuinfo,
index 6c6e714a7521a4f4d8e9968536134541942ee1b6..2c8dc08869124c57ed646996b28dee4e60e76aa4 100644 (file)
@@ -25,7 +25,7 @@
 
 extern void __flush_disable_L1(void);
 
-void amigaone_show_cpuinfo(struct seq_file *m)
+static void amigaone_show_cpuinfo(struct seq_file *m)
 {
        seq_printf(m, "vendor\t\t: Eyetech Ltd.\n");
 }
@@ -65,7 +65,7 @@ static int __init amigaone_add_bridge(struct device_node *dev)
        return 0;
 }
 
-void __init amigaone_setup_arch(void)
+static void __init amigaone_setup_arch(void)
 {
        if (ppc_md.progress)
                ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0);
@@ -83,7 +83,7 @@ static void __init amigaone_discover_phbs(void)
        BUG_ON(phb != 0);
 }
 
-void __init amigaone_init_IRQ(void)
+static void __init amigaone_init_IRQ(void)
 {
        struct device_node *pic, *np = NULL;
        const unsigned long *prop = NULL;
@@ -123,7 +123,7 @@ static int __init request_isa_regions(void)
 }
 machine_device_initcall(amigaone, request_isa_regions);
 
-void __noreturn amigaone_restart(char *cmd)
+static void __noreturn amigaone_restart(char *cmd)
 {
        local_irq_disable();
 
index 9c10aac40c7b11ec8812a1f2243ee91801868d88..e265f026eee2a98a813a9263f97215df59a6f101 100644 (file)
@@ -99,9 +99,6 @@ static void __init linkstation_init_IRQ(void)
        mpic_init(mpic);
 }
 
-extern void avr_uart_configure(void);
-extern void avr_uart_send(const char);
-
 static void __noreturn linkstation_restart(char *cmd)
 {
        local_irq_disable();
index 5ad12023e56280171238e13cf5136f67df1cc0bc..ebc258fa4858d023bd528d6015e64a2df465166c 100644 (file)
@@ -156,4 +156,7 @@ int mpc10x_disable_store_gathering(struct pci_controller *hose);
 /* For MPC107 boards that use the built-in openpic */
 void mpc10x_set_openpic(void);
 
+void avr_uart_configure(void);
+void avr_uart_send(const char c);
+
 #endif /* __PPC_KERNEL_MPC10X_H */
index fd130fe7a65acd35b8fe9f908e5529b8218055b4..4e983af3294922c415140a1f4101c3f5001303ef 100644 (file)
@@ -260,7 +260,7 @@ out:
 }
 
 
-static int gpio_mdio_remove(struct platform_device *dev)
+static void gpio_mdio_remove(struct platform_device *dev)
 {
        struct mii_bus *bus = dev_get_drvdata(&dev->dev);
 
@@ -271,8 +271,6 @@ static int gpio_mdio_remove(struct platform_device *dev)
        kfree(bus->priv);
        bus->priv = NULL;
        mdiobus_free(bus);
-
-       return 0;
 }
 
 static const struct of_device_id gpio_mdio_match[] =
@@ -287,7 +285,7 @@ MODULE_DEVICE_TABLE(of, gpio_mdio_match);
 static struct platform_driver gpio_mdio_driver =
 {
        .probe          = gpio_mdio_probe,
-       .remove         = gpio_mdio_remove,
+       .remove_new     = gpio_mdio_remove,
        .driver = {
                .name = "gpio-mdio-bitbang",
                .of_match_table = gpio_mdio_match,
index f27d314147373294b6f476980014275edbdaa32c..60f990a336c470224475af73b1ae258d375994bd 100644 (file)
@@ -270,16 +270,18 @@ static int __init pas_add_bridge(struct device_node *dev)
 
 void __init pas_pci_init(void)
 {
+       struct device_node *root = of_find_node_by_path("/");
        struct device_node *np;
        int res;
 
        pci_set_flags(PCI_SCAN_ALL_PCIE_DEVS);
 
-       np = of_find_compatible_node(of_root, NULL, "pasemi,rootbus");
+       np = of_find_compatible_node(root, NULL, "pasemi,rootbus");
        if (np) {
                res = pas_add_bridge(np);
                of_node_put(np);
        }
+       of_node_put(root);
 }
 
 void __iomem *__init pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset)
index 8bdae0caf21e5f14c4b0d38fe7cd15697ad9c811..84f101ec53a96f2ef41ca8081919f55ebf04a796 100644 (file)
@@ -2,7 +2,7 @@
 config PPC_PMAC
        bool "Apple PowerMac based machines"
        depends on PPC_BOOK3S && CPU_BIG_ENDIAN
-       select ADB_CUDA if POWER_RESET && PPC32
+       select ADB_CUDA if POWER_RESET && ADB
        select MPIC
        select FORCE_PCI
        select PPC_INDIRECT_PCI if PPC32
index 81c9fbae88b140253c9551e451b8a71645e00953..2cc257f75c50f66dbce3e3dd73ca6b69dd87bab4 100644 (file)
@@ -2333,7 +2333,6 @@ static struct pmac_mb_def pmac_mb_defs[] = {
                PMAC_TYPE_POWERMAC_G5,          g5_features,
                0,
        },
-#ifdef CONFIG_PPC64
        {       "PowerMac7,3",                  "PowerMac G5",
                PMAC_TYPE_POWERMAC_G5,          g5_features,
                0,
@@ -2359,7 +2358,6 @@ static struct pmac_mb_def pmac_mb_defs[] = {
                0,
        },
 #endif /* CONFIG_PPC64 */
-#endif /* CONFIG_PPC64 */
 };
 
 /*
index b66b06efcef1e1001f27ad556ba3880678dee947..24f04f20d3e85c58a167fd6c639e72f09677f34a 100644 (file)
@@ -425,12 +425,11 @@ static int opal_prd_probe(struct platform_device *pdev)
        return 0;
 }
 
-static int opal_prd_remove(struct platform_device *pdev)
+static void opal_prd_remove(struct platform_device *pdev)
 {
        misc_deregister(&opal_prd_dev);
        opal_message_notifier_unregister(OPAL_MSG_PRD, &opal_prd_event_nb);
        opal_message_notifier_unregister(OPAL_MSG_PRD2, &opal_prd_event_nb2);
-       return 0;
 }
 
 static const struct of_device_id opal_prd_match[] = {
@@ -444,7 +443,7 @@ static struct platform_driver opal_prd_driver = {
                .of_match_table = opal_prd_match,
        },
        .probe  = opal_prd_probe,
-       .remove = opal_prd_remove,
+       .remove_new = opal_prd_remove,
 };
 
 module_platform_driver(opal_prd_driver);
index 509e30ad01bb430319bf8ebc6d5ffc9bb9146669..e8ab3d6b03bd28425de8a89f12854ea2b227d5ec 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <asm/processor.h>
 #include <asm/ppc_asm.h>
+#include <asm/ptrace.h>
 
 #define lv1call .long 0x44000022; extsw r3, r3
 
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
+       stdu    r1, -STACK_FRAME_MIN_SIZE(r1);  \
        li      r11, API_NUMBER;                \
        lv1call;                                \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE;   \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -38,18 +41,19 @@ _GLOBAL(_##API_NAME)                                \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r3, -8(r1);                     \
+       std     r3, -8(r1);                     \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -57,21 +61,22 @@ _GLOBAL(_##API_NAME)                                \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r3, -8(r1);                     \
-       stdu    r4, -16(r1);                    \
+       std     r4, -16(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -79,16 +84,17 @@ _GLOBAL(_##API_NAME)                                \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r3, -8(r1);                     \
        std     r4, -16(r1);                    \
-       stdu    r5, -24(r1);                    \
+       std     r5, -24(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 24;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+24; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -96,7 +102,7 @@ _GLOBAL(_##API_NAME)                         \
        ld      r11, -24(r1);                   \
        std     r6, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -104,7 +110,7 @@ _GLOBAL(_##API_NAME)                                \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r3, -8(r1);                     \
        std     r4, -16(r1);                    \
@@ -112,12 +118,13 @@ _GLOBAL(_##API_NAME)                              \
        std     r6, -32(r1);                    \
        std     r7, -40(r1);                    \
        std     r8, -48(r1);                    \
-       stdu    r9, -56(r1);                    \
+       std     r9, -56(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-56(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 56;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+56; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -133,7 +140,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -56(r1);                   \
        std     r10, 0(r11);                    \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -141,18 +148,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r4, -8(r1);                     \
+       std     r4, -8(r1);                     \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -160,21 +168,22 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r4, -8(r1);                     \
-       stdu    r5, -16(r1);                    \
+       std     r5, -16(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -182,16 +191,17 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r4, -8(r1);                     \
        std     r5, -16(r1);                    \
-       stdu    r6, -24(r1);                    \
+       std     r6, -24(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 24;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+24; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -199,7 +209,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -24(r1);                   \
        std     r6, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -207,17 +217,18 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r4, -8(r1);                     \
        std     r5, -16(r1);                    \
        std     r6, -24(r1);                    \
-       stdu    r7, -32(r1);                    \
+       std     r7, -32(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-32(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 32;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+32; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -227,7 +238,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -32(r1);                   \
        std     r7, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -235,18 +246,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r4, -8(r1);                     \
        std     r5, -16(r1);                    \
        std     r6, -24(r1);                    \
        std     r7, -32(r1);                    \
-       stdu    r8, -40(r1);                    \
+       std     r8, -40(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-40(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 40;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+40; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -258,7 +270,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -40(r1);                   \
        std     r8, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -266,19 +278,20 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r4, -8(r1);                     \
        std     r5, -16(r1);                    \
        std     r6, -24(r1);                    \
        std     r7, -32(r1);                    \
        std     r8, -40(r1);                    \
-       stdu    r9, -48(r1);                    \
+       std     r9, -48(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-48(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 48;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+48; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -292,7 +305,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -48(r1);                   \
        std     r9, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -300,7 +313,7 @@ _GLOBAL(_##API_NAME)                                \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r4, -8(r1);                     \
        std     r5, -16(r1);                    \
@@ -308,12 +321,13 @@ _GLOBAL(_##API_NAME)                              \
        std     r7, -32(r1);                    \
        std     r8, -40(r1);                    \
        std     r9, -48(r1);                    \
-       stdu    r10, -56(r1);                   \
+       std     r10, -56(r1);                   \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-56(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 56;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+56; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -329,7 +343,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -56(r1);                   \
        std     r10, 0(r11);                    \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -337,18 +351,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r5, -8(r1);                     \
+       std     r5, -8(r1);                     \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -356,21 +371,22 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r5, -8(r1);                     \
-       stdu    r6, -16(r1);                    \
+       std     r6, -16(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -378,16 +394,17 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r5, -8(r1);                     \
        std     r6, -16(r1);                    \
-       stdu    r7, -24(r1);                    \
+       std     r7, -24(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 24;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+24; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -395,7 +412,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -24(r1);                   \
        std     r6, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -403,17 +420,18 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r5, -8(r1);                     \
        std     r6, -16(r1);                    \
        std     r7, -24(r1);                    \
-       stdu    r8, -32(r1);                    \
+       std     r8, -32(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-32(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 32;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+32;\
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -423,7 +441,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -32(r1);                   \
        std     r7, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -431,18 +449,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r5, -8(r1);                     \
        std     r6, -16(r1);                    \
        std     r7, -24(r1);                    \
        std     r8, -32(r1);                    \
-       stdu    r9, -40(r1);                    \
+       std     r9, -40(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-40(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 40;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+40; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -454,7 +473,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -40(r1);                   \
        std     r8, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -462,18 +481,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r6, -8(r1);                     \
+       std     r6, -8(r1);                     \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -481,21 +501,22 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r6, -8(r1);                     \
-       stdu    r7, -16(r1);                    \
+       std     r7, -16(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -503,16 +524,17 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r6, -8(r1);                     \
        std     r7, -16(r1);                    \
-       stdu    r8, -24(r1);                    \
+       std     r8, -24(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 24;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+24; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -520,7 +542,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -24(r1);                   \
        std     r6, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -528,18 +550,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r7, -8(r1);                     \
+       std     r7, -8(r1);                     \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -547,21 +570,22 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r7, -8(r1);                     \
-       stdu    r8, -16(r1);                    \
+       std     r8, -16(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -569,16 +593,17 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r7, -8(r1);                     \
        std     r8, -16(r1);                    \
-       stdu    r9, -24(r1);                    \
+       std     r9, -24(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 24;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+24; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -586,7 +611,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -24(r1);                   \
        std     r6, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -594,18 +619,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r8, -8(r1);                     \
+       std     r8, -8(r1);                     \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -613,21 +639,22 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r8, -8(r1);                     \
-       stdu    r9, -16(r1);                    \
+       std     r9, -16(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -635,16 +662,17 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r8, -8(r1);                     \
        std     r9, -16(r1);                    \
-       stdu    r10, -24(r1);                   \
+       std     r10, -24(r1);                   \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-24(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 24;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+24; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
@@ -652,7 +680,7 @@ _GLOBAL(_##API_NAME)                                \
        ld      r11, -24(r1);                   \
        std     r6, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -660,18 +688,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r9, -8(r1);                     \
+       std     r9, -8(r1);                     \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -679,21 +708,22 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r9, -8(r1);                     \
-       stdu    r10, -16(r1);                   \
+       std     r10, -16(r1);                   \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -701,23 +731,24 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
        std     r9, -8(r1);                     \
-       stdu    r10, -16(r1);                   \
+       std     r10, -16(r1);                   \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-16(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 16;                     \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+16; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
        ld      r11, -16(r1);                   \
        std     r5, 0(r11);                     \
-       ld      r11, 48+8*8(r1);                \
+       ld      r11, STK_PARAM_AREA+8*8(r1);    \
        std     r6, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -725,18 +756,19 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       stdu    r10, -8(r1);                    \
+       std     r10, -8(r1);                    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE-8(r1); \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       addi    r1, r1, 8;                      \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE+8; \
        ld      r11, -8(r1);                    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -744,27 +776,29 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
                                                \
-       std     r10, 48+8*7(r1);                \
+       std     r10, STK_PARAM_AREA+8*7(r1);    \
+       stdu    r1, -STACK_FRAME_MIN_SIZE(r1);  \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       ld      r11, 48+8*7(r1);                \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE;   \
+       ld      r11, STK_PARAM_AREA+8*7(r1);    \
        std     r4, 0(r11);                     \
-       ld      r11, 48+8*8(r1);                \
+       ld      r11, STK_PARAM_AREA+8*8(r1);    \
        std     r5, 0(r11);                     \
-       ld      r11, 48+8*9(r1);                \
+       ld      r11, STK_PARAM_AREA+8*9(r1);    \
        std     r6, 0(r11);                     \
-       ld      r11, 48+8*10(r1);               \
+       ld      r11, STK_PARAM_AREA+8*10(r1);   \
        std     r7, 0(r11);                     \
-       ld      r11, 48+8*11(r1);               \
+       ld      r11, STK_PARAM_AREA+8*11(r1);   \
        std     r8, 0(r11);                     \
-       ld      r11, 48+8*12(r1);               \
+       ld      r11, STK_PARAM_AREA+8*12(r1);   \
        std     r9, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
@@ -772,15 +806,17 @@ _GLOBAL(_##API_NAME)                              \
 _GLOBAL(_##API_NAME)                           \
                                                \
        mflr    r0;                             \
-       std     r0, 16(r1);                     \
+       std     r0, LRSAVE(r1);                 \
+       stdu    r1, -STACK_FRAME_MIN_SIZE(r1);  \
                                                \
        li      r11, API_NUMBER;                \
        lv1call;                                \
                                                \
-       ld      r11, 48+8*8(r1);                \
+       addi    r1, r1, STACK_FRAME_MIN_SIZE;   \
+       ld      r11, STK_PARAM_AREA+8*8(r1);    \
        std     r4, 0(r11);                     \
                                                \
-       ld      r0, 16(r1);                     \
+       ld      r0, LRSAVE(r1);                 \
        mtlr    r0;                             \
        blr
 
index 998e3aff2457246a4299d140d183b14b6d69bed8..b401282727a445aff0e0593182f855bfe6e09e91 100644 (file)
@@ -55,7 +55,7 @@ static struct device ibmebus_bus_device = { /* fake "parent" device */
        .init_name = "ibmebus",
 };
 
-struct bus_type ibmebus_bus_type;
+const struct bus_type ibmebus_bus_type;
 
 /* These devices will automatically be added to the bus during init */
 static const struct of_device_id ibmebus_matches[] __initconst = {
@@ -432,7 +432,7 @@ static int ibmebus_bus_modalias(const struct device *dev, struct kobj_uevent_env
        return of_device_uevent_modalias(dev, env);
 }
 
-struct bus_type ibmebus_bus_type = {
+const struct bus_type ibmebus_bus_type = {
        .name      = "ibmebus",
        .uevent    = ibmebus_bus_modalias,
        .bus_groups = ibmbus_bus_groups,
index 1c151d77e74b3485593ab586ce15e95dc7fe816f..f73c4d1c26af9822b12fcb9df19f25892933ab38 100644 (file)
@@ -346,9 +346,13 @@ static int read_rtas_lpar_name(struct seq_file *m)
  */
 static int read_dt_lpar_name(struct seq_file *m)
 {
+       struct device_node *root = of_find_node_by_path("/");
        const char *name;
+       int ret;
 
-       if (of_property_read_string(of_root, "ibm,partition-name", &name))
+       ret = of_property_read_string(root, "ibm,partition-name", &name);
+       of_node_put(root);
+       if (ret)
                return -ENOENT;
 
        seq_printf(m, "partition_name=%s\n", name);
index 423ee1d5bd9440d3e437e763aca682ac1cd24943..6dfb55b52d363de342883b3caef9e19a446d38b9 100644 (file)
@@ -26,6 +26,7 @@ static int query_token, change_token;
 #define RTAS_CHANGE_MSI_FN     3
 #define RTAS_CHANGE_MSIX_FN    4
 #define RTAS_CHANGE_32MSI_FN   5
+#define RTAS_CHANGE_32MSIX_FN  6
 
 /* RTAS Helpers */
 
@@ -41,7 +42,7 @@ static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs)
        seq_num = 1;
        do {
                if (func == RTAS_CHANGE_MSI_FN || func == RTAS_CHANGE_MSIX_FN ||
-                   func == RTAS_CHANGE_32MSI_FN)
+                   func == RTAS_CHANGE_32MSI_FN || func == RTAS_CHANGE_32MSIX_FN)
                        rc = rtas_call(change_token, 6, 4, rtas_ret, addr,
                                        BUID_HI(buid), BUID_LO(buid),
                                        func, num_irqs, seq_num);
@@ -406,8 +407,12 @@ again:
 
                if (use_32bit_msi_hack && rc > 0)
                        rtas_hack_32bit_msi_gen2(pdev);
-       } else
-               rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);
+       } else {
+               if (pdev->no_64bit_msi)
+                       rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSIX_FN, nvec);
+               else
+                       rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);
+       }
 
        if (rc != nvec) {
                if (nvec != nvec_in) {
index 526c621b098bece600fdfe72de1c4f53697d33f5..eea2041b270b546477a34e3836662969d6dd25eb 100644 (file)
@@ -101,10 +101,12 @@ retry:
                esi_buf_size = ESI_HDR_SIZE + (CURR_MAX_ESI_ATTRS * max_esi_attrs);
 
                temp_buf = krealloc(buf, esi_buf_size, GFP_KERNEL);
-               if (temp_buf)
+               if (temp_buf) {
                        buf = temp_buf;
-               else
-                       return -ENOMEM;
+               } else {
+                       ret = -ENOMEM;
+                       goto out_buf;
+               }
 
                goto retry;
        }
index 1a53e048ceb768f175237361018d6177092b4220..c233f9db039ba4a15a625c7b9593d62181a5356f 100644 (file)
@@ -1521,7 +1521,7 @@ err:      kfree(p);
        return rc;
 }
 
-static int papr_scm_remove(struct platform_device *pdev)
+static void papr_scm_remove(struct platform_device *pdev)
 {
        struct papr_scm_priv *p = platform_get_drvdata(pdev);
 
@@ -1538,8 +1538,6 @@ static int papr_scm_remove(struct platform_device *pdev)
        pdev->archdata.priv = NULL;
        kfree(p->bus_desc.provider_name);
        kfree(p);
-
-       return 0;
 }
 
 static const struct of_device_id papr_scm_match[] = {
@@ -1550,7 +1548,7 @@ static const struct of_device_id papr_scm_match[] = {
 
 static struct platform_driver papr_scm_driver = {
        .probe = papr_scm_probe,
-       .remove = papr_scm_remove,
+       .remove_new = papr_scm_remove,
        .driver = {
                .name = "papr_scm",
                .of_match_table = papr_scm_match,
index ecea85c74c43fa9f697dadaa7857589cb25e191a..284a6fa04b0c27b8b0345986eff654a1ea4058db 100644 (file)
@@ -1029,9 +1029,11 @@ static void __init pseries_add_hw_description(void)
                return;
        }
 
-       if (of_property_read_bool(of_root, "ibm,powervm-partition") ||
-           of_property_read_bool(of_root, "ibm,fw-net-version"))
+       dn = of_find_node_by_path("/");
+       if (of_property_read_bool(dn, "ibm,powervm-partition") ||
+           of_property_read_bool(dn, "ibm,fw-net-version"))
                seq_buf_printf(&ppc_hw_desc, "hv:phyp ");
+       of_node_put(dn);
 }
 
 /*
@@ -1091,7 +1093,11 @@ static void pseries_power_off(void)
 
 static int __init pSeries_probe(void)
 {
-       if (!of_node_is_type(of_root, "chrp"))
+       struct device_node *root = of_find_node_by_path("/");
+       bool ret = of_node_is_type(root, "chrp");
+
+       of_node_put(root);
+       if (!ret)
                return 0;
 
        /* Cell blades firmware claims to be chrp while it's not. Until this
index 2dc9cbc4bcd8fea42fc12e19a93880dcde3edafb..90ff85c879bfe9bbc602fbc146a50fa5d933424a 100644 (file)
@@ -991,18 +991,6 @@ static DEVICE_ATTR_RO(cmo_allocated);
 static DEVICE_ATTR_RW(cmo_desired);
 static DEVICE_ATTR_RW(cmo_allocs_failed);
 
-static struct attribute *vio_cmo_dev_attrs[] = {
-       &dev_attr_name.attr,
-       &dev_attr_devspec.attr,
-       &dev_attr_modalias.attr,
-       &dev_attr_cmo_entitled.attr,
-       &dev_attr_cmo_allocated.attr,
-       &dev_attr_cmo_desired.attr,
-       &dev_attr_cmo_allocs_failed.attr,
-       NULL,
-};
-ATTRIBUTE_GROUPS(vio_cmo_dev);
-
 /* sysfs bus functions and data structures for CMO */
 
 #define viobus_cmo_rd_attr(name)                                        \
@@ -1062,11 +1050,7 @@ static struct attribute *vio_bus_attrs[] = {
 };
 ATTRIBUTE_GROUPS(vio_bus);
 
-static void __init vio_cmo_sysfs_init(void)
-{
-       vio_bus_type.dev_groups = vio_cmo_dev_groups;
-       vio_bus_type.bus_groups = vio_bus_groups;
-}
+static void __init vio_cmo_sysfs_init(void) { }
 #else /* CONFIG_PPC_SMLPAR */
 int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
 void vio_cmo_set_dev_desired(struct vio_dev *viodev, size_t desired) {}
@@ -1584,14 +1568,6 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RO(modalias);
 
-static struct attribute *vio_dev_attrs[] = {
-       &dev_attr_name.attr,
-       &dev_attr_devspec.attr,
-       &dev_attr_modalias.attr,
-       NULL,
-};
-ATTRIBUTE_GROUPS(vio_dev);
-
 void vio_unregister_device(struct vio_dev *viodev)
 {
        device_unregister(&viodev->dev);
@@ -1626,7 +1602,39 @@ static int vio_hotplug(const struct device *dev, struct kobj_uevent_env *env)
        return 0;
 }
 
-struct bus_type vio_bus_type = {
+#ifdef CONFIG_PPC_SMLPAR
+static struct attribute *vio_cmo_dev_attrs[] = {
+       &dev_attr_name.attr,
+       &dev_attr_devspec.attr,
+       &dev_attr_modalias.attr,
+       &dev_attr_cmo_entitled.attr,
+       &dev_attr_cmo_allocated.attr,
+       &dev_attr_cmo_desired.attr,
+       &dev_attr_cmo_allocs_failed.attr,
+       NULL,
+};
+ATTRIBUTE_GROUPS(vio_cmo_dev);
+
+const struct bus_type vio_bus_type = {
+       .name = "vio",
+       .dev_groups = vio_cmo_dev_groups,
+       .bus_groups = vio_bus_groups,
+       .uevent = vio_hotplug,
+       .match = vio_bus_match,
+       .probe = vio_bus_probe,
+       .remove = vio_bus_remove,
+       .shutdown = vio_bus_shutdown,
+};
+#else /* CONFIG_PPC_SMLPAR */
+static struct attribute *vio_dev_attrs[] = {
+       &dev_attr_name.attr,
+       &dev_attr_devspec.attr,
+       &dev_attr_modalias.attr,
+       NULL,
+};
+ATTRIBUTE_GROUPS(vio_dev);
+
+const struct bus_type vio_bus_type = {
        .name = "vio",
        .dev_groups = vio_dev_groups,
        .uevent = vio_hotplug,
@@ -1635,6 +1643,7 @@ struct bus_type vio_bus_type = {
        .remove = vio_bus_remove,
        .shutdown = vio_bus_shutdown,
 };
+#endif /* CONFIG_PPC_SMLPAR */
 
 /**
  * vio_get_attribute: - get attribute for virtual device
index 558ec68d768e65cdaa8266b751b8d65cd285ae02..8e6c84df4ca10c1f26ec4e1693227e0999230d4a 100644 (file)
@@ -320,7 +320,7 @@ static irqreturn_t fsl_msi_cascade(int irq, void *data)
        return ret;
 }
 
-static int fsl_of_msi_remove(struct platform_device *ofdev)
+static void fsl_of_msi_remove(struct platform_device *ofdev)
 {
        struct fsl_msi *msi = platform_get_drvdata(ofdev);
        int virq, i;
@@ -343,8 +343,6 @@ static int fsl_of_msi_remove(struct platform_device *ofdev)
        if ((msi->feature & FSL_PIC_IP_MASK) != FSL_PIC_IP_VMPIC)
                iounmap(msi->msi_regs);
        kfree(msi);
-
-       return 0;
 }
 
 static struct lock_class_key fsl_msi_irq_class;
@@ -603,7 +601,7 @@ static struct platform_driver fsl_of_msi_driver = {
                .of_match_table = fsl_of_msi_ids,
        },
        .probe = fsl_of_msi_probe,
-       .remove = fsl_of_msi_remove,
+       .remove_new = fsl_of_msi_remove,
 };
 
 static __init int fsl_of_msi_init(void)
index dabbdd356664cdf5bf1f7eb3d07a9c54795ab721..d94cf36b0f65865cb56cabc7d4498dc3eb287a02 100644 (file)
@@ -49,7 +49,7 @@
 #define DBG(fmt...)
 #endif
 
-struct bus_type mpic_subsys = {
+const struct bus_type mpic_subsys = {
        .name = "mpic",
        .dev_name = "mpic",
 };
index fcf8d1516210fb672c5a2f0e52e7d07b49da78fe..737f97fd67d72e6d396e8002d3c915e7b007da8a 100644 (file)
@@ -173,7 +173,7 @@ out:
        return rc;
 }
 
-static int pmi_of_remove(struct platform_device *dev)
+static void pmi_of_remove(struct platform_device *dev)
 {
        struct pmi_handler *handler, *tmp;
 
@@ -189,13 +189,11 @@ static int pmi_of_remove(struct platform_device *dev)
 
        kfree(data);
        data = NULL;
-
-       return 0;
 }
 
 static struct platform_driver pmi_of_platform_driver = {
        .probe          = pmi_of_probe,
-       .remove         = pmi_of_remove,
+       .remove_new     = pmi_of_remove,
        .driver = {
                .name = "pmi",
                .of_match_table = pmi_match,
index 9669c99252256fcf60c0ac05f6c47e755074c050..d79d6633f33363123b136d973787544b2c989a51 100644 (file)
@@ -643,10 +643,8 @@ static int xmon_core(struct pt_regs *regs, volatile int fromipi)
                        touch_nmi_watchdog();
                } else {
                        cmd = 1;
-#ifdef CONFIG_SMP
                        if (xmon_batch)
                                cmd = batch_cmds(regs);
-#endif
                        if (!locked_down && cmd)
                                cmd = cmds(regs);
                        if (locked_down || cmd != 0) {
@@ -1820,8 +1818,8 @@ static void print_bug_trap(struct pt_regs *regs)
        const struct bug_entry *bug;
        unsigned long addr;
 
-       if (regs->msr & MSR_PR)
-               return;         /* not in kernel */
+       if (user_mode(regs))
+               return;
        addr = regs->nip;       /* address of trap instruction */
        if (!is_kernel_addr(addr))
                return;
index 17f6ccee53c7c26e1a3a4f19b1aee82a7950cc7a..4ac854f6b05777c669d7de39ab006d963b74bd48 100644 (file)
@@ -1188,7 +1188,7 @@ static int pata_macio_attach(struct macio_dev *mdev,
        return rc;
 }
 
-static int pata_macio_detach(struct macio_dev *mdev)
+static void pata_macio_detach(struct macio_dev *mdev)
 {
        struct ata_host *host = macio_get_drvdata(mdev);
        struct pata_macio_priv *priv = host->private_data;
@@ -1203,8 +1203,6 @@ static int pata_macio_detach(struct macio_dev *mdev)
        ata_host_detach(host);
 
        unlock_media_bay(priv->mdev->media_bay);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
index 057b0221f695a06d26f00baf17fe77ee46da5da2..b0407c5fadb2a94d65347ac05452253f3717a49a 100644 (file)
@@ -74,7 +74,9 @@ static struct adb_driver *adb_driver_list[] = {
        NULL
 };
 
-static struct class *adb_dev_class;
+static const struct class adb_dev_class = {
+       .name = "adb",
+};
 
 static struct adb_driver *adb_controller;
 BLOCKING_NOTIFIER_HEAD(adb_client_list);
@@ -888,10 +890,10 @@ adbdev_init(void)
                return;
        }
 
-       adb_dev_class = class_create("adb");
-       if (IS_ERR(adb_dev_class))
+       if (class_register(&adb_dev_class))
                return;
-       device_create(adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, "adb");
+
+       device_create(&adb_dev_class, NULL, MKDEV(ADB_MAJOR, 0), NULL, "adb");
 
        platform_device_register(&adb_pfdev);
        platform_driver_probe(&adb_pfdrv, adb_dummy_probe);
index a5ee8f736a8e006af30d372aa6e6343577206428..565f1e21ff7dc0802c8e378a02bc723af84cb58b 100644 (file)
@@ -136,7 +136,7 @@ static int macio_device_modalias(const struct device *dev, struct kobj_uevent_en
 
 extern const struct attribute_group *macio_dev_groups[];
 
-struct bus_type macio_bus_type = {
+const struct bus_type macio_bus_type = {
        .name   = "macio",
        .match  = macio_bus_match,
        .uevent = macio_device_modalias,
index 40240bce77b01e288e3ef7ba94bc0a07c6a1421f..896a43bd819f7102ba29cbbc6441174f2e03edde 100644 (file)
@@ -523,7 +523,7 @@ static int rackmeter_probe(struct macio_dev* mdev,
        return rc;
 }
 
-static int rackmeter_remove(struct macio_dev* mdev)
+static void rackmeter_remove(struct macio_dev *mdev)
 {
        struct rackmeter *rm = dev_get_drvdata(&mdev->ofdev.dev);
 
@@ -558,8 +558,6 @@ static int rackmeter_remove(struct macio_dev* mdev)
 
        /* Get rid of me */
        kfree(rm);
-
-       return 0;
 }
 
 static int rackmeter_shutdown(struct macio_dev* mdev)
index 3c1b29476ce24abd99415c4fd51c86f6eb5279a0..37cdc6931f6d02cc435be824304a94c68ddde50d 100644 (file)
@@ -481,11 +481,9 @@ static int therm_of_probe(struct platform_device *dev)
        return -ENODEV;
 }
 
-static int
-therm_of_remove( struct platform_device *dev )
+static void therm_of_remove(struct platform_device *dev)
 {
        i2c_del_driver( &g4fan_driver );
-       return 0;
 }
 
 static const struct of_device_id therm_of_match[] = {{
@@ -501,7 +499,7 @@ static struct platform_driver therm_of_driver = {
                .of_match_table = therm_of_match,
        },
        .probe          = therm_of_probe,
-       .remove         = therm_of_remove,
+       .remove_new     = therm_of_remove,
 };
 
 struct apple_thermal_info {
index d1dec314ae305948668a5216ca9d80982973ec91..876b4d8cbe378ad609f3b64bc75eb70449bd9f19 100644 (file)
@@ -662,16 +662,14 @@ static int wf_pm112_probe(struct platform_device *dev)
        return 0;
 }
 
-static int wf_pm112_remove(struct platform_device *dev)
+static void wf_pm112_remove(struct platform_device *dev)
 {
        wf_unregister_client(&pm112_events);
-       /* should release all sensors and controls */
-       return 0;
 }
 
 static struct platform_driver wf_pm112_driver = {
        .probe = wf_pm112_probe,
-       .remove = wf_pm112_remove,
+       .remove_new = wf_pm112_remove,
        .driver = {
                .name = "windfarm",
        },
index 82500417ebeec8546fc85d091d277e1ef448306a..cd45fbc4fe1cec25dd5c288ee58001fcccac56db 100644 (file)
@@ -992,15 +992,14 @@ static int pm121_probe(struct platform_device *ddev)
        return 0;
 }
 
-static int pm121_remove(struct platform_device *ddev)
+static void pm121_remove(struct platform_device *ddev)
 {
        wf_unregister_client(&pm121_events);
-       return 0;
 }
 
 static struct platform_driver pm121_driver = {
        .probe = pm121_probe,
-       .remove = pm121_remove,
+       .remove_new = pm121_remove,
        .driver = {
                .name = "windfarm",
                .bus = &platform_bus_type,
index e21f973551cc25206687861323ab219948774a39..14fa1e9ac3e00489ce2340f5f72405d50c1f1c94 100644 (file)
@@ -775,17 +775,14 @@ static int wf_pm72_probe(struct platform_device *dev)
        return 0;
 }
 
-static int wf_pm72_remove(struct platform_device *dev)
+static void wf_pm72_remove(struct platform_device *dev)
 {
        wf_unregister_client(&pm72_events);
-
-       /* should release all sensors and controls */
-       return 0;
 }
 
 static struct platform_driver wf_pm72_driver = {
        .probe  = wf_pm72_probe,
-       .remove = wf_pm72_remove,
+       .remove_new = wf_pm72_remove,
        .driver = {
                .name = "windfarm",
        },
index 257fb2c695c53c1a246104395b000f1065fdf6ad..404d2454e33de622c1926442aa9733d3d451bfca 100644 (file)
@@ -724,7 +724,7 @@ static int wf_smu_probe(struct platform_device *ddev)
        return 0;
 }
 
-static int wf_smu_remove(struct platform_device *ddev)
+static void wf_smu_remove(struct platform_device *ddev)
 {
        wf_unregister_client(&wf_smu_events);
 
@@ -761,13 +761,11 @@ static int wf_smu_remove(struct platform_device *ddev)
        /* Destroy control loops state structures */
        kfree(wf_smu_sys_fans);
        kfree(wf_smu_cpu_fans);
-
-       return 0;
 }
 
 static struct platform_driver wf_smu_driver = {
-        .probe = wf_smu_probe,
-        .remove = wf_smu_remove,
+       .probe = wf_smu_probe,
+       .remove_new = wf_smu_remove,
        .driver = {
                .name = "windfarm",
        },
index 120a9cfba0c54e994564e0fe6064f691263c7651..fba02a375435e40956fa6f6565f616dc0b20ff06 100644 (file)
@@ -647,7 +647,7 @@ static int wf_smu_probe(struct platform_device *ddev)
        return 0;
 }
 
-static int wf_smu_remove(struct platform_device *ddev)
+static void wf_smu_remove(struct platform_device *ddev)
 {
        wf_unregister_client(&wf_smu_events);
 
@@ -691,13 +691,11 @@ static int wf_smu_remove(struct platform_device *ddev)
        kfree(wf_smu_slots_fans);
        kfree(wf_smu_drive_fans);
        kfree(wf_smu_cpu_fans);
-
-       return 0;
 }
 
 static struct platform_driver wf_smu_driver = {
-        .probe = wf_smu_probe,
-        .remove = wf_smu_remove,
+       .probe = wf_smu_probe,
+       .remove_new = wf_smu_remove,
        .driver = {
                .name = "windfarm",
        },
index e9eb7fdde48c1f6fb07df32e678fab72d54a030c..dc8f2c7ef10315edf556b1a461a0acfed463d884 100644 (file)
@@ -668,17 +668,14 @@ static int wf_rm31_probe(struct platform_device *dev)
        return 0;
 }
 
-static int wf_rm31_remove(struct platform_device *dev)
+static void wf_rm31_remove(struct platform_device *dev)
 {
        wf_unregister_client(&rm31_events);
-
-       /* should release all sensors and controls */
-       return 0;
 }
 
 static struct platform_driver wf_rm31_driver = {
        .probe  = wf_rm31_probe,
-       .remove = wf_rm31_remove,
+       .remove_new = wf_rm31_remove,
        .driver = {
                .name = "windfarm",
        },
index 9e653e2925f78ae9047dceedd062e71c52c80008..292b1f9cd9e78e799aa359deceed4ee3958fbb22 100644 (file)
@@ -1591,7 +1591,7 @@ bmac_proc_info(char *buffer, char **start, off_t offset, int length)
 }
 #endif
 
-static int bmac_remove(struct macio_dev *mdev)
+static void bmac_remove(struct macio_dev *mdev)
 {
        struct net_device *dev = macio_get_drvdata(mdev);
        struct bmac_data *bp = netdev_priv(dev);
@@ -1609,8 +1609,6 @@ static int bmac_remove(struct macio_dev *mdev)
        macio_release_resources(mdev);
 
        free_netdev(dev);
-
-       return 0;
 }
 
 static const struct of_device_id bmac_match[] =
index fd1b008b7208c50917e9a5d9df9bcc2218de1304..e6350971c7076c259453ac04c95c7c6f706b4bae 100644 (file)
@@ -272,7 +272,7 @@ static int mace_probe(struct macio_dev *mdev, const struct of_device_id *match)
        return rc;
 }
 
-static int mace_remove(struct macio_dev *mdev)
+static void mace_remove(struct macio_dev *mdev)
 {
        struct net_device *dev = macio_get_drvdata(mdev);
        struct mace_data *mp;
@@ -296,8 +296,6 @@ static int mace_remove(struct macio_dev *mdev)
        free_netdev(dev);
 
        macio_release_resources(mdev);
-
-       return 0;
 }
 
 static void dbdma_reset(volatile struct dbdma_regs __iomem *dma)
index 335d102586ac2dc7d935b3a91022a56151e4494f..8856c67c466acd4dc98aee218f3ceaebf250a7a9 100644 (file)
@@ -395,25 +395,26 @@ int of_device_compatible_match(const struct device_node *device,
 EXPORT_SYMBOL_GPL(of_device_compatible_match);
 
 /**
- * of_machine_is_compatible - Test root of device tree for a given compatible value
- * @compat: compatible string to look for in root node's compatible property.
+ * of_machine_compatible_match - Test root of device tree against a compatible array
+ * @compats: NULL terminated array of compatible strings to look for in root node's compatible property.
  *
- * Return: A positive integer if the root node has the given value in its
+ * Returns true if the root node has any of the given compatible values in its
  * compatible property.
  */
-int of_machine_is_compatible(const char *compat)
+bool of_machine_compatible_match(const char *const *compats)
 {
        struct device_node *root;
        int rc = 0;
 
        root = of_find_node_by_path("/");
        if (root) {
-               rc = of_device_is_compatible(root, compat);
+               rc = of_device_compatible_match(root, compats);
                of_node_put(root);
        }
-       return rc;
+
+       return rc != 0;
 }
-EXPORT_SYMBOL(of_machine_is_compatible);
+EXPORT_SYMBOL(of_machine_compatible_match);
 
 static bool __of_device_is_status(const struct device_node *device,
                                  const char * const*strings)
index 6a019132109c1ee678ad09d5b4b413d7fe691bbc..377dcab32cd8fe5ed7a23765a6d6e9448642b76e 100644 (file)
@@ -508,7 +508,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat
        return rc;
 }
 
-static int mac53c94_remove(struct macio_dev *mdev)
+static void mac53c94_remove(struct macio_dev *mdev)
 {
        struct fsc_state *fp = (struct fsc_state *)macio_get_drvdata(mdev);
        struct Scsi_Host *host = fp->host;
@@ -526,11 +526,8 @@ static int mac53c94_remove(struct macio_dev *mdev)
        scsi_host_put(host);
 
        macio_release_resources(mdev);
-
-       return 0;
 }
 
-
 static struct of_device_id mac53c94_match[] = 
 {
        {
index 0a48da52d1dc40c06ecd2c709636bff5f9549d17..1c15cac41d805a783e634936cb261e16e70f2113 100644 (file)
@@ -1986,7 +1986,7 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
        return -ENODEV;
 }
 
-static int mesh_remove(struct macio_dev *mdev)
+static void mesh_remove(struct macio_dev *mdev)
 {
        struct mesh_state *ms = (struct mesh_state *)macio_get_drvdata(mdev);
        struct Scsi_Host *mesh_host = ms->host;
@@ -2013,11 +2013,8 @@ static int mesh_remove(struct macio_dev *mdev)
        macio_release_resources(mdev);
 
        scsi_host_put(mesh_host);
-
-       return 0;
 }
 
-
 static struct of_device_id mesh_match[] = 
 {
        {
index c8bf08c19c647a761e8c4b99fb2453c726e96c18..732d821db4f805d539e732367b9ef9df1afb7cc9 100644 (file)
@@ -1507,12 +1507,12 @@ static int pmz_attach(struct macio_dev *mdev, const struct of_device_id *match)
  * That one should not be called, macio isn't really a hotswap device,
  * we don't expect one of those serial ports to go away...
  */
-static int pmz_detach(struct macio_dev *mdev)
+static void pmz_detach(struct macio_dev *mdev)
 {
        struct uart_pmac_port   *uap = dev_get_drvdata(&mdev->ofdev.dev);
        
        if (!uap)
-               return -ENODEV;
+               return;
 
        uart_remove_one_port(&pmz_uart_reg, &uap->port);
 
@@ -1523,11 +1523,8 @@ static int pmz_detach(struct macio_dev *mdev)
        dev_set_drvdata(&mdev->ofdev.dev, NULL);
        uap->dev = NULL;
        uap->port.dev = NULL;
-       
-       return 0;
 }
 
-
 static int pmz_suspend(struct macio_dev *mdev, pm_message_t pm_state)
 {
        struct uart_pmac_port *uap = dev_get_drvdata(&mdev->ofdev.dev);
index 4f24e33d67a602570306659bf1984e0863f2274f..df702b2c2ae3a61f465331c073118d3779b89250 100644 (file)
@@ -398,7 +398,20 @@ extern void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align));
 extern int of_alias_get_id(struct device_node *np, const char *stem);
 extern int of_alias_get_highest_id(const char *stem);
 
-extern int of_machine_is_compatible(const char *compat);
+bool of_machine_compatible_match(const char *const *compats);
+
+/**
+ * of_machine_is_compatible - Test root of device tree for a given compatible value
+ * @compat: compatible string to look for in root node's compatible property.
+ *
+ * Return: true if the root node has the given value in its compatible property.
+ */
+static inline bool of_machine_is_compatible(const char *compat)
+{
+       const char *compats[] = { compat, NULL };
+
+       return of_machine_compatible_match(compats);
+}
 
 extern int of_add_property(struct device_node *np, struct property *prop);
 extern int of_remove_property(struct device_node *np, struct property *prop);
@@ -805,6 +818,11 @@ static inline int of_remove_property(struct device_node *np, struct property *pr
        return 0;
 }
 
+static inline bool of_machine_compatible_match(const char *const *compats)
+{
+       return false;
+}
+
 static inline bool of_console_check(const struct device_node *dn, const char *name, int index)
 {
        return false;
index 6991c4b8ab189d25f2cda92661f7da4a8a558a94..cc61cb9b3e9af86a41b50d5221a1b94f4d6591bb 100644 (file)
@@ -32,6 +32,8 @@
 #define AT_HWCAP2 26   /* extension of AT_HWCAP */
 #define AT_RSEQ_FEATURE_SIZE   27      /* rseq supported feature size */
 #define AT_RSEQ_ALIGN          28      /* rseq allocation alignment */
+#define AT_HWCAP3 29   /* extension of AT_HWCAP */
+#define AT_HWCAP4 30   /* extension of AT_HWCAP */
 
 #define AT_EXECFN  31  /* filename of program */
 
index 3f49a9e28bfc5509742822fff70a2d2b3eb74ee7..b8ff5cccd0c811fd76050be0f9cf50efa899a3cc 100644 (file)
@@ -365,15 +365,13 @@ static int i2sbus_probe(struct macio_dev* dev, const struct of_device_id *match)
        return 0;
 }
 
-static int i2sbus_remove(struct macio_dev* dev)
+static void i2sbus_remove(struct macio_dev *dev)
 {
        struct i2sbus_control *control = dev_get_drvdata(&dev->ofdev.dev);
        struct i2sbus_dev *i2sdev, *tmp;
 
        list_for_each_entry_safe(i2sdev, tmp, &control->list, item)
                soundbus_remove_one(&i2sdev->sound);
-
-       return 0;
 }
 
 #ifdef CONFIG_PM
index a89f1fbf86ecbfb42a1dd949fcb360a9b8df4539..1d293ab7718507d4f4e2dd3fdd8fa4f113c78ae6 100644 (file)
 /* Default to taking the first of any alternative feature sections */
 test_feature = 1
 
+#define DCBT_SETUP_STREAMS(from, from_parms, to, to_parms, scratch)    \
+       lis     scratch,0x8000; /* GO=1 */                              \
+       clrldi  scratch,scratch,32;                                     \
+       /* setup read stream 0 */                                       \
+       dcbt    0,from,0b01000;         /* addr from */                 \
+       dcbt    0,from_parms,0b01010;   /* length and depth from */     \
+       /* setup write stream 1 */                                      \
+       dcbtst  0,to,0b01000;           /* addr to */                   \
+       dcbtst  0,to_parms,0b01010;     /* length and depth to */       \
+       eieio;                                                          \
+       dcbt    0,scratch,0b01010;      /* all streams GO */
+
 #endif /* __SELFTESTS_POWERPC_PPC_ASM_H */