Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitde22d21

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Add page table dump support for uefi
Extend the current page table dump support in RISC-V to include efipages as well.Here is the output of efi runtime page table mappings.---[ UEFI runtime start ]---0x0000000020002000-0x0000000020003000 0x00000000be732000 4K PTE D A . . . W R V0x0000000020018000-0x0000000020019000 0x00000000be738000 4K PTE D A . . . W R V0x000000002002c000-0x000000002002d000 0x00000000be73c000 4K PTE D A . . . W R V0x0000000020031000-0x0000000020032000 0x00000000bff61000 4K PTE D A . . X W R V---[ UEFI runtime end ]---Signed-off-by: Atish Patra <atish.patra@wdc.com>Reviewed-by: Anup Patel <anup@brainfault.org>Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
1 parentb91540d commitde22d21

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

‎arch/riscv/mm/ptdump.c‎

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (C) 2019 SiFive
44
*/
55

6+
#include<linux/efi.h>
67
#include<linux/init.h>
78
#include<linux/debugfs.h>
89
#include<linux/seq_file.h>
@@ -49,6 +50,14 @@ struct addr_marker {
4950
constchar*name;
5051
};
5152

53+
/* Private information for debugfs */
54+
structptd_mm_info {
55+
structmm_struct*mm;
56+
conststructaddr_marker*markers;
57+
unsigned longbase_addr;
58+
unsigned longend;
59+
};
60+
5261
staticstructaddr_markeraddress_markers[]= {
5362
#ifdefCONFIG_KASAN
5463
{KASAN_SHADOW_START,"Kasan shadow start"},
@@ -68,6 +77,28 @@ static struct addr_marker address_markers[] = {
6877
{-1,NULL},
6978
};
7079

80+
staticstructptd_mm_infokernel_ptd_info= {
81+
.mm=&init_mm,
82+
.markers=address_markers,
83+
.base_addr=KERN_VIRT_START,
84+
.end=ULONG_MAX,
85+
};
86+
87+
#ifdefCONFIG_EFI
88+
staticstructaddr_markerefi_addr_markers[]= {
89+
{0,"UEFI runtime start" },
90+
{SZ_1G,"UEFI runtime end" },
91+
{-1,NULL }
92+
};
93+
94+
staticstructptd_mm_infoefi_ptd_info= {
95+
.mm=&efi_mm,
96+
.markers=efi_addr_markers,
97+
.base_addr=0,
98+
.end=SZ_2G,
99+
};
100+
#endif
101+
71102
/* Page Table Entry */
72103
structprot_bits {
73104
u64mask;
@@ -245,22 +276,22 @@ static void note_page(struct ptdump_state *pt_st, unsigned long addr,
245276
}
246277
}
247278

248-
staticvoidptdump_walk(structseq_file*s)
279+
staticvoidptdump_walk(structseq_file*s,structptd_mm_info*pinfo)
249280
{
250281
structpg_statest= {
251282
.seq=s,
252-
.marker=address_markers,
283+
.marker=pinfo->markers,
253284
.level=-1,
254285
.ptdump= {
255286
.note_page=note_page,
256287
.range= (structptdump_range[]) {
257-
{KERN_VIRT_START,ULONG_MAX},
288+
{pinfo->base_addr,pinfo->end},
258289
{0,0}
259290
}
260291
}
261292
};
262293

263-
ptdump_walk_pgd(&st.ptdump,&init_mm,NULL);
294+
ptdump_walk_pgd(&st.ptdump,pinfo->mm,NULL);
264295
}
265296

266297
voidptdump_check_wx(void)
@@ -293,7 +324,7 @@ void ptdump_check_wx(void)
293324

294325
staticintptdump_show(structseq_file*m,void*v)
295326
{
296-
ptdump_walk(m);
327+
ptdump_walk(m,m->private);
297328

298329
return0;
299330
}
@@ -308,8 +339,13 @@ static int ptdump_init(void)
308339
for (j=0;j<ARRAY_SIZE(pte_bits);j++)
309340
pg_level[i].mask |=pte_bits[j].mask;
310341

311-
debugfs_create_file("kernel_page_tables",0400,NULL,NULL,
342+
debugfs_create_file("kernel_page_tables",0400,NULL,&kernel_ptd_info,
312343
&ptdump_fops);
344+
#ifdefCONFIG_EFI
345+
if (efi_enabled(EFI_RUNTIME_SERVICES))
346+
debugfs_create_file("efi_page_tables",0400,NULL,&efi_ptd_info,
347+
&ptdump_fops);
348+
#endif
313349

314350
return0;
315351
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp