Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6120647imu; Mon, 21 Jan 2019 03:37:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN6jb1IkmkWPYAwg/lxVrbqwN8p8LKwKk0BrJNBKGiOcS/NCoWEXcqSWXAEBiulEr9tag1gD X-Received: by 2002:a63:e915:: with SMTP id i21mr27292890pgh.409.1548070635623; Mon, 21 Jan 2019 03:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548070635; cv=none; d=google.com; s=arc-20160816; b=Rtalp2fKuRF81HewzWvsQQ6nCpzjIT85trSndaBDVe49tIueKjbH1QFjLvc7OvPQ7m PyFtI+9N+eUh59OOnNvsLCOrTRn4ZEpY1vqlaUk4sR4Ggu/DrHwxpkV65hbrUeiiGeIl yT7BR77fVRkt6EPOWuWBnxbt6ijU4SKHV31Xrz3FPNsL46BWMPTg9fqGw7LDSJ65XjPF 7MZE8u5CciPgNDGLHN4Cx2jz8bPesVnuOzXL8gn3Eo74OpMQHoDeLtsTNTM1sBPbYiXk Sjz4TdXmcPEce+nB6k01g0nqHSqlSsHoL00O0X4SAX7JHlBf/pJY7MME4p106r/+KEXn 3CHw== 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:message-id :dkim-signature; bh=pZnOGi6oWYyBG/FR/JV+zQsF193o/sVkM4x8/e+owpM=; b=Y/SkPCt3H/D+/Mq7zkX330oWN/ZkEj79cRZwdKDTTVNFehRXd57GkbrxDHcI4MNf+i HEG7QGHTDLVMDj8gL33oFUUG2Z9oPA3rzosVf7hROV2ffftkokEfORd4+QdvB4Ase48f B6FuXj7o+OKLz23bCmyZXEi9NLJtbSE4a5og7mj3zxI31fzGQYY55fDfW+8ix2hJ6psq b0OzCaA16XLucrlW9Oq83uoW70EROc1ltdqGJaunrzRJFftSIstgBmAk3af3jpJQSh40 ZXSqW+ntXM5YDf1GRqxpKqUiTZtVxFR+oeDCjntRQtGA7pL/gG4xkMEQK4ixgdZQHHQ7 NxJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=an0frlJq; 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 d9si11402145pgv.123.2019.01.21.03.37.00; Mon, 21 Jan 2019 03:37:15 -0800 (PST) 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=an0frlJq; 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 S1728416AbfAULev (ORCPT + 99 others); Mon, 21 Jan 2019 06:34:51 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:59804 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbfAULeu (ORCPT ); Mon, 21 Jan 2019 06:34:50 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43jqG96W8Vz9v3wJ; Mon, 21 Jan 2019 12:34:41 +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=an0frlJq; 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 bq-BmlNsXOPn; Mon, 21 Jan 2019 12:34:41 +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 43jqG95FV2z9v3wF; Mon, 21 Jan 2019 12:34:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1548070481; bh=pZnOGi6oWYyBG/FR/JV+zQsF193o/sVkM4x8/e+owpM=; h=From:Subject:To:Cc:Date:From; b=an0frlJqloJSz8U/VSgcA0JQFxt+Xoq6iMBoIPiAHyjzXwO0n6aJ0Kd8vJEpRZGtY FseDBfnZ3VPJceToaK6M4j9VGT2Xtg0pWPUdHay3KtH9pXIygd9UrlBSdK5dtChVTM dP8x57Lz2vDfP3YWEMOefXLF2QwYocEw61pZx+0E= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2E22A8B7AB; Mon, 21 Jan 2019 12:34:48 +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 rlnnpTFldpU0; Mon, 21 Jan 2019 12:34:48 +0100 (CET) Received: from po16846vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 106BE8B7A1; Mon, 21 Jan 2019 12:34:48 +0100 (CET) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id E4C097188A; Mon, 21 Jan 2019 11:34:47 +0000 (UTC) Message-Id: <11b867f8f9c903572e4c4194155bf1d51b54ccd1.1547800935.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH] powerpc: simplify BDI switch To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 21 Jan 2019 11:34:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no reason to re-read each time the pointer at location 0xf0 as it is fixed and known. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/mmu.h | 2 ++ arch/powerpc/kernel/head_32.S | 5 ++--- arch/powerpc/kernel/head_40x.S | 5 ++--- arch/powerpc/kernel/head_8xx.S | 1 + arch/powerpc/mm/8xx_mmu.c | 7 ++----- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h index 25607604a7a5..6d22a8e78fe2 100644 --- a/arch/powerpc/include/asm/mmu.h +++ b/arch/powerpc/include/asm/mmu.h @@ -356,6 +356,8 @@ extern void early_init_mmu_secondary(void); extern void setup_initial_memory_limit(phys_addr_t first_memblock_base, phys_addr_t first_memblock_size); static inline void mmu_early_init_devtree(void) { } + +extern void *abatron_pteptrs[2]; #endif /* __ASSEMBLY__ */ #endif diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index 05b08db3901d..c2f564690778 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S @@ -1027,9 +1027,8 @@ _ENTRY(switch_mmu_context) * The PGDIR is passed as second argument. */ lwz r4,MM_PGD(r4) - lis r5, KERNELBASE@h - lwz r5, 0xf0(r5) - stw r4, 0x4(r5) + lis r5, abatron_pteptrs@ha + stw r4, abatron_pteptrs@l + 0x4(r5) #endif li r4,0 isync diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S index b19d78410511..11dd09d0ce1a 100644 --- a/arch/powerpc/kernel/head_40x.S +++ b/arch/powerpc/kernel/head_40x.S @@ -953,9 +953,8 @@ _GLOBAL(set_context) /* Context switch the PTE pointer for the Abatron BDI2000. * The PGDIR is the second parameter. */ - lis r5, KERNELBASE@h - lwz r5, 0xf0(r5) - stw r4, 0x4(r5) + lis r5, abatron_pteptrs@ha + stw r4, abatron_pteptrs@l + 0x4(r5) #endif sync mtspr SPRN_PID,r3 diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 20cc816b3508..ec12abc2a8ce 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -989,5 +989,6 @@ swapper_pg_dir: /* Room for two PTE table poiners, usually the kernel and current user * pointer to their respective root page table (pgdir). */ + .globl abatron_pteptrs abatron_pteptrs: .space 8 diff --git a/arch/powerpc/mm/8xx_mmu.c b/arch/powerpc/mm/8xx_mmu.c index 92b677faea8c..174452f7b5db 100644 --- a/arch/powerpc/mm/8xx_mmu.c +++ b/arch/powerpc/mm/8xx_mmu.c @@ -156,14 +156,11 @@ void set_context(unsigned long id, pgd_t *pgd) { s16 offset = (s16)(__pa(swapper_pg_dir)); -#ifdef CONFIG_BDI_SWITCH - pgd_t **ptr = *(pgd_t ***)(KERNELBASE + 0xf0); - /* Context switch the PTE pointer for the Abatron BDI2000. * The PGDIR is passed as second argument. */ - *(ptr + 1) = pgd; -#endif + if (IS_ENABLED(CONFIG_BDI_SWITCH)) + abatron_pteptrs[1] = pgd; /* Register M_TWB will contain base address of level 1 table minus the * lower part of the kernel PGDIR base address, so that all accesses to -- 2.13.3