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


Groups > linux.kernel > #1199532

[PATCH] powerpc: Add an inline function to update HID0

From "Gautham R. Shenoy" <ego@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH] powerpc: Add an inline function to update HID0
Date 2015-08-04 10:40 +0200
Message-ID <pTFVo-5cP-19@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Section 3.7 of Version 1.2 of the Power8 Processor User's Manual
prescribes that updates to HID0 be preceded by a SYNC instruction and
followed by an ISYNC instruction (Page 91).

Create a function name update_hid0() which follows this recipe and
invoke it from the static split core path.

Signed-off-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/kvm_ppc.h       | 11 +++++++++++
 arch/powerpc/platforms/powernv/subcore.c |  4 ++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index c6ef05b..325f1d6 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -685,4 +685,15 @@ static inline ulong kvmppc_get_ea_indexed(struct kvm_vcpu *vcpu, int ra, int rb)
 
 extern void xics_wake_cpu(int cpu);
 
+static inline void update_hid0(unsigned long hid0)
+{
+	/*
+	 *  The HID0 update should at the very least be preceded by a
+	 *  a SYNC instruction followed by an ISYNC instruction
+	 */
+	mb();
+	mtspr(SPRN_HID0, hid0);
+	isync();
+}
+
 #endif /* __POWERPC_KVM_PPC_H__ */
diff --git a/arch/powerpc/platforms/powernv/subcore.c b/arch/powerpc/platforms/powernv/subcore.c
index f60f80a..37e77bf 100644
--- a/arch/powerpc/platforms/powernv/subcore.c
+++ b/arch/powerpc/platforms/powernv/subcore.c
@@ -190,7 +190,7 @@ static void unsplit_core(void)
 
 	hid0 = mfspr(SPRN_HID0);
 	hid0 &= ~HID0_POWER8_DYNLPARDIS;
-	mtspr(SPRN_HID0, hid0);
+	update_hid0(hid0);
 	update_hid_in_slw(hid0);
 
 	while (mfspr(SPRN_HID0) & mask)
@@ -227,7 +227,7 @@ static void split_core(int new_mode)
 	/* Write new mode */
 	hid0  = mfspr(SPRN_HID0);
 	hid0 |= HID0_POWER8_DYNLPARDIS | split_parms[i].value;
-	mtspr(SPRN_HID0, hid0);
+	update_hid0(hid0);
 	update_hid_in_slw(hid0);
 
 	/* Wait for it to happen */
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH] powerpc: Add an inline function to update HID0 "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2015-08-04 10:40 +0200
  Re: powerpc: Add an inline function to update HID0 Michael Ellerman <mpe@ellerman.id.au> - 2015-08-04 12:10 +0200
    Re: powerpc: Add an inline function to update HID0 Gautham R Shenoy <ego@linux.vnet.ibm.com> - 2015-08-04 13:00 +0200
      [PATCH v2] powerpc: Add an inline function to update HID0 "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2015-08-04 13:10 +0200
    Re: powerpc: Add an inline function to update HID0 Madhavan Srinivasan <maddy@linux.vnet.ibm.com> - 2015-08-04 16:10 +0200
      Re: powerpc: Add an inline function to update HID0 Michael Ellerman <mpe@ellerman.id.au> - 2015-08-05 04:10 +0200
    Re: powerpc: Add an inline function to update HID0 Segher Boessenkool <segher@kernel.crashing.org> - 2015-08-05 04:40 +0200
      Re: powerpc: Add an inline function to update HID0 Gautham R Shenoy <ego@linux.vnet.ibm.com> - 2015-08-05 09:00 +0200
        [PATCH v3] powerpc: Add an inline function to update POWER8 HID0 "Gautham R. Shenoy" <ego@linux.vnet.ibm.com> - 2015-08-05 09:10 +0200
          Re: [PATCH v3] powerpc: Add an inline function to update POWER8 HID0 Sam Bobroff <sam.bobroff@au1.ibm.com> - 2015-08-14 07:00 +0200
          Re: [PATCH v3] powerpc: Add an inline function to update POWER8 HID0 Shreyas B Prabhu <shreyas@linux.vnet.ibm.com> - 2015-08-14 11:10 +0200
          Re: [v3] powerpc: Add an inline function to update POWER8 HID0 Michael Ellerman <mpe@ellerman.id.au> - 2015-08-17 10:10 +0200
    Re: powerpc: Add an inline function to update HID0 Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2015-08-09 04:40 +0200

csiph-web