[PATCH 1/2] drm/exynos: add more condition to check iommu support

Inki Dae inki.dae at samsung.com
Fri Mar 13 03:06:59 PDT 2015


On 2015년 03월 12일 13:36, Hyungwon Hwang wrote:
> Checking whether the iommu mapping allocated is not enough to determine
> whether iommu is supported properly or not. Even though there is mapping,
> the kernel is going to be panicked without the iommu being allocated.
> So this patch adds the additional condition to check whether iommu is
> really supported or not.
> 
> [    0.960859] [drm] Initialized drm 1.1.0 20060810
> [    1.016344] ------------[ cut here ]------------
> [    1.016453] kernel BUG at drivers/iommu/exynos-iommu.c:481!
> [    1.020877] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
> [    1.026693] Modules linked in:
> [    1.029736] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc1-00089-gb7abcc2-dirty #13
> [    1.037802] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> [    1.043880] task: db0c0000 ti: db0a6000 task.ti: db0a6000
> [    1.049268] PC is at __exynos_sysmmu_enable+0x188/0x214
> [    1.054470] LR is at exynos_iommu_attach_device+0x44/0x118
> [    1.059940] pc : [<c02bf0d0>]    lr : [<c02bf1a0>]    psr: 60000193
> [    1.059940] sp : db0a7cd8  ip : 00000000  fp : 00000000
> [    1.071394] r10: a0000113  r9 : 00000000  r8 : db355f90
> [    1.076603] r7 : db25b210  r6 : db355640  r5 : 00000000  r4 : 00000000
> [    1.083113] r3 : 00000000  r2 : db355640  r1 : 5b244000  r0 : db25b210
> [    1.089624] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> [    1.097001] Control: 10c5387d  Table: 4000406a  DAC: 00000015
> [    1.102729] Process swapper/0 (pid: 1, stack limit = 0xdb0a6210)
> [    1.108719] Stack: (0xdb0a7cd8 to 0xdb0a8000)
> [    1.113060] 7cc0:                                                       00000000 db355f80
> [    1.121223] 7ce0: 00000000 db355640 db25b210 db355f90 00000000 a0000113 00000000 c02bf1a0
> [    1.129383] 7d00: a0000113 c0115974 00200200 5b244000 db25b210 db25b210 da822c10 db157800
> [    1.137542] 7d20: c0846540 00000000 c07ea3f4 c02bc8e8 db25b210 db278b40 da822c10 c001eb48
> [    1.145701] 7d40: da822e10 db25b210 da822c10 c02ef444 da822e10 00000001 00000001 c02f0af4
> [    1.153860] 7d60: da822e10 db2b0640 db2b25c0 db2b0640 00000000 c02f3850 db157800 00000000
> [    1.162019] 7d80: db157800 00000000 00000000 db278900 00000000 c02eb7d8 db157800 00000000
> [    1.170179] 7da0: 00000000 c08267b8 00000000 c02d4a44 c08e69f4 da822c00 db157800 c02d62c4
> [    1.178337] 7dc0: 00000000 c07ea3f4 00000000 c02faf6c db2b07e0 db2b07e0 00000002 db2b0640
> [    1.186497] 7de0: db2b07d0 c02f33f0 db2b0640 00000000 c0827130 c05a5230 da822c10 c02f34dc
> [    1.194656] 7e00: c08268c8 da822c10 00000001 c08268c8 c0826774 c02eb97c da822c10 da8c0cd0
> [    1.202815] 7e20: 00000000 c08e6ab0 da822c10 c0826774 fffffdfb c02f9acc c08e6ab0 da822c10
> [    1.210974] 7e40: c08466d8 00000000 c0826774 c02f7ea4 db2b8f80 c02491a0 db2b7a80 da822c10
> [    1.219134] 7e60: c0826774 da822c44 c0827458 db2b7a80 0000007d c02f81cc 00000000 c0826774
> [    1.227293] 7e80: c02f8140 c02f61b0 db11205c db2b93b4 c0826774 db2b8f80 00000000 c02f7540
> [    1.235452] 7ea0: c070a3ac 00000000 c08e6a84 c0826774 00000000 c08e6a84 00000000 c02f8a48
> [    1.243611] 7ec0: 00000000 00000000 c08e6a84 c02eb6f0 00000000 c070a3ac ffffffff 00000000
> [    1.251770] 7ee0: 00000000 00000000 00000000 00000000 00000000 00000000 c08095a0 c08095a0
> [    1.259930] 7f00: c02eb628 c0008a3c c0584ad4 c078395c 0000007d dfeff9b0 00000000 dfeff9af
> [    1.268089] 7f20: 00000000 db0a7f38 dfeffb46 dfeffb37 c0584ad4 c0040f40 0000395c 00000000
> [    1.276248] 7f40: c0716918 dfeffb57 00000006 00000006 c080d618 dfeff980 c07fee24 00000006
> [    1.284408] 7f60: c07ea3ec c0851c80 c0851c80 0000007d c07ea3f4 c07aee28 00000006 00000006
> [    1.292566] 7f80: c07ae5ac c0047e88 00001c80 c055553c 00000000 00000000 00000000 00000000
> [    1.300725] 7fa0: 00000000 c0555548 00000000 c000f390 00000000 00000000 00000000 00000000
> [    1.308884] 7fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> [    1.317044] 7fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ffffffff ffffffdf
> [    1.325220] [<c02bf0d0>] (__exynos_sysmmu_enable) from [<c02bf1a0>] (exynos_iommu_attach_device+0x44/0x118)
> [    1.334928] [<c02bf1a0>] (exynos_iommu_attach_device) from [<c02bc8e8>] (iommu_attach_device+0x1c/0xc8)
> [    1.344305] [<c02bc8e8>] (iommu_attach_device) from [<c001eb48>] (arm_iommu_attach_device+0x18/0x50)
> [    1.353420] [<c001eb48>] (arm_iommu_attach_device) from [<c02ef444>] (drm_iommu_attach_device+0x4c/0xcc)
> [    1.362880] [<c02ef444>] (drm_iommu_attach_device) from [<c02f0af4>] (fimd_bind+0x124/0x198)
> [    1.371298] [<c02f0af4>] (fimd_bind) from [<c02f3850>] (component_bind_all+0xc4/0x228)
> [    1.379195] [<c02f3850>] (component_bind_all) from [<c02eb7d8>] (exynos_drm_load+0xa0/0x148)
> [    1.387618] [<c02eb7d8>] (exynos_drm_load) from [<c02d4a44>] (drm_dev_register+0xa8/0x104)
> [    1.395864] [<c02d4a44>] (drm_dev_register) from [<c02d62c4>] (drm_platform_init+0x44/0xdc)
> [    1.404195] [<c02d62c4>] (drm_platform_init) from [<c02f33f0>] (try_to_bring_up_master.part.2+0xc8/0x108)
> [    1.413741] [<c02f33f0>] (try_to_bring_up_master.part.2) from [<c02f34dc>] (component_master_add_with_match+0xac/0x124)
> [    1.424505] [<c02f34dc>] (component_master_add_with_match) from [<c02eb97c>] (exynos_drm_platform_probe+0xfc/0x128)
> [    1.434925] [<c02eb97c>] (exynos_drm_platform_probe) from [<c02f9acc>] (platform_drv_probe+0x44/0xa4)
> [    1.444124] [<c02f9acc>] (platform_drv_probe) from [<c02f7ea4>] (driver_probe_device+0x13c/0x394)
> [    1.452977] [<c02f7ea4>] (driver_probe_device) from [<c02f81cc>] (__driver_attach+0x8c/0x90)
> [    1.461395] [<c02f81cc>] (__driver_attach) from [<c02f61b0>] (bus_for_each_dev+0x68/0x9c)
> [    1.469555] [<c02f61b0>] (bus_for_each_dev) from [<c02f7540>] (bus_add_driver+0x160/0x21c)
> [    1.477801] [<c02f7540>] (bus_add_driver) from [<c02f8a48>] (driver_register+0x78/0xf8)
> [    1.485786] [<c02f8a48>] (driver_register) from [<c02eb6f0>] (exynos_drm_init+0xc8/0x110)
> [    1.493946] [<c02eb6f0>] (exynos_drm_init) from [<c0008a3c>] (do_one_initcall+0xb8/0x1f0)
> [    1.502108] [<c0008a3c>] (do_one_initcall) from [<c07aee28>] (kernel_init_freeable+0x1d4/0x278)
> [    1.510787] [<c07aee28>] (kernel_init_freeable) from [<c0555548>] (kernel_init+0xc/0xe8)
> [    1.518859] [<c0555548>] (kernel_init) from [<c000f390>] (ret_from_fork+0x14/0x24)
> [    1.526406] Code: e3130004 1a00001e e3a06000 eaffffcf (e7f001f2)
> [    1.532505] ---[ end trace 03b1b443463b1342 ]---
> [    1.537077] Kernel panic - not syncing: Fatal exception
> 
> Signed-off-by: Hyungwon Hwang <human.hwang at samsung.com>
> Cc: Inki Dae <inki.dae at samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_iommu.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_iommu.h b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
> index 35d2588..597bf70 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_iommu.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_iommu.h
> @@ -32,7 +32,7 @@ static inline bool is_drm_iommu_supported(struct drm_device *drm_dev)
>  #ifdef CONFIG_ARM_DMA_USE_IOMMU
>  	struct device *dev = drm_dev->dev;
> 
> -	return dev->archdata.mapping ? true : false;
> +	return dev->archdata.mapping && dev->archdata.iommu;

As of now, dev->archdata.iommu would always be NULL so above
dev->archdata.iommu is same as false. Therefore, it has no any meaning.
Even exynos iommu driver sets a iommu owner to dev->archdata.iommu, it
seems not good for other driver accesses the iommu object directly.

Thanks,
Inki Dae

>  #else
>  	return false;
>  #endif
> --
> 1.9.1
> 
> 



More information about the dri-devel mailing list