Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when trying to use the H264 decoder #3

Open
Miouyouyou opened this issue Aug 2, 2017 · 16 comments
Open

Crash when trying to use the H264 decoder #3

Miouyouyou opened this issue Aug 2, 2017 · 16 comments
Assignees
Milestone

Comments

@Miouyouyou
Copy link
Owner

Miouyouyou commented Aug 2, 2017

When using the MPP decoder test suite or reading a video using Longchair's MPV with MPP support, the VPU driver crashes. Here's the dmesg from the module loading to the crash.

[  120.229291] rk-vcodec ff9a0000.vpu-service: probe device
[  120.235264] rk-vcodec ff9a0000.vpu-service: ( Myy ) Used the DTB IO moomoomoos
[  120.243401] rk-vcodec ff9a0000.vpu-service: vpu mmu dec eea86a10
[  120.250351] rk-vcodec ff9a0000.vpu-service: allocator is drm
[  120.256708] rk-vcodec ff9a0000.vpu-service: checking hw id 4831
[  120.263635] rk-vcodec ff9a0000.vpu-service: init success
[  120.269885] rk-vcodec ff9c0000.hevc-service: probe device
[  120.275954] rk-vcodec ff9c0000.hevc-service: ( Myy ) Used the DTB IO moomoomoos
[  120.284143] rk-vcodec ff9c0000.hevc-service: vpu mmu dec eea87210
[  120.291129] rk-vcodec ff9c0000.hevc-service: allocator is drm
[  120.297584] rk-vcodec ff9c0000.hevc-service: checking hw id 6867
[  120.304588] rk-vcodec ff9c0000.hevc-service: init success
[  152.052713] rk-vcodec ff9a0000.vpu-service: dev opened
[  152.148193] rk-vcodec ff9a0000.vpu-service: ( Myy ) reg->reg[tbl[0]] → 21 (15)
[  152.157963] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_iommu_import(ed150000, eebde000, 21) → -12
[  152.168480] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ed105980, -12) →   (null)
[  152.179569] rk-vcodec ff9a0000.vpu-service: can not find -12 buffer in list
[  152.187363] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_iommu_map_iommu(ed150000,eebde000,-12,ed13b098,ed13b09c) → -22
[  152.199813] rk-vcodec ff9a0000.vpu-service: reg 12 fd 21 ion map iommu failed
[  152.207801] rk-vcodec ff9a0000.vpu-service: can not find -12 buffer in list
[  152.215589] rk_vcodec: reg_init:1303: error: translate reg address failed, dumping regs
[  152.224549] Unhandled fault: page domain fault (0x01b) at 0x02d553e0
[  152.231634] pgd = eccac000
[  152.234650] [02d553e0] *pgd=2cf33835, *pte=7429675f, *ppte=74296c7f
[  152.241654] Internal error: : 1b [#1] PREEMPT SMP ARM
[  152.247283] Modules linked in: rk_vcodec(O) mali_kbase dw_hdmi_i2s_audio [last unloaded: rk_vcodec]
[  152.257398] CPU: 0 PID: 1334 Comm: mpp_dec_parser Tainted: G           O    4.13.0-rc3-RockMyy-XIII-VPU-Test #3
[  152.268659] Hardware name: Rockchip (Device Tree)
[  152.273909] task: ed33cb00 task.stack: eccbc000
[  152.278970] PC is at reg_init+0x910/0xa2c [rk_vcodec]
[  152.284612] LR is at reg_init+0x8ec/0xa2c [rk_vcodec]
[  152.290250] pc : [<bf0cc420>]    lr : [<bf0cc3fc>]    psr: 80000013
[  152.297247] sp : eccbdd98  ip : 00000000  fp : bf0d1928
[  152.303078] r10: bf0d47c0  r9 : ed13b098  r8 : ed13b09c
[  152.308910] r7 : ed13b080  r6 : 00000000  r5 : 00000065  r4 : ed277000
[  152.316199] r3 : 02d553e0  r2 : 00000000  r1 : bf0d2059  r0 : eea86410
[  152.323489] Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[  152.331457] Control: 10c5387d  Table: 2ccac06a  DAC: 00000051
[  152.337872] Process mpp_dec_parser (pid: 1334, stack limit = 0xeccbc218)
[  152.345355] Stack: (0xeccbdd98 to 0xeccbe000)
[  152.350216] dd80:                                                       fffffff4 ed13b098
[  152.359351] dda0: ed13b09c ffffffea 00000194 fffffff4 ed164018 ed164018 00000015 00000000
[  152.368486] ddc0: bf0d4464 00000000 0010fff0 ed277018 ed277020 ed27702c c12e1e08 00000000
[  152.377620] dde0: 02d553e0 00000002 00000010 00000014 c0f41ee8 bf0d1927 c12e1680 0000000b
[  152.386756] de00: c12e1680 c11a824d c11a8220 c01f8520 20000013 ed01bc00 ed01bc34 ed01bc00
[  152.395883] de20: af400000 c0c26770 c0f41ee8 c0f341ef 2ddf7000 00000009 c12e1680 c11a8296
[  152.405018] de40: c11a8288 c01f7840 efe6ee40 00000707 af400000 c0c26770 73af2e37 c020461c
[  152.414154] de60: ecdc4630 ed8f96f0 ee356c9c ecdc4630 ee356ca8 ed1a4c1c ed1a4c08 c0206abc
[  152.423280] de80: 00000000 ecdc4630 ecdc4630 00000707 140440fb c0207dc4 ecdc4630 140440fb
[  152.432415] dea0: ed147900 b1322b64 eebde000 ed164018 bf0d47c0 ee9ead18 00000051 00000000
[  152.441550] dec0: 00000000 bf0ce074 c12fc5d8 00000000 00000000 ed1a4c08 ed1a4c1c 02d553e0
[  152.450685] dee0: 00000194 af26b000 000000fb ed147900 00195000 ee92b1b8 b1322b64 ecdbef00
[  152.459819] df00: b1322b64 40046c03 00000011 00000000 00000000 c0234498 00002000 c0234cf8
[  152.468955] df20: ed01bc44 00000003 00000001 00195000 00000000 ed147900 00000000 c01f6f0c
[  152.478090] df40: 00000001 00000000 000111d3 eccbdf5c eccbdf60 00000001 00000001 00000000
[  152.487226] df60: ecdbef00 00000000 ecdbef00 ecdbef01 b1322b64 40046c03 00000011 00000000
[  152.496352] df80: 00000000 c0234e50 b1322b64 b68fb000 be9e10f8 00000000 00000036 c0107064
[  152.505487] dfa0: eccbc000 c0106ea0 b68fb000 be9e10f8 00000011 40046c03 b1322b64 b1322b64
[  152.514622] dfc0: b68fb000 be9e10f8 00000000 00000036 be9e10f8 b58ea000 00000000 00000000
[  152.523758] dfe0: b68fb40c b1322b3c b68b7485 b6399da6 00000030 00000011 25d078c7 1e1a2741
[  152.532895] [<bf0cc420>] (reg_init [rk_vcodec]) from [<bf0ce074>] (vpu_service_ioctl+0x408/0x720 [rk_vcodec])
[  152.543979] [<bf0ce074>] (vpu_service_ioctl [rk_vcodec]) from [<c0234498>] (vfs_ioctl+0x20/0x34)
[  152.553795] [<c0234498>] (vfs_ioctl) from [<c0234cf8>] (do_vfs_ioctl+0x72c/0x838)
[  152.562155] [<c0234cf8>] (do_vfs_ioctl) from [<c0234e50>] (SyS_ioctl+0x4c/0x74)
[  152.570324] [<c0234e50>] (SyS_ioctl) from [<c0106ea0>] (ret_fast_syscall+0x0/0x3c)
[  152.578780] Code: e1a02006 e59f111c e5930160 e59d3048 (e7933106) 
[  152.585576] ---[ end trace 70e0d45a6c3d255f ]---
@Miouyouyou Miouyouyou added this to the 1.0 milestone Aug 2, 2017
@Miouyouyou Miouyouyou self-assigned this Aug 2, 2017
Miouyouyou added a commit that referenced this issue Aug 2, 2017
When asked to do its job. Basically, the following error happens when
trying the MPP test suite or anything built upon MPP :

[  152.532895] [<bf0cc420>] (reg_init [rk_vcodec]) from [<bf0ce074>] (vpu_service_ioctl+0x408/0x720 [rk_vcodec])
[  152.543979] [<bf0ce074>] (vpu_service_ioctl [rk_vcodec]) from [<c0234498>] (vfs_ioctl+0x20/0x34)
[  152.553795] [<c0234498>] (vfs_ioctl) from [<c0234cf8>] (do_vfs_ioctl+0x72c/0x838)
[  152.562155] [<c0234cf8>] (do_vfs_ioctl) from [<c0234e50>] (SyS_ioctl+0x4c/0x74)
[  152.570324] [<c0234e50>] (SyS_ioctl) from [<c0106ea0>] (ret_fast_syscall+0x0/0x3c)

Turns out that memory isn't allocated at some point and the code
continues, using the -ENOMEM error code as an actual value to do some
operations which obviously fail.

More informations here :
#3

Signed-off-by: Myy <[email protected]>
@Miouyouyou
Copy link
Owner Author

The issue seems to be triggered by a call to alloc_iova that fails. The call is located here :
https://github.com/Miouyouyou/rockchip-vcodec/blob/master/vcodec_iommu_drm.c#L329

@Miouyouyou
Copy link
Owner Author

Miouyouyou commented Aug 2, 2017

Turns out that alloc_iova is called like this :

alloc_iova(ecde7c00, 0, 0, true) →   (null)

Which obviously cannot work, since the second argument is supposed to the size to allocate.

The second argument is determined by a call to iova_align which is actually called like this :

iova_align(ecde7c00, 0) → 0

Again, the second argument being the size, this cannot work correctly.

Now, 0 is determined by the variable iova_len, which is initialized at 0 and then incremented during the for_each_sg calls...

I'll log the for_each_sg calls as I'm pretty sure the loop isn't triggered...

@Miouyouyou
Copy link
Owner Author

A few logs later, and it seems that for_each_sg is called after all ! It's just that iova_len is always incremented by 0 during the loop, which clearly doesn't help...

[   54.955880] ( Myy ) for_each_sg(ecc19400, ??, 31, ??)
[   54.961585] ( Myy ) vcodec_dma_map_sg loop [0/31]
[   54.966849] ( Myy ) [0/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   54.973424] ( Myy ) [0/31] iova_len = 0
[   54.977714] ( Myy ) vcodec_dma_map_sg loop [1/31]
[   54.983020] ( Myy ) [1/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   54.989545] ( Myy ) [1/31] iova_len = 0
[   54.993896] ( Myy ) vcodec_dma_map_sg loop [2/31]
[   54.999162] ( Myy ) [2/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.005729] ( Myy ) [2/31] iova_len = 0
[   55.010020] ( Myy ) vcodec_dma_map_sg loop [3/31]
[   55.015319] ( Myy ) [3/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.021846] ( Myy ) [3/31] iova_len = 0
[   55.026183] ( Myy ) vcodec_dma_map_sg loop [4/31]
[   55.031446] ( Myy ) [4/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.038023] ( Myy ) [4/31] iova_len = 0
[   55.042316] ( Myy ) vcodec_dma_map_sg loop [5/31]
[   55.047618] ( Myy ) [5/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.054144] ( Myy ) [5/31] iova_len = 0
[   55.058469] ( Myy ) vcodec_dma_map_sg loop [6/31]
[   55.063733] ( Myy ) [6/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.070294] ( Myy ) [6/31] iova_len = 0
[   55.074585] ( Myy ) vcodec_dma_map_sg loop [7/31]
[   55.079883] ( Myy ) [7/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.086407] ( Myy ) [7/31] iova_len = 0
[   55.090733] ( Myy ) vcodec_dma_map_sg loop [8/31]
[   55.095997] ( Myy ) [8/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.102562] ( Myy ) [8/31] iova_len = 0
[   55.106853] ( Myy ) vcodec_dma_map_sg loop [9/31]
[   55.112155] ( Myy ) [9/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.118681] ( Myy ) [9/31] iova_len = 0
[   55.123007] ( Myy ) vcodec_dma_map_sg loop [10/31]
[   55.128366] ( Myy ) [10/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.135023] ( Myy ) [10/31] iova_len = 0
[   55.139410] ( Myy ) vcodec_dma_map_sg loop [11/31]
[   55.144810] ( Myy ) [11/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.151429] ( Myy ) [11/31] iova_len = 0
[   55.155843] ( Myy ) vcodec_dma_map_sg loop [12/31]
[   55.161204] ( Myy ) [12/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.167863] ( Myy ) [12/31] iova_len = 0
[   55.172251] ( Myy ) vcodec_dma_map_sg loop [13/31]
[   55.177649] ( Myy ) [13/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.184270] ( Myy ) [13/31] iova_len = 0
[   55.188695] ( Myy ) vcodec_dma_map_sg loop [14/31]
[   55.194056] ( Myy ) [14/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.200712] ( Myy ) [14/31] iova_len = 0
[   55.205100] ( Myy ) vcodec_dma_map_sg loop [15/31]
[   55.210494] ( Myy ) [15/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.217115] ( Myy ) [15/31] iova_len = 0
[   55.221518] ( Myy ) vcodec_dma_map_sg loop [16/31]
[   55.226876] ( Myy ) [16/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.233497] ( Myy ) [16/31] iova_len = 0
[   55.237881] ( Myy ) vcodec_dma_map_sg loop [17/31]
[   55.243230] ( Myy ) [17/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.249847] ( Myy ) [17/31] iova_len = 0
[   55.254232] ( Myy ) vcodec_dma_map_sg loop [18/31]
[   55.259591] ( Myy ) [18/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.266208] ( Myy ) [18/31] iova_len = 0
[   55.270594] ( Myy ) vcodec_dma_map_sg loop [19/31]
[   55.275950] ( Myy ) [19/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.282569] ( Myy ) [19/31] iova_len = 0
[   55.286945] ( Myy ) vcodec_dma_map_sg loop [20/31]
[   55.292300] ( Myy ) [20/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.298917] ( Myy ) [20/31] iova_len = 0
[   55.303302] ( Myy ) vcodec_dma_map_sg loop [21/31]
[   55.308658] ( Myy ) [21/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.315275] ( Myy ) [21/31] iova_len = 0
[   55.319673] ( Myy ) vcodec_dma_map_sg loop [22/31]
[   55.325032] ( Myy ) [22/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.331651] ( Myy ) [22/31] iova_len = 0
[   55.336033] ( Myy ) vcodec_dma_map_sg loop [23/31]
[   55.341391] ( Myy ) [23/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.348006] ( Myy ) [23/31] iova_len = 0
[   55.352392] ( Myy ) vcodec_dma_map_sg loop [24/31]
[   55.357749] ( Myy ) [24/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.364368] ( Myy ) [24/31] iova_len = 0
[   55.368754] ( Myy ) vcodec_dma_map_sg loop [25/31]
[   55.374111] ( Myy ) [25/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.380727] ( Myy ) [25/31] iova_len = 0
[   55.385112] ( Myy ) vcodec_dma_map_sg loop [26/31]
[   55.390466] ( Myy ) [26/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.397083] ( Myy ) [26/31] iova_len = 0
[   55.401466] ( Myy ) vcodec_dma_map_sg loop [27/31]
[   55.406821] ( Myy ) [27/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.413441] ( Myy ) [27/31] iova_len = 0
[   55.417825] ( Myy ) vcodec_dma_map_sg loop [28/31]
[   55.423181] ( Myy ) [28/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.429803] ( Myy ) [28/31] iova_len = 0
[   55.434186] ( Myy ) vcodec_dma_map_sg loop [29/31]
[   55.439541] ( Myy ) [29/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.446151] ( Myy ) [29/31] iova_len = 0
[   55.450534] ( Myy ) vcodec_dma_map_sg loop [30/31]
[   55.455890] ( Myy ) [30/31] iova_align(ed2fac00, 0 (0 + 0)) = 0
[   55.462499] ( Myy ) [30/31] iova_len = 0
[   55.466884] ( Myy ) iova_align(ed2fac00, 0) → 0
[   55.472144] ( Myy ) alloc_iova(ed2fac00, 0, 0, true) →   (null)

@Miouyouyou Miouyouyou reopened this Aug 2, 2017
@Miouyouyou
Copy link
Owner Author

Okay, so the new logged code flow is this :

[   75.548313] rk-vcodec ff9a0000.vpu-service: ( Myy ) reg->reg[tbl[0]] → 21 (15)
[   75.556657] ( Myy ) kzalloc(76, GFP_KERNEL) → ed1f9480                                                                                               
[   75.562792] ( Myy ) Still alive ♪
[   75.566712] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(64, GFP_KERNEL) → ecf9c800
[   75.576573] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(12, GFP_KERNEL) → ecf9c5c0
[   75.585631] ( Myy ) [0/5] sg->length = 4096
[   75.590317] ( Myy ) [1/5] sg->length = 4096
[   75.595048] ( Myy ) [2/5] sg->length = 4096
[   75.599730] ( Myy ) [3/5] sg->length = 1409024
[   75.604740] ( Myy ) [4/5] sg->length = 675840
[   75.609614] ( Myy ) (Copy) [0/5] sg->length = 4096
[   75.615026] ( Myy ) (Copy) [1/5] sg->length = 4096
[   75.620384] ( Myy ) (Copy) [2/5] sg->length = 4096
[   75.625783] ( Myy ) (Copy) [3/5] sg->length = 1409024
[   75.631433] ( Myy ) (Copy) [4/5] sg->length = 675840
[   75.637030] ( Myy ) for_each_sg(ed1f9500, ??, 5, ??)
[   75.642583] ( Myy ) vcodec_dma_map_sg loop [0/5]
[   75.647798] ( Myy ) [0/5] (Before) iova_align(ed200800, 4096 (4096 + 0))
[   75.655295] ( Myy ) [0/5] (After) iova_align(ed200800, 4096 (4096 + 0)) = 0
[   75.663123] ( Myy ) [0/5] iova_len = 0 (+0)
[   75.667803] ( Myy ) vcodec_dma_map_sg loop [1/5]
[   75.673006] ( Myy ) [1/5] (Before) iova_align(ed200800, 4096 (4096 + 0))
[   75.680502] ( Myy ) [1/5] (After) iova_align(ed200800, 4096 (4096 + 0)) = 0
[   75.688331] ( Myy ) [1/5] iova_len = 0 (+0)
[   75.693009] ( Myy ) vcodec_dma_map_sg loop [2/5]
[   75.698233] ( Myy ) [2/5] (Before) iova_align(ed200800, 4096 (4096 + 0))
[   75.705730] ( Myy ) [2/5] (After) iova_align(ed200800, 4096 (4096 + 0)) = 0
[   75.713554] ( Myy ) [2/5] iova_len = 0 (+0)
[   75.718232] ( Myy ) vcodec_dma_map_sg loop [3/5]
[   75.723437] ( Myy ) [3/5] (Before) iova_align(ed200800, 1409024 (1409024 + 0))
[   75.731515] ( Myy ) [3/5] (After) iova_align(ed200800, 1409024 (1409024 + 0)) = 0
[   75.739923] ( Myy ) [3/5] iova_len = 0 (+0)
[   75.744602] ( Myy ) vcodec_dma_map_sg loop [4/5]
[   75.749816] ( Myy ) [4/5] (Before) iova_align(ed200800, 675840 (675840 + 0))
[   75.757703] ( Myy ) [4/5] (After) iova_align(ed200800, 675840 (675840 + 0)) = 0
[   75.765918] ( Myy ) [4/5] iova_len = 0 (+0)
[   75.770609] ( Myy ) iova_align(ed200800, 0) → 0
[   75.775910] ( Myy ) alloc_iova(ed200800, 0, 0, true) →   (null)

So, the issue is really in the iova_align call. Turns out that the domain->granule value is never defined... I don't know why, but it is set to 0, which makes any iova_align call returns 0, since iova_align is defined like this :

static inline size_t iova_align(struct iova_domain *iovad, size_t size)
{
	return ALIGN(size, iovad->granule);
}

So, now, I'm wondering if iovad->granule existed during the 4.4 era !

@Miouyouyou
Copy link
Owner Author

Well, I still don't get the idea behind alloc_iova calls and how they're built, how you calculate the number of 'page frames' needed, etc... Which makes understanding the code extremely difficult.

Seriously, if anyone understand this part, feel free to leave a comment.

I'll give it a look tomorrow.

@Miouyouyou
Copy link
Owner Author

So that part was a copy paste of standard IOMMU code, which is now available through dma-iommu helpers functions.

Still, the issue persist so something isn't initialized correctly at all :


[   89.531108] Unable to handle kernel NULL pointer dereference at virtual address 00000020
[   89.540181] pgd = ebcb0000
[   89.543201] [00000020] *pgd=2bcc8835, *pte=00000000, *ppte=00000000
[   89.550217] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[   89.556244] Modules linked in: rk_vcodec(O) mali_kbase dw_hdmi_i2s_audio
[   89.563735] CPU: 0 PID: 1432 Comm: mpp_dec_parser Tainted: G           O    4.13.0-rc4-RockMyy-XIII #2
[   89.574132] Hardware name: Rockchip (Device Tree)
[   89.579382] task: ecf87080 task.stack: ebcaa000
[   89.584442] PC is at iommu_dma_map_sg+0x2c/0x2bc
[   89.589595] LR is at iommu_get_domain_for_dev+0x18/0x28
[   89.595426] pc : [<c06be174>]    lr : [<c06bb33c>]    psr: 60000013
[   89.602423] sp : ebcabd20  ip : c120df84  fp : eea89210
[   89.608254] r10: ed9c2690  r9 : 00000000  r8 : eea89210
[   89.614086] r7 : ffffffff  r6 : ed9c2680  r5 : ed381000  r4 : ed1df800
[   89.621374] r3 : 00000000  r2 : 00000001  r1 : 00000000  r0 : 00000000
[   89.628664] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   89.636633] Control: 10c5387d  Table: 2bcb006a  DAC: 00000051
[   89.643048] Process mpp_dec_parser (pid: 1432, stack limit = 0xebcaa218)
[   89.650532] Stack: (0xebcabd20 to 0xebcac000)
[   89.655395] bd20: 000000cc ed381440 ed381580 00000022 00000003 ed120328 ed381700 ed381440
[   89.664531] bd40: ed381000 ed9c2680 00000000 ed120328 ed381700 ed9c2690 eea89210 bf0a9f88
[   89.673658] bd60: bf0acde8 00000022 ed1de694 c120df84 bf0acde8 ed1de000 ecef1118 ee9f2780
[   89.682784] bd80: bf0ab927 00000051 00000000 bf0ae7c0 bf0ab928 bf0a5fa0 00000015 00000000
[   89.691919] bda0: 00000000 00000000 00000194 00000000 ed145818 ed145818 00000015 00000000
[   89.701054] bdc0: bf0ae464 00000000 0010fff0 ed1de018 ed1de020 ed1de02c c12e1cc8 00000000
[   89.710189] bde0: 01e423e0 00000002 00000010 00000014 c0f420ad bf0ab927 c12e1540 0000000a
[   89.719324] be00: c12e1540 c11a824d c11a8220 c01f85f4 20000013 ed2c7c00 ed2c7c34 ed2c7c00
[   89.728459] be20: af400000 c0c288f0 c0f420ad c0f343b4 2ddf7000 0000000c c12e1540 c11a8296
[   89.737595] be40: c11a8288 c01f7914 efea1dc0 00000707 af400000 c0c288f0 7546ee37 c02046f0
[   89.746731] be60: ebc04f78 eda30740 ee356c9c ebc04f78 ee356ca8 ecda93dc ecda93c8 c0206b90
[   89.755858] be80: 00000000 ebc04f78 ebc04f78 00000707 140440fb c0207e98 ebc04f78 140440fb
[   89.764985] bea0: ed955600 b1359b64 ee9f2780 ed145818 bf0ae7c0 ecef1118 00000051 00000000
[   89.774112] bec0: 00000000 bf0a8074 c12fc5d8 00000000 00000000 ecda93c8 ecda93dc 01e423e0
[   89.783239] bee0: 00000194 af26b000 000000fb ed955600 00195000 edbd6be8 b1359b64 ecc05e00
[   89.792374] bf00: b1359b64 40046c03 00000011 00000000 00000000 c02345d4 00002000 c0234e34
[   89.801510] bf20: ed2c7c44 00000003 00000001 00195000 00000000 ed955600 00000000 c01f6fe0
[   89.810640] bf40: 00000001 00000000 000111d3 ebcabf5c ebcabf60 00000001 00000001 00000000
[   89.819780] bf60: ecc05e00 00000000 ecc05e00 ecc05e01 b1359b64 40046c03 00000011 00000000
[   89.828916] bf80: 00000000 c0234f8c b1359b64 b6960000 be9a70f8 00000000 00000036 c0107064
[   89.838053] bfa0: ebcaa000 c0106ea0 b6960000 be9a70f8 00000011 40046c03 b1359b64 b1359b64
[   89.847179] bfc0: b6960000 be9a70f8 00000000 00000036 be9a70f8 b594f000 00000000 00000000
[   89.856306] bfe0: b696040c b1359b3c b691c485 b63feda6 00000030 00000011 2fffd861 2fffdc61
[   89.865453] [<c06be174>] (iommu_dma_map_sg) from [<bf0a9f88>] (vcodec_drm_import+0x238/0x40c [rk_vcodec])
[   89.876152] [<bf0a9f88>] (vcodec_drm_import [rk_vcodec]) from [<bf0a5fa0>] (reg_init+0x490/0xa2c [rk_vcodec])
[   89.887236] [<bf0a5fa0>] (reg_init [rk_vcodec]) from [<bf0a8074>] (vpu_service_ioctl+0x408/0x720 [rk_vcodec])
[   89.898320] [<bf0a8074>] (vpu_service_ioctl [rk_vcodec]) from [<c02345d4>] (vfs_ioctl+0x20/0x34)
[   89.908137] [<c02345d4>] (vfs_ioctl) from [<c0234e34>] (do_vfs_ioctl+0x72c/0x838)
[   89.916497] [<c0234e34>] (do_vfs_ioctl) from [<c0234f8c>] (SyS_ioctl+0x4c/0x74)
[   89.924665] [<c0234f8c>] (SyS_ioctl) from [<c0106ea0>] (ret_fast_syscall+0x0/0x3c)
[   89.933122] Code: e598315c e3530000 03e07000 e1a09000 (e590a020) 
[   89.940082] ---[ end trace 84f520c09fb204e0 ]---

Looks like the code crashed after the first call to iommu_get_domain_for_dev(dev) ... This requires a bit more attention.

@Miouyouyou
Copy link
Owner Author

Well here's your problem : [ 33.802658] rk-vcodec ff9a0000.vpu-service: No IOMMU DOMAIN !!?

The IOMMU domain isn't initialized at all... It seems that IOMMU groups are mandatory too...

@Miouyouyou
Copy link
Owner Author

So, turns out that various IOMMU API fail with Rockchip systems. The last I tested was a hacked version of iommu_dma_map_sg, which I named myy_iommu_dma_map_sg.
It's basically the same function, except that it takes the domain as an argument, since I can't use iommu_get_domain_for_dev(dev) on Rockchip systems...

I have no clear idea why. It seems that the IOMMU group never gets its domain initialized on such systems, for reasons I haven't looked up.

Anyway, iommu_dma_map_sg crashes too ! ... Isn't that nice !

I'll paste the crash dmesg in a few minutes.

@Miouyouyou
Copy link
Owner Author

[ 3829.842716] rk-vcodec ff9c0000.hevc-service: probe device
[ 3829.848861] rk-vcodec ff9c0000.hevc-service: ( Myy ) Used the DTB IO moomoomoos
[ 3829.857173] rk-vcodec ff9c0000.hevc-service: vpu mmu dec eea87210
[ 3829.864017] rk-vcodec ff9c0000.hevc-service: Hello I'm Dev
[ 3829.870156] rk_iommu ff9c0440.iommu: Hello I'm his brother, MMU Dev
[ 3829.877166] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_create]
[ 3829.884860] rk-vcodec ff9c0000.hevc-service: iommu_dma_init_domain0
[ 3829.892439] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_create]
[ 3829.899684] rk-vcodec ff9c0000.hevc-service: allocator is drm
[ 3829.906117] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_attach]
[ 3829.913224] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_attach_unlock]
[ 3829.921044] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_attach_unlock]
[ 3829.928835] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_attach]
[ 3829.935941] rk-vcodec ff9c0000.hevc-service: checking hw id 6867
[ 3829.943777] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_detach]
[ 3829.950994] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_detach]
[ 3829.958290] rk-vcodec ff9c0000.hevc-service: init success
[ 3829.964545] rk-vcodec ff9a0000.vpu-service: probe device
[ 3829.970513] rk-vcodec ff9a0000.vpu-service: ( Myy ) Used the DTB IO moomoomoos
[ 3829.978594] rk-vcodec ff9a0000.vpu-service: vpu mmu dec eea89810
[ 3829.985341] rk-vcodec ff9a0000.vpu-service: Hello I'm Dev
[ 3829.991381] rk_iommu ff9a0800.iommu: Hello I'm his brother, MMU Dev
[ 3829.998390] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_create]
[ 3830.005975] rk-vcodec ff9a0000.vpu-service: iommu_dma_init_domain0
[ 3830.013386] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_create]
[ 3830.020402] rk-vcodec ff9a0000.vpu-service: allocator is drm
[ 3830.026732] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach]
[ 3830.033742] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach_unlock]
[ 3830.041458] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach_unlock]
[ 3830.049149] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach]
[ 3830.056164] rk-vcodec ff9a0000.vpu-service: checking hw id 4831
[ 3830.063050] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_detach]
[ 3830.070087] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_detach]
[ 3830.077129] rk-vcodec ff9a0000.vpu-service: init success
[ 3833.258702] rk-vcodec ff9a0000.vpu-service: dev opened
[ 3833.357192] rk-vcodec ff9a0000.vpu-service: ( Myy ) reg->reg[tbl[0]] → 21 (15)
[ 3833.365518] ( Myy ) kzalloc(76, GFP_KERNEL) → ecc52300                                                                                               
[ 3833.371632] ( Myy ) Still alive ♪
[ 3833.375615] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[ 3833.382696] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(64, GFP_KERNEL) → edba1d00
[ 3833.392537] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(12, GFP_KERNEL) → edba1d80
[ 3833.401592] Unable to handle kernel NULL pointer dereference at virtual address 00000010
[ 3833.410726] pgd = ecc08000
[ 3833.413812] [00000010] *pgd=2cce2835, *pte=00000000, *ppte=00000000
[ 3833.420904] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[ 3833.426932] Modules linked in: rk_vcodec(O) mali_kbase dw_hdmi_i2s_audio
[ 3833.434423] CPU: 3 PID: 2051 Comm: mpp_dec_parser Tainted: G           O    4.13.0-rc4-RockMyy-XIII #6
[ 3833.444819] Hardware name: Rockchip (Device Tree)
[ 3833.450068] task: ecf1ddc0 task.stack: ecc0c000
[ 3833.455127] PC is at kmem_cache_alloc+0x130/0x210
[ 3833.460379] LR is at alloc_iova+0x1c/0x184
[ 3833.464949] pc : [<c021becc>]    lr : [<c06bef14>]    psr: 60000013
[ 3833.471945] sp : ecc0dc80  ip : ed0e2ecc  fp : 00000001
[ 3833.477777] r10: ed2a6800  r9 : 000fffff  r8 : 000fffff
[ 3833.483609] r7 : c06bef14  r6 : 01080020  r5 : 00000000  r4 : 00000000
[ 3833.490897] r3 : c176bc64  r2 : 000fffff  r1 : 01080020  r0 : c12e88e8
[ 3833.498187] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[ 3833.506156] Control: 10c5387d  Table: 2cc0806a  DAC: 00000051
[ 3833.512571] Process mpp_dec_parser (pid: 2051, stack limit = 0xecc0c218)
[ 3833.520054] Stack: (0xecc0dc80 to 0xecc0e000)
[ 3833.524917] dc80: 00000000 01080020 00000009 00000000 ed2a6804 00000200 000fffff 000fffff
[ 3833.534044] dca0: ed2a6800 c06bef14 c060eec4 014000c0 ecc0c000 ecc0dcd8 0001e79b 00000009
[ 3833.543171] dcc0: 00000000 c120957c ed2a6804 00000200 000fffff ed2a6800 00000013 c06bf958
[ 3833.552306] dce0: ffffffff 0000000c 00000000 00200000 ffffffff eea89210 ed0e2ecc ed2a6800
[ 3833.561441] dd00: 00000013 c06be078 ed1bfc00 c06be25c 000000cc edba1d00 edba1d80 00000013
[ 3833.570576] dd20: 00000000 eea89210 edba12c0 edba1d00 edba1780 ecc52300 00000000 eea89210
[ 3833.579711] dd40: edba12c0 ecc52310 ed0e22a8 bf0a99d8 00000003 ecc0dd74 00000000 ed0e2280
[ 3833.588846] dd60: ecd98e00 00000013 ed1bed68 c120df84 bf0acd74 ecd11800 ecc68e18 ed188300
[ 3833.597982] dd80: bf0ab90f 00000051 00000000 bf0ae7c0 bf0ab910 bf0a5e2c 00000015 00000000
[ 3833.607108] dda0: 00000000 00000000 00000194 00000000 ed12ca18 ed12ca18 00000015 00000000
[ 3833.616245] ddc0: bf0ae464 00000000 0010fff0 ecd11818 ecd11820 ecd1182c 2de2a000 00000003
[ 3833.625380] dde0: 0329a3e0 00000002 00076c16 00000014 76c1659f bf0ab90f 00000103 ecc0de70
[ 3833.634507] de00: 76c1659f c020429c 00000000 eac095e8 00000001 ecc0de70 0000005d eb57886c
[ 3833.643634] de20: eac095e8 c01d98a4 000e94f7 00000000 0000005d 00000080 c12e1540 eac09560
[ 3833.652769] de40: c11a8288 0000004e eb8af948 b697f000 0000005d ecf1ddc0 edb7e644 c0c28910
[ 3833.661905] de60: 76c1659f c0204f28 ee37f33c ed07c478 eb8af948 00000054 014200ca 0000005d
[ 3833.671031] de80: b697f000 ecc0ada0 ecc0ada0 00000000 00000000 00000000 00000000 00000000
[ 3833.680166] dea0: ed961fb0 b1422b64 ed188300 ed12ca18 bf0ae7c0 ecc68e18 00000051 00000000
[ 3833.689301] dec0: 00000000 bf0a7fa4 c12fc5d8 00000000 00000000 eda42420 00000000 0329a3e0
[ 3833.698436] dee0: 00000194 af36b000 000000fb 00000007 c1210294 ecc33d58 b1422b64 ed160c00
[ 3833.707572] df00: b1422b64 40046c03 00000011 00000000 00000000 c02345d4 00002000 c0234e34
[ 3833.716709] df20: edb7e644 00000003 00000001 00195000 00000000 ed160700 00000000 c01f6fe0
[ 3833.725835] df40: 00000001 00000000 000111d3 ecc0df5c ecc0df60 00000001 00000001 00000000
[ 3833.734970] df60: ed160c00 00000000 ed160c00 ed160c01 b1422b64 40046c03 00000011 00000000
[ 3833.744104] df80: 00000000 c0234f8c b1422b64 b69f2000 beeed0f8 00000000 00000036 c0107064
[ 3833.753239] dfa0: ecc0c000 c0106ea0 b69f2000 beeed0f8 00000011 40046c03 b1422b64 b1422b64
[ 3833.762375] dfc0: b69f2000 beeed0f8 00000000 00000036 beeed0f8 b59e1000 00000000 00000000
[ 3833.771502] dfe0: b69f240c b1422b3c b69ae485 b6490da6 00000030 00000011 00000000 00000000
[ 3833.780642] [<c021becc>] (kmem_cache_alloc) from [<c06bef14>] (alloc_iova+0x1c/0x184)
[ 3833.789393] [<c06bef14>] (alloc_iova) from [<c06bf958>] (alloc_iova_fast+0x170/0x1c4)
[ 3833.798142] [<c06bf958>] (alloc_iova_fast) from [<c06be078>] (iommu_dma_alloc_iova+0x80/0x88)
[ 3833.807668] [<c06be078>] (iommu_dma_alloc_iova) from [<c06be25c>] (myy_iommu_dma_map_sg+0x114/0x2b4)
[ 3833.817878] [<c06be25c>] (myy_iommu_dma_map_sg) from [<bf0a99d8>] (vcodec_drm_import+0x270/0x470 [rk_vcodec])
[ 3833.828965] [<bf0a99d8>] (vcodec_drm_import [rk_vcodec]) from [<bf0a5e2c>] (reg_init+0x490/0xa2c [rk_vcodec])
[ 3833.840041] [<bf0a5e2c>] (reg_init [rk_vcodec]) from [<bf0a7fa4>] (vpu_service_ioctl+0x408/0x720 [rk_vcodec])
[ 3833.851124] [<bf0a7fa4>] (vpu_service_ioctl [rk_vcodec]) from [<c02345d4>] (vfs_ioctl+0x20/0x34)
[ 3833.860942] [<c02345d4>] (vfs_ioctl) from [<c0234e34>] (do_vfs_ioctl+0x72c/0x838)
[ 3833.869302] [<c0234e34>] (do_vfs_ioctl) from [<c0234f8c>] (SyS_ioctl+0x4c/0x74)
[ 3833.877469] [<c0234f8c>] (SyS_ioctl) from [<c0106ea0>] (ret_fast_syscall+0x0/0x3c)
[ 3833.885927] Code: 0a000001 e1a00005 eb27d755 e59f00d4 (e5948010) 
[ 3833.892806] ---[ end trace fb8dc0adea09a394 ]---

@Miouyouyou
Copy link
Owner Author

With a little more messages :

[   60.504121] rk-vcodec ff9c0000.hevc-service: → [vcodec_probe]
[   60.510905] rk-vcodec ff9c0000.hevc-service: → [vcodec_read_property]
[   60.518475] rk-vcodec ff9c0000.hevc-service: ← [vcodec_read_property]
[   60.525880] rk-vcodec ff9c0000.hevc-service: → [vcodec_init_drvdata]
[   60.533182] rk-vcodec ff9c0000.hevc-service: ← [vcodec_init_drvdata]
[   60.540482] rk-vcodec ff9c0000.hevc-service: → [vpu_get_clk]
[   60.547039] rk-vcodec ff9c0000.hevc-service: ← [vpu_get_clk]
[   60.553622] rk-vcodec ff9c0000.hevc-service: → [vcodec_subdev_probe]
[   60.560925] rk-vcodec ff9c0000.hevc-service: probe device
[   60.566985] rk-vcodec ff9c0000.hevc-service: ( Myy ) Used the DTB IO moomoomoos
[   60.575160] rk-vcodec ff9c0000.hevc-service: vpu mmu dec eea87210
[   60.581976] rk-vcodec ff9c0000.hevc-service: → [vpu_service_power_on]
[   60.589375] rk-vcodec ff9c0000.hevc-service: → [vpu_queue_power_off_work]
[   60.597161] rk-vcodec ff9c0000.hevc-service: ← [vpu_queue_power_off_work]
[   60.604965] rk-vcodec ff9c0000.hevc-service: ← [vpu_service_power_on]
[   60.612362] rk-vcodec ff9c0000.hevc-service: Hello I'm Dev
[   60.618497] rk_iommu ff9c0440.iommu: Hello I'm his brother, MMU Dev
[   60.625506] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_create]
[   60.633208] rk-vcodec ff9c0000.hevc-service: iommu_dma_init_domain0
[   60.640797] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_create]
[   60.648037] rk-vcodec ff9c0000.hevc-service: allocator is drm
[   60.654471] rk-vcodec ff9c0000.hevc-service: → [vcodec_enter_mode]
[   60.661578] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_attach]
[   60.668689] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_attach_unlock]
[   60.676503] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_attach_unlock]
[   60.684297] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_attach]
[   60.691404] rk-vcodec ff9c0000.hevc-service: → [vpu_service_check_hw]
[   60.698802] rk-vcodec ff9c0000.hevc-service: checking hw id 6867
[   60.705519] rk-vcodec ff9c0000.hevc-service: ← [vpu_service_check_hw]
[   60.712907] rk-vcodec ff9c0000.hevc-service: → [vcodec_exit_mode]
[   60.719931] rk-vcodec ff9c0000.hevc-service: ← [vcodec_exit_mode]
[   60.727039] rk-vcodec ff9c0000.hevc-service: → [get_hw_info]
[   60.733570] rk-vcodec ff9c0000.hevc-service: ← [get_hw_info]
[   60.741106] rk-vcodec ff9c0000.hevc-service: → [vpu_service_power_off]
[   60.748703] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_detach]
[   60.755986] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_detach]
[   60.763125] rk-vcodec ff9c0000.hevc-service: ← [vpu_service_power_off]
[   60.770623] rk-vcodec ff9c0000.hevc-service: ← [vcodec_subdev_probe]
[   60.777924] rk-vcodec ff9c0000.hevc-service: init success
[   60.783961] rk-vcodec ff9c0000.hevc-service: ← [vcodec_probe]
[   60.790704] rk-vcodec ff9a0000.vpu-service: → [vcodec_probe]
[   60.797296] rk-vcodec ff9a0000.vpu-service: → [vcodec_read_property]
[   60.804623] rk-vcodec ff9a0000.vpu-service: ← [vcodec_read_property]
[   60.811926] rk-vcodec ff9a0000.vpu-service: → [vcodec_init_drvdata]
[   60.819134] rk-vcodec ff9a0000.vpu-service: ← [vcodec_init_drvdata]
[   60.826337] rk-vcodec ff9a0000.vpu-service: → [vpu_get_clk]
[   60.832777] rk-vcodec ff9a0000.vpu-service: ← [vpu_get_clk]
[   60.839216] rk-vcodec ff9a0000.vpu-service: → [vcodec_subdev_probe]
[   60.846418] rk-vcodec ff9a0000.vpu-service: probe device
[   60.852381] rk-vcodec ff9a0000.vpu-service: ( Myy ) Used the DTB IO moomoomoos
[   60.860459] rk-vcodec ff9a0000.vpu-service: vpu mmu dec eea89810
[   60.867175] rk-vcodec ff9a0000.vpu-service: → [vpu_service_power_on]
[   60.874476] rk-vcodec ff9a0000.vpu-service: → [vpu_queue_power_off_work]
[   60.882164] rk-vcodec ff9a0000.vpu-service: ← [vpu_queue_power_off_work]
[   60.889859] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_power_on]
[   60.897160] rk-vcodec ff9a0000.vpu-service: Hello I'm Dev
[   60.903196] rk_iommu ff9a0800.iommu: Hello I'm his brother, MMU Dev
[   60.910222] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_create]
[   60.917835] rk-vcodec ff9a0000.vpu-service: iommu_dma_init_domain0
[   60.925303] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_create]
[   60.932453] rk-vcodec ff9a0000.vpu-service: allocator is drm
[   60.938788] rk-vcodec ff9a0000.vpu-service: → [vcodec_enter_mode]
[   60.945799] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach]
[   60.952807] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach_unlock]
[   60.960514] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach_unlock]
[   60.968212] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach]
[   60.975222] rk-vcodec ff9a0000.vpu-service: → [vpu_service_check_hw]
[   60.982522] rk-vcodec ff9a0000.vpu-service: checking hw id 4831
[   60.989141] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_check_hw]
[   60.996441] rk-vcodec ff9a0000.vpu-service: → [vcodec_exit_mode]
[   61.003351] rk-vcodec ff9a0000.vpu-service: ← [vcodec_exit_mode]
[   61.010418] rk-vcodec ff9a0000.vpu-service: → [get_hw_info]
[   61.016845] rk-vcodec ff9a0000.vpu-service: ← [get_hw_info]
[   61.024307] rk-vcodec ff9a0000.vpu-service: → [vpu_service_power_off]
[   61.031817] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_detach]
[   61.038999] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_detach]
[   61.046045] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_power_off]
[   61.053445] rk-vcodec ff9a0000.vpu-service: ← [vcodec_subdev_probe]
[   61.060648] rk-vcodec ff9a0000.vpu-service: init success
[   61.066588] rk-vcodec ff9a0000.vpu-service: ← [vcodec_probe]
[   64.622281] rk-vcodec ff9c0000.hevc-service: → [vpu_power_off_work]
[   64.629487] rk-vcodec ff9c0000.hevc-service: → [vpu_service_power_off]
[   64.636985] rk-vcodec ff9c0000.hevc-service: ← [vpu_power_off_work]
[   64.942318] rk-vcodec ff9a0000.vpu-service: → [vpu_power_off_work]
[   64.949423] rk-vcodec ff9a0000.vpu-service: → [vpu_service_power_off]
[   64.956821] rk-vcodec ff9a0000.vpu-service: ← [vpu_power_off_work]
[   67.330161] rk-vcodec ff9a0000.vpu-service: → [vpu_service_open]
[   67.337102] rk-vcodec ff9a0000.vpu-service: dev opened
[   67.342847] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_open]
[   67.349780] rk-vcodec ff9a0000.vpu-service: → [vpu_service_ioctl]
[   67.356802] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_ioctl]
[   67.457794] rk-vcodec ff9a0000.vpu-service: → [vpu_service_ioctl]
[   67.464841] rk-vcodec ff9a0000.vpu-service: → [reg_init]
[   67.471188] rk-vcodec ff9a0000.vpu-service: → [vcodec_reg_address_translate]
[   67.479291] rk-vcodec ff9a0000.vpu-service: → [vcodec_bufid_to_iova]
[   67.486654] ( Myy ) kzalloc(76, GFP_KERNEL) → ed3ff180
[   67.492657] ( Myy ) Still alive ♪
[   67.496606] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   67.503681] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(64, GFP_KERNEL) → ed0ef180
[   67.513459] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(12, GFP_KERNEL) → ed0ef880
[   67.522595] Unable to handle kernel NULL pointer dereference at virtual address 00000010
[   67.531658] pgd = ebc8c000
[   67.534726] [00000010] *pgd=2d166835, *pte=00000000, *ppte=00000000
[   67.541744] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[   67.547771] Modules linked in: rk_vcodec(O) dw_hdmi_i2s_audio mali_kbase
[   67.555263] CPU: 0 PID: 1513 Comm: mpp_dec_parser Tainted: G           O    4.13.0-rc4-RockMyy-XIII #6
[   67.565659] Hardware name: Rockchip (Device Tree)
[   67.570909] task: ed9f8000 task.stack: ebc7e000
[   67.575967] PC is at kmem_cache_alloc+0x130/0x210
[   67.581220] LR is at alloc_iova+0x1c/0x184
[   67.585789] pc : [<c021becc>]    lr : [<c06bef14>]    psr: 60000013
[   67.592787] sp : ebc7fc88  ip : ed96aecc  fp : 00000001
[   67.598619] r10: ebc91000  r9 : 000fffff  r8 : 000fffff
[   67.604450] r7 : c06bef14  r6 : 01080020  r5 : 00000000  r4 : 00000000
[   67.611739] r3 : c176bc64  r2 : 000fffff  r1 : 01080020  r0 : c12e88e8
[   67.619029] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   67.626998] Control: 10c5387d  Table: 2bc8c06a  DAC: 00000051
[   67.633413] Process mpp_dec_parser (pid: 1513, stack limit = 0xebc7e218)
[   67.640895] Stack: (0xebc7fc88 to 0xebc80000)
[   67.645757] fc80:                   00000000 01080020 00000009 00000000 ebc91004 00000200
[   67.654892] fca0: 000fffff 000fffff ebc91000 c06bef14 c060eec4 014000c0 ebc7e000 ebc7fce0
[   67.664027] fcc0: 000040a8 00000009 00000000 c120957c ebc91004 00000200 000fffff ebc91000
[   67.673162] fce0: 0000000e c06bf958 ffffffff 0000000c 00000000 00200000 ffffffff eea89210
[   67.682297] fd00: ed96aecc ebc91000 0000000e c06be078 ed191000 c06be25c 000000cc ed0ef180
[   67.691433] fd20: ed0ef880 0000000e 00000000 eea89210 ed0ef7c0 ed0ef180 ed0ef8c0 ed3ff180
[   67.700560] fd40: 00000000 eea89210 ed0ef7c0 ed3ff190 ed990a28 bf0aa3e0 00000003 ebc7fd7c
[   67.709686] fd60: 00000000 ed990a00 ed197380 0000000e ed191504 c120df84 bf0acfb6 ed0db800
[   67.718821] fd80: ed04d818 ecf2b480 bf0abbb3 00000000 00000002 bf0ae7c0 00000194 bf0a6094
[   67.727957] fda0: eea89210 00000006 bf0abbb4 ed24cc18 0000006d 00000015 bf0ae464 00000000
[   67.737084] fdc0: c0f5bf50 ed0db818 ed0db820 ed0db82c 00000000 45545359 6c703d4d 0164b3e0
[   67.746211] fde0: ed24cc18 00000002 702b3d45 00000014 3a6d726f bf0abbb3 30303030 7570762e
[   67.755338] fe00: 7265732d 65636976 c11a8200 c01f85f4 20000013 ee9fec00 ee9fec34 ee9fec00
[   67.764473] fe20: af400000 c0c28910 c0f420cd c0f343d4 2ddf7000 00000010 c12e1540 c11a8296
[   67.773610] fe40: c11a8288 c01f7914 efea3280 00000707 af400000 eea89210 00000006 ebc7feb0
[   67.782745] fe60: ed04d818 bf0ae7c0 40046c03 00000000 00000000 c0707338 00000006 ebc7fe8c
[   67.791881] fe80: c0f5bf50 c0707394 c0f5bf50 bf0aceee eea30f40 ebc7feb0 ecf2b480 ed24cc18
[   67.801016] fea0: b13ebb64 ecf2b480 ed24cc18 b13ebb64 ed04d818 bf0ae7c0 00000051 00000000
[   67.810152] fec0: 00000000 bf0a6e6c c12fc5d8 00000000 00000000 ecd138f0 ecd13904 0164b3e0
[   67.819288] fee0: 00000194 af26b000 000000fb eccf4c00 00195000 ed314238 b13ebb64 eccf4600
[   67.828415] ff00: b13ebb64 40046c03 00000011 00000000 00000000 c02345d4 00002000 c0234e34
[   67.837542] ff20: ee9fec44 00000003 00000001 00195000 00000000 eccf4c00 00000000 c01f6fe0
[   67.846677] ff40: 00000001 00000000 000111d3 ebc7ff5c ebc7ff60 00000001 00000001 00000000
[   67.855812] ff60: eccf4600 00000000 eccf4600 eccf4601 b13ebb64 40046c03 00000011 00000000
[   67.864948] ff80: 00000000 c0234f8c b13ebb64 b69ab000 be90a0f8 00000000 00000036 c0107064
[   67.874084] ffa0: ebc7e000 c0106ea0 b69ab000 be90a0f8 00000011 40046c03 b13ebb64 b13ebb64
[   67.883211] ffc0: b69ab000 be90a0f8 00000000 00000036 be90a0f8 b599a000 00000000 00000000
[   67.892338] ffe0: b69ab40c b13ebb3c b6967485 b6449da6 00000030 00000011 7ce941ae 8418445f
[   67.901479] [<c021becc>] (kmem_cache_alloc) from [<c06bef14>] (alloc_iova+0x1c/0x184)
[   67.910229] [<c06bef14>] (alloc_iova) from [<c06bf958>] (alloc_iova_fast+0x170/0x1c4)
[   67.918978] [<c06bf958>] (alloc_iova_fast) from [<c06be078>] (iommu_dma_alloc_iova+0x80/0x88)
[   67.928504] [<c06be078>] (iommu_dma_alloc_iova) from [<c06be25c>] (myy_iommu_dma_map_sg+0x114/0x2b4)
[   67.938714] [<c06be25c>] (myy_iommu_dma_map_sg) from [<bf0aa3e0>] (vcodec_drm_import+0x270/0x470 [rk_vcodec])
[   67.949800] [<bf0aa3e0>] (vcodec_drm_import [rk_vcodec]) from [<bf0a6094>] (reg_init+0x4d0/0xb84 [rk_vcodec])
[   67.960884] [<bf0a6094>] (reg_init [rk_vcodec]) from [<bf0a6e6c>] (vpu_service_ioctl+0x44c/0x7bc [rk_vcodec])
[   67.971968] [<bf0a6e6c>] (vpu_service_ioctl [rk_vcodec]) from [<c02345d4>] (vfs_ioctl+0x20/0x34)
[   67.981785] [<c02345d4>] (vfs_ioctl) from [<c0234e34>] (do_vfs_ioctl+0x72c/0x838)
[   67.990145] [<c0234e34>] (do_vfs_ioctl) from [<c0234f8c>] (SyS_ioctl+0x4c/0x74)
[   67.998312] [<c0234f8c>] (SyS_ioctl) from [<c0106ea0>] (ret_fast_syscall+0x0/0x3c)
[   68.006768] Code: 0a000001 e1a00005 eb27d755 e59f00d4 (e5948010) 
[   68.013686] ---[ end trace 6bb9a642316f6eda ]---

@Miouyouyou
Copy link
Owner Author

With the map_sg calls commented :

[   26.742792] rk-vcodec ff9c0000.hevc-service: → [vcodec_probe]
[   26.749479] rk-vcodec ff9c0000.hevc-service: → [vcodec_read_property]
[   26.757471] rk-vcodec ff9c0000.hevc-service: ← [vcodec_read_property]
[   26.765121] rk-vcodec ff9c0000.hevc-service: → [vcodec_init_drvdata]
[   26.772651] rk-vcodec ff9c0000.hevc-service: ← [vcodec_init_drvdata]
[   26.780196] rk-vcodec ff9c0000.hevc-service: → [vpu_get_clk]
[   26.786761] rk-vcodec ff9c0000.hevc-service: ← [vpu_get_clk]
[   26.793351] rk-vcodec ff9c0000.hevc-service: → [vcodec_subdev_probe]
[   26.800656] rk-vcodec ff9c0000.hevc-service: probe device
[   26.806718] rk-vcodec ff9c0000.hevc-service: ( Myy ) Used the DTB IO moomoomoos
[   26.814895] rk-vcodec ff9c0000.hevc-service: vpu mmu dec eea87210
[   26.821712] rk-vcodec ff9c0000.hevc-service: → [vpu_service_power_on]
[   26.829111] rk-vcodec ff9c0000.hevc-service: → [vpu_queue_power_off_work]
[   26.836899] rk-vcodec ff9c0000.hevc-service: ← [vpu_queue_power_off_work]
[   26.844705] rk-vcodec ff9c0000.hevc-service: ← [vpu_service_power_on]
[   26.852103] rk-vcodec ff9c0000.hevc-service: Hello I'm Dev
[   26.858239] rk_iommu ff9c0440.iommu: Hello I'm his brother, MMU Dev
[   26.865250] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_create]
[   26.872500] rk-vcodec ff9c0000.hevc-service: iommu_dma_init_domain0
[   26.880006] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_create]
[   26.887115] rk-vcodec ff9c0000.hevc-service: allocator is drm
[   26.893546] rk-vcodec ff9c0000.hevc-service: → [vcodec_enter_mode]
[   26.900653] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_attach]
[   26.907760] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_attach_unlock]
[   26.915576] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_attach_unlock]
[   26.923386] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_attach]
[   26.930503] rk-vcodec ff9c0000.hevc-service: → [vpu_service_check_hw]
[   26.937903] rk-vcodec ff9c0000.hevc-service: checking hw id 6867
[   26.944622] rk-vcodec ff9c0000.hevc-service: ← [vpu_service_check_hw]
[   26.952019] rk-vcodec ff9c0000.hevc-service: → [vcodec_exit_mode]
[   26.959031] rk-vcodec ff9c0000.hevc-service: ← [vcodec_exit_mode]
[   26.966133] rk-vcodec ff9c0000.hevc-service: → [get_hw_info]
[   26.972667] rk-vcodec ff9c0000.hevc-service: ← [get_hw_info]
[   26.979376] rk-vcodec ff9c0000.hevc-service: → [vpu_service_power_off]
[   26.986968] rk-vcodec ff9c0000.hevc-service: → [vcodec_drm_detach]
[   26.994099] rk-vcodec ff9c0000.hevc-service: ← [vcodec_drm_detach]
[   27.001238] rk-vcodec ff9c0000.hevc-service: ← [vpu_service_power_off]
[   27.008736] rk-vcodec ff9c0000.hevc-service: ← [vcodec_subdev_probe]
[   27.016040] rk-vcodec ff9c0000.hevc-service: init success
[   27.022079] rk-vcodec ff9c0000.hevc-service: ← [vcodec_probe]
[   27.028811] rk-vcodec ff9a0000.vpu-service: → [vcodec_probe]
[   27.035403] rk-vcodec ff9a0000.vpu-service: → [vcodec_read_property]
[   27.042731] rk-vcodec ff9a0000.vpu-service: ← [vcodec_read_property]
[   27.050057] rk-vcodec ff9a0000.vpu-service: → [vcodec_init_drvdata]
[   27.057271] rk-vcodec ff9a0000.vpu-service: ← [vcodec_init_drvdata]
[   27.064477] rk-vcodec ff9a0000.vpu-service: → [vpu_get_clk]
[   27.070919] rk-vcodec ff9a0000.vpu-service: ← [vpu_get_clk]
[   27.077354] rk-vcodec ff9a0000.vpu-service: → [vcodec_subdev_probe]
[   27.084559] rk-vcodec ff9a0000.vpu-service: probe device
[   27.090522] rk-vcodec ff9a0000.vpu-service: ( Myy ) Used the DTB IO moomoomoos
[   27.098600] rk-vcodec ff9a0000.vpu-service: vpu mmu dec eea89810
[   27.105318] rk-vcodec ff9a0000.vpu-service: → [vpu_service_power_on]
[   27.112621] rk-vcodec ff9a0000.vpu-service: → [vpu_queue_power_off_work]
[   27.120313] rk-vcodec ff9a0000.vpu-service: ← [vpu_queue_power_off_work]
[   27.128016] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_power_on]
[   27.135319] rk-vcodec ff9a0000.vpu-service: Hello I'm Dev
[   27.141408] rk_iommu ff9a0800.iommu: Hello I'm his brother, MMU Dev
[   27.148423] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_create]
[   27.155568] rk-vcodec ff9a0000.vpu-service: iommu_dma_init_domain0
[   27.162977] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_create]
[   27.169990] rk-vcodec ff9a0000.vpu-service: allocator is drm
[   27.176324] rk-vcodec ff9a0000.vpu-service: → [vcodec_enter_mode]
[   27.183353] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach]
[   27.190365] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach_unlock]
[   27.198086] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach_unlock]
[   27.205779] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach]
[   27.212788] rk-vcodec ff9a0000.vpu-service: → [vpu_service_check_hw]
[   27.220090] rk-vcodec ff9a0000.vpu-service: checking hw id 4831
[   27.226710] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_check_hw]
[   27.234003] rk-vcodec ff9a0000.vpu-service: → [vcodec_exit_mode]
[   27.240913] rk-vcodec ff9a0000.vpu-service: ← [vcodec_exit_mode]
[   27.247961] rk-vcodec ff9a0000.vpu-service: → [get_hw_info]
[   27.254398] rk-vcodec ff9a0000.vpu-service: ← [get_hw_info]
[   27.260945] rk-vcodec ff9a0000.vpu-service: → [vpu_service_power_off]
[   27.268365] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_detach]
[   27.275394] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_detach]
[   27.282437] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_power_off]
[   27.289841] rk-vcodec ff9a0000.vpu-service: ← [vcodec_subdev_probe]
[   27.297045] rk-vcodec ff9a0000.vpu-service: init success
[   27.302994] rk-vcodec ff9a0000.vpu-service: ← [vcodec_probe]
[   28.760202] rk-vcodec ff9a0000.vpu-service: → [vpu_service_open]
[   28.767190] rk-vcodec ff9a0000.vpu-service: dev opened
[   28.772978] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_open]
[   28.779933] rk-vcodec ff9a0000.vpu-service: → [vpu_service_ioctl]
[   28.786957] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_ioctl]
[   28.887040] rk-vcodec ff9a0000.vpu-service: → [vpu_service_ioctl]
[   28.894078] rk-vcodec ff9a0000.vpu-service: → [reg_init]
[   28.900784] rk-vcodec ff9a0000.vpu-service: → [vcodec_reg_address_translate]
[   28.909103] rk-vcodec ff9a0000.vpu-service: ← [vcodec_reg_address_translate]
[   28.917422] rk-vcodec ff9a0000.vpu-service: → [vcodec_bufid_to_iova]
[   28.924963] ( Myy ) kzalloc(76, GFP_KERNEL) → ee9ec380
[   28.930971] ( Myy ) Still alive ♪
[   28.934949] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   28.942194] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(56, GFP_KERNEL) → ece59500
[   28.952183] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_import]
[   28.959201] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   28.966505] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   28.974683] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 0) → ece59500
[   28.985584] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   28.992888] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   28.999899] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(56, GFP_KERNEL) → ece59140
[   29.009536] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_import]
[   29.016535] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.023837] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.032013] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.042907] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.050211] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.057221] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.064521] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.072695] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.083591] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.090893] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.097902] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.105204] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.113378] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.124272] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.131572] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.138580] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.145881] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.154055] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.164950] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.172251] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.179264] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.186587] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.194758] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.205654] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.212947] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.219959] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.227261] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.235438] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.246331] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.253635] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.260646] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.267950] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.276126] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.287034] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.294340] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.301404] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.308707] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.316892] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.327786] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.335085] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.342085] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.349387] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.357562] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.368457] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.375757] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.382765] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.390064] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.398238] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.409131] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.416430] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.423428] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.430727] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.438902] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.449797] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.457096] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.464096] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.471386] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.479551] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.490435] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.497735] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.504744] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.512046] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.520212] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.531106] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.538405] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.545404] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.552703] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.560868] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.571752] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.579052] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.586061] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.593364] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.601530] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.612424] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.619723] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.626731] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.634031] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.642196] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.653086] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.660385] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.667393] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.674695] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.682870] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.693761] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.701058] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.708068] rk-vcodec ff9a0000.vpu-service: ( Myy ) kzalloc(56, GFP_KERNEL) → ed3d0740
[   29.717122] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_import]
[   29.724129] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.731429] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.739606] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 2) → ed3d0740
[   29.750500] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.757799] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_import]
[   29.764809] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_map_iommu]
[   29.772111] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   29.780276] rk-vcodec ff9a0000.vpu-service: ( Myy ) vcodec_drm_get_buffer_no_lock(ee9ec380, 1) → ece59140
[   29.791168] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_map_iommu]
[   29.798469] rk-vcodec ff9a0000.vpu-service: ← [vcodec_bufid_to_iova]
[   29.805771] rk-vcodec ff9a0000.vpu-service: → [get_reg_freq]
[   29.812285] → [reg_check_fmt]
[   29.815786] ← [reg_check_fmt]
[   29.819296] → [reg_probe_width]
[   29.823000] ← [reg_probe_width]
[   29.826704] rk-vcodec ff9a0000.vpu-service: ← [get_reg_freq]
[   29.833217] rk-vcodec ff9a0000.vpu-service: ← [reg_init]
[   29.839354] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_ioctl]
[   29.839374] rk-vcodec ff9a0000.vpu-service: → [vpu_set_register_work]
[   29.839376] rk-vcodec ff9a0000.vpu-service: → [try_set_reg]
[   29.839379] rk-vcodec ff9a0000.vpu-service: → [vpu_service_power_on]
[   29.839382] rk-vcodec ff9a0000.vpu-service: → [vpu_queue_power_off_work]
[   29.839385] rk-vcodec ff9a0000.vpu-service: ← [vpu_queue_power_off_work]
[   29.839406] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_power_on]
[   29.839408] rk-vcodec ff9a0000.vpu-service: → [reg_from_wait_to_run]
[   29.839410] rk-vcodec ff9a0000.vpu-service: ← [reg_from_wait_to_run]
[   29.839412] rk-vcodec ff9a0000.vpu-service: → [reg_copy_to_hw]
[   29.839414] rk-vcodec ff9a0000.vpu-service: → [vpu_service_set_freq]
[   29.839458] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_set_freq]
[   29.839461] rk-vcodec ff9a0000.vpu-service: → [vcodec_enter_mode]
[   29.839463] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach]
[   29.839466] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_attach_unlock]
[   29.839488] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach_unlock]
[   29.839490] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_attach]
[   29.839500] → [time_record]
[   29.839501] ← [time_record]
[   29.839503] rk-vcodec ff9a0000.vpu-service: ← [reg_copy_to_hw]
[   29.839506] rk_iommu ff9a0800.iommu: Page fault at 0x75d9cee0 of type read
[   29.839507] rk-vcodec ff9a0000.vpu-service: ← [try_set_reg]
[   29.839511] rk_iommu ff9a0800.iommu: iova = 0x75d9cee0: dte_index: 0x1d7 pte_index: 0x19c page_offset: 0xee0
[   29.839512] rk-vcodec ff9a0000.vpu-service: ← [vpu_set_register_work]
[   29.839516] rk_iommu ff9a0800.iommu: mmu_dte_addr: 0x2d363000 dte@0x2d36375c: 0x000000 valid: 0 pte@0x00000000: 0x000000 valid: 0 page@0x00000000 flags: 0x0                                                                                                                                                 
[   29.840815] rk-vcodec ff9a0000.vpu-service: → [vdpu_irq]
[   29.840817] → [time_record]
[   29.840818] ← [time_record]
[   29.840819] → [check_irq_err]
[   29.840820] → [time_diff]
[   29.840821] ← [time_diff]
[   29.840824] rk-vcodec ff9a0000.vpu-service: ← [vdpu_irq]
[   29.846377] rk-vcodec ff9a0000.vpu-service: → [vdpu_isr]
[   29.846381] rk-vcodec ff9a0000.vpu-service: → [reg_from_run_to_done]
[   29.846383] → [reg_copy_from_hw]
[   29.846409] ← [reg_copy_from_hw]
[   29.846412] rk-vcodec ff9a0000.vpu-service: → [vcodec_exit_mode]
[   29.846414] rk-vcodec ff9a0000.vpu-service: ← [vcodec_exit_mode]
[   29.846418] rk-vcodec ff9a0000.vpu-service: ← [reg_from_run_to_done]
[   29.846422] rk-vcodec ff9a0000.vpu-service: ← [vdpu_isr]
[   29.846542] rk-vcodec ff9a0000.vpu-service: → [vpu_set_register_work]
[   29.846545] rk-vcodec ff9a0000.vpu-service: → [try_set_reg]
[   29.846547] rk-vcodec ff9a0000.vpu-service: ← [try_set_reg]
[   29.846550] rk-vcodec ff9a0000.vpu-service: ← [vpu_set_register_work]
[   30.128314] rk-vcodec ff9a0000.vpu-service: → [vpu_service_ioctl]
[   30.135328] rk-vcodec ff9a0000.vpu-service: → [return_reg]
[   30.141667] rk-vcodec ff9a0000.vpu-service: → [reg_deinit]
[   30.148005] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.155498] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.163673] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.171171] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.177988] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.186161] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.192968] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.200463] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.208638] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.216135] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.222951] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.231122] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.237938] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.245435] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.253610] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.261142] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.267960] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.276136] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.282953] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.290448] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.298622] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.306118] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.312934] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.321110] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.327926] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.335421] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.343595] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.351092] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.357900] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.366071] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.372887] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.380381] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.388547] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.396040] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.402857] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.411032] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.417848] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.425345] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.433510] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.441007] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.447813] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.455988] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.462806] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.470302] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.478477] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.485970] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.492778] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.500954] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.507770] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.515267] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.523432] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.530928] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.537744] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.545919] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.552736] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.560232] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.568399] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.575894] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.582709] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.590882] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.597698] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.605195] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.613361] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.620859] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.627675] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.635850] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.642667] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.650161] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.658336] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.665827] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.672643] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.680814] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.687630] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.695124] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.703290] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.710785] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.717601] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.725777] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.732593] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.740088] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.748263] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.755755] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.762572] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.770747] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.777563] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.785055] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.793231] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.800727] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.807542] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.815718] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.822534] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.830030] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.838205] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.845698] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.852518] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.860691] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.867507] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.875000] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.883175] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.890464] rk-vcodec ff9c0000.hevc-service: → [vpu_power_off_work]
[   30.890467] rk-vcodec ff9c0000.hevc-service: → [vpu_service_power_off]
[   30.890470] rk-vcodec ff9c0000.hevc-service: ← [vpu_power_off_work]
[   30.912556] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.919373] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.927548] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.934366] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.941862] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.950035] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   30.957529] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   30.964344] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.972518] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   30.979333] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   30.986827] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   30.995002] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   31.002498] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   31.009313] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   31.017488] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   31.024304] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_unmap_iommu]
[   31.031798] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   31.039972] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_unmap_iommu]
[   31.047456] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_free]
[   31.054262] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_get_buffer_no_lock]
[   31.062437] rk-vcodec ff9a0000.vpu-service: ← [vcodec_drm_free]
[   31.069251] rk-vcodec ff9a0000.vpu-service: ← [reg_deinit]
[   31.075582] rk-vcodec ff9a0000.vpu-service: ← [return_reg]
[   31.081911] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_ioctl]
[   31.093210] rk-vcodec ff9a0000.vpu-service: → [vpu_service_session_clear]
[   31.101041] rk-vcodec ff9a0000.vpu-service: ← [vpu_service_session_clear]
[   31.108859] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_clear_session]
[   31.116592] rk-vcodec ff9a0000.vpu-service: → [vcodec_drm_clear_map]
[   31.123905] BUG: spinlock bad magic on CPU#0, mpv/1133
[   31.129644]  lock: 0xed329400, .magic: 00000000, .owner: <none>/-1, .owner_cpu: -559067475
[   31.138878] CPU: 0 PID: 1133 Comm: mpv Tainted: G           O    4.13.0-rc4-RockMyy-XIII #6
[   31.148205] Hardware name: Rockchip (Device Tree)
[   31.153466] [<c010f5c8>] (unwind_backtrace) from [<c010b0ec>] (show_stack+0x10/0x14)
[   31.162119] [<c010b0ec>] (show_stack) from [<c0c12cec>] (dump_stack+0x78/0x98)
[   31.170190] [<c0c12cec>] (dump_stack) from [<c015ce24>] (do_raw_spin_lock+0x20/0xdc)
[   31.178841] [<c015ce24>] (do_raw_spin_lock) from [<c0c288bc>] (_raw_spin_lock_irqsave+0x20/0x28)
[   31.188659] [<c0c288bc>] (_raw_spin_lock_irqsave) from [<c06bf224>] (find_iova+0x10/0x38)
[   31.197801] [<c06bf224>] (find_iova) from [<bf0a9e6c>] (vcodec_drm_clear_map+0x90/0x158 [rk_vcodec])
[   31.208012] [<bf0a9e6c>] (vcodec_drm_clear_map [rk_vcodec]) from [<bf0aaae8>] (vcodec_drm_clear_session+0x5c/0x94 [rk_vcodec])
[   31.220748] [<bf0aaae8>] (vcodec_drm_clear_session [rk_vcodec]) from [<bf0a9bb4>] (vcodec_iommu_clear+0x34/0x64 [rk_vcodec])
[   31.233289] [<bf0a9bb4>] (vcodec_iommu_clear [rk_vcodec]) from [<bf0a57f0>] (vpu_service_release+0xb0/0x118 [rk_vcodec])
[   31.245440] [<bf0a57f0>] (vpu_service_release [rk_vcodec]) from [<c0224dfc>] (__fput+0xd8/0x1b4)
[   31.255258] [<c0224dfc>] (__fput) from [<c0139ccc>] (task_work_run+0xbc/0xcc)
[   31.263229] [<c0139ccc>] (task_work_run) from [<c010a8a8>] (do_work_pending+0x9c/0xb0)
[   31.272074] [<c010a8a8>] (do_work_pending) from [<c0106ef4>] (slow_work_pending+0xc/0x20)
[   31.281211] Unable to handle kernel NULL pointer dereference at virtual address 0000000f
[   31.290249] pgd = ebc68000
[   31.293263] [0000000f] *pgd=2d27a835, *pte=00000000, *ppte=00000000
[   31.300267] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
[   31.306293] Modules linked in: rk_vcodec(O) mali_kbase dw_hdmi_i2s_audio
[   31.313782] CPU: 0 PID: 1133 Comm: mpv Tainted: G           O    4.13.0-rc4-RockMyy-XIII #6
[   31.323109] Hardware name: Rockchip (Device Tree)
[   31.328358] task: edbb76c0 task.stack: ed3c8000
[   31.333414] PC is at private_find_iova+0x18/0x54
[   31.338566] LR is at find_iova+0x20/0x38
[   31.342941] pc : [<c06bf1d8>]    lr : [<c06bf234>]    psr: a00e0093
[   31.349939] sp : ed3c9ed8  ip : 7f0de51c  fp : ed141d08
[   31.355770] r10: 00000000  r9 : ee94cda8  r8 : ed329400
[   31.361602] r7 : ee94cd80  r6 : a00e0013  r5 : 00000000  r4 : ed329400
[   31.368890] r3 : ffffffff  r2 : 00010000  r1 : 00000000  r0 : 00000000
[   31.376180] Flags: NzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   31.384246] Control: 10c5387d  Table: 2bc6806a  DAC: 00000051
[   31.390660] Process mpv (pid: 1133, stack limit = 0xed3c8218)
[   31.397075] Stack: (0xed3c9ed8 to 0xed3ca000)
[   31.401936] 9ec0:                                                       ece59528 ffffffff
[   31.411071] 9ee0: ee9ec390 bf0a9e6c ece59528 eeb39f4c 00000000 ece59500 ee9ec380 ee9ec390
[   31.420206] 9f00: ece59140 ed2ee258 ed141d00 ed33d978 ed141d08 bf0aaae8 bf0aaa8c ee9ec380
[   31.429342] 9f20: ee94cd88 ed2ee218 ecc03b18 bf0a9bb4 00000000 ed9fd300 bf0ae7c0 bf0a57f0
[   31.438469] 9f40: bf0a5740 ed141d00 ed33d978 00000000 00000008 ec016720 ee931410 c0224dfc
[   31.447596] 9f60: 00000000 00000000 00000001 edbb76c0 00000000 c12fcfc0 00000006 c0107064
[   31.456731] 9f80: ed3c8000 00000000 00c508f0 c0139ccc c0107064 ed3c8000 ed3c9fb0 c010a8a8
[   31.465867] 9fa0: b69ba000 02337298 02308a14 c0106ef4 00000000 00000002 b59a9084 00000000
[   31.474993] 9fc0: b69ba000 02337298 02308a14 00000006 02308754 00000001 00000000 00c508f0
[   31.484120] 9fe0: 00000000 be87c470 00000000 b64c3612 000e0030 00000011 00000000 00000000
[   31.493257] [<c06bf1d8>] (private_find_iova) from [<c06bf234>] (find_iova+0x20/0x38)
[   31.501912] [<c06bf234>] (find_iova) from [<bf0a9e6c>] (vcodec_drm_clear_map+0x90/0x158 [rk_vcodec])
[   31.512122] [<bf0a9e6c>] (vcodec_drm_clear_map [rk_vcodec]) from [<bf0aaae8>] (vcodec_drm_clear_session+0x5c/0x94 [rk_vcodec])
[   31.524857] [<bf0aaae8>] (vcodec_drm_clear_session [rk_vcodec]) from [<bf0a9bb4>] (vcodec_iommu_clear+0x34/0x64 [rk_vcodec])
[   31.537397] [<bf0a9bb4>] (vcodec_iommu_clear [rk_vcodec]) from [<bf0a57f0>] (vpu_service_release+0xb0/0x118 [rk_vcodec])
[   31.549547] [<bf0a57f0>] (vpu_service_release [rk_vcodec]) from [<c0224dfc>] (__fput+0xd8/0x1b4)
[   31.559363] [<c0224dfc>] (__fput) from [<c0139ccc>] (task_work_run+0xbc/0xcc)
[   31.567334] [<c0139ccc>] (task_work_run) from [<c010a8a8>] (do_work_pending+0x9c/0xb0)
[   31.576180] [<c010a8a8>] (do_work_pending) from [<c0106ef4>] (slow_work_pending+0xc/0x20)
[   31.585316] Code: e6ff0072 e1500822 1a000004 e7f001f2 (e5932010) 
[   31.592111] ---[ end trace d7aee5a3dd0d94ba ]---
[   31.597264] note: mpv[1133] exited with preempt_count 1
[   33.897797] rk-vcodec ff9a0000.vpu-service: → [vpu_power_off_work]
[   33.904906] rk-vcodec ff9a0000.vpu-service: → [vpu_queue_power_off_work]
[   33.912730] rk-vcodec ff9a0000.vpu-service: ← [vpu_queue_power_off_work]
[   33.920493] rk-vcodec ff9a0000.vpu-service: ← [vpu_power_off_work]

@zsj0613
Copy link

zsj0613 commented Dec 11, 2019

hi bro, I got same question, did you fixed it ?

@Miouyouyou
Copy link
Owner Author

My last try was with that version : https://github.com/Miouyouyou/RockMyy/tree/VPU-V4L2-5.x

However, I'm trying to run 5.4.x kernels on Tinkerboard (having issues with an old 5.2.x bug causing problems with the MMC) which incorporate new and tested VPU drivers for Hantro chips. Hantro being the VPU design IP used in various Rockchip SoC.

@Miouyouyou
Copy link
Owner Author

I forgot to add, my last try worked but was glitchy. Visual artifacts appearing here and there. So, yeah, the latest kernels with the latest version of FFMPEG might be a better solution.

@zsj0613
Copy link

zsj0613 commented Dec 12, 2019

I forgot to add, my last try worked but was glitchy. Visual artifacts appearing here and there. So, yeah, the latest kernels with the latest version of FFMPEG might be a better solution.

yeah,It should be kernel's problem. MPP works fine on Firefly 3399 kernel(https://gitlab.com/TeeFirefly/FireNow-Nougat), but It cause kernel crash on X3399 kernel(http://x.9tripod.com/forum/forum.php?mod=forumdisplay&fid=2) .

@Miouyouyou
Copy link
Owner Author

Well, the main issue is the kernel driver... Though, I learned after a while that if you search for "Hantro" drivers, on Github, you'll find some user-space driven drivers implementations. These were done by just "mmaping" /dev/mem on the right hardware MMIO addresses and handling the whole VPU programming through direct memory accesses...

Anyway, there are various issues with the Rockchip drivers for Android :

  1. They never told anyone about the VPU IP used. Which is a shame, since a lot of documentation was provided by the i.MX company, who already had a driver for the previous version of the same IP (Hantro VPU).

  2. Most of the Android drivers were done by the Google team, for Android. Meaning it was specifically targeted for the ION graphical subsystem and various API specifically added by Google in their Linux kernel versions.

  3. The whole DTS setup was quite a mess during the 4.9<->4.19 era for Rockchip systems. Various definitions were lacking, making various hardware parts (clocks, timers, memory units, ...) not working correctly, and generating various crashes here and there.

  4. There were a lot of discussions about "What API should be used for a VPU driver". Google pushed V4L2 on their kernels, but their work were not integrated into the main kernel due to various reasons (poor documentation, various rework needed, ...).

There is now a V4L2 driver, written by Collabora and Bay Libre I think, VPU driver for Rockchip systems integrated into 5.3+ kernels... The thing is I cannot test it due to some stupid bug on RK3288 systems, which make some "write" functions on the MMC not working (You can create a file but writing into it generate errors... Since file creation actually write things on the MMC, I don't really know what the bug is about...). To pinpoint the issue, I'll have to use "git bisect" and test maybe a dozen broken kernels between version 5.2-rcX and 5.1... Or find someone who got this issue and fixed it already.

So, yeah, if you can test a 5.4.x or 5.5-rcX kernel on your RK3399, enable the VPU driver and give it a try. It might just work as-is. You might have to use a newer version of FFMPEG with support for V4L2 request API, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants