From patchwork Tue Sep 17 17:09:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 275508 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 3492A2C00E6 for ; Wed, 18 Sep 2013 03:10:08 +1000 (EST) Received: from mailhub1.si.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by ozlabs.org (Postfix) with ESMTP id 06E202C00DD for ; Wed, 18 Sep 2013 03:09:31 +1000 (EST) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 63F441C85F0; Tue, 17 Sep 2013 19:09:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from mailhub1.si.c-s.fr ([192.168.12.234]) by localhost (mailhub1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9cY-NKPKiPmI; Tue, 17 Sep 2013 19:09:29 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4BF671C85EC; Tue, 17 Sep 2013 19:09:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 3556423DC3; Tue, 17 Sep 2013 19:09:29 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id VUaRhg9vbGSJ; Tue, 17 Sep 2013 19:09:29 +0200 (CEST) Received: from localhost.localdomain (unknown [172.25.231.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by messagerie.si.c-s.fr (Postfix) with ESMTP id 024CC23DC5; Tue, 17 Sep 2013 19:09:28 +0200 (CEST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.13.8/8.13.8) with ESMTP id r8HH9Rso018281; Tue, 17 Sep 2013 19:09:28 +0200 Received: (from root@localhost) by localhost.localdomain (8.13.8/8.13.8/Submit) id r8HH9Rxo018278; Tue, 17 Sep 2013 19:09:27 +0200 Date: Tue, 17 Sep 2013 19:09:27 +0200 Message-Id: <201309171709.r8HH9Rxo018278@localhost.localdomain> From: Christophe Leroy To: Benjamin Herrenschmidt , Paul Mackerras , scottwood@freescale.com Subject: [PATCH v3] powerpc 8xx: Fixing issue with CONFIG_PIN_TLB Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16rc2 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Activating CONFIG_PIN_TLB is supposed to pin the IMMR and the first three 8Mbytes pages. But the setting of the MD_CTR was missing so as the index is decremented every DTLB update, the pinning of the third 8Mbytes page was overwriting the DTLB entry for IMMR. At the same time, the last entry written being entry 31, next entries would possibly get overwritten after. We are now starting from entry 31 and decrementing. Signed-off-by: Christophe Leroy diff -ur linux-3.11.org/arch/powerpc/kernel/head_8xx.S linux-3.11/arch/powerpc/kernel/head_8xx.S --- linux-3.11.org/arch/powerpc/kernel/head_8xx.S 2013-09-02 22:46:10.000000000 +0200 +++ linux-3.11/arch/powerpc/kernel/head_8xx.S 2013-09-09 11:28:54.000000000 +0200 @@ -796,8 +796,7 @@ #ifdef CONFIG_PIN_TLB lis r10, (MD_RSV4I | MD_RESETVAL)@h - ori r10, r10, 0x1c00 - mr r8, r10 + ori r10, r10, 0x1f00 #else lis r10, MD_RESETVAL@h #endif @@ -829,7 +828,7 @@ * internal registers (among other things). */ #ifdef CONFIG_PIN_TLB - addi r10, r10, 0x0100 + addi r10, r10, -0x0100 mtspr SPRN_MD_CTR, r10 #endif mfspr r9, 638 /* Get current IMMR */ @@ -848,7 +847,7 @@ #ifdef CONFIG_PIN_TLB /* Map two more 8M kernel data pages. */ - addi r10, r10, 0x0100 + addi r10, r10, -0x0100 mtspr SPRN_MD_CTR, r10 lis r8, KERNELBASE@h /* Create vaddr for TLB */ @@ -862,6 +861,9 @@ addis r11, r11, 0x0080 /* Add 8M */ mtspr SPRN_MD_RPN, r11 + addi r10, r10, -0x0100 + mtspr SPRN_MD_CTR, r10 + addis r8, r8, 0x0080 /* Add 8M */ mtspr SPRN_MD_EPN, r8 mtspr SPRN_MD_TWC, r9