Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp2835337pjo; Mon, 16 Mar 2020 05:36:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtHjrYCCZ0F55klORzZqz0y7L9AeuWeb0UZnxqrrqDeY2lVtMNXRTrGa/WF/Ev0v7T/uiyp X-Received: by 2002:a9d:a51:: with SMTP id 75mr21722129otg.112.1584362201283; Mon, 16 Mar 2020 05:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584362201; cv=none; d=google.com; s=arc-20160816; b=TAUTN/qvTszu7eLlb8anjWGeD3kxoHypVtFnKsDht1BilGzL4XsFb/HnI56FDtJtd4 8k79KCNhFr+IkQL+6PC1c9YHgrWYCG/vk4tyy9B3uU8jAGUHFrC57SUV857Mq8ig/VXS ubiTLzytASVCbTnWZhQxykAjUim6YsGz+7+QhBeQB9qjsTFdJ1VeZ3trVB/4SM5Da8fJ yE0ocKSJSJ4z3yrEKuHwp22adySonr+6q4E9NjqGLDS8wTlejeyGRbc8kdJRv2iDweyw thsUnfAtWS1kByJ2BgMbaVQKVpPKZw14/91hmsQUnm0goswPMucQsoUDYmEkLw24Je8H fAMg== 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=vEpeAOuN9+u+UqwhKp0hocFZ/JQ7NbtdHfn7EsmiUSI=; b=y2aP3DCWDxsnWX8x+TFUy9+En9D5SrVZI+FSzvATN+WK+RPXX7BJDbRZWkN9AgZ/EG h540WlNGOeI6H2d/mE9Jpp+Q4jtRCVZ0gix7ugYWunpKLm4fl8RV5GG3ifXZdBlAilBk swMa0NycHRukaW3bDcy4uSBCB4cFblWFQzli7bkXHAltKw2YSW2a/PvSBD1cVZicTXEe H929sa1qikJr3Hg1qVXANWzjyGQoZV1CwRp3LJ/vRHVgcpjdAZqk1PCjSC6lMMIFKZHa bg3RR8JO1O+ae7ZCKgkKEFHCiJy4Abad5THcEwYsSc0BGTGfGpCD23YACdULyjYD3Jls Uwxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=WoTOWTbX; 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 l185si9697552oif.274.2020.03.16.05.36.28; Mon, 16 Mar 2020 05:36:41 -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=WoTOWTbX; 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 S1731096AbgCPMf7 (ORCPT + 99 others); Mon, 16 Mar 2020 08:35:59 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:43841 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730919AbgCPMf6 (ORCPT ); Mon, 16 Mar 2020 08:35:58 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48gwkv4f8Hz9tygx; Mon, 16 Mar 2020 13:35:51 +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=WoTOWTbX; 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 hourlX5lNtQy; Mon, 16 Mar 2020 13:35:51 +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 48gwkv3PLSz9tyg5; Mon, 16 Mar 2020 13:35:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1584362151; bh=vEpeAOuN9+u+UqwhKp0hocFZ/JQ7NbtdHfn7EsmiUSI=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=WoTOWTbXXU7UmzKkG2XJaYwy0kVNDxUHcdPdHmuwISNWhfWJnLuQJtDJ5X0omumUj er9euVJYZjdmQ0zPXLT1njU8aoDE3Pn00sBDyMsAZvugLXqqzj6PSRuHVkw3KgiVgp AAlaghV4Sb/zklOkFt2STvZmyHFdrSPhzbA/GNF4= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6D7618B7D0; Mon, 16 Mar 2020 13:35:56 +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 plUrLy4ru3Kw; Mon, 16 Mar 2020 13:35:56 +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 5055A8B7CB; Mon, 16 Mar 2020 13:35:56 +0100 (CET) Received: by pc16570vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 47D5765595; Mon, 16 Mar 2020 12:35:56 +0000 (UTC) Message-Id: <755f29975957f229f445b600686b4fba9ee9399a.1584360344.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v1 11/46] powerpc/ptdump: Display size of BATs To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 16 Mar 2020 12:35:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Display the size of areas mapped with BATs. For that, the size display for pages is refactorised. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/ptdump/bats.c | 4 ++++ arch/powerpc/mm/ptdump/ptdump.c | 23 ++++++++++++++--------- arch/powerpc/mm/ptdump/ptdump.h | 2 ++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/mm/ptdump/bats.c b/arch/powerpc/mm/ptdump/bats.c index d3a5d6b318d1..d6c660f63d71 100644 --- a/arch/powerpc/mm/ptdump/bats.c +++ b/arch/powerpc/mm/ptdump/bats.c @@ -10,6 +10,8 @@ #include #include +#include "ptdump.h" + static char *pp_601(int k, int pp) { if (pp == 0) @@ -42,6 +44,7 @@ static void bat_show_601(struct seq_file *m, int idx, u32 lower, u32 upper) #else seq_printf(m, "0x%08x ", pbn); #endif + pt_dump_size(m, size); seq_printf(m, "Kernel %s User %s", pp_601(k & 2, pp), pp_601(k & 1, pp)); @@ -88,6 +91,7 @@ static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, bool #else seq_printf(m, "0x%08x ", brpn); #endif + pt_dump_size(m, size); if (k == 1) seq_puts(m, "User "); diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c index d92bb8ea229c..1f97668853e3 100644 --- a/arch/powerpc/mm/ptdump/ptdump.c +++ b/arch/powerpc/mm/ptdump/ptdump.c @@ -112,6 +112,19 @@ static struct addr_marker address_markers[] = { seq_putc(m, c); \ }) +void pt_dump_size(struct seq_file *m, unsigned long size) +{ + static const char units[] = "KMGTPE"; + const char *unit = units; + + /* Work out what appropriate unit to use */ + while (!(size & 1023) && unit[1]) { + size >>= 10; + unit++; + } + pt_dump_seq_printf(m, "%9lu%c ", size, *unit); +} + static void dump_flag_info(struct pg_state *st, const struct flag_info *flag, u64 pte, int num) { @@ -146,8 +159,6 @@ static void dump_flag_info(struct pg_state *st, const struct flag_info static void dump_addr(struct pg_state *st, unsigned long addr) { - static const char units[] = "KMGTPE"; - const char *unit = units; unsigned long delta; #ifdef CONFIG_PPC64 @@ -164,13 +175,7 @@ static void dump_addr(struct pg_state *st, unsigned long addr) pt_dump_seq_printf(st->seq, " " REG " ", st->start_pa); delta = (addr - st->start_address) >> 10; } - /* Work out what appropriate unit to use */ - while (!(delta & 1023) && unit[1]) { - delta >>= 10; - unit++; - } - pt_dump_seq_printf(st->seq, "%9lu%c", delta, *unit); - + pt_dump_size(st->seq, delta); } static void note_prot_wx(struct pg_state *st, unsigned long addr) diff --git a/arch/powerpc/mm/ptdump/ptdump.h b/arch/powerpc/mm/ptdump/ptdump.h index 5d513636de73..b91f65f162d6 100644 --- a/arch/powerpc/mm/ptdump/ptdump.h +++ b/arch/powerpc/mm/ptdump/ptdump.h @@ -17,3 +17,5 @@ struct pgtable_level { }; extern struct pgtable_level pg_level[5]; + +void pt_dump_size(struct seq_file *m, unsigned long delta); -- 2.25.0