From nobody Fri Dec 19 20:16:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2DA3CD493F for ; Thu, 21 Sep 2023 02:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229699AbjIUCuz (ORCPT ); Wed, 20 Sep 2023 22:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229687AbjIUCuw (ORCPT ); Wed, 20 Sep 2023 22:50:52 -0400 Received: from Atcsqr.andestech.com (60-248-80-70.hinet-ip.hinet.net [60.248.80.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 742A0F4 for ; Wed, 20 Sep 2023 19:50:44 -0700 (PDT) Received: from mail.andestech.com (ATCPCS16.andestech.com [10.0.1.222]) by Atcsqr.andestech.com with ESMTP id 38L2od68059282; Thu, 21 Sep 2023 10:50:39 +0800 (+08) (envelope-from peterlin@andestech.com) Received: from atctrx.andestech.com (10.0.15.173) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.498.0; Thu, 21 Sep 2023 10:50:34 +0800 From: Yu Chien Peter Lin To: , , , , , , , , CC: , Yu Chien Peter Lin Subject: [PATCH v4 2/3] riscv: Introduce PBMT field to PTDUMP Date: Thu, 21 Sep 2023 10:50:21 +0800 Message-ID: <20230921025022.3989723-3-peterlin@andestech.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230921025022.3989723-1-peterlin@andestech.com> References: <20230921025022.3989723-1-peterlin@andestech.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.0.15.173] X-DNSRBL: X-MAIL: Atcsqr.andestech.com 38L2od68059282 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This patch introduces the PBMT field to the PTDUMP, so it can display the memory attributes for NC or IO. Signed-off-by: Yu Chien Peter Lin Reviewed-by: Alexandre Ghiti Tested-by: Alexandre Ghiti --- Changes v1 -> v2 - no change Changes v2 -> v3 - Add ".." when PBMT field is clear Changes v3 -> v4 - Include Alexandre's RB/TB-tags --- arch/riscv/mm/ptdump.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/riscv/mm/ptdump.c b/arch/riscv/mm/ptdump.c index 57a0926c6627..13997cf3fe36 100644 --- a/arch/riscv/mm/ptdump.c +++ b/arch/riscv/mm/ptdump.c @@ -135,6 +135,12 @@ struct prot_bits { =20 static const struct prot_bits pte_bits[] =3D { { +#ifdef CONFIG_64BIT + .mask =3D _PAGE_MTMASK_SVPBMT, + .set =3D "MT(%s)", + .clear =3D " .. ", + }, { +#endif .mask =3D _PAGE_SOFT, .set =3D "RSW(%d)", .clear =3D " .. ", @@ -205,6 +211,16 @@ static void dump_prot(struct pg_state *st) if (val) { if (pte_bits[i].mask =3D=3D _PAGE_SOFT) sprintf(s, pte_bits[i].set, val >> 8); +#ifdef CONFIG_64BIT + else if (pte_bits[i].mask =3D=3D _PAGE_MTMASK_SVPBMT) { + if (val =3D=3D _PAGE_NOCACHE_SVPBMT) + sprintf(s, pte_bits[i].set, "NC"); + else if (val =3D=3D _PAGE_IO_SVPBMT) + sprintf(s, pte_bits[i].set, "IO"); + else + sprintf(s, pte_bits[i].set, "??"); + } +#endif else sprintf(s, "%s", pte_bits[i].set); } else { --=20 2.34.1