Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5422468pxu; Thu, 22 Oct 2020 01:40:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXjFxkB0/H9jivt9lNwrHQmtaiZNzD1KQ6FD+dOmI9AK8h96F/VI6NYk9YEtzc3jwwWTN5 X-Received: by 2002:a50:ff10:: with SMTP id a16mr1213399edu.83.1603356051822; Thu, 22 Oct 2020 01:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603356051; cv=none; d=google.com; s=arc-20160816; b=jrS1xWfuuDn29j+mpyJGgL2QosdhEN0DgVEVlEcoC0plLve9DXRJtq6+mKQq3E6jCy wa/9yFA0Ai4KsEDbkMeqPe5pmFhKwMsfPrbj61qXwEtW3rEfoXqXvP/XqQvVoMbwBzpJ xw/KOk8jJNYaELSuJHjTcWFmQShT33c9EbI5BoI65lw8mIB2fXKxR8XY77kf3jPki2NX F4VpwkeLhhpBJJfoRhrw0BcK0vSz442vLm5xr7N1r/UpCDlQ4n4ILyxUKzY/Y0DxeB5n Pt6DfvYO0lEUB5AbAYNe1nOfBwMGI3/eo+7yCvJzHrWaP09rQaxK+H1O3PwLyGqRh+IG ZOew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=exk2NaKoym2/QfVrTM10rbM57i495EhE47R8ZGEW0do=; b=ZLGxzMMWsp3XmcMfhCy7RBwGws0Ip+FAU5picChdqpVkX6/EBDB/647S3IeCYjFlso xP/XY5bkto7eIwHQzbUd90091F85oBofJI2iqvgSN9eeejIAxDgUArytlQM/apVYTOKD jI6OryqDY4B79sM6bdoaJ40NhQChh/B3ePCyAKGTrIDpZ2WQjMPDuofSMNZ64fFCSoRl X33IHB61ZO78SvUKiFerwW/+psxhWQvdfhsIUxJ5w1IFdZwBm+jw+P0FxK8v8IGyZMEg foJgrgK+vEx0Y9alK7QBJzdbEDtNemUsBT69XhtGp0qgZcvAIwixwU20Xlb3g1zJqXWp Zm4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si448917eje.169.2020.10.22.01.40.29; Thu, 22 Oct 2020 01:40:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2895679AbgJVGaN (ORCPT + 99 others); Thu, 22 Oct 2020 02:30:13 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:40555 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2895623AbgJVG3s (ORCPT ); Thu, 22 Oct 2020 02:29:48 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4CGyBx5JtXzB09ZW; Thu, 22 Oct 2020 08:29:45 +0200 (CEST) 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 y4mHO_G7RDT5; Thu, 22 Oct 2020 08:29:45 +0200 (CEST) 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 4CGyBx4L43zB09ZT; Thu, 22 Oct 2020 08:29:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7BBE18B805; Thu, 22 Oct 2020 08:29:46 +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 cV23mr_T0r57; Thu, 22 Oct 2020 08:29:46 +0200 (CEST) Received: from po17688vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1CD9A8B769; Thu, 22 Oct 2020 08:29:46 +0200 (CEST) Received: by po17688vm.idsi0.si.c-s.fr (Postfix, from userid 0) id F04E8667EF; Thu, 22 Oct 2020 06:29:45 +0000 (UTC) Message-Id: <3495f7277589a5d96c06a789e61570de0a2b153c.1603348103.git.christophe.leroy@csgroup.eu> In-Reply-To: <648e2448e938d52d0b5887445e018ca584edc06d.1603348103.git.christophe.leroy@csgroup.eu> References: <648e2448e938d52d0b5887445e018ca584edc06d.1603348103.git.christophe.leroy@csgroup.eu> From: Christophe Leroy Subject: [PATCH v1 20/20] powerpc/32s: Only build hash code when CONFIG_PPC_BOOK3S_604 is selected To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Thu, 22 Oct 2020 06:29:45 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It is now possible to only build book3s/32 kernel for CPUs without hash table. Opt out hash related code when CONFIG_PPC_BOOK3S_604 is not selected. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_book3s_32.S | 12 ++++++++++++ arch/powerpc/mm/book3s32/Makefile | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/head_book3s_32.S b/arch/powerpc/kernel/head_book3s_32.S index 620af1dda70c..4fc4091aaade 100644 --- a/arch/powerpc/kernel/head_book3s_32.S +++ b/arch/powerpc/kernel/head_book3s_32.S @@ -287,6 +287,7 @@ DataAccess: #ifdef CONFIG_VMAP_STACK mtspr SPRN_SPRG_SCRATCH0,r10 mfspr r10, SPRN_SPRG_THREAD +#ifdef CONFIG_PPC_BOOK3S_604 BEGIN_MMU_FTR_SECTION stw r11, THR11(r10) mfspr r10, SPRN_DSISR @@ -302,6 +303,7 @@ BEGIN_MMU_FTR_SECTION mtcr r11 lwz r11, THR11(r10) END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) +#endif mtspr SPRN_SPRG_SCRATCH1,r11 mfspr r11, SPRN_DAR stw r11, DAR(r10) @@ -319,6 +321,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) #else /* CONFIG_VMAP_STACK */ EXCEPTION_PROLOG handle_dar_dsisr=1 get_and_save_dar_dsisr_on_stack r4, r5, r11 +#ifdef CONFIG_PPC_BOOK3S_604 BEGIN_MMU_FTR_SECTION #ifdef CONFIG_PPC_KUAP andis. r0, r5, (DSISR_BAD_FAULT_32S | DSISR_DABRMATCH | DSISR_PROTFAULT)@h @@ -330,8 +333,11 @@ BEGIN_MMU_FTR_SECTION bl hash_page b handle_page_fault_tramp_1 FTR_SECTION_ELSE +#endif b handle_page_fault_tramp_2 +#ifdef CONFIG_PPC_BOOK3S_604 ALT_MMU_FTR_SECTION_END_IFSET(MMU_FTR_HPTE_TABLE) +#endif #endif /* CONFIG_VMAP_STACK */ /* Instruction access exception. */ @@ -347,12 +353,14 @@ InstructionAccess: mfspr r11, SPRN_SRR1 /* check whether user or kernel */ stw r11, SRR1(r10) mfcr r10 +#ifdef CONFIG_PPC_BOOK3S_604 BEGIN_MMU_FTR_SECTION andis. r11, r11, SRR1_ISI_NOPT@h /* no pte found? */ bne hash_page_isi .Lhash_page_isi_cont: mfspr r11, SPRN_SRR1 /* check whether user or kernel */ END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) +#endif andi. r11, r11, MSR_PR EXCEPTION_PROLOG_1 @@ -363,9 +371,11 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) beq 1f /* if so, try to put a PTE */ li r3,0 /* into the hash table */ mr r4,r12 /* SRR0 is fault address */ +#ifdef CONFIG_PPC_BOOK3S_604 BEGIN_MMU_FTR_SECTION bl hash_page END_MMU_FTR_SECTION_IFSET(MMU_FTR_HPTE_TABLE) +#endif #endif /* CONFIG_VMAP_STACK */ 1: mr r4,r12 andis. r5,r9,DSISR_SRR1_MATCH_32S@h /* Filter relevant SRR1 bits */ @@ -703,6 +713,7 @@ handle_page_fault_tramp_2: EXC_XFER_LITE(0x300, handle_page_fault) #ifdef CONFIG_VMAP_STACK +#ifdef CONFIG_PPC_BOOK3S_604 .macro save_regs_thread thread stw r0, THR0(\thread) stw r3, THR3(\thread) @@ -774,6 +785,7 @@ fast_hash_page_return: mfspr r11, SPRN_SPRG_SCRATCH1 mfspr r10, SPRN_SPRG_SCRATCH0 RFI +#endif /* CONFIG_PPC_BOOK3S_604 */ stack_overflow: vmap_stack_overflow_exception diff --git a/arch/powerpc/mm/book3s32/Makefile b/arch/powerpc/mm/book3s32/Makefile index 3f972db17761..446d9de88ce4 100644 --- a/arch/powerpc/mm/book3s32/Makefile +++ b/arch/powerpc/mm/book3s32/Makefile @@ -6,4 +6,6 @@ ifdef CONFIG_KASAN CFLAGS_mmu.o += -DDISABLE_BRANCH_PROFILING endif -obj-y += mmu.o hash_low.o mmu_context.o tlb.o nohash_low.o +obj-y += mmu.o mmu_context.o +obj-$(CONFIG_PPC_BOOK3S_603) += nohash_low.o +obj-$(CONFIG_PPC_BOOK3S_604) += hash_low.o tlb.o -- 2.25.0