Port Linux Mainline On Khadas VIM

Hi umiddelb,
Because I got a kernel panic randomly with scpi_clocks enabled, so disable it before I found why. Does you ever meet this?

[    1.406205] scpi_clocks scpi:clocks: failed to register clock 'vcpu'
omain-0 init dvfs: 4
[    1.415667] Unable to handle kernel NULL pointer dereference at virtual address 000000b8
[    1.418124] pgd = ffff000008fad000
[    1.421507] [000000b8] *pgd=000000006c3fe003, *pud=000000006c3fd003, *pmd=0000000000000000
[    1.429697] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[    1.435200] Modules linked in:
[    1.438223] CPU: 0 PID: 91 Comm: kworker/0:1 Not tainted 4.12.0-rc5 #1
[    1.444687] Hardware name: Khadas VIM (DT)
[    1.448752] Workqueue: events deferred_probe_work_func
[    1.453831] task: ffff80006942db00 task.stack: ffff8000695ec000
[    1.459701] PC is at __clk_create_clk+0x78/0xd0
[    1.464182] LR is at __clk_create_clk+0x70/0xd0
[    1.468666] pc : [<ffff00000848b7c8>] lr : [<ffff00000848b7c0>] pstate: 60000045
[    1.475996] sp : ffff8000695ef160
[    1.479274] x29: ffff8000695ef160 x28: ffff80006c3724e0 
[    1.484535] x27: ffff000008f9b000 x26: 0000000000000000 
[    1.489796] x25: ffff80006967ec80 x24: ffff80006967ec80 
[    1.495057] x23: 0000000000000000 x22: 0000000000000000 
[    1.500319] x21: ffff80006967ec80 x20: ffff80006924a8a0 
[    1.505580] x19: ffff80006924ae80 x18: 0000000000000007 
[    1.510841] x17: 000000000000000e x16: 0000000000000001 
[    1.516102] x15: 0000000000000019 x14: 0000000000000033 
[    1.521363] x13: 000000000000004c x12: 0000000000000020 
[    1.526625] x11: 0000000000000030 x10: 0101010101010101 
[    1.531886] x9 : 0000000000000000 x8 : ffff80006924af00 
[    1.537147] x7 : 0000000000000000 x6 : 000000000000003f 
[    1.542408] x5 : 0000000000000000 x4 : ffff80006942db00 
[    1.547669] x3 : 0000000000000000 x2 : ffff80006942db00 
[    1.552931] x1 : ffff80006924aea8 x0 : 0000000000000000 
[    1.558193] Process kworker/0:1 (pid: 91, stack limit = 0xffff8000695ec000)
[    1.565094] Stack: (0xffff8000695ef160 to 0xffff8000695f0000)
[    1.570788] f160: ffff8000695ef190 ffff00000848c1f4 ffff000008e9b3e8 ffff8000695ef220
[    1.578550] f180: ffff000008e9b000 ffff80006924a400 ffff8000695ef1d0 ffff0000084881ac
[    1.586312] f1a0: 0000000000000000 ffff80006c3d4090 ffff000008c23060 0000000000000000
[    1.594075] f1c0: ffff000008c23050 0000000000000000 ffff8000695ef270 ffff00000848821c
[    1.601837] f1e0: ffff80006967ec80 0000000000000000 ffff000008f99000 ffff000008efd6c8
[    1.609600] f200: ffff80006924ad00 ffff8000695c6e00 00000000000003e8 ffff8000695ef258
[    1.617362] f220: ffff80006c3d6c48 0000000000000001 ffff8000695c7200 ffff80006c3d4090
[    1.625125] f240: ffff80006c3724e0 ffff000008efd6c8 ffff000008f9b000 ffff8000695c7200
[    1.632887] f260: ffff8000695ef290 ffff00000855ebec ffff8000695ef290 ffff00000855ebfc
[    1.640650] f280: ffff000008efd000 ffff8000695c7200 ffff8000695ef2c0 ffff00000855f3e0
[    1.648412] f2a0: ffff80006c3724e0 0000000000000000 000000006924ad00 ffff80006c3724e0
[    1.656175] f2c0: ffff8000695ef2f0 ffff000008777660 ffff80006924ad80 0000000000000000
[    1.663937] f2e0: 0000000005f5e100 00000000000de2b0 ffff8000695ef340 ffff000008776c7c
[    1.671699] f300: 0000000000000000 ffff8000695c6e00 ffff000008f9bdb0 ffff80006c3724e0
[    1.679462] f320: ffff000008f9b000 ffff8000695c6e00 ffff000008f9bdc0 ffff000008775a18
[    1.687225] f340: ffff8000695ef390 ffff00000877718c ffff000008f4ac88 ffff8000695c6e00
[    1.694987] f360: ffff000008e29340 ffff000008e39f40 ffff000008f9bdf0 ffff000008e39000
[    1.702750] f380: ffff000008f9b000 0000000000000000 ffff8000695ef3f0 ffff000008775658
[    1.710512] f3a0: ffff8000695c6e00 0000000000000008 0000000000000000 ffff000008e29000
[    1.718275] f3c0: ffff000008f9bdb0 ffff000008e39000 ffff000008f9b000 ffff8000695c6f18
[    1.726037] f3e0: ffff000008f1a000 00000000ffffffff ffff8000695ef460 ffff000008775c5c
[    1.733800] f400: ffff000008f1ae48 ffff000008efca18 ffff000008f9b000 ffff000008f1a000
[    1.741562] f420: ffff000008f1b400 0000000000000002 0000000000000000 0000000000000000
[    1.749325] f440: ffff800068cae400 00000000ffffffff ffff000008f1b400 0000000108393de8
[    1.757087] f460: ffff8000695ef480 ffff00000854b3e8 ffff000008f1ae48 0000000008efca18
[    1.764850] f480: ffff8000695ef4c0 ffff000008774ad8 ffff000008f1b320 ffff000008f1ad98
[    1.772612] f4a0: ffff8000695ef4c0 ffff800069f47aa0 ffff80006968e268 0000000000000000
[    1.780375] f4c0: ffff8000695ef4f0 ffff000008777278 ffff000008f9bdb0 ffff000008f1b488
[    1.788137] f4e0: ffff000008f9be08 ffff000008c93ce8 ffff8000695ef520 ffff000008777740
[    1.795899] f500: ffff000008f1b400 ffff800068cae810 ffff000008f1b3d8 0000000000000000
[    1.803662] f520: ffff8000695ef530 ffff00000854ec3c ffff8000695ef560 ffff00000854cf3c
[    1.811425] f540: ffff800068cae810 ffff000008f99000 0000000000000000 ffff000008f99000
[    1.819187] f560: ffff8000695ef5a0 ffff00000854d15c ffff000008f1b400 ffff8000695ef640
[    1.826950] f580: ffff800068cae810 0000000000000001 ffff000008efb000 ffff000008f99000
[    1.834712] f5a0: ffff8000695ef5d0 ffff00000854b0b8 0000000000000000 ffff8000695ef640
[    1.842475] f5c0: ffff00000854d0c4 ffff8000695ef640 ffff8000695ef610 ffff00000854cc0c
[    1.850237] f5e0: ffff800068cae810 ffff800068cae870 ffff800068cae810 ffff000008e69f60
[    1.858000] f600: ffff800069f478c8 ffff800068ca6668 ffff8000695ef650 ffff00000854d19c
[    1.865762] f620: ffff800068cae820 ffff000008efc900 ffff800068cae810 ffff000008efc608
[    1.873525] f640: ffff800068cae810 0000000000000001 ffff8000695ef660 ffff00000854c1c0
[    1.881287] f660: ffff8000695ef690 ffff00000854a200 ffff800068cae820 ffff800068cae810
[    1.889050] f680: 0000000000000000 ffff00000854a1f8 ffff8000695ef700 ffff00000854e910
[    1.896812] f6a0: 0000000000000000 ffff800068cae800 ffff800068cae800 ffff800068cae810
[    1.904575] f6c0: ffff000008efc000 ffff000008e4c000 ffff000008e4c000 ffff000008c34890
[    1.912337] f6e0: ffff000008559480 ffff800068cae968 00000000fffedc67 0000000000000000
[    1.920100] f700: ffff8000695ef750 ffff00000854f534 ffff8000695ef7e0 ffff800068cae800
[    1.927862] f720: 0000000000000000 ffff800068cae410 ffff80006c3d6ab8 ffff0000089d80e0
[    1.935625] f740: ffff0000089d7fa0 ffff800068cae800 ffff8000695ef780 ffff000008490d3c
[    1.943387] f760: ffff80006c3d6c48 ffff0000089d80e0 0000000000000000 0000000000000000
[    1.951150] f780: ffff8000695ef830 ffff00000854ec3c ffff000008e9ba40 ffff800068cae410
[    1.958912] f7a0: ffff000008e9ba18 0000000000000000 ffff000008e9ba40 0000000000000001
[    1.966675] f7c0: 0000000000000000 0000000000000000 ffff800068cae3b0 ffff8000695c7168
[    1.974437] f7e0: 0000000000000000 0000000000000000 ffff000008c34890 00000000ffffffff
[    1.982199] f800: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    1.989962] f820: 0000000000000000 0000000000000000 ffff8000695ef860 ffff00000854cf3c
[    1.997725] f840: ffff800068cae410 ffff000008f99000 0000000000000000 ffff000008f99000
[    2.005487] f860: ffff8000695ef8a0 ffff00000854d15c ffff000008e9ba40 ffff8000695ef940
[    2.013250] f880: ffff800068cae410 0000000000000001 ffff000008efb000 ffff000008f99000
[    2.021012] f8a0: ffff8000695ef8d0 ffff00000854b0b8 0000000000000000 ffff8000695ef940
[    2.028775] f8c0: ffff00000854d0c4 ffff8000695ef940 ffff8000695ef910 ffff00000854cc0c
[    2.036537] f8e0: ffff800068cae410 ffff800068cae470 ffff800068cae410 ffff000008e69f60
[    2.044300] f900: ffff800069f478c8 ffff8000691f5c68 ffff8000695ef950 ffff00000854d19c
[    2.052062] f920: ffff800068cae420 ffff000008efc900 ffff800068cae410 ffff800069585c10
[    2.059825] f940: ffff800068cae410 0000000000000001 ffff8000695ef960 ffff00000854c1c0
[    2.067587] f960: ffff8000695ef990 ffff00000854a200 ffff800068cae420 ffff800068cae410
[    2.075350] f980: 0000000000000000 ffff00000854a1f8 ffff8000695efa00 ffff0000087cbf10
[    2.083112] f9a0: ffff800068cae400 ffff800068cae410 ffff800069585c10 ffff80006c3d6b50
[    2.090874] f9c0: 0000000000000000 0000000000000000 ffff800069585c10 0000000000000002
[    2.098637] f9e0: ffff800068cae400 ffff800068cae410 ffff8000695efa20 ffff0000087cc47c
[    2.106400] fa00: ffff8000695efa20 ffff0000087cc4d4 ffff800068cae400 0000000000000000
[    2.114162] fa20: ffff8000695efa60 ffff0000087cc640 0000000000000000 ffff80006c3d6ab8
[    2.121925] fa40: 0000000000000000 0000000000000001 0000000000000000 ffff000008ca0ba0
[    2.129687] fa60: ffff8000695efaf0 ffff0000087cc978 ffff80006c3d6ab8 ffff800069516c18
[    2.137450] fa80: ffff80006c3d6860 0000000000000000 0000000000000000 ffff800069585c10
[    2.145212] faa0: ffff8000695c71b8 0000000000000002 ffff8000695efac0 ffff0000087c902c
[    2.152975] fac0: ffff8000695efaf0 ffff0000087cc98c 00000000ffffffa1 ffff800069516c18
[    2.160737] fae0: ffff80006c3d6860 ffff8000695c7168 ffff8000695efb30 ffff0000087b1800
[    2.168500] fb00: 00000000ffffffa1 ffff800069516c18 ffff000008f1e000 ffff000008a6e3f8
[    2.176262] fb20: 0000000000000002 ffff800069585c10 ffff8000695efc20 ffff00000854ec3c
[    2.184025] fb40: ffff000008f1e150 ffff800069585c10 ffff000008f1e128 0000000000000000
[    2.191787] fb60: ffff000008f1e150 0000000000000001 ffff0000080d7e7c 00000000000001c8
[    2.199550] fb80: ffff80006942db00 ffff8000694d0000 ffff000008f1e150 ffff8000695c7018
[    2.207312] fba0: ffff800069585c00 ffff0000087b1380 ffff0000087b1208 ffff80006c3d6860
[    2.215075] fbc0: 5f6c6d6100000000 006c616d72656874 0000000000000000 ffff00000000038e
[    2.222837] fbe0: 00000000c8013400 00000000c80137ff ffff80006c3dbec0 0000000000000200
[    2.230599] fc00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.238362] fc20: ffff8000695efc50 ffff00000854cf3c ffff800069585c10 ffff000008f99000
[    2.246125] fc40: 0000000000000000 ffff000008f99000 ffff8000695efc90 ffff00000854d15c
[    2.253887] fc60: ffff000008f1e150 ffff8000695efd30 ffff800069585c10 0000000000000001
[    2.261650] fc80: 0000000000000000 0000000000000000 ffff8000695efcc0 ffff00000854b0b8
[    2.269412] fca0: 0000000000000000 ffff8000695efd30 ffff00000854d0c4 ffff8000695efd30
[    2.277175] fcc0: ffff8000695efd00 ffff00000854cc0c ffff800069585c10 ffff800069585c70
[    2.284937] fce0: ffff800069585c10 ffff00000890fbcc ffff800069f478c8 ffff80006961f068
[    2.292700] fd00: ffff8000695efd40 ffff00000854d19c ffff800069585c10 ffff000008efc900
[    2.300462] fd20: ffff800069585c10 ffff000008efc000 ffff800069585c10 0000000000000001
[    2.308225] fd40: ffff8000695efd50 ffff00000854c1c0 ffff8000695efd80 ffff00000854c62c
[    2.315987] fd60: ffff800069585c10 ffff000008efc538 ffff000008efc558 ffff00000854c624
[    2.323750] fd80: ffff8000695efdb0 ffff0000080d7d0c ffff8000694d0000 ffff000008efc568
[    2.331512] fda0: ffff80006c37ac00 ffff80006c37ea00 ffff8000695efdf0 ffff0000080d8064
[    2.339275] fdc0: ffff80006c37ac00 ffff8000694cdb80 ffff8000694d0030 ffff80006942db00
[    2.347037] fde0: ffff80006c37ac20 ffff000008e37000 ffff8000695efe60 ffff0000080ddbf8
[    2.354800] fe00: ffff800069505d80 ffff8000694cdb80 ffff000008f4ef00 ffff80006942db00
[    2.362562] fe20: ffff000008beebf0 ffff8000694d0000 ffff0000080d7e7c ffff800069505db8
[    2.370325] fe40: ffff800069f6bd10 0000000000000000 ffff000008f4ef00 ffff80006942db00
[    2.378087] fe60: 0000000000000000 ffff000008082ec0 ffff0000080ddaf8 ffff8000694cdb80
[    2.385849] fe80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.393611] fea0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.401374] fec0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.409137] fee0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.416899] ff00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.424662] ff20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.432424] ff40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.440187] ff60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.447949] ff80: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.455712] ffa0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[    2.463474] ffc0: 0000000000000000 0000000000000005 0000000000000000 0000000000000000
[    2.471237] ffe0: 0000000000000000 0000000000000000 6f622f8200000000 0000000000000000
[    2.478998] Call trace:
[    2.481415] Exception stack(0xffff8000695eef90 to 0xffff8000695ef0c0)
[    2.487796] ef80:                                   ffff80006924ae80 0001000000000000
[    2.495560] efa0: ffff8000695ef160 ffff00000848b7c8 ffff80006942db80 ffff80006c37b400
[    2.503322] efc0: ffff80006942db00 ffff8000695ef078 ffff8000695eefe0 ffff0000080e33f0
[    2.511085] efe0: ffff8000695ef020 ffff00000890fc84 ffff000008e42b80 ffff80006c37b400
[    2.518847] f000: ffff8000695ef050 ffff000008120130 ffff8000695ef100 ffff8000695ef100
[    2.526610] f020: ffff8000695ef100 ffff80006c374d00 0000000000000000 ffff80006924aea8
[    2.534372] f040: ffff80006942db00 0000000000000000 ffff80006942db00 0000000000000000
[    2.542134] f060: 000000000000003f 0000000000000000 ffff80006924af00 0000000000000000
[    2.549897] f080: 0101010101010101 0000000000000030 0000000000000020 000000000000004c
[    2.557659] f0a0: 0000000000000033 0000000000000019 0000000000000001 000000000000000e
[    2.565425] [<ffff00000848b7c8>] __clk_create_clk+0x78/0xd0
[    2.570944] [<ffff00000848c1f4>] __of_clk_get_from_provider+0xf0/0x12c
[    2.577412] [<ffff0000084881ac>] __of_clk_get_by_name+0xfc/0x114
[    2.583362] [<ffff00000848821c>] clk_get+0x2c/0x70
[    2.588109] [<ffff00000855ebfc>] dev_pm_opp_get_opp_table+0xac/0x11c
[    2.594402] [<ffff00000855f3e0>] dev_pm_opp_add+0x1c/0x64
[    2.599752] [<ffff000008777660>] scpi_init_opp_table+0xb4/0x16c
[    2.605615] [<ffff000008776c7c>] _get_cluster_clk_and_freq_table+0x78/0x174
[    2.612515] [<ffff00000877718c>] bL_cpufreq_init+0x414/0x48c
[    2.618121] [<ffff000008775658>] cpufreq_online+0xbc/0x640
[    2.623555] [<ffff000008775c5c>] cpufreq_add_dev+0x68/0x78
[    2.628989] [<ffff00000854b3e8>] subsys_interface_register+0x84/0xc0
[    2.635285] [<ffff000008774ad8>] cpufreq_register_driver+0x120/0x1bc
[    2.641581] [<ffff000008777278>] bL_cpufreq_register+0x74/0x118
[    2.647446] [<ffff000008777740>] scpi_cpufreq_probe+0x28/0x38
[    2.653140] [<ffff00000854ec3c>] platform_drv_probe+0x50/0xbc
[    2.658831] [<ffff00000854cf3c>] driver_probe_device+0x21c/0x2d0
[    2.664782] [<ffff00000854d15c>] __device_attach_driver+0x98/0xc8
[    2.670820] [<ffff00000854b0b8>] bus_for_each_drv+0x54/0x94
[    2.676340] [<ffff00000854cc0c>] __device_attach+0xc4/0x12c
[    2.681860] [<ffff00000854d19c>] device_initial_probe+0x10/0x18
[    2.687725] [<ffff00000854c1c0>] bus_probe_device+0x90/0x98
[    2.693245] [<ffff00000854a200>] device_add+0x400/0x57c
[    2.698420] [<ffff00000854e910>] platform_device_add+0xb8/0x21c
[    2.704284] [<ffff00000854f534>] platform_device_register_full+0xe8/0x108
[    2.711013] [<ffff000008490d3c>] scpi_clocks_probe+0xd0/0x140
[    2.716705] [<ffff00000854ec3c>] platform_drv_probe+0x50/0xbc
[    2.722397] [<ffff00000854cf3c>] driver_probe_device+0x21c/0x2d0
[    2.728349] [<ffff00000854d15c>] __device_attach_driver+0x98/0xc8
[    2.734386] [<ffff00000854b0b8>] bus_for_each_drv+0x54/0x94
[    2.739906] [<ffff00000854cc0c>] __device_attach+0xc4/0x12c
[    2.745426] [<ffff00000854d19c>] device_initial_probe+0x10/0x18
[    2.751291] [<ffff00000854c1c0>] bus_probe_device+0x90/0x98
[    2.756811] [<ffff00000854a200>] device_add+0x400/0x57c
[    2.761989] [<ffff0000087cbf10>] of_device_add+0x44/0x5c
[    2.767248] [<ffff0000087cc4d4>] of_platform_device_create_pdata+0x80/0xd0
[    2.774061] [<ffff0000087cc640>] of_platform_bus_create+0xe0/0x2fc
[    2.780185] [<ffff0000087cc978>] of_platform_populate+0x48/0xac
[    2.786051] [<ffff0000087b1800>] scpi_probe+0x3a0/0x468
[    2.791225] [<ffff00000854ec3c>] platform_drv_probe+0x50/0xbc
[    2.796917] [<ffff00000854cf3c>] driver_probe_device+0x21c/0x2d0
[    2.802869] [<ffff00000854d15c>] __device_attach_driver+0x98/0xc8
[    2.808906] [<ffff00000854b0b8>] bus_for_each_drv+0x54/0x94
[    2.814426] [<ffff00000854cc0c>] __device_attach+0xc4/0x12c
[    2.819946] [<ffff00000854d19c>] device_initial_probe+0x10/0x18
[    2.825811] [<ffff00000854c1c0>] bus_probe_device+0x90/0x98
[    2.831331] [<ffff00000854c62c>] deferred_probe_work_func+0x78/0xac
[    2.837542] [<ffff0000080d7d0c>] process_one_work+0x124/0x294
[    2.843233] [<ffff0000080d8064>] worker_thread+0x1e8/0x3c8
[    2.848668] [<ffff0000080ddbf8>] kthread+0x100/0x12c
[    2.853585] [<ffff000008082ec0>] ret_from_fork+0x10/0x50
[    2.858846] Code: f9001260 97fff521 f9400280 9100a261 (f9405c02) 
[    2.864999] ---[ end trace 7a19ac7fb82f1325 ]---