Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2835943pjo; Mon, 16 Mar 2020 05:37:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsO8ITddIdpCf6/KEHf39bbHJfTFU/sxmhj3UawIZ7204QqgSwAOu4p27yBJQADZfMRmo3h X-Received: by 2002:a9d:64d4:: with SMTP id n20mr21114230otl.193.1584362239408; Mon, 16 Mar 2020 05:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362239; cv=none; d=google.com; s=arc-20160816; b=Wh3m+x+t+4NEjercnTCjBQmtkQhXjFObuMEWd/FwHWoNZF33JannDg9f8V8PNnBC6l 13zop/tBqJecNCqA6+nTBdPC7UiOPyVF92ZShQLX4fVIq0AJcp/5FwRtiMlDmB8zjvXk E2mKkoiOWOdUdY3Gp7MVHWajEKzi0DUEGEu3aLJZPWStezGw8e1Ra/NJLBnqajxIGlMZ tGN/I3XGcfiRPtnsmJvDYnDcEScj5un0wGbp15Kere8pGlbFm+KDkUqyaq1KUeq2kIOD J/Fv6P82zofjFESSaUjx6kCliF3hPSefiB9eiIjfJ915+kgoCIetABDlEoYYq63UC/uu UGww== 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=BpfFLBkbJkuxnqbVoA084JvTYcb/hx3a8yIvVMCCaRQ=; b=CsU52woy6CT+eRFIHaNpqknyHVGhP+MRU2JrsUEZnvCnUgUNmizCfSZ17sGk5vO4wl DQhSu1rxhGYBgpxwjH7ELDKu1Cy/e9HA/3DVUH8utzvQdi4DCCMZ3x9KqcHsvrety2ER KgkZ1skGdhB++pnvYAe0gr9wvpWEku63ZMcvHtXphW5KEbV8iSQ4tsTi+U8LSkyOBT6o 8MkcURRsse4PlVbilKK+98X2N1VkJZ3E0yPiVM6BMBZxoPIqYGOgkpTWWHXamhTjzXy8 RV8utW8nByuncEGRp6nCF+gG0np41f5YUlbNhk1i7J/bjNRweb8x3Ve1ukgfPBZlicY3 zKdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=p2IzPxG6; 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 x63si9461586oia.101.2020.03.16.05.37.04; Mon, 16 Mar 2020 05:37:19 -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=p2IzPxG6; 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 S1731243AbgCPMgW (ORCPT + 99 others); Mon, 16 Mar 2020 08:36:22 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:41784 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731190AbgCPMgN (ORCPT ); Mon, 16 Mar 2020 08:36:13 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwlC1V2Cz9v02m; Mon, 16 Mar 2020 13:36:07 +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=p2IzPxG6; 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 j_po_jq3GY_Z; Mon, 16 Mar 2020 13:36:07 +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 48gwlC0T79z9v02f; Mon, 16 Mar 2020 13:36:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362167; bh=BpfFLBkbJkuxnqbVoA084JvTYcb/hx3a8yIvVMCCaRQ=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=p2IzPxG6TuhfUtNi+Wi47tOS9lRyai7UoXp6XZyzmI/W4gWDxSnuk49CPP6Pj+4wc Cthrssv5CkmnUGAe1VbCr7QKG8kyNsq7Iyu6SZWRDaoXz0Fk1w8+bHh4G/Cgtb8AiP 8voNIjMjDpbcTS1jWJyi2QP3zTyYasfmarvAnJiA= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0B96B8B7D0; Mon, 16 Mar 2020 13:36:12 +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 ufvd-gpqaPiZ; Mon, 16 Mar 2020 13:36:11 +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 D32528B7CB; Mon, 16 Mar 2020 13:36:11 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id C72CA65595; Mon, 16 Mar 2020 12:36:11 +0000 (UTC) Message-Id: <63a5e2c2444937caf1e81066bb61e00cbf34634a.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 26/46] powerpc/8xx: Prepare handlers for _PAGE_HUGE for 512k pages. 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:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Prepare ITLB handler to handle _PAGE_HUGE when CONFIG_HUGETLBFS is enabled. This means that the L1 entry has to be kept in r11 until L2 entry is read, in order to insert _PAGE_HUGE into it. Also move pgd_offset helpers before pte_update() as they will be needed there in next patch. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/pgtable.h | 13 ++++++------- arch/powerpc/kernel/head_8xx.S | 15 +++++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index dd5835354e33..1a86d20b58f3 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -206,6 +206,12 @@ static inline void pmd_clear(pmd_t *pmdp) } +/* to find an entry in a kernel page-table-directory */ +#define pgd_offset_k(address) pgd_offset(&init_mm, address) + +/* to find an entry in a page-table-directory */ +#define pgd_index(address) ((address) >> PGDIR_SHIFT) +#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) /* * PTE updates. This function is called whenever an existing @@ -348,13 +354,6 @@ static inline int pte_young(pte_t pte) pfn_to_page((__pa(pmd_val(pmd)) >> PAGE_SHIFT)) #endif -/* to find an entry in a kernel page-table-directory */ -#define pgd_offset_k(address) pgd_offset(&init_mm, address) - -/* to find an entry in a page-table-directory */ -#define pgd_index(address) ((address) >> PGDIR_SHIFT) -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) - /* Find an entry in the third-level page table.. */ #define pte_index(address) \ (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 905205c79a25..adad8baadcf5 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S @@ -196,7 +196,7 @@ SystemCall: InstructionTLBMiss: mtspr SPRN_SPRG_SCRATCH0, r10 -#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) +#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS) mtspr SPRN_SPRG_SCRATCH1, r11 #endif @@ -235,16 +235,19 @@ InstructionTLBMiss: rlwinm r10, r10, 0, 20, 31 oris r10, r10, (swapper_pg_dir - PAGE_OFFSET)@ha 3: + mtcr r11 #endif +#ifdef CONFIG_HUGETLBFS + lwz r11, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */ + mtspr SPRN_MI_TWC, r11 /* Set segment attributes */ + mtspr SPRN_MD_TWC, r11 +#else lwz r10, (swapper_pg_dir-PAGE_OFFSET)@l(r10) /* Get level 1 entry */ mtspr SPRN_MI_TWC, r10 /* Set segment attributes */ - mtspr SPRN_MD_TWC, r10 +#endif mfspr r10, SPRN_MD_TWC lwz r10, 0(r10) /* Get the pte */ -#ifdef ITLB_MISS_KERNEL - mtcr r11 -#endif #ifdef CONFIG_SWAP rlwinm r11, r10, 32-5, _PAGE_PRESENT and r11, r11, r10 @@ -263,7 +266,7 @@ InstructionTLBMiss: /* Restore registers */ 0: mfspr r10, SPRN_SPRG_SCRATCH0 -#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) +#if defined(ITLB_MISS_KERNEL) || defined(CONFIG_SWAP) || defined(CONFIG_HUGETLBFS) mfspr r11, SPRN_SPRG_SCRATCH1 #endif rfi -- 2.25.0