summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-09-14 21:13:46 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-09-28 00:30:02 -0500
commitcca6c3408711a8971dfc8c3331d381741012775f (patch)
tree77604854989d034b1a8991d455da5f80d3559b82 /include
parentab101cb041a985f99c9e05977d4d43ad4baaeef8 (diff)
downloadblackbird-skiboot-cca6c3408711a8971dfc8c3331d381741012775f.tar.gz
blackbird-skiboot-cca6c3408711a8971dfc8c3331d381741012775f.zip
cpu: idle POWER9 power management implementation
Add pm idle support to POWER9. IPIs are implemented with doorbells. POWER9 can use the EC=ESL=0 (lite) stop when sreset is not available. EC=ESL=1 state with RL=3 is enabled when we have a sreset wakeup. Deep idle states are not implemented. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/processor.h31
-rw-r--r--include/skiboot.h4
2 files changed, 34 insertions, 1 deletions
diff --git a/include/processor.h b/include/processor.h
index da483046..1f18762a 100644
--- a/include/processor.h
+++ b/include/processor.h
@@ -77,6 +77,7 @@
#define SPR_HMER 0x150 /* Hypervisor Maintenance Exception */
#define SPR_HMEER 0x151 /* HMER interrupt enable mask */
#define SPR_AMOR 0x15d
+#define SPR_PSSCR 0x357 /* RW: Stop status and control (ISA 3) */
#define SPR_TSCR 0x399
#define SPR_HID0 0x3f0
#define SPR_HID1 0x3f1
@@ -85,6 +86,7 @@
#define SPR_HID5 0x3f6
#define SPR_PIR 0x3ff /* RO: Processor Identification */
+
/* Bits in LPCR */
/* Powersave Exit Cause Enable is different for P7 and P8 */
@@ -99,6 +101,14 @@
#define SPR_LPCR_P8_PECE2 PPC_BIT(49) /* Wake on external interrupts */
#define SPR_LPCR_P8_PECE3 PPC_BIT(50) /* Wake on decrementer */
#define SPR_LPCR_P8_PECE4 PPC_BIT(51) /* Wake on MCs, HMIs, etc... */
+
+#define SPR_LPCR_P9_PECE (PPC_BITMASK(47,51) | PPC_BITMASK(17,17))
+#define SPR_LPCR_P9_PECEU0 PPC_BIT(17) /* Wake on HVI */
+#define SPR_LPCR_P9_PECEL0 PPC_BIT(47) /* Wake on priv doorbell */
+#define SPR_LPCR_P9_PECEL1 PPC_BIT(48) /* Wake on hv doorbell */
+#define SPR_LPCR_P9_PECEL2 PPC_BIT(49) /* Wake on external interrupts */
+#define SPR_LPCR_P9_PECEL3 PPC_BIT(50) /* Wake on decrementer */
+#define SPR_LPCR_P9_PECEL4 PPC_BIT(51) /* Wake on MCs, HMIs, etc... */
#define SPR_LPCR_P9_LD PPC_BIT(46) /* Large decrementer mode bit */
@@ -309,6 +319,27 @@ static inline void sync_icache(void)
asm volatile("sync; icbi 0,%0; sync; isync" : : "r" (0) : "memory");
}
+/*
+ * Doorbells
+ */
+static inline void msgclr(void)
+{
+ uint64_t rb = (0x05 << (63-36));
+ asm volatile("msgclr %0" : : "r"(rb));
+}
+
+static inline void p9_dbell_receive(void)
+{
+ uint64_t rb = (0x05 << (63-36));
+ /* msgclr ; msgsync ; lwsync */
+ asm volatile("msgclr %0 ; .long 0x7c0006ec ; lwsync" : : "r"(rb));
+}
+
+static inline void p9_dbell_send(uint32_t pir)
+{
+ uint64_t rb = (0x05 << (63-36)) | pir;
+ asm volatile("sync ; msgsnd %0" : : "r"(rb));
+}
/*
* Byteswap load/stores
diff --git a/include/skiboot.h b/include/skiboot.h
index a32af6a5..db913258 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -315,7 +315,9 @@ extern void fast_sleep_exit(void);
extern void fake_rtc_init(void);
/* Assembly in head.S */
-extern void enter_pm_state(bool winkle);
+extern void enter_p8_pm_state(bool winkle);
+extern void enter_p9_pm_state(uint64_t psscr);
+extern void enter_p9_pm_lite_state(uint64_t psscr);
extern uint32_t reset_patch_start;
extern uint32_t reset_patch_end;
OpenPOWER on IntegriCloud