Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6119522imu; Mon, 21 Jan 2019 03:36:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN7X7uZA5zZJYsU5iWeaBiMFY2JTpBR9TEbwcz+KxUIWurZqp2474cKB0YSr6+WkEFQjCPbH X-Received: by 2002:a62:546:: with SMTP id 67mr28785337pff.99.1548070566857; Mon, 21 Jan 2019 03:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548070566; cv=none; d=google.com; s=arc-20160816; b=gA/Wbpn1jRt1G5c5O781mKnug9YGD0+wro0JMg4XPpP7q8WtD8ZZt/bDyL5A4wvInq o8mQBs50UfXlASzlrJTqILRlyiTqImfmqYoC34jomnmNCdxioJKY52trkslLSinxRBWv maE9CPELS5CbcEkX038YrV+Cj5OPh+X9ssEYZN5MzkOh+qNiZT3eBKSyIlmbSSbPwlUl 6lxlCtJ7t1GzcP5FvuhDgHOsJ95WbJMDG1nVrStHpTlZAAY1TTs1/OqSgAhj5Nom7lbJ CzcrFDCTrH8q4wkDITgv+SRXutZl8E86+L7esqCoI7bISFw4LYYs135MZ7EH1ueW6ZYq qSww== 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=gYgGmND3mbaqrV7MZ/3IKEIKVSoSwnqCPaXIlWu5rM4=; b=BnfSbCYVU1biI4lx9vBJUn2LRxn57I7GO6WgOEHj5HT7ZQueYl3oyXCCZlq6TsITS5 14zMPe2KroWekXBr4YAzMKHabVEwTq+UlfqDJw4vpPcvInpGQxN5hvOi385N21D+idSr 4gXOV7b9AJBjZJ01uWehpjp6UYdjh7tFw9rZS5I7wMcWJ79HIaILo/reu9zSWQzVZxu/ 9WPpcSUuhWXESSv0K25tCnsviQfOhQtzZXGakU+FVNKe53GFPlXReeqf86gMtLuZpEXx vXWflFSd8deX4EKsEHr3Ial/qnioKuo6E8coAIn9NFIPUFHAUqCnDd5K0s74fay5Ii8F xW9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=PIIwG6gX; 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 a124si12740839pfb.263.2019.01.21.03.35.50; Mon, 21 Jan 2019 03:36:06 -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=PIIwG6gX; 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 S1728339AbfAULel (ORCPT + 99 others); Mon, 21 Jan 2019 06:34:41 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:26207 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727951AbfAULei (ORCPT ); Mon, 21 Jan 2019 06:34:38 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43jqFy3GjVz9v3wF; Mon, 21 Jan 2019 12:34:30 +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=PIIwG6gX; 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 iMBQWnes_JGE; Mon, 21 Jan 2019 12:34:30 +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 43jqFy28xjz9v3wD; Mon, 21 Jan 2019 12:34:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1548070470; bh=gYgGmND3mbaqrV7MZ/3IKEIKVSoSwnqCPaXIlWu5rM4=; h=From:Subject:To:Cc:Date:From; b=PIIwG6gXkbmREg4x1PNlZZll69MmFJCnJVAUGrR7Qz0dXbei5vwbxwRwC2cCbbHvx BC/ZaiLwiagD/uUQvhzklNU1QYS2ghr0ucMbJSgXL+43MtH+QpHuJoT9si+5C6yWJI jjNNkn3PPgXfuEgWO1VS9GrTJeiH9uiceZBXGrSY= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D393B8B7AA; Mon, 21 Jan 2019 12:34:36 +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 lGKDHx_q2v5G; Mon, 21 Jan 2019 12:34:36 +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 B6B7D8B7A1; Mon, 21 Jan 2019 12:34:36 +0100 (CET) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 8C9397188A; Mon, 21 Jan 2019 11:34:36 +0000 (UTC) Message-Id: <6658dcb02424fbd5e19be3c3c9abb1a20253db46.1547801451.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH v2 1/2] powerpc/8xx: replace most #ifdef by IS_ENABLED() in 8xx_mmu.c 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:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch replaces most #ifdef mess by IS_ENABLED() in 8xx_mmu.c This has the advantage of allowing syntax verification at compile time regardless of selected options. Signed-off-by: Christophe Leroy --- v2: left CONFIG_BDI_SWITCH change aside as it goes away in another patch arch/powerpc/mm/8xx_mmu.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/arch/powerpc/mm/8xx_mmu.c b/arch/powerpc/mm/8xx_mmu.c index bfa503cff351..92b677faea8c 100644 --- a/arch/powerpc/mm/8xx_mmu.c +++ b/arch/powerpc/mm/8xx_mmu.c @@ -66,26 +66,22 @@ unsigned long p_block_mapped(phys_addr_t pa) void __init MMU_init_hw(void) { /* PIN up to the 3 first 8Mb after IMMR in DTLB table */ -#ifdef CONFIG_PIN_TLB_DATA - unsigned long ctr = mfspr(SPRN_MD_CTR) & 0xfe000000; - unsigned long flags = 0xf0 | MD_SPS16K | _PAGE_SH | _PAGE_DIRTY; -#ifdef CONFIG_PIN_TLB_IMMR - int i = 29; -#else - int i = 28; -#endif - unsigned long addr = 0; - unsigned long mem = total_lowmem; - - for (; i < 32 && mem >= LARGE_PAGE_SIZE_8M; i++) { - mtspr(SPRN_MD_CTR, ctr | (i << 8)); - mtspr(SPRN_MD_EPN, (unsigned long)__va(addr) | MD_EVALID); - mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID); - mtspr(SPRN_MD_RPN, addr | flags | _PAGE_PRESENT); - addr += LARGE_PAGE_SIZE_8M; - mem -= LARGE_PAGE_SIZE_8M; + if (IS_ENABLED(CONFIG_PIN_TLB_DATA)) { + unsigned long ctr = mfspr(SPRN_MD_CTR) & 0xfe000000; + unsigned long flags = 0xf0 | MD_SPS16K | _PAGE_SH | _PAGE_DIRTY; + int i = IS_ENABLED(CONFIG_PIN_TLB_IMMR) ? 29 : 28; + unsigned long addr = 0; + unsigned long mem = total_lowmem; + + for (; i < 32 && mem >= LARGE_PAGE_SIZE_8M; i++) { + mtspr(SPRN_MD_CTR, ctr | (i << 8)); + mtspr(SPRN_MD_EPN, (unsigned long)__va(addr) | MD_EVALID); + mtspr(SPRN_MD_TWC, MD_PS8MEG | MD_SVALID); + mtspr(SPRN_MD_RPN, addr | flags | _PAGE_PRESENT); + addr += LARGE_PAGE_SIZE_8M; + mem -= LARGE_PAGE_SIZE_8M; + } } -#endif } static void __init mmu_mapin_immr(void) @@ -110,12 +106,10 @@ unsigned long __init mmu_mapin_ram(unsigned long top) if (__map_without_ltlbs) { mapped = 0; mmu_mapin_immr(); -#ifndef CONFIG_PIN_TLB_IMMR - patch_instruction_site(&patch__dtlbmiss_immr_jmp, PPC_INST_NOP); -#endif -#ifndef CONFIG_PIN_TLB_TEXT - mmu_patch_cmp_limit(&patch__itlbmiss_linmem_top, 0); -#endif + if (!IS_ENABLED(CONFIG_PIN_TLB_IMMR)) + patch_instruction_site(&patch__dtlbmiss_immr_jmp, PPC_INST_NOP); + if (!IS_ENABLED(CONFIG_PIN_TLB_TEXT)) + mmu_patch_cmp_limit(&patch__itlbmiss_linmem_top, 0); } else { mapped = top & ~(LARGE_PAGE_SIZE_8M - 1); } -- 2.13.3