diff mbox series

[v3,2/3] riscv: Introduce PBMT field to PTDUMP

Message ID 20230920035522.3180558-2-peterlin@andestech.com (mailing list archive)
State Superseded
Headers show
Series [v3,1/3] riscv: Improve PTDUMP to show RSW with non-zero value | expand

Checks

Context Check Description
conchuod/cover_letter warning Series does not have a cover letter
conchuod/tree_selection success Guessed tree name to be for-next at HEAD 0bb80ecc33a8
conchuod/fixes_present success Fixes tag not required for -next series
conchuod/maintainers_pattern success MAINTAINERS pattern errors before the patch: 5 and now 5
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/build_rv64_clang_allmodconfig success Errors and warnings before: 9 this patch: 9
conchuod/module_param success Was 0 now: 0
conchuod/build_rv64_gcc_allmodconfig success Errors and warnings before: 9 this patch: 9
conchuod/build_rv32_defconfig success Build OK
conchuod/dtb_warn_rv64 success Errors and warnings before: 29 this patch: 29
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success No Fixes tag
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Yu-Chien Peter Lin Sept. 20, 2023, 3:55 a.m. UTC
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 <peterlin@andestech.com>
---
Changes v1 -> v2
- no change
Changes v2 -> v3
- Add ".." when PBMT field is clear
---
 arch/riscv/mm/ptdump.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Alexandre Ghiti Sept. 20, 2023, 9:12 a.m. UTC | #1
On 20/09/2023 05:55, Yu Chien Peter Lin wrote:
> 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 <peterlin@andestech.com>
> ---
> Changes v1 -> v2
> - no change
> Changes v2 -> v3
> - Add ".." when PBMT field is clear
> ---
>   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 {
>   
>   static const struct prot_bits pte_bits[] = {
>   	{
> +#ifdef CONFIG_64BIT
> +		.mask = _PAGE_MTMASK_SVPBMT,
> +		.set = "MT(%s)",
> +		.clear = "  ..  ",
> +	}, {
> +#endif
>   		.mask = _PAGE_SOFT,
>   		.set = "RSW(%d)",
>   		.clear = "  ..  ",
> @@ -205,6 +211,16 @@ static void dump_prot(struct pg_state *st)
>   		if (val) {
>   			if (pte_bits[i].mask == _PAGE_SOFT)
>   				sprintf(s, pte_bits[i].set, val >> 8);
> +#ifdef CONFIG_64BIT
> +			else if (pte_bits[i].mask == _PAGE_MTMASK_SVPBMT) {
> +				if (val == _PAGE_NOCACHE_SVPBMT)
> +					sprintf(s, pte_bits[i].set, "NC");
> +				else if (val == _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 {


You can add:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks!

Alex
diff mbox series

Patch

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 {
 
 static const struct prot_bits pte_bits[] = {
 	{
+#ifdef CONFIG_64BIT
+		.mask = _PAGE_MTMASK_SVPBMT,
+		.set = "MT(%s)",
+		.clear = "  ..  ",
+	}, {
+#endif
 		.mask = _PAGE_SOFT,
 		.set = "RSW(%d)",
 		.clear = "  ..  ",
@@ -205,6 +211,16 @@  static void dump_prot(struct pg_state *st)
 		if (val) {
 			if (pte_bits[i].mask == _PAGE_SOFT)
 				sprintf(s, pte_bits[i].set, val >> 8);
+#ifdef CONFIG_64BIT
+			else if (pte_bits[i].mask == _PAGE_MTMASK_SVPBMT) {
+				if (val == _PAGE_NOCACHE_SVPBMT)
+					sprintf(s, pte_bits[i].set, "NC");
+				else if (val == _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 {