Commit Graph

237 Commits

Author SHA1 Message Date
Zhen Chen
a519839892 MALI: midgard: change kbase_platform_driver.driver.name to "midgard"
To make it possible that the both built-in midgard and bifrost device driver
could be both loaded.

Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: I8271a6d817dda3781d70fc69aaaccf3860354b48
2021-02-02 11:40:24 +08:00
Zhen Chen
a9f72d8212 MALI: bifrost: remove 'of_device_id' instances related to midgard
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: I2afba12c2fff75017de22ffb11e4fdb36d9fea73
2021-02-02 11:40:24 +08:00
Zhen Chen
5a1b8a4b4b MALI: midgard: add and include rename.h
rename.h could rename the symbols that have same name in midgard/ and bifrost/,
to make it possible to build in both midgard/ and bifrost/.

Change-Id: Ibca4e2beca8a4d8ea28f712a3e219cb2a403c7e2
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2021-02-02 11:40:24 +08:00
Zhen Chen
15a5ee10cc Mali: utgard: actually use rk_context::is_powered
Fix the following warning reported
in https://redmine.rock-chips.com/issues/230655 :

[   76.900395] ------------[ cut here ]------------
[   76.900404] aclk_gpu already disabled
[   76.900503] WARNING: CPU: 3 PID: 1674 at drivers/clk/clk.c:829 clk_core_disable+0x250/0x268
...

Change-Id: Iaf26ce07574b9909188cde99142a13e98a9a93de
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2021-02-01 18:16:04 +08:00
Finley Xiao
6fc2a5c028 MALI: bifrost: Add rockchip simple-power-model support
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I721c0f247c81b63a1590c9001ad481837f15f15e
2021-01-08 17:59:35 +08:00
Finley Xiao
7bfc54efa9 MALI: bifrost: Add private data for governor
This adds support to get simple_ondemand governor data from devicetree.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I6d44ba467d52bde191fb1b87bce02dc503055262
2021-01-07 19:29:58 +08:00
Liang Chen
88169e6e3b MALI: bifrost: Fix wrong voltage for devfreq
(kbdev->current_freqs[i] > freqs[i]) will be always false becasue kbdev->current_freqs[i]
has been updated to freqs[i], so we need save current_freqs[i] to old_freqs[i].

Change-Id: I3f8a06d474a359cf292460878c53592c4ce1472b
Signed-off-by: Liang Chen <cl@rock-chips.com>
2021-01-05 14:52:16 +08:00
Zhen Chen
fd5989b3f9 MALI: bifrost: fix bug "Kbase can do an out of bound access due to invalid jobslot parameter"
This patch is from ARM via mail
"Fwd: 00209996 - [Rockchip][IMPORTANT] Cat A(rare)- Security bug in Mali DDK (16-Nov, 2020) Edit Subject"

Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: Ife807e5e850274222db8aea0e4cac588e02a8e53
2020-11-30 18:04:43 +08:00
Zhen Chen
c0720cd95e MALI: rockchip: upgrade bifrost DDK to g2p0-01eac0, from r25p1-01bet0
In addition, rename some configs that have been used in drivers/gpu/arm/midgard.

Change-Id: I5356d6b3f544195eb6bebe88927abe7c8bcb7dd1
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2020-11-30 18:04:43 +08:00
Zhen Chen
6017dfa725 MALI: rockchip: upgrade bifrost DDK to r25p1-01bet0, from r21p0-01rel0
In addition, rename some configs that have been used in drivers/gpu/arm/midgard.

Change-Id: I4244ea3ac7f039f182d5e58f677d9c31417188bf
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2020-10-23 12:13:16 +08:00
Caesar Wang
bf1fb1ba8d MALI: bifrost_for_linux: adjust source codes for kernel v4.19
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Change-Id: Icd0b7085a5e19d8c40b7c2762b2286c89af0197c
2020-07-24 15:30:35 +08:00
Tao Huang
a392d416cc MALI: rockchip: Fix make distclean
make distclean
scripts/Makefile.clean:15: drivers/gpu/arm/midgard_for_linux/Makefile:
No such file or directory

Fixes: 25bb952677 ("MALI: rockchip: remove drivers/gpu/arm/midgard_for_linux/")
Change-Id: Ia47e2581d9679f3bcca809ad4506b61068e1710d
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2020-06-19 21:41:20 +08:00
Zhen Chen
25bb952677 MALI: rockchip: remove drivers/gpu/arm/midgard_for_linux/
rk3399/rk3288 Android and Linux devices are all using drivers/gpu/arm/midgard,
which is Midgard device driver on DDK r18.

Change-Id: Iac8484edf91d57c7b74d5b952c96e0bb03159791
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2020-06-18 17:26:44 +08:00
Zhen Chen
4e2b2ec2ef Mali: utgard: adjust corresponding to the refined gpu node in dts files
Such as :
	arch/arm/boot/dts/rk312x.dtsi,
	arch/arm/boot/dts/rk322x.dtsi

Change-Id: Ib92193685fc7572558f2f4e65fec6be29d20ac2f
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-11-26 19:37:41 +08:00
Zhen Chen
a803fa6605 Mali: utgard: fix memory(fences) leaks
In deed, Zhixiong Lin missed these codes when he picking source codes
from DDK r9 to port utgard device driver of r7 to kernel 4.19.

Change-Id: If140b478b4ea8a4f72d532b8e8216ab53856be08
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-11-18 09:10:15 +08:00
Zhen Chen
69c7c17655 MALI: rockchip: upgrade bifrost DDK to r21p0-01rel0, from r20p0-01rel0
Change-Id: Ibdb2508859f24df1014fc485097685bcecb7b31b
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-11-14 11:38:21 +08:00
Finley Xiao
8459dabb68 MALI: utgard: Add private data for governor
This adds support to get simple_ondemand governor data from devicetree.

Change-Id: Ic897ad6227152c4ce695d6cee8085b4d303339bf
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-10-24 17:50:18 +08:00
Finley Xiao
e2f291faa9 MALI: midgard: Fix power coefficient overflow
Change-Id: Ie0ceca32a33a5a8da56d3a32913e819a7e31e45b
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-10-24 17:49:15 +08:00
Finley Xiao
88738d6110 MALI: bifrost: Fix voltage error when there isn't operating-points-v2-mali
Change-Id: Iad5e75ac6e9529ad79c845599cfe5426a5e03811
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-10-24 10:57:13 +08:00
Finley Xiao
e5291ee9cf MALI: bifrost: Make set regulater before initialize OPPs
WARNING: CPU: 3 PID: 35 at drivers/opp/core.c:1406 dev_pm_opp_set_regulators+0x160/0x1f8
Modules linked in:
CPU: 3 PID: 35 Comm: kworker/3:1 Not tainted 4.19.53 #252
Hardware name: Rockchip rk3326 863 rkisp1 board (DT)
Workqueue: events deferred_probe_work_func
pstate: 20400005 (nzCv daif +PAN -UAO)
pc : dev_pm_opp_set_regulators+0x160/0x1f8
lr : dev_pm_opp_set_regulators+0x28/0x1f8
sp : ffffff80097ebb10
x29: ffffff80097ebb10 x28: 0000000000000000
x27: 0000000000000001 x26: ffffffc03b48c0b8
x25: ffffffc03e2a4810 x24: 0000000000000002
x23: ffffff80093d10d8 x22: ffffffc03e2a4800
x21: ffffffc03b48c000 x20: ffffffc03b48b200
x19: ffffffc03b48c000 x18: ffffffffffffffff
x17: 0000000000000000 x16: ffffffc03e26a880
x15: ffffff800933da88 x14: ffffff80894ecdf7
x13: ffffff80094ece05 x12: ffffff80094ed240
x11: 0000000000000004 x10: 0101010101010101
x9 : fffffffffffffffd x8 : 7f7f7f7f7f7f7f7f
x7 : fefefeff646c606d x6 : 0d0d0206ebadf2e1
x5 : 0000000000000007 x4 : 0000000000000006
x3 : ffffff8009427ff8 x2 : 0000000000000000
x1 : ffffffc03b45d180 x0 : ffffffc03b48b250

Call trace:
 dev_pm_opp_set_regulators+0x160/0x1f8
 kbase_platform_device_probe+0x24c/0xd30
 platform_drv_probe+0x50/0xa8
 really_probe+0x1f8/0x288
 driver_probe_device+0x58/0x100
 __device_attach_driver+0x9c/0xf8
 bus_for_each_drv+0x70/0xc8
 __device_attach+0xdc/0x138
 device_initial_probe+0x10/0x18
 bus_probe_device+0x94/0xa0
 deferred_probe_work_func+0x6c/0xa0
 process_one_work+0x1ec/0x450
 worker_thread+0x234/0x428
 kthread+0xfc/0x128
 ret_from_fork+0x10/0x18
---[ end trace 30d550c0a063d9db ]---

Change-Id: I66b1642bc54729bf0bb6d1d015069b7b8e51e02c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-10-24 10:57:13 +08:00
Zhen Chen
de4888b119 MALI: bifrost: Add necessary calling of dev_pm_opp_put()
According to
commit 8a31d9d942 ("PM / OPP: Update OPP users to put reference")

Fixes: b0ad177659 ("MALI: rockchip: upgrade Bifrost DDK to r20p0-01rel0, from r12p0-01rel0")
Change-Id: I2df7c7ddab0ae740e75579a0f620c3d918f0eed5
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-10-15 12:02:31 +08:00
Zhen Chen
b0ad177659 MALI: rockchip: upgrade Bifrost DDK to r20p0-01rel0, from r12p0-01rel0
I replace "sg_dma_len" with "MALI_SG_DMA_LEN"
and rename configs which have duplicated names in midgard/, as before.

Note that drivers/gpu/arm/bifrost on DDK r20
depends on drivers/base/memory_group_manager.

Change-Id: Ie51fda035a98b5151f25a0fcf7294b88d4ecc978
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-10-15 10:10:21 +08:00
Tao Huang
d525a9ab3d Mali: midgard_for_linux: Update OPP users to put reference
According to
commit 8a31d9d942 ("PM / OPP: Update OPP users to put reference")

Change-Id: Id38e4632f951242bcbebef3fba066c118d2203e3
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-10-12 15:25:20 +08:00
Tao Huang
a4513fc9c7 Mali: midgard: Update OPP users to put reference
According to
commit 8a31d9d942 ("PM / OPP: Update OPP users to put reference")

Change-Id: I355e2752197b0625123e3af61fcbd871a59f0c71
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-10-12 15:25:20 +08:00
Tao Huang
643e24b271 Mali: utgard: Update OPP users to put reference
According to
commit 8a31d9d942 ("PM / OPP: Update OPP users to put reference")

Change-Id: Ic142e054b3366737f0fcdc34ac0a19fc7dcd78d6
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-10-12 15:25:20 +08:00
Tao Huang
27f7384f3c MALI: bifrost_for_linux: Update OPP users to put reference
According to
commit 8a31d9d942 ("PM / OPP: Update OPP users to put reference")

Change-Id: I8bc69ec067623e05a610b816990e128e853d01a6
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-10-12 15:25:20 +08:00
Tao Huang
4b72de839f MALI: bifrost: Update OPP users to put reference
According to
commit 8a31d9d942 ("PM / OPP: Update OPP users to put reference")

Change-Id: I2b342c28a0c1d44adebd589b48ea95c9dcd7182d
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2019-10-12 15:25:20 +08:00
Zhen Chen
f828f106e0 MALI: bifrost: only call dma_fence_set_error() for actual errors
This would eliminate the repeating WARNING logs from dma_fence_set_error().

Change-Id: I3b319decb8899dfc0410f4975e31bb1c67f7ae9f
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-08-29 19:27:20 +08:00
Zhen Chen
c4e657e5ac Mali: midgard: remove kbase_mem_phy_alloc::zone_cache and relative codes
Some relative codes,
such as 'zone_page_state_add(1, zone, NR_SLAB_RECLAIMABLE);',
caused compile errors, when compiled with clang.
The corresponding interface(NR_SLAB_RECLAIMABLE, et.) was changed
between kernel v4.4 and v4.19.

These codes were used to updates the cachelines with the statistics,
and are removed in Midgard DDK r22.
Here, I remove them too, in current Midgard DDK r18.

Change-Id: I3a7e789c0456f28eba623b20564ea8a97109051f
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-27 19:05:57 +08:00
Zhen Chen
ae48165fb6 Mali: midgard: fix compile errors when ARCH=arm under kernel v4.19
Change-Id: I59be58843da8f55e242d82f15533f8c8aa48eece
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-24 11:58:59 +08:00
Zhixiong Lin
d40d76adb5 Mali: utgard: fix compile errors when ARCH=arm under kernel v4.19
Change-Id: Iea66ada0c6aef9fffc270175cdeca1377827542d
Signed-off-by: Zhixiong Lin <zhixiong.lin@rock-chips.com>
2019-06-24 11:07:12 +08:00
Randy Li
f077059630 Mali: midgard: fix the memory translation for aarch32
When the clients are 32 bits while the kernel is 64 bits,
we need to translate the memory address before accessing.

The previous commit was refreshed by ddk update.

Change-Id: I7f47ab94da258e9d170613252aae9b396623cf48
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2019-06-20 14:58:49 +08:00
Zhen Chen
da6f49f0dd Mali: midgard: fix Spectre v1 vulnerability
user_atom.atom_number can be indirectly controlled by user-space,
hence leading to a potential exploitation
of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/gpu/arm/midgard/mali_kbase_jd.c:1397 kbase_jd_submit() warn:
potential spectre issue 'jctx->atoms' [r]
katom = &jctx->atoms[user_atom.atom_number];

Fix this by sanitizing user_atom.atom_number
before 'katom = &jctx->atoms[user_atom.atom_number];'.

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Fixes: 5cf27d0b6090 ("Mali: midgard: changes to enlarge BASE_JD_ATOM_COUNT to 512, for defect 184210")
Change-Id: If52f30d29a80a06c6693ddadd5947ab9fe8fbc25
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:58:49 +08:00
Zhen Chen
b8fd2316f9 Mali: midgard: changes to enlarge BASE_JD_ATOM_COUNT to 512, for defect 184210
The source code of mali_so must be modified correspondingly.

Change-Id: I3f4bd03fa2d369d912e6bc05c53d2d3abefb92d3
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:58:49 +08:00
Zhen Chen
732afe7d96 Mali: bifrost: adjust source codes for kernel v4.19
Change-Id: I80aaaa2cd9b14607336b2db2dd5890a84f260561
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:15:33 +08:00
Zhen Chen
89ad87fb8e Mali: midgard: adjust source codes for kernel v4.19
Parts of the modifications are borrowed from Mali Bifrost DDK r13.

Change-Id: I82c68041a3185063ae2d8a40a7a7c17feaab0733
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-06-20 14:14:49 +08:00
Zhixiong Lin
414f9ff2d8 MALI: utgard: Add implementation of mali sync timeline based on CONFIG_SYNC_FILE
Mali sync timeline in Utgard DDK r7p0-00rel1 depends on CONFIG_SYNC.
But, CONFIG_SYNC is no longer supported by kernel v4.19.
This modification is from ARM release:DX910-SW-99002-r9p0-01rel0.tgz

Change-Id: I2f2b36c57132ebc49cc8235b2d071ed6ed540825
Signed-off-by: Zhixiong Lin <zhixiong.lin@rock-chips.com>
2019-06-19 19:56:13 +08:00
Zhixiong Lin
3b4356fdb4 MALI: utgard: adapter 4.19 timmer and memory interface
Change-Id: Ic5dc26292ee350aaa138409447bf5501ad0e316d
Signed-off-by: Zhixiong Lin <zhixiong.lin@rock-chips.com>
2019-06-19 14:32:47 +08:00
Finley Xiao
2a796d5cd4 MALI: midgard: Add private data for governor
This adds support to get simple_ondemand governor data from devicetree.

Change-Id: Ica8cde1b28a81d5b7e2c5c8c109a2469311bcd8e
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-14 19:59:45 +08:00
Finley Xiao
a98c052143 GPU: rockchip: Add gpu to system monitor
Change-Id: I2c487c6ec8a46705197ceb9c2130b448f839ed66
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-14 19:51:00 +08:00
Finley Xiao
3b1503b829 MALI: midgard_for_linux: RK: Add support to get soc infomation
Change-Id: I0fcc59bdb978ea85de3c1afb9ae6b368d1fd5e9c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Finley Xiao
cfa8862b8f MALI: midgard: RK: Add support to get soc infomation
Change-Id: I9e5ea0458ec08ddfc10d9d4e258713e747946959
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2019-06-12 09:38:43 +08:00
Zhen Chen
0af9a0968c MALI: rockchip: restore midgard_for_linux/, device driver under it is on DDK r14
The process to get current source code under midgard_for_linux/ :
1. On the status of commit 18166b65,
	revert commit "91842c9 MALI: rockchip: upgrade midgard DDK to r18p0-01rel0",
	which upgraded drivers/gpu/arm/midgard/ from DDK r14 to r18.
2. copy directory drivers/gpu/arm/midgard/ to drivers/gpu/arm/midgard_for_linux/.

It's ensured that changes of commits in drivers/gpu/arm/midgard/
from RK power management group early than commit 18166b65
are correspondingly remained in current drivers/gpu/arm/midgard_for_linux/.

Change-Id: I41463a8c160e5d25365d6872eef1049de4a317fb
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2019-01-24 14:14:16 +08:00
Liang Chen
fad451203d MALI: bifrost_for_linux: optimize opp-table for rockchip SoCs
Change-Id: I33e029a58880c3a54f36e9c5d7d94ce2394404b7
Signed-off-by: Liang Chen <cl@rock-chips.com>
2019-01-02 18:52:27 +08:00
Zhen Chen
e705e67167 MALI: utgard: RK: use '__GFP_ZERO | GFP_HIGHUSER' as 'flags' of alloc_page()
Just the same as in Midgard device driver.
This could resolve Defect #170228 and #184427 in RK redmine.

In addition, add err log for the case that alloc_page() returns NULL.

Change-Id: Ie1ddfae9429236900e4308e2cfecec2cd75a183a
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2018-11-15 14:14:07 +08:00
Tao Huang
bd30ecadeb MALI: utgard: RK: do not build ump on Kbuild
Save a lot of build time.

Change-Id: I0e63cfae3c3c2625b3100f016134120e5551a5b5
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-09-10 21:02:53 +08:00
Tao Huang
f3363cd81c MALI: utgard: RK: do not get GIT_REV on mali Kbuild
Disable build mali driver when just git commit change.

Change-Id: Ie659e2da02260079ccd5d2873f28afbe7f2b2761
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-09-10 21:02:17 +08:00
Tao Huang
90cb7171b8 MALI: bifrost_for_linux: Fix build problem with O=
Change-Id: I6fdee0196ed321b23bffc6531f09c6e5885ce0a6
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-08-28 09:35:35 +08:00
Tao Huang
7a799e8df2 MALI: bifrost: Fix build problem with O=
Change-Id: I4f8625523f86b385d72857d06779669261aef6f9
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-08-28 09:24:06 +08:00
Zhen Chen
18166b6556 Mali: midgard: set "FMODE_UNSIGNED_OFFSET" bit in file flags of mali device file
According to commit "mmap: introduce sane default mmap limits"

Change-Id: I96bc78053c06fdeaef178662dda36770da867436
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2018-08-07 09:50:37 +08:00