Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1622031

[PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop

From "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop
Date 2017-04-12 13:50 +0200
Message-ID <tvoWC-3Wi-9@gated-at.bofh.it> (permalink)
References <tvoWB-3Wi-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

On wakeup from a deep-stop used for CPU-Hotplug, we invoke
cur_cpu_spec->cpu_restore() which would set sane default values to
various SPRs including LPCR.

On POWER9, the cpu_restore_power9() call would would restore LPCR to a
sane value that is set at early boot time, thereby clearing LPCR_UPRT.

However, LPCR_UPRT is required to be set if we are running in Radix
mode. If this is not set we will end up with a crash when we enable
IR,DR.

To fix this, after returning from cur_cpu_spec->cpu_restore() in the
idle exit path, set LPCR_UPRT if we are running in Radix mode.

Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/idle_book3s.S | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 6a9bd28..39a9b63 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -804,6 +804,19 @@ no_segments:
 #endif
 	mtctr	r12
 	bctrl
+/*
+ * cur_cpu_spec->cpu_restore would restore LPCR to a
+ * sane value that is set at early boot time,
+ * thereby clearing LPCR_UPRT.
+ * LPCR_UPRT is required if we are running in Radix mode.
+ * Set it here if that be the case.
+ */
+BEGIN_MMU_FTR_SECTION
+	mfspr	r3, SPRN_LPCR
+	LOAD_REG_IMMEDIATE(r4, LPCR_UPRT)
+	or	r3, r3, r4
+	mtspr	SPRN_LPCR, r3
+END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX)
 
 hypervisor_state_restored:
 
-- 
1.9.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2017-04-12 13:50 +0200
  Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2017-04-13 06:10 +0200
    Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2017-04-13 06:20 +0200
      Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop Michael Neuling <mikey@neuling.org> - 2017-04-13 08:30 +0200
        Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from  deep-stop Nicholas Piggin <npiggin@gmail.com> - 2017-04-13 09:20 +0200
          Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop Michael Ellerman <mpe@ellerman.id.au> - 2017-04-13 12:10 +0200
          Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from deep-stop Gautham R Shenoy <ego@linux.vnet.ibm.com> - 2017-04-13 14:00 +0200
            Re: [PATCH 3/3] powernv:idle: Set LPCR_UPRT on wakeup from  deep-stop Nicholas Piggin <npiggin@gmail.com> - 2017-04-13 14:10 +0200

csiph-web