mm_vm_dump is for dumping a VM's stage 2 page table. To dump the hypervisor's page table (which is what mm_init is initialising), try:

mm_ptable_dump(&ptable, MM_FLAG_STAGE1);

If that doesn't work let me know and I'll try to reproduce the problem.

On Mon, 20 Jul 2020 at 17:20, Madhukar Pappireddy <Madhukar.Pappireddy@arm.com> wrote:
Hi Raghu and Andrew,

Thanks for the inputs. I have added the mm_vm_dump() call to the mm_init() function but nothing was dumped to uart log. I guess I am missing something trivial. It looks like mm_root_table_count() returns 0. Any suggestions?

diff --git a/src/mm.c b/src/mm.c
index 2e352e9..7c56a09 100644
--- a/src/mm.c
+++ b/src/mm.c
@@ -1041,5 +1041,7 @@ bool mm_init(struct mpool *ppool)
        mm_identity_map(stage1_locked, layout_data_begin(), layout_data_end(),
                        MM_MODE_R | MM_MODE_W, ppool);

+       mm_vm_dump(&ptable);
+
        return arch_mm_init(ptable.root);
 }

Thanks,
Madhukar

-----Original Message-----
From: Hafnium <hafnium-bounces@lists.trustedfirmware.org> On Behalf Of Andrew Walbran via Hafnium
Sent: Friday, July 17, 2020 6:10 AM
To: Raghu K <raghu.ncstate@icloud.com>
Cc: hafnium@lists.trustedfirmware.org
Subject: Re: [Hafnium] Debugging page table creation in Hafnium

Yep, mm_vm_dump sounds like what you're looking for. You can add a call where you like and it will go to the log UART.

On Thu, 16 Jul 2020 at 19:14, Raghu K via Hafnium < hafnium@lists.trustedfirmware.org> wrote:

> Quick search indicates mm_vm_dump() and the functions it calls in
> src/mm.c should do what you want. i've not tried it or don't know the
> format, but this may be what you are looking for.
>
> -Raghu
>
> On 7/16/20 11:03 AM, Madhukar Pappireddy via Hafnium wrote:
> > Hi,
> >
> > I was wondering if there is support in Hafnium to dump page tables
> > to a
> log file. I am new to the Hafnium project and would appreciate any help.
> Below is an example from TF-A which provides such provision.
> >
> > ......<snip>
> > VERBOSE: Translation tables state:
> > VERBOSE:   Xlat regime:     EL3
> > VERBOSE:   Max allowed PA:  0xfffffffff
> > VERBOSE:   Max allowed VA:  0xfffffffff
> > VERBOSE:   Max mapped PA:   0x2f1fffff
> > VERBOSE:   Max mapped VA:   0x2f1fffff
> > VERBOSE:   Initial lookup level: 1
> > VERBOSE:   Entries @initial lookup level: 64
> > VERBOSE:   Used 3 sub-tables out of 5 (spare: 2)
> >    [LV1] VA:0x0 size:0x40000000
> >      [LV2] VA:0x0 size:0x200000
> >        [LV3] VA:0x0 PA:0x0 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x1000 PA:0x1000 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x2000 PA:0x2000 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x3000 PA:0x3000 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x4000 PA:0x4000 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x5000 PA:0x5000 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x6000 PA:0x6000 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x7000 PA:0x7000 size:0x1000 MEM-RO-EXEC-S
> >        [LV3] VA:0x8000 PA:0x8000 size:0x1000 MEM-RO-XN-S
> >        [LV3] VA:0x9000 PA:0x9000 size:0x1000 MEM-RO-XN-S
> >        [LV3] VA:0xa000 PA:0xa000 size:0x1000 MEM-RO-XN-S
> >        [LV3] VA:0xb000 size:0x1000
> >        [LV3] (500 invalid descriptors omitted)
> >      [LV2] VA:0x200000 size:0x200000
> >      [LV2] (30 invalid descriptors omitted)
> >      [LV2] VA:0x4000000 size:0x200000 ..... <snip>
> >
> > Thanks,
> > Madhukar
> >
>
> --
> Hafnium mailing list
> Hafnium@lists.trustedfirmware.org
> https://lists.trustedfirmware.org/mailman/listinfo/hafnium
>