Re: [PATCH 4/5] powerpc/pm: add sleep and deep sleep on QorIQ SoCs

2018-04-02 Thread kbuild test robot
Hi Ran,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on v4.16 next-20180329]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Ran-Wang/powerpc-pm-Fix-suspend-n-in-menuconfig-for-e500mc-platforms/20180330-072848
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-ppc64e_defconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

   arch/powerpc/platforms/85xx/sleep.S: Assembler messages:
>> arch/powerpc/platforms/85xx/sleep.S:1174: Warning: invalid register 
>> expression

vim +1174 arch/powerpc/platforms/85xx/sleep.S

  1137  
  1138  _GLOBAL(fsl_booke_deep_sleep_resume)
  1139  /* disable interrupts */
  1140  FSL_DIS_ALL_IRQ
  1141  
  1142  /* switch to 64-bit mode */
  1143  bl  .enable_64b_mode
  1144  
  1145  /* set TOC pointer */
  1146  bl  .relative_toc
  1147  
  1148  /* setup initial TLBs, switch to kernel space ... */
  1149  bl  .start_initialization_book3e
  1150  
  1151  /* address space changed, set TOC pointer again */
  1152  bl  .relative_toc
  1153  
  1154  /* call a cpu state restore handler */
  1155  LOAD_REG_ADDR(r23, cur_cpu_spec)
  1156  ld  r23,0(r23)
  1157  ld  r23,CPU_SPEC_RESTORE(r23)
  1158  cmpdi   0,r23,0
  1159  beq 1f
  1160  ld  r23,0(r23)
  1161  mtctr   r23
  1162  bctrl
  1163  1:
  1164  LOAD_REG_ADDR(r3, regs_buffer)
  1165  bl  e5500_cpu_state_restore
  1166  
  1167  /* Load each CAM entry */
  1168  LOAD_REG_ADDR(r3, tlbcam_index)
  1169  lwz r3, 0(r3)
  1170  mtctr   r3
  1171  li  r0, 0
  1172  3:  mr  r3, r0
  1173  bl  loadcam_entry
> 1174  addir0, r0, 1
  1175  bdnz3b
  1176  
  1177  /* restore return address */
  1178  LOAD_REG_ADDR(r3, buf_tmp)
  1179  ld  r4, 16(r3)
  1180  mtspr   SPRN_TCR, r4
  1181  ld  r4, 0(r3)
  1182  mtlrr4
  1183  ld  r4, 8(r3)
  1184  mtmsr   r4
  1185  ld  r4, 24(r3)
  1186  mtcrr4
  1187  
  1188  blr
  1189  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH 4/5] powerpc/pm: add sleep and deep sleep on QorIQ SoCs

2018-03-29 Thread Ran Wang
In sleep mode, the clocks of CPU core and unused IP blocks are turned
off (IP blocks allowed to wake up system will running).

Some QorIQ SoCs like MPC8536, P1022 and T104x, have deep sleep PM mode
in addtion to the sleep PM mode. While in deep sleep mode,
additionally, the power supply is removed from CPU core and most IP
blocks. Only the blocks needed to wake up the chip out of deep sleep
are ON.

This feature supports 32-bit and 36-bit address space.

The sleep mode is equal to the Standby state in Linux. The deep sleep
mode is equal to the Suspend-to-RAM state of Linux Power Management.
Command to enter sleep mode.
echo standby > /sys/power/state
Command to enter deep sleep mode.
echo mem > /sys/power/state

Signed-off-by: Dave Liu 
Signed-off-by: Li Yang 
Signed-off-by: Jin Qing 
Signed-off-by: Jerry Huang 
Signed-off-by: Ramneek Mehresh 
Signed-off-by: Zhao Chenhui 
Signed-off-by: Wang Dongsheng 
Signed-off-by: Tang Yuantian 
Signed-off-by: Xie Xiaobo 
Signed-off-by: Zhao Qiang 
Signed-off-by: Shengzhou Liu 
Signed-off-by: Ran Wang 
---
 arch/powerpc/include/asm/cacheflush.h |7 +
 arch/powerpc/include/asm/fsl_pm.h |   31 +
 arch/powerpc/kernel/Makefile  |1 +
 arch/powerpc/kernel/fsl_booke_entry_mapping.S |   10 +
 arch/powerpc/kernel/fsl_pm.c  |   49 +
 arch/powerpc/kernel/head_64.S |2 +-
 arch/powerpc/platforms/85xx/Kconfig   |6 +
 arch/powerpc/platforms/85xx/Makefile  |2 +
 arch/powerpc/platforms/85xx/deepsleep.c   |  349 
 arch/powerpc/platforms/85xx/qoriq_pm.c|  223 +
 arch/powerpc/platforms/85xx/sleep.S   | 1192 +
 arch/powerpc/platforms/86xx/Kconfig   |1 +
 arch/powerpc/sysdev/fsl_pmc.c |  176 -
 arch/powerpc/sysdev/fsl_soc.c |   31 +
 arch/powerpc/sysdev/fsl_soc.h |   18 +
 15 files changed, 2078 insertions(+), 20 deletions(-)
 create mode 100644 arch/powerpc/kernel/fsl_pm.c
 create mode 100644 arch/powerpc/platforms/85xx/deepsleep.c
 create mode 100644 arch/powerpc/platforms/85xx/qoriq_pm.c
 create mode 100644 arch/powerpc/platforms/85xx/sleep.S

diff --git a/arch/powerpc/include/asm/cacheflush.h 
b/arch/powerpc/include/asm/cacheflush.h
index b77f036..a5411af 100644
--- a/arch/powerpc/include/asm/cacheflush.h
+++ b/arch/powerpc/include/asm/cacheflush.h
@@ -31,6 +31,13 @@
 #define flush_dcache_mmap_lock(mapping)do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)  do { } while (0)
 
+extern void __flush_disable_L1(void);
+#ifdef CONFIG_FSL_SOC_BOOKE
+extern void flush_dcache_L1(void);
+#else
+#define flush_dcache_L1()  do { } while (0)
+#endif
+
 extern void flush_icache_range(unsigned long, unsigned long);
 extern void flush_icache_user_range(struct vm_area_struct *vma,
struct page *page, unsigned long addr,
diff --git a/arch/powerpc/include/asm/fsl_pm.h 
b/arch/powerpc/include/asm/fsl_pm.h
index 47df55e..510e5d2 100644
--- a/arch/powerpc/include/asm/fsl_pm.h
+++ b/arch/powerpc/include/asm/fsl_pm.h
@@ -11,6 +11,9 @@
 #ifndef __PPC_FSL_PM_H
 #define __PPC_FSL_PM_H
 
+#ifndef __ASSEMBLY__
+#include 
+
 #define E500_PM_PH10   1
 #define E500_PM_PH15   2
 #define E500_PM_PH20   3
@@ -46,6 +49,34 @@ struct fsl_pm_ops {
 
 extern const struct fsl_pm_ops *qoriq_pm_ops;
 
+struct fsm_reg_vals {
+   u32 offset;
+   u32 value;
+};
+
+void fsl_fsm_setup(void __iomem *base, struct fsm_reg_vals *val);
+void fsl_epu_setup_default(void __iomem *epu_base);
+void fsl_npc_setup_default(void __iomem *npc_base);
+void fsl_fsm_clean(void __iomem *base, struct fsm_reg_vals *val);
+void fsl_epu_clean_default(void __iomem *epu_base);
+
+extern int fsl_dp_iomap(void);
+extern void fsl_dp_iounmap(void);
+
+extern int fsl_enter_epu_deepsleep(void);
+extern void fsl_dp_enter_low(void __iomem *ccsr_base, void __iomem *dcsr_base,
+void __iomem *pld_base, int pld_flag);
+extern void fsl_booke_deep_sleep_resume(void);
+
 int __init fsl_rcpm_init(void);
 
+void set_pm_suspend_state(suspend_state_t state);
+suspend_state_t pm_suspend_state(void);
+
+void fsl_set_power_except(struct device *dev, int on);
+#endif /* __ASSEMBLY__ */
+
+#define T1040QDS_TETRA_FLAG1
+#define T104xRDB_CPLD_FLAG 2
+
 #endif /* __PPC_FSL_PM_H */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 1b6bc7f..f191269 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_EEH)  += eeh.o