All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>
To: xen-devel@lists.xen.org
Subject: [PATCH v02 4/7] arm: omap: introduce print pagetable function for IPU remoteproc
Date: Thu, 26 Jun 2014 14:07:03 +0300	[thread overview]
Message-ID: <1403780826-22123-5-git-send-email-andrii.tseglytskyi@globallogic.com> (raw)
In-Reply-To: <1403780826-22123-1-git-send-email-andrii.tseglytskyi@globallogic.com>

This patch adds a possibility to dump all pagetables of
IPU remoteproc. The only reason to have this patch - is a
low level debug.

Change-Id: If327ca62c964ff9cba3d0952c80a15c06884470b
Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>
---
 xen/arch/arm/platforms/omap_iommu.c |   68 ++++++++++++++++++++++++++++++++++-
 1 file changed, 67 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/platforms/omap_iommu.c b/xen/arch/arm/platforms/omap_iommu.c
index bbaa7bc..d3a3c15 100644
--- a/xen/arch/arm/platforms/omap_iommu.c
+++ b/xen/arch/arm/platforms/omap_iommu.c
@@ -19,7 +19,6 @@
 #include <xen/errno.h>
 #include <xen/stdbool.h>
 #include <xen/mm.h>
-#include <xen/vmap.h>
 #include <xen/sched.h>
 #include <xen/remoteproc_iommu.h>
 
@@ -73,6 +72,8 @@
 static u32 mmu_ipu_translate_pagetable(struct mmu_info *mmu, struct mmu_pagetable *pgt);
 static u32 mmu_sgx_translate_pagetable(struct mmu_info *mmu, struct mmu_pagetable *pgt);
 
+static void mmu_ipu_print_pagetables(struct mmu_info *mmu);
+
 static u32 ipu_trap_offsets[] = {
     MMU_IPU_TTB_OFFSET,
 };
@@ -104,6 +105,7 @@ struct mmu_info omap_ipu_mmu = {
     .mem_size       = 0x1000,
     .num_traps          = ARRAY_SIZE(ipu_trap_offsets),
     .translate_pfunc	= mmu_ipu_translate_pagetable,
+    .print_pagetable_pfunc  = mmu_ipu_print_pagetables,
 };
 
 static const struct pagetable_data pagetable_sgx_data = {
@@ -165,6 +167,70 @@ static u32 mmu_pte_table_alloc(struct mmu_info *mmu, u32 pgd, u32 sect_num,
     return __pa(pte) | PGD_TABLE;
 }
 
+static void mmu_ipu_print_one_pagetable(struct mmu_info *mmu, struct mmu_pagetable *pgt, u32 index)
+{
+    u32 i, page_counter = 0;
+    u32 *pagetable;
+
+    ASSERT(pgt);
+    ASSERT(pgt->hyp_pagetable);
+    ASSERT(pgt->paddr);
+    ASSERT(pgt->maddr);
+
+    pagetable = pgt->hyp_pagetable;
+
+    pr_mmu("pgt[%u][0x%08x][0x%08x]", index, pgt->paddr, pgt->maddr);
+    for ( i = 0; i < MMU_PTRS_PER_PGD(mmu); i++ )
+    {
+        u32 pgd = pagetable[i];
+        u32 *pte_table = NULL;
+        u32 j;
+
+        if ( !pgd )
+            continue;
+
+        /* "supersection" 16 Mb */
+        /* "section" 1Mb */
+        if ( ipu_pgd_is_super(pgd) || ipu_pgd_is_section(pgd) )
+        {
+            pr_mmu("pgt[%u][0x%08x][0x%08x] pgd[%u] 0x%08x (max %lu)",
+                   index, pgt->paddr, pgt->maddr, i, pgd, MMU_PTRS_PER_PGD(mmu));
+
+        /* "table" */
+        }
+        else if ( ipu_pgd_is_table(pgd) )
+        {
+            pte_table = __va(pgd & MMU_SECTION_MASK(MMU_OMAP_SECOND_LEVEL_SHIFT));
+            if ( !pte_table )
+            {
+                pr_mmu("failed to map pagetable");
+                return;
+            }
+
+            for ( j = 0; j < MMU_PTRS_PER_PTE(mmu); j++ )
+            {
+                if ( !pte_table[j] )
+                    continue;
+
+                page_counter++;
+                pr_mmu("pgt[%u][0x%08x][0x%08x] pgd[%u][0x%08x]\t pte[%u][0x%08x] (max %lu)",
+                    index, pgt->paddr, pgt->maddr, i, pgd, j, pte_table[j], MMU_PTRS_PER_PTE(mmu));
+            }
+        }
+    }
+    ASSERT(page_counter == pgt->page_counter);
+}
+
+static void mmu_ipu_print_pagetables(struct mmu_info *mmu)
+{
+	struct mmu_pagetable *pgt;
+	u32 i = 0;
+
+	list_for_each_entry(pgt, &mmu->pagetables_list, link_node) {
+		mmu_ipu_print_one_pagetable(mmu, pgt, i++);
+	}
+}
+
 static u32 mmu_ipu_translate_pagetable(struct mmu_info *mmu, struct mmu_pagetable *pgt)
 {
     u32 *kern_pgt, *hyp_pgt;
-- 
1.7.9.5

  parent reply	other threads:[~2014-06-26 11:07 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 11:06 [PATCH v02 0/7] arm: introduce remoteprocessor iommu module Andrii Tseglytskyi
2014-06-26 11:07 ` [PATCH v02 1/7] " Andrii Tseglytskyi
2014-06-29 18:00   ` Julien Grall
2014-07-22 15:20     ` Andrii Tseglytskyi
2014-07-22 16:29       ` Julien Grall
2014-07-31 11:59       ` Andrii Tseglytskyi
2014-07-31 12:11         ` Julien Grall
2014-07-31 12:49           ` Andrii Tseglytskyi
2014-07-04 13:59   ` Stefano Stabellini
2014-07-16 15:19     ` Ian Campbell
2014-07-22 12:42       ` Stefano Stabellini
2014-07-22 13:29         ` Julien Grall
2014-07-22 16:31           ` Andrii Tseglytskyi
2014-07-22 17:22         ` Andrii Tseglytskyi
2014-07-23 10:32           ` Stefano Stabellini
2014-07-23 10:54             ` Andrii Tseglytskyi
2014-07-22 15:40       ` Andrii Tseglytskyi
2014-07-22 15:32     ` Andrii Tseglytskyi
2014-08-01 10:06       ` Andrii Tseglytskyi
2014-08-01 10:32         ` Julien Grall
2014-08-01 10:34           ` Andrii Tseglytskyi
2014-08-01 10:37             ` Julien Grall
2014-08-01 10:43               ` Andrii Tseglytskyi
2014-08-20 19:40     ` Andrii Tseglytskyi
2014-08-21 15:30       ` Andrii Tseglytskyi
2014-08-21 23:41         ` Stefano Stabellini
2014-08-21 23:43       ` Stefano Stabellini
2014-07-16 15:29   ` Ian Campbell
2014-07-16 15:34     ` Ian Campbell
2014-07-22 16:24       ` Andrii Tseglytskyi
2014-07-22 16:14     ` Andrii Tseglytskyi
2014-06-26 11:07 ` [PATCH v02 2/7] arm: omap: introduce iommu translation for IPU remoteproc Andrii Tseglytskyi
2014-07-04 14:01   ` Stefano Stabellini
2014-07-22 16:56     ` Andrii Tseglytskyi
2014-07-04 14:30   ` Julien Grall
2014-07-22 16:58     ` Andrii Tseglytskyi
2014-07-16 15:36   ` Ian Campbell
2014-07-22 17:16     ` Andrii Tseglytskyi
2014-06-26 11:07 ` [PATCH v02 3/7] arm: omap: introduce iommu translation for GPU remoteproc Andrii Tseglytskyi
2014-06-26 11:07 ` Andrii Tseglytskyi [this message]
2014-07-16 15:38   ` [PATCH v02 4/7] arm: omap: introduce print pagetable function for IPU remoteproc Ian Campbell
2014-07-22 16:55     ` Andrii Tseglytskyi
2014-06-26 11:07 ` [PATCH v02 5/7] arm: omap: introduce print pagetable function for GPU remoteproc Andrii Tseglytskyi
2014-06-26 11:07 ` [PATCH v02 6/7] arm: introduce do_translate_pagetable hypercall Andrii Tseglytskyi
2014-07-04 14:05   ` Stefano Stabellini
2014-07-16 15:42     ` Ian Campbell
2014-07-22 16:47       ` Andrii Tseglytskyi
2014-07-22 16:37     ` Andrii Tseglytskyi
2014-07-04 14:35   ` Julien Grall
2014-07-16 15:43     ` Ian Campbell
2014-07-22 16:50       ` Andrii Tseglytskyi
2014-07-22 16:39     ` Andrii Tseglytskyi
2014-07-22 16:44       ` Julien Grall
2014-07-22 16:48         ` Andrii Tseglytskyi
2014-06-26 11:07 ` [PATCH v02 7/7] arm: add trap for remoteproc mmio accesses Andrii Tseglytskyi
2014-06-26 16:52   ` Julien Grall
2014-06-27  8:36     ` Andrii Tseglytskyi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403780826-22123-5-git-send-email-andrii.tseglytskyi@globallogic.com \
    --to=andrii.tseglytskyi@globallogic.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.