[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 03/38] arm: handy function to print a walk of a domain's p2m.



Useful for debug but not actually used in this patch.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/arch/arm/p2m.c         |   34 ++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/page.h |    1 +
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 4f624d8..fdbecbc 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -5,6 +5,40 @@
 #include <xen/domain_page.h>
 #include <asm/flushtlb.h>
 
+void dump_p2m_lookup(struct domain *d, paddr_t addr)
+{
+    struct p2m_domain *p2m = &d->arch.p2m;
+    lpae_t *first = NULL, *second = NULL, *third = NULL;
+
+    printk("dom%d IPA %#016llx\n", d->domain_id, addr);
+
+    first = __map_domain_page(p2m->first_level);
+    printk("1ST[%#03llx] = %#016llx\n",
+           first_table_offset(addr),
+           first[first_table_offset(addr)].bits);
+    if ( !first[first_table_offset(addr)].p2m.valid ||
+         !first[first_table_offset(addr)].p2m.table )
+        goto done;
+
+    second = map_domain_page(first[first_table_offset(addr)].p2m.base);
+    printk("2ND[%#03llx] = %#016llx\n",
+           second_table_offset(addr),
+           second[second_table_offset(addr)].bits);
+    if ( !second[second_table_offset(addr)].p2m.valid ||
+         !second[second_table_offset(addr)].p2m.table )
+        goto done;
+
+    third = map_domain_page(second[second_table_offset(addr)].p2m.base);
+    printk("3RD[%#03llx] = %#016llx\n",
+           third_table_offset(addr),
+           third[third_table_offset(addr)].bits);
+
+done:
+    if (third) unmap_domain_page(third);
+    if (second) unmap_domain_page(second);
+    if (first) unmap_domain_page(first);
+}
+
 void p2m_load_VTTBR(struct domain *d)
 {
     struct p2m_domain *p2m = &d->arch.p2m;
diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h
index 22c56b5..c7b6530 100644
--- a/xen/include/asm-arm/page.h
+++ b/xen/include/asm-arm/page.h
@@ -313,6 +313,7 @@ static inline uint64_t gva_to_ipa(uint32_t va)
 #define PAR_FAULT 0x1
 
 extern void dump_pt_walk(uint32_t addr);
+extern void dump_p2m_lookup(struct domain *d, paddr_t addr);
 
 #endif /* __ASSEMBLY__ */
 
-- 
1.7.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.