From patchwork Wed Apr 24 10:30:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 239151 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id CB0E32C0567 for ; Wed, 24 Apr 2013 20:30:36 +1000 (EST) Received: by ozlabs.org (Postfix) id 0AA902C0113; Wed, 24 Apr 2013 20:30:11 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 9733C2C0112; Wed, 24 Apr 2013 20:30:10 +1000 (EST) Received: by localhost.localdomain (Postfix, from userid 1000) id 75ECAD48E8F; Wed, 24 Apr 2013 20:30:09 +1000 (EST) Received: from ale.ozlabs.ibm.com (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id 74FA1D41ED5; Wed, 24 Apr 2013 20:30:09 +1000 (EST) From: Michael Neuling To: benh@kernel.crashing.org X-GPG-Fingerprint: 9B25 DC2A C58D 2C8D 47C2 457E 0887 E86F 32E6 BE16 X-GPG-Fingerprint: 9365 87D7 A7EF 4721 420B 91D9 CD5B 874B EAC1 B3F5 MIME-Version: 1.0 Subject: [PATCH] powerpc: Add isync to copy_and_flush X-Mailer: MH-E 8.2; nmh 1.5; GNU Emacs 23.4.1 Date: Wed, 24 Apr 2013 20:30:09 +1000 Message-ID: <29244.1366799409@ale.ozlabs.ibm.com> Cc: Linux PPC dev , miltonm@realtime.net, Nishanth Aravamudan X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In __after_prom_start we copy the kernel down to zero in two calls to copy_and_flush. After the first call (copy from 0 to copy_to_here:) we jump to the newly copied code soon after. Unfortunately there's no isync between the copy of this code and the jump to it. Hence it's possible that stale instructions could still be in the icache or pipeline before we branch to it. We've seen this on real machines and it's results in no console output after: calling quiesce... returning from prom_init The below adds an isync to ensure that the copy and flushing has completed before any branching to the new instructions occurs. Signed-off-by: Michael Neuling cc: stable@kernel.org --- benh: we should get this in 3.9 ASAP. diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S index 0886ae6..b61363d 100644 --- a/arch/powerpc/kernel/head_64.S +++ b/arch/powerpc/kernel/head_64.S @@ -509,6 +509,7 @@ _GLOBAL(copy_and_flush) sync addi r5,r5,8 addi r6,r6,8 + isync blr .align 8