lkml.org 
[lkml]   [2020]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH 5/5] iommu/tegra-smmu: Add pagetable mappings to debugfs
    From
    Date
    26.09.2020 11:07, Nicolin Chen пишет:
    ...
    > + for (pd_index = 0; pd_index < SMMU_NUM_PDE; pd_index++) {
    > + struct page *pt;
    > + u32 *addr;
    > +
    > + if (!as->count[pd_index] || !pd[pd_index])
    > + continue;

    I guess the idea of this patch is to print out the hardware state, isn't
    it? Hence the as->count shouldn't be checked here.

    > + pde_count++;
    > + pte_count += as->count[pd_index];
    > + seq_printf(s, "\t[%d] 0x%x (%d)\n",
    > + pd_index, pd[pd_index], as->count[pd_index]);
    > + pt = as->pts[pd_index];
    > + addr = page_address(pt);
    > +
    > + seq_puts(s, "\t{\n");
    > + seq_printf(s, "\t\t%-5s %-4s %12s %12s\n", "PDE", "ATTR", "PHYS", "IOVA");
    > + for (pt_index = 0; pt_index < SMMU_NUM_PTE; pt_index++) {
    > + u64 iova;
    > +
    > + if (!addr[pt_index])
    > + continue;
    > +
    > + iova = ((dma_addr_t)pd_index & (SMMU_NUM_PDE - 1)) << SMMU_PDE_SHIFT;
    > + iova |= ((dma_addr_t)pt_index & (SMMU_NUM_PTE - 1)) << SMMU_PTE_SHIFT;
    > +
    > + seq_printf(s, "\t\t#%-4d 0x%-4x 0x%-12llx 0x%-12llx\n",
    > + pt_index, addr[pt_index] >> SMMU_PTE_ATTR_SHIFT,
    > + SMMU_PFN_PHYS(addr[pt_index] & ~SMMU_PTE_ATTR), iova);
    >

    Would be nice if you could improve the output formatting by printing out
    contiguous ranges that have the same ATTRs, otherwise it could be a bit
    too large and unpractical output in a case if lots of pages are mapped.

    \
     
     \ /
      Last update: 2020-09-26 23:25    [W:4.396 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site