All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Tseglytskyi <andrii.tseglytskyi@globallogic.com>
To: Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Julien Grall <julien.grall@linaro.org>,
	xen-devel@lists.xen.org
Subject: [PATCH v03 09/10] arm: omap: introduce print pagetable function for IPU remoteproc
Date: Tue,  2 Sep 2014 18:46:09 +0300	[thread overview]
Message-ID: <1409672770-23164-10-git-send-email-andrii.tseglytskyi@globallogic.com> (raw)
In-Reply-To: <1409672770-23164-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.

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

diff --git a/xen/arch/arm/remoteproc/omap_iommu.c b/xen/arch/arm/remoteproc/omap_iommu.c
index f00bfc6..70867e9 100644
--- a/xen/arch/arm/remoteproc/omap_iommu.c
+++ b/xen/arch/arm/remoteproc/omap_iommu.c
@@ -75,6 +75,8 @@ static int mmu_omap_copy_pagetable(struct mmu_info *mmu, struct mmu_pagetable *p
 static paddr_t mmu_ipu_translate_pagetable(struct mmu_info *mmu, struct mmu_pagetable *pgt);
 static paddr_t mmu_gpu_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,
 };
@@ -107,6 +109,7 @@ struct mmu_info omap_ipu_mmu = {
     .num_traps          = ARRAY_SIZE(ipu_trap_offsets),
     .copy_pagetable_pfunc	= mmu_omap_copy_pagetable,
     .translate_pfunc	= mmu_ipu_translate_pagetable,
+    .print_pagetable_pfunc  = mmu_ipu_print_pagetables,
 };
 
 static const struct pagetable_data pagetable_gpu_data = {
@@ -226,6 +229,71 @@ static paddr_t mmu_pte_table_alloc(struct mmu_info *mmu, paddr_t pgd, u32 sect_n
     return __pa(pte) | IPU_PGD_TABLE;
 }
 
+static void mmu_ipu_print_one_pagetable(struct mmu_info *mmu, struct mmu_pagetable *pgt, u32 index)
+{
+    u32 *pagetable;
+    u32 i, page_counter = 0;
+
+    ASSERT(pgt);
+    ASSERT(pgt->hyp_pagetable);
+    ASSERT(pgt->paddr);
+    ASSERT(pgt->maddr);
+
+    pagetable = pgt->hyp_pagetable;
+
+    pr_mmu(mmu, "pgt[%u][0x%"PRIpaddr"][0x%"PRIpaddr"]", index, pgt->paddr, pgt->maddr);
+    for ( i = 0; i < MMU_PTRS_PER_PGD(mmu); i++ )
+    {
+        paddr_t pgd = pagetable[i];
+        paddr_t *pte_table = NULL;
+
+        if ( !pgd )
+            continue;
+
+        /* "supersection" 16 Mb */
+        /* "section" 1Mb */
+        if ( ipu_pgd_is_super(pgd) || ipu_pgd_is_section(pgd) )
+        {
+            pr_mmu(mmu, "pgt[%u][0x%"PRIpaddr"][0x%"PRIpaddr"] pgd[%u] 0x%"PRIpaddr" (max %lu)",
+                   index, pgt->paddr, pgt->maddr, i, pgd, MMU_PTRS_PER_PGD(mmu));
+
+        /* "table" */
+        }
+        else if ( ipu_pgd_is_table(pgd) )
+        {
+            u32 j;
+
+            pte_table = __va(pgd & MMU_SECTION_MASK(MMU_OMAP_SECOND_LEVEL_SHIFT));
+            if ( !pte_table )
+            {
+                pr_mmu(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(mmu, "pgt[%u][0x%"PRIpaddr"][0x%"PRIpaddr"] pgd[%u][0x%"PRIpaddr"]\t pte[%u][0x%"PRIpaddr"] (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 paddr_t mmu_ipu_translate_pagetable(struct mmu_info *mmu, struct mmu_pagetable *pgt)
 {
     /* IPU pagetable consists of set of 32 bit pointers */
-- 
1.9.1

  parent reply	other threads:[~2014-09-02 15:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 15:46 [PATCH v03 00/10] arm: introduce remoteprocessor iommu module Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 01/10] xen: implement guest_physmap_pin_range Andrii Tseglytskyi
2014-09-03  9:43   ` Jan Beulich
2014-09-11  1:12   ` Julien Grall
2014-09-02 15:46 ` [PATCH v03 02/10] domctl: introduce access_remote_pagetable call Andrii Tseglytskyi
2014-09-03  9:46   ` Jan Beulich
2014-09-02 15:46 ` [PATCH v03 03/10] xsm: arm: create domU_rpc_t security label Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 04/10] arm: introduce remoteprocessor iommu module Andrii Tseglytskyi
2014-09-11  0:41   ` Julien Grall
2014-09-02 15:46 ` [PATCH v03 05/10] arm: omap: introduce iommu translation for IPU remoteproc Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 06/10] arm: omap: introduce iommu translation for GPU remoteproc Andrii Tseglytskyi
2014-09-02 15:46 ` [PATCH v03 07/10] arm: introduce remoteproc_mmu_translate_pagetable mem subops call Andrii Tseglytskyi
2014-09-03  9:48   ` Jan Beulich
2014-09-13  0:04   ` Stefano Stabellini
2014-09-02 15:46 ` [PATCH v03 08/10] arm: add trap for remoteproc mmio accesses Andrii Tseglytskyi
2014-09-03  9:52   ` Jan Beulich
2014-09-02 15:46 ` Andrii Tseglytskyi [this message]
2014-09-02 15:46 ` [PATCH v03 10/10] arm: omap: introduce print pagetable function for GPU remoteproc 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=1409672770-23164-10-git-send-email-andrii.tseglytskyi@globallogic.com \
    --to=andrii.tseglytskyi@globallogic.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=stefano.stabellini@citrix.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.