Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 57c54126 authored by Olav Haugan's avatar Olav Haugan Committed by Gerrit - the friendly Code Review server
Browse files

iommu: msm: Populate context banks at the end of IOMMU probe



When calling of_platform_populate() on the context bank child nodes the
probe function for the context bank might actually run at that moment.
However, the context bank probe function requires data that is provided
by the caller (IOMMU probe) of of_platform_populte(). If the IOMMU probe
function does not complete before the context bank probe function
executes we might crash.

Instead move the call to of_platform_populate() the end of the IOMMU
probe function to ensure all the data is available when context bank
probe function executes.

Stack trace:

[    3.757438] Unable to handle kernel NULL pointer dereference at
virtual address 00000050
[    3.757447] pgd = ffffffc00007d000
[    3.757467] [00000050] *pgd=000000000e70b003, *pmd=000000000e70c003,
*pte=00e00000f9000407
[    3.757483] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[    3.757492] Modules linked in:
[    3.757510] CPU: 2 PID: 6 Comm: kworker/u16:0 Not tainted
3.10.49-perf-g2a22a7c #2
[    3.757543] Workqueue: deferwq deferred_probe_work_func
[    3.757554] task: ffffffc00e7a3480 ti: ffffffc00e7d4000
task.ti: ffffffc00e7d4000
[    3.757575] PC is at msm_iommu_ctx_probe+0x78/0x2fc
[    3.757590] LR is at msm_iommu_ctx_probe+0x68/0x2fc
[    3.757600] pc : [<ffffffc000932d84>] lr :
[<ffffffc000932d74>] pstate: 60000005
[    3.757605] sp : ffffffc00e7d78b0
[    3.757620] x29: ffffffc00e7d78b0 x28: 0000000000000089
[    3.757634] x27: ffffffc00153c000 x26: 0000000000000000
[    3.757647] x25: ffffffc0be7cf410 x24: 0000000000000072
[    3.757661] x23: 0000000000000000 x22: ffffffc0be37d410
[    3.757675] x21: ffffffc0be078818 x20: ffffffc0be37d400
[    3.757688] x19: ffffffc0c32abdb8 x18: 0000000000000000
[    3.757701] x17: 0000000000000000 x16: 0000000000000000
[    3.757714] x15: 0000000000000000 x14: 0fffffffffffffff
[    3.757727] x13: 0000000000000030 x12: 0000000000000030
[    3.757741] x11: 0101010101010101 x10: ffffffffffffffff
[    3.757754] x9 : 0000000000000000 x8 : ffffffc0be079000
[    3.757767] x7 : 0000000000000000 x6 : 000000000000003f
[    3.757779] x5 : 0000000000000040 x4 : 0000000000000000
[    3.757802] x3 : 0000000000000000 x2 : 0000000000000003
[    3.757815] x1 : ffffffc001028000 x0 : 0000000000000001
[    3.757823]
....
[    3.758780] Process kworker/u16:0 (pid: 6, stack limit =
		0xffffffc00e7d4058)
[    3.758784] Call trace:
[    3.758805] [<ffffffc000932d84>]
msm_iommu_ctx_probe+0x78/0x2fc
[    3.758820] [<ffffffc0005b485c>] platform_drv_probe+0x14/0x20
[    3.758839] [<ffffffc0005b3568>]
driver_probe_device+0xd4/0x240
[    3.758857] [<ffffffc0005b36fc>] __device_attach+0x28/0x4c
[    3.758874] [<ffffffc0005b1a4c>] bus_for_each_drv+0x70/0x90
[    3.758891] [<ffffffc0005b3448>] device_attach+0x68/0x98
[    3.758908] [<ffffffc0005b298c>] bus_probe_device+0x28/0xa0
[    3.758923] [<ffffffc0005b1010>] device_add+0x434/0x594
[    3.758941] [<ffffffc00089ed38>] of_device_add+0x38/0x44
[    3.758957] [<ffffffc00089f3ac>]
of_platform_device_create_pdata+0x54/0x78
[    3.758974] [<ffffffc00089f598>]
of_platform_bus_create+0x1ac/0x228
[    3.758990] [<ffffffc00089f73c>]
of_platform_populate+0x68/0x90
[    3.759008] [<ffffffc000932bbc>] msm_iommu_probe+0x528/0x678
[    3.759021] [<ffffffc0005b485c>] platform_drv_probe+0x14/0x20
[    3.759039] [<ffffffc0005b3568>]
driver_probe_device+0xd4/0x240
[    3.759056] [<ffffffc0005b36fc>] __device_attach+0x28/0x4c
[    3.759072] [<ffffffc0005b1a4c>] bus_for_each_drv+0x70/0x90
[    3.759088] [<ffffffc0005b3448>] device_attach+0x68/0x98
[    3.759105] [<ffffffc0005b298c>] bus_probe_device+0x28/0xa0
[    3.759122] [<ffffffc0005b2e7c>]
deferred_probe_work_func+0x70/0xa0
[    3.759138] [<ffffffc000235ac4>] process_one_work+0x260/0x3c4
[    3.759151] [<ffffffc000236b14>] worker_thread+0x1f8/0x348
[    3.759169] [<ffffffc00023bf54>] kthread+0xac/0xb8

CRs-fixed: 771980
Signed-off-by: default avatarOlav Haugan <ohaugan@codeaurora.org>
Change-Id: I6ee8ffdfc31ad65251c95d9cafd3d6f49b92ff8e
parent 9bc95e76
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment