lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Nov 2016 00:07:49 +0530
From:   "Gautham R. Shenoy" <ego@...ux.vnet.ibm.com>
To:     Michael Ellerman <mpe@...erman.id.au>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Paul Mackerras <paulus@...ba.org>,
        Michael Neuling <mikey@...ling.org>,
        Vaidyanathan Srinivasan <svaidy@...ux.vnet.ibm.com>,
        "Shreyas B. Prabhu" <shreyasbp@...il.com>
Cc:     "linuxppc-dev@...ts.ozlabs.org>, linux-kernel@...r.kernel.org>, skiboot"@lists.ozlabs.org,
        "Gautham R. Shenoy" <ego@...ux.vnet.ibm.com>
Subject: [RFC/PATCH] powernv: Handle wakeup from stop due to SRESET

From: "Gautham R. Shenoy" <ego@...ux.vnet.ibm.com>

The existing code doesn't handle the case when CPU which was in a
hardware-idle state (nap,sleep,winkle on POWER8 and various stop
states on POWER9) gets woken up due to a System Reset interrupt.

This patch checks if the CPU was woken up due to System Reset, in
which case, after restoring the required hardware state, it jumps to
the system reset handler.

Signed-off-by: Gautham R. Shenoy <ego@...ux.vnet.ibm.com>
---
 arch/powerpc/kernel/idle_book3s.S | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 72dac0b..0098879 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -353,6 +353,18 @@ ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 66);		\
 	ld	r3,ORIG_GPR3(r1);	/* Restore original r3 */	\
 20:	nop;
 
+#define CHECK_SRESET_INTERRUPT                                          \
+BEGIN_FTR_SECTION_NESTED(67);						\
+	mfspr	r0,SPRN_SRR1;						\
+	rlwinm	r0,r0,45-31,0xf; /* Extract wake reason field (P8,9) */ \
+	cmpwi	r0,0x4;		  /* System Reset ? 	*/		\
+	bne	21f;							\
+	b	system_reset_common; 					\
+	b	.; 		/* We shouldn't return here */		\
+FTR_SECTION_ELSE_NESTED(67);						\
+	nop		   ;						\
+ALT_FTR_SECTION_END_NESTED_IFSET(CPU_FTR_ARCH_207S, 67);		\
+21:	nop;
 
 /*
  * r3 - requested stop state
@@ -644,6 +656,7 @@ _GLOBAL(pnv_wakeup_loss)
 	ld	r1,PACAR1(r13)
 BEGIN_FTR_SECTION
 	CHECK_HMI_INTERRUPT
+	CHECK_SRESET_INTERRUPT
 END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
 	REST_NVGPRS(r1)
 	REST_GPR(2, r1)
@@ -666,6 +679,7 @@ _GLOBAL(pnv_wakeup_noloss)
 	bne	pnv_wakeup_loss
 BEGIN_FTR_SECTION
 	CHECK_HMI_INTERRUPT
+	CHECK_SRESET_INTERRUPT
 END_FTR_SECTION_IFSET(CPU_FTR_HVMODE)
 	ld	r1,PACAR1(r13)
 	ld	r6,_CCR(r1)
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ