Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2837859pjo; Mon, 16 Mar 2020 05:39:20 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtRqNFuXepMSHIj2v9s1SVvO4XaaK7reK5QnXqW8TeDQ/8devtuZcwxZ4iu5sLVT/z1IxNv X-Received: by 2002:a05:6830:1285:: with SMTP id z5mr7657645otp.241.1584362360111; Mon, 16 Mar 2020 05:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362360; cv=none; d=google.com; s=arc-20160816; b=0n3629EEngR9ibvZAdUHyEDXrY8IJXPSLkzfwDZWs1myZkfuRVJCUTCXziYmEYmMlx yHOht5TAQflCkKG8vDe+8oC8RdUIZFBW6h4bWRNSsDi/1sRKjlrYxWLA91sB1S94QcCi JUiy1MqF/lzDyAfL1X8jrQ/U7UbrZH2fcph1HCUKRFWuTtekt3ZqKHzqxy5H78ZOIeBj ncOuWTFYhQrEvaCHq3xkk0ZCqW6p7WtoO8IGUbthSuCDXJrOp0R1ko5AApXIKdxjP7yd 18NTK/H4aNABG9i+gZs2qh+P4jrPSTvxrOk52BeZYqzY4Pgb1cjC7YTW0H2MEQemgZJV dAtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:dkim-signature; bh=iWOn+U7JOwLJNDauXlLGMF/b0VCQfBy5EbGKISCTiPs=; b=ckvOLRnCNuSr6ngvXo0jnADRd8ZV1ucSyS+lSC+tCVFJs/CHiGL5KfBkxiIxd2cCTK PX7bwV+dQSWYmoJB+xvf41xF92tcEllCJuy89G1mUD9MCb+fKAb5qXPmL2CI61NF9UY2 WjpaognCJpaARXBAgRXBt33d1B87WTScVU0lJVIO29T0pcqYw5sFmYWspU8yV7JybGPi 9fmqbNxS6TzJjsB5m1/g2IOnRW3r6OZEXac4T7b0/msxwKPDL9q2nOKqQgoI1YF7g5Yv jG6M1BuUGhDfmWoyaaSK58J4cbydBIV/B6dg0AWUHeHFaIDdVc+iPVOLnrsQ7ETw+ymC wipw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=XuIEimow; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si10478483otk.234.2020.03.16.05.39.07; Mon, 16 Mar 2020 05:39:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=XuIEimow; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731104AbgCPMhW (ORCPT + 99 others); Mon, 16 Mar 2020 08:37:22 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:5721 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731217AbgCPMgT (ORCPT ); Mon, 16 Mar 2020 08:36:19 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwlJ3Hvsz9v02l; Mon, 16 Mar 2020 13:36:12 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=XuIEimow; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id CAUC3HyXR9ym; Mon, 16 Mar 2020 13:36:12 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48gwlJ2Hjrz9v02j; Mon, 16 Mar 2020 13:36:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362172; bh=iWOn+U7JOwLJNDauXlLGMF/b0VCQfBy5EbGKISCTiPs=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=XuIEimowdBMEl+xgGXl3TC3VZWtzkl29R5/5Xe6G7OiZ/deNk/4Q9/p7Zbg57c0F9 2oBPpWMem9iMGzYvj4mTCD/3WdIFm4a4K1kkH6F1wmTncpykPIfJwjE1OiPUAMEn1C vV3jq16XP0uZVrzYlcmHkPGAdfKWgnQprdWlxmCg= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 43A188B7CB; Mon, 16 Mar 2020 13:36:17 +0100 (CET) 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 o0mNKxGmDu8N; Mon, 16 Mar 2020 13:36:17 +0100 (CET) Received: from pc16570vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.100]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 13A848B7D2; Mon, 16 Mar 2020 13:36:17 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 0878365595; Mon, 16 Mar 2020 12:36:16 +0000 (UTC) Message-Id: <607a53cfe5dcc62ea8ed17e40aafa8fa89493c54.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 31/46] powerpc/8xx: Add function to update pinned TLBs To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 16 Mar 2020 12:36:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pinned TLBs are not easy to modify when the MMU is enabled. Create a small function to update a pinned TLB entry with MMU off. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/mmu-8xx.h | 3 ++ arch/powerpc/kernel/head_8xx.S | 44 ++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h index a092e6434bda..794bce83c5b0 100644 --- a/arch/powerpc/include/asm/nohash/32/mmu-8xx.h +++ b/arch/powerpc/include/asm/nohash/32/mmu-8xx.h @@ -193,6 +193,9 @@ #include +void mpc8xx_update_tlb(int data, int idx, unsigned long epn, + unsigned long twc, unsigned long rpn); + typedef struct { unsigned int id; unsigned int active; diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 423465b10c82..84b3c7692b37 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -866,6 +866,50 @@ initial_mmu: mtspr SPRN_DER, r8 blr +/* + * void mpc8xx_update_tlb(int data, int idx, unsigned long epn, + * unsigned long twc, unsigned long rpn); + */ +_GLOBAL(mpc8xx_update_tlb) + lis r9, (1f - PAGE_OFFSET)@h + ori r9, r9, (1f - PAGE_OFFSET)@l + mfmsr r10 + mflr r11 + li r12, MSR_KERNEL & ~(MSR_IR | MSR_DR) + rlwinm r0, r10, 0, ~MSR_RI + rlwinm r0, r0, 0, ~MSR_EE + mtmsr r0 + isync + .align 4 + mtspr SPRN_SRR0, r9 + mtspr SPRN_SRR1, r12 + rfi + +1: cmpwi r3, 0 + beq 2f + + mfspr r0, SPRN_MD_CTR + rlwimi r0, r4, 8, 0x00001f00 + mtspr SPRN_MD_CTR, r0 + + mtspr SPRN_MD_EPN, r5 + mtspr SPRN_MD_TWC, r6 + mtspr SPRN_MD_RPN, r7 + b 3f + +2: mfspr r0, SPRN_MI_CTR + rlwimi r0, r4, 8, 0x00001f00 + mtspr SPRN_MI_CTR, r0 + + mtspr SPRN_MI_EPN, r5 + mtspr SPRN_MI_TWC, r6 + mtspr SPRN_MI_RPN, r7 + +3: li r12, MSR_KERNEL & ~(MSR_IR | MSR_DR | MSR_RI) + mtmsr r12 + mtspr SPRN_SRR1, r10 + mtspr SPRN_SRR0, r11 + rfi /* * We put a few things here that have to be page-aligned. -- 2.25.0