Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp757253ybl; Wed, 14 Aug 2019 05:37:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqztVE4/wbzF4uSQtUJenilSDHyNp0lfybsty4dobpsD2LNb+lpHdhA+BWjlNti5ZupT1Xjx X-Received: by 2002:a17:90a:9cf:: with SMTP id 73mr6958794pjo.90.1565786240463; Wed, 14 Aug 2019 05:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565786240; cv=none; d=google.com; s=arc-20160816; b=lQ0TSSRFM3glb7YNH4NRSBog5vFrbE2feDSmIgzU8Sakt2rtUqI/qSp6ofP6Yr82SD e8E3TpF8O/kTnRrIN25EQC3wU+BwyJXP11DD9N0kubCjkX6ktylQlGRJlnJnPvncGbez kANxlIlAN3sT7Y8qGPLq2WmMbX3JCZGpOfkDt6EihMVrOvJPXaLGjJduXKp/VUMA1jAh moJkJc5TZu63D8Fau67BHa93AWHPlKD76SaBS7rpKq2Cn3QMoKzPg07L1j+FwDT5Z+s3 AF3Tj8MtbM76dD9Mc3cMrv+jnPnBPOWBU2AD07DmkoY1ecEaklrCBx93fVZwJwfEBdoq Iaxw== 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=tZIO4hN5UhqIHA84c5kHAJ+5u0attVl897iQhB7+51s=; b=voia2mX5qSUFEI3HPoafAWS9hS1rb6WMP1jprhrczJiZ4PFqXhILVnjMVSUK1YcpUz jdv5q29ItStQdfk7lBmgvHxMaJWOFEoMqt53Xjk9yPWc6ggW1RImYrXsHJKXrNNf7c4C wGyfe1tmx0p8yg/jU65BFbkg6U1N6qNgLu+ROCVr+Z8UPxaK+JuB0KyNsCIa0/d0YTo4 H1rAWCNVlljS2igsv2zoL2Y7+nbnz4Cfctf1NEK2bDQMOMYdkjnOF//gXfxY30zqj5H9 lAVZzFVa2X9ZoheP1ZPRtsLex0+W/nsGfYkr1FdC7DKQezqI+Klft2Il7UY3pJ65ylx9 MGcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b="sfigohy/"; 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 186si66952894pgc.248.2019.08.14.05.37.04; Wed, 14 Aug 2019 05:37: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="sfigohy/"; 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 S1727847AbfHNMgT (ORCPT + 99 others); Wed, 14 Aug 2019 08:36:19 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:29440 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727774AbfHNMgP (ORCPT ); Wed, 14 Aug 2019 08:36:15 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 467pwX46Jjz9v0dM; Wed, 14 Aug 2019 14:36:12 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=sfigohy/; 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 Ns4VjSPXU8QY; Wed, 14 Aug 2019 14:36:12 +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 467pwX302vz9v0dJ; Wed, 14 Aug 2019 14:36:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1565786172; bh=tZIO4hN5UhqIHA84c5kHAJ+5u0attVl897iQhB7+51s=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=sfigohy/jUX16dbPav1SIlP8pYVpU7zUSM9YbV/0RMp4wds9r1qXJCBTO6NuS+9/m HoOC325fZabH72Sz/OdlFEWHIySXjvcndVCXq3SNHnDEhxBEI3bVPXfAHo/jEGUzOb 7qVbRqdt97LD2RZf4l+wIAQen6AFi6kgpHODLQqI= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E3E598B7F5; Wed, 14 Aug 2019 14:36:13 +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 GN1p7v0uNpUd; Wed, 14 Aug 2019 14:36:13 +0200 (CEST) Received: from pc17473vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.101]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C17B78B761; Wed, 14 Aug 2019 14:36:13 +0200 (CEST) Received: by pc17473vm.idsi0.si.c-s.fr (Postfix, from userid 0) id B02EB6B6C0; Wed, 14 Aug 2019 12:36:13 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH 5/5] powerpc/ptdump: drop non vital #ifdefs To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 14 Aug 2019 12:36:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hashpagetable.c is only compiled when CONFIG_PPC_BOOK3S_64 is defined, so drop the test and its 'else' branch. Use IS_ENABLED(CONFIG_PPC_PSERIES) instead of #ifdef, this allows the code to be checked at any build. It is still optimised out by GCC. Use IS_ENABLED(CONFIG_PPC_64K_PAGES) instead of #ifdef. Use IS_ENABLED(CONFIG_SPARSEMEN_VMEMMAP) instead of #ifdef. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/plpar_wrappers.h | 6 ++++++ arch/powerpc/mm/ptdump/hashpagetable.c | 24 +++++++++--------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm/plpar_wrappers.h b/arch/powerpc/include/asm/plpar_wrappers.h index cff5a411e595..4497c8afb573 100644 --- a/arch/powerpc/include/asm/plpar_wrappers.h +++ b/arch/powerpc/include/asm/plpar_wrappers.h @@ -340,6 +340,12 @@ static inline long plpar_set_ciabr(unsigned long ciabr) { return 0; } + +static inline long plpar_pte_read_4(unsigned long flags, unsigned long ptex, + unsigned long *ptes) +{ + return 0; +} #endif /* CONFIG_PPC_PSERIES */ #endif /* _ASM_POWERPC_PLPAR_WRAPPERS_H */ diff --git a/arch/powerpc/mm/ptdump/hashpagetable.c b/arch/powerpc/mm/ptdump/hashpagetable.c index 72f0e4a3d839..a07278027c6f 100644 --- a/arch/powerpc/mm/ptdump/hashpagetable.c +++ b/arch/powerpc/mm/ptdump/hashpagetable.c @@ -237,7 +237,6 @@ static int native_find(unsigned long ea, int psize, bool primary, u64 *v, u64 return -1; } -#ifdef CONFIG_PPC_PSERIES static int pseries_find(unsigned long ea, int psize, bool primary, u64 *v, u64 *r) { struct hash_pte ptes[4]; @@ -274,7 +273,6 @@ static int pseries_find(unsigned long ea, int psize, bool primary, u64 *v, u64 * } return -1; } -#endif static void decode_r(int bps, unsigned long r, unsigned long *rpn, int *aps, unsigned long *lp_bits) @@ -316,10 +314,9 @@ static void decode_r(int bps, unsigned long r, unsigned long *rpn, int *aps, static int base_hpte_find(unsigned long ea, int psize, bool primary, u64 *v, u64 *r) { -#ifdef CONFIG_PPC_PSERIES - if (firmware_has_feature(FW_FEATURE_LPAR)) + if (IS_ENABLED(CONFIG_PPC_PSERIES) && firmware_has_feature(FW_FEATURE_LPAR)) return pseries_find(ea, psize, primary, v, r); -#endif + return native_find(ea, psize, primary, v, r); } @@ -386,12 +383,13 @@ static void walk_pte(struct pg_state *st, pmd_t *pmd, unsigned long start) psize = mmu_vmalloc_psize; else psize = mmu_io_psize; -#ifdef CONFIG_PPC_64K_PAGES + /* check for secret 4K mappings */ - if (((pteval & H_PAGE_COMBO) == H_PAGE_COMBO) || - ((pteval & H_PAGE_4K_PFN) == H_PAGE_4K_PFN)) + if (IS_ENABLED(CONFIG_PPC_64K_PAGES) && + ((pteval & H_PAGE_COMBO) == H_PAGE_COMBO || + (pteval & H_PAGE_4K_PFN) == H_PAGE_4K_PFN)) psize = mmu_io_psize; -#endif + /* check for hashpte */ status = hpte_find(st, addr, psize); @@ -469,9 +467,10 @@ static void walk_linearmapping(struct pg_state *st) static void walk_vmemmap(struct pg_state *st) { -#ifdef CONFIG_SPARSEMEM_VMEMMAP struct vmemmap_backing *ptr = vmemmap_list; + if (!IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP)) + return; /* * Traverse the vmemmaped memory and dump pages that are in the hash * pagetable. @@ -481,7 +480,6 @@ static void walk_vmemmap(struct pg_state *st) ptr = ptr->list; } seq_puts(st->seq, "---[ vmemmap end ]---\n"); -#endif } static void populate_markers(void) @@ -495,11 +493,7 @@ static void populate_markers(void) address_markers[6].start_address = PHB_IO_END; address_markers[7].start_address = IOREMAP_BASE; address_markers[8].start_address = IOREMAP_END; -#ifdef CONFIG_PPC_BOOK3S_64 address_markers[9].start_address = H_VMEMMAP_START; -#else - address_markers[9].start_address = VMEMMAP_BASE; -#endif } static int ptdump_show(struct seq_file *m, void *v) -- 2.13.3