Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm: Extend gpu devcore dumps with pgtbl info

In the case of iova fault triggered devcore dumps, include additional
debug information based on what we think is the current page tables,
including the TTBR0 value (which should match what we have in
adreno_smmu_fault_info unless things have gone horribly wrong), and
the pagetable entries traversed in the process of resolving the
faulting iova.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/628117/

+51 -1
+10
drivers/gpu/drm/msm/adreno/adreno_gpu.c
··· 883 883 drm_printf(p, " - dir=%s\n", info->flags & IOMMU_FAULT_WRITE ? "WRITE" : "READ"); 884 884 drm_printf(p, " - type=%s\n", info->type); 885 885 drm_printf(p, " - source=%s\n", info->block); 886 + 887 + /* Information extracted from what we think are the current 888 + * pgtables. Hopefully the TTBR0 matches what we've extracted 889 + * from the SMMU registers in smmu_info! 890 + */ 891 + drm_puts(p, "pgtable-fault-info:\n"); 892 + drm_printf(p, " - ttbr0: %.16llx\n", (u64)info->pgtbl_ttbr0); 893 + drm_printf(p, " - asid: %d\n", info->asid); 894 + drm_printf(p, " - ptes: %.16llx %.16llx %.16llx %.16llx\n", 895 + info->ptes[0], info->ptes[1], info->ptes[2], info->ptes[3]); 886 896 } 887 897 888 898 drm_printf(p, "rbbm-status: 0x%08x\n", state->rbbm_status);
+9
drivers/gpu/drm/msm/msm_gpu.c
··· 281 281 if (submit) { 282 282 int i; 283 283 284 + if (state->fault_info.ttbr0) { 285 + struct msm_gpu_fault_info *info = &state->fault_info; 286 + struct msm_mmu *mmu = submit->aspace->mmu; 287 + 288 + msm_iommu_pagetable_params(mmu, &info->pgtbl_ttbr0, 289 + &info->asid); 290 + msm_iommu_pagetable_walk(mmu, info->iova, info->ptes); 291 + } 292 + 284 293 state->bos = kcalloc(submit->nr_bos, 285 294 sizeof(struct msm_gpu_state_bo), GFP_KERNEL); 286 295
+8
drivers/gpu/drm/msm/msm_gpu.h
··· 101 101 int flags; 102 102 const char *type; 103 103 const char *block; 104 + 105 + /* Information about what we think/expect is the current SMMU state, 106 + * for example expected_ttbr0 should match smmu_info.ttbr0 which 107 + * was read back from SMMU registers. 108 + */ 109 + phys_addr_t pgtbl_ttbr0; 110 + u64 ptes[4]; 111 + int asid; 104 112 }; 105 113 106 114 /**
+22
drivers/gpu/drm/msm/msm_iommu.c
··· 195 195 return &iommu->domain->geometry; 196 196 } 197 197 198 + int 199 + msm_iommu_pagetable_walk(struct msm_mmu *mmu, unsigned long iova, uint64_t ptes[4]) 200 + { 201 + struct msm_iommu_pagetable *pagetable; 202 + struct arm_lpae_io_pgtable_walk_data wd = {}; 203 + 204 + if (mmu->type != MSM_MMU_IOMMU_PAGETABLE) 205 + return -EINVAL; 206 + 207 + pagetable = to_pagetable(mmu); 208 + 209 + if (!pagetable->pgtbl_ops->pgtable_walk) 210 + return -EINVAL; 211 + 212 + pagetable->pgtbl_ops->pgtable_walk(pagetable->pgtbl_ops, iova, &wd); 213 + 214 + for (int i = 0; i < ARRAY_SIZE(wd.ptes); i++) 215 + ptes[i] = wd.ptes[i]; 216 + 217 + return 0; 218 + } 219 + 198 220 static const struct msm_mmu_funcs pagetable_funcs = { 199 221 .map = msm_iommu_pagetable_map, 200 222 .unmap = msm_iommu_pagetable_unmap,
+2 -1
drivers/gpu/drm/msm/msm_mmu.h
··· 54 54 struct msm_mmu *msm_iommu_pagetable_create(struct msm_mmu *parent); 55 55 56 56 int msm_iommu_pagetable_params(struct msm_mmu *mmu, phys_addr_t *ttbr, 57 - int *asid); 57 + int *asid); 58 + int msm_iommu_pagetable_walk(struct msm_mmu *mmu, unsigned long iova, uint64_t ptes[4]); 58 59 struct iommu_domain_geometry *msm_iommu_get_geometry(struct msm_mmu *mmu); 59 60 60 61 #endif /* __MSM_MMU_H__ */