Commit Graph

322 Commits

Author SHA1 Message Date
Zhen Chen 71c9ade488 Mali: bifrost: log: Add task_comm of contexts in OOM notification log
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: Ib6cfebe6eeafc10e69a5a9e7b206c208dd8bf1de
2023-10-30 19:22:17 +08:00
Zhen Chen 8a98ecb28e Mali: bifrost: log: Add pid and task_comm of contexts in the info read from node "gpu_memory"
The output of "cat /sys/kernel/debug/mali0/gpu_memory" would look like:
<dev>                <pages>
mali0                  13312
  <kctx>                  <comm>               <pid>         <pages>
  kctx-0x0000000000000000 system_server        609              1653
  kctx-0x0000000000000000 droid.launcher3      1042             1636
  kctx-0x0000000000000000 ndroid.systemui      802              5859
  kctx-0x0000000000000000 ndroid.settings      915              1566
  kctx-0x0000000000000000 surfaceflinger       310              2590

Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: Ifc8e4a49cc00aff54feacc1fbcdacf3af255e0a1
2023-10-30 19:22:17 +08:00
Zhen Chen 194a7d5a75 MALI: bifrost: Fix a null pointer exception when event tracing is enabled
The issue was reported in https://redmine.rock-chips.com/issues/442097.
The kernel crash log:
[   10.737137][ T1028] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
...
[   10.747955][ T1028] pc : __pi_strlen+0x60/0x84
[   10.748673][ T1028] lr : trace_event_raw_event_dma_fence+0xe0/0x1e8
...
[   10.761907][ T1028] Call trace:
[   10.762198][ T1028]  __pi_strlen+0x60/0x84
[   10.762561][ T1028]  dma_fence_init+0xd4/0xfc
[   10.762951][ T1028]  kbasep_kcpu_fence_signal_init+0x6c/0x1b0
[   10.763454][ T1028]  kbase_kcpu_fence_signal_prepare+0x6c/0x134
[   10.763980][ T1028]  kbase_csf_kcpu_queue_enqueue+0x1d0/0x10ec
[   10.764499][ T1028]  kbase_ioctl+0xa80/0xf78
[   10.764890][ T1028]  __arm64_sys_ioctl+0x90/0xc8
[   10.765296][ T1028]  el0_svc_common+0xac/0x1ac
[   10.765691][ T1028]  do_el0_svc+0x1c/0x28
[   10.766058][ T1028]  el0_svc+0x10/0x1c
[   10.766389][ T1028]  el0_sync_handler+0x68/0xac
[   10.766796][ T1028]  el0_sync+0x160/0x180

Change-Id: I68739107dd9486b3a964746583c526a51f68e1ae
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-10-18 15:44:29 +08:00
Bian Jin chen 3868949da6 mali400: Fix compilation errors on clang-r487747c.
Signed-off-by: Bian Jin chen <kenjc.bian@rock-chips.com>
Change-Id: I2c4bbf5fb7513eca3cc7f01963dd977b7fd58462
2023-06-16 18:07:41 +08:00
Zhen Chen 73b5dde370 MALI: bifrost: Not to call kbase_ipa_reset_data() if rockchip simple-power-model is used
When rockchip simple-power-model is used,
kbase_ipa_reset_data() for the default mali power models should not be called.

The issue is exposed by the following exception logs:
[    3.406039] ------------[ cut here ]------------
[    3.406056] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
[    3.406081] WARNING: CPU: 1 PID: 154 at kernel/locking/mutex.c:955 __mutex_lock_common+0x974/0xbc0
[    3.406094] Modules linked in:
[    3.406111] CPU: 1 PID: 154 Comm: kworker/u16:3 Not tainted 5.10.157 #110
[    3.406118] Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
[    3.406132] Workqueue: devfreq_wq devfreq_monitor
[    3.406144] pstate: 60c00009 (nZCv daif +PAN +UAO -TCO BTYPE=--)
[    3.406152] pc : __mutex_lock_common+0x974/0xbc0
[    3.406161] lr : __mutex_lock_common+0x974/0xbc0
...
[    3.406342] Call trace:
[    3.406351] __mutex_lock_common+0x974/0xbc0
[    3.406361] mutex_lock_nested+0x50/0x5c
[    3.406374] kbase_ipa_reset_data+0x40/0x154
[    3.406384] kbase_devfreq_status+0x60/0x90
[    3.406394] devfreq_simple_ondemand_func+0x34/0x104
[    3.406401] update_devfreq+0x60/0xf0
[    3.406408] devfreq_monitor+0x34/0x9c
[    3.406421] process_one_work+0x218/0x358
[    3.406429] worker_thread+0x230/0x4e0
[    3.406439] kthread+0x144/0x160
[    3.406449] ret_from_fork+0x10/0x30

Fixes: 68c4487930 ("MALI: bifrost: not to call kbase_ipa_init() if rockchip simple-power-model is used")
Change-Id: I5fb5d4b6e63df77e6ea45ab3c60d627e3d0a03a2
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-06-14 15:05:49 +08:00
Tao Huang 8c43b7ff27 soc: rockchip_system_monitor: Fix TPYE -> TYPE typo
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I815c6e01039c0ba6469b575cf86349e6b87148c5
2023-06-13 15:28:39 +08:00
Zhen Chen eaf544c6d9 Mali: bifrost: disable tiler heap reclaiming temporally
Comes from mail "230423: 15:04: ARM support: Yao: ".

This patch and fw_230426 can resolve the occurrence
of "Unhandled Page fault" and CS_FAULTs exceptions
in the stress test "Dvfs+Gl_retrace+Rockx+emmc".

In another mail, Yao said "before any further suggestion or conclusion from RD,
you could temporally WA the issue by disable tiler heap reclaim".

Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: If06aa8e207b05f1a277aae9a86d1ff76b9a9f93b
2023-06-08 11:18:42 +08:00
Zhen Chen e8df1af4f2 Mali: bifrost: use task_tgid_vnr() and task_pid_vnr() to get tgid and pid
To resolve the error of "Failed to get pid pointer for ...",
when running in container environment that uses pid_namespace.

Change-Id: Iff033d9cd8af33b9f2a536cbfbe2ae1e8d71bfba
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-05-30 18:41:29 +08:00
Zhen Chen 7a76350c1e MALI: rockchip: upgrade bifrost DDK to g18p0-01eac0, from g17p0-01eac0
Change-Id: I2c7e002c4b1a1834f89c52e4113e3b2f48f9cba6
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-05-30 18:41:29 +08:00
Zhen Chen 22047de6cf MALI: midgard: Fix a bug of dereferencing possible ERR_PTR()
The original error check message:
drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c:371 midgard_kbase_devfreq_init() error: 'kbdev->devfreq' dereferencing possible ERR_PTR()

Modifications here are based on corresponding codes in drivers/gpu/arm/bifrost/.

Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: I6d74d39b92ce89e72814f3a0749b79140338b229
2023-05-24 11:19:04 +08:00
Zhen Chen d3eea38dbb Mali: bifrost: make some functions not depend on CONFIG_DEBUG_FS
Including:
kbase_device_kinstr_prfcnt_init(),
kbase_device_kinstr_prfcnt_term(),
kbase_device_io_history_init(),
kbase_device_io_history_term.

To resolve compilation errors when CONFIG_DEBUG_FS is not enabled.

Change-Id: Ibeaf97bd9fdbbb45308160e11c4dbb386a0dea71
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-04-27 09:49:05 +08:00
Zhen Chen 68c4487930 MALI: bifrost: not to call kbase_ipa_init() if rockchip simple-power-model is used
To avoid warning logs:
[ 4.268726] mali fb000000.gpu: Couldn't find power_model DT node matching 'arm,mali-simple-power-model'
[ 4.268737] mali fb000000.gpu: Error -22, no DT entry: mali-simple-power-model.static-coefficient = 1*[0]
[ 4.268899] mali fb000000.gpu: Error -22, no DT entry: mali-simple-power-model.dynamic-coefficient = 1*[0]
[ 4.269057] mali fb000000.gpu: Error -22, no DT entry: mali-simple-power-model.ts = 4*[0]
[ 4.269222] mali fb000000.gpu: Error -22, no DT entry: mali-simple-power-model.thermal-zone = ''

Change-Id: I4f7248c0847b0f161ad2fb04b4ce5a7c6777a770
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-04-27 09:48:57 +08:00
Shaohan Yao 791feb8cc2 mali400: mali: Add rockchip simple-power-model support
Signed-off-by: Shaohan Yao <shaohan.yao@rock-chips.com>
Change-Id: I0f4edae3b6ad76d31fdc93a5cf96561afe0511ee
2023-04-17 17:05:08 +08:00
Liang Chen 47989c4975 mali400: mali: set clk_gpu to normal pll when suspend
The pvtpll will power-down when suspend, and it will cause gpu resume
failed, so do not use pvtpll when suspend.

Signed-off-by: Liang Chen <cl@rock-chips.com>
Change-Id: Ibf06cc8d836c994468751a66cf9ed3d0cc1e4b9f
2023-04-06 09:44:27 +08:00
Liang Chen 5302628c0d MALI: mali400: force gpu enter runtime suspend before system suspend
Signed-off-by: Liang Chen <cl@rock-chips.com>
Change-Id: I17c3c883774de97f2e09c56184ed98baf1ce5a07
2023-04-06 09:44:27 +08:00
Zhen Chen 25b2037af2 MALI: rockchip: upgrade bifrost DDK to g17p0-01eac0, from g15p0-01eac0
In addition, add some more modifications, according to
commit ccf3f0670c ("MALI: bifrost: from ARM: Remove references to PageMovable()").

Note, the corresponding mali_csffw.bin for DDK g15 MUST be used.

Change-Id: Ie233cd29d8d169202d5b80b00a97ccb90e6bd3f2
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-03-16 19:13:26 +08:00
Zhen Chen ccf3f0670c MALI: bifrost: from ARM: Remove references to PageMovable()
The original patch is attached in the mail of Zhigang.Yao@arm.com at 2023-02-08 09:00.

Commit message in the original patch:
{
From d1245d8578ba6ae4fb1b0f70417a97ea6afa920d Mon Sep 17 00:00:00 2001
From: Raffaele Aquilone <raffaele.aquilone@arm.com>
Date: Thu, 19 Jan 2023 15:26:12 +0000
Subject: [PATCH] GPUCORE-36657 Remove PageMovable() symbol

The PageMovable() function has been removed from the DDK because
it cannot be used in Android. The movable status of the page has
been duplicated into the status variable of the page metadata,
and it's kept up to date every time the movable property is set or
cleared, except in those cases where it's not necessary to keep
alive the information.

The unit test that attempts to migrate a firmware page has been
removed because now the driver has no way to detect that a page
without metadata is not movable; the driver has to trust that
the system doesn't try to isolate pages which are not movable.
...
}

Its base is not current g15.
I applied it manually on DDK g15.

Change-Id: I7e8a29f3ce79d991bc8b3a746690e9ef279e572a
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2023-02-16 18:19:50 +08:00
Finley Xiao 49aa54ec05 MALI: bifrost: Fix building error when disable CONFIG_MALI_BIFROST_DEVFREQ
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I523b4f8e547c49e2e262fe29c7252888e0694a6c
2023-02-03 16:35:31 +08:00
Zhen Chen b77f682d3c MALI: bifrost: fix a compilation error when DEBUG_FS and MALI_CSF_SUPPORT are disabled
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: I8f4228ccc6a8ef5d9bb9f3cb43a10fd091bbc5c5
2023-01-10 11:12:17 +08:00
Finley Xiao 70f62fd169 MALI: mali400: Add support to use scmi clock
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I19f19c3091efcbb9ddd9290d37812bd3a8601076
2022-12-22 11:19:51 +08:00
Finley Xiao b1bae8a36b MALI: bifrost: Implement set_soc_info and set_soc_info for rk3588
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: Ic5dddbd667b63b61f60b80270ba8bae8b1086852
2022-12-07 17:21:51 +08:00
Zhen Chen 034aad5dd8 MALI: rockchip: upgrade bifrost DDK to g15p0-01eac0, from g13p0-01eac0
Note, the corresponding mali_csffw.bin for DDK g15 MUST be used.

Change-Id: Ic30634fa6247d62bf96f506c64d13b89e16b02e6
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-11-22 14:13:04 +08:00
Jacob Chen 4e8fc0099d MALI: utgard: fix mali_mmap failed
Validate vmf_insert_pfn return value with VM_FAULT_NOPAGE

Signed-off-by: Jacob Chen <cc@rock-chips.com>
Change-Id: I53b1eabd20ab76f08f5edf571ead1ffaccd19ec1
2022-11-16 10:48:04 +08:00
Zhen Chen aef810d2c1 MALI: bifrost: from ARM: do a faster & cleaner reset for unrecoverable CS_FATAL
This is part of the workaround for HW_issue_of_fragment_endpoint_TERMINATED_responses,
though it is not expected to be triggered often.

Change-Id: I6b0cf15b8050ebacd3099f52af1a03d786c6ff44
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-09-23 15:21:33 +08:00
Zhen Chen d559263e69 MALI: bifrost: from ARM: handle_oom_event(): ignore "Invalid Heap statistics" error
Continue heap chunk alloc.

Change-Id: I49aade60f7d2402c7ae268eafb4d717f9147a88e
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-09-23 15:21:24 +08:00
Zhen Chen c38b77a6e2 MALI: rockchip: upgrade bifrost DDK to g13p0-01eac0, from g12p0-01eac0
Note, the corresponding mali_csffw.bin for DDK g13 MUST be used.

Change-Id: I63c00b4eccd2e780aea2691faa2ecea6847c41e2
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-09-23 15:21:15 +08:00
Zhen Chen 2b324c9063 MALI: bifrost: quick_reset: disable err logs when quick_reset is enabled
Not work for CSF based Valhall GPU.

Change-Id: Ic2ad8073f8091b4d31f15527d30f10759d5b01ed
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-09-21 17:34:37 +08:00
Zhen Chen 216596cf79 MALI: bifrost: quick_reset: use short timeout (quick_reset) for the case to workaround
Not work for CSF based Valhall GPU.

Change-Id: I38d27d2006e25acbab826efd36b49efffa6b79f1
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-09-21 17:34:37 +08:00
Zhen Chen d61da3a0f2 MALI: bifrost: quick_reset: reduce JM_DEFAULT_RESET_TIMEOUT_MS to 1 (ms)
To implement quick reset.
Not work for CSF based Valhall GPU.

Change-Id: I4d84d3a11ec4a5632c1a5f09bd90ed241fb9fc9a
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-09-20 19:34:32 +08:00
Zhen Chen cd13ec865c MALI: bifrost: log: not to output "Protected memory allocator not found, Firmware protected mode entry will not be supported" as err log
It's allowed to run without firmware protected mode entry.
While the customer of RK3588 might be troubled by the log.

Change-Id: I9f1b7c795f2095f1851692c93a7f4598acf702fc
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-09-14 10:57:17 +08:00
Tao Huang 00a0a68f4e MALI: midgard: Fix compile warning when !CONFIG_DEBUG_FS
In file included from drivers/gpu/arm/midgard/backend/gpu/mali_kbase_mmu_hw_direct.c:22:
 drivers/gpu/arm/midgard/mali_kbase.h:600:9: warning: 'kbase_io_history_term' macro redefined [-Wmacro-redefined]
 #define kbase_io_history_term CSTD_NOP
         ^
 drivers/gpu/arm/midgard/rename.h:139:9: note: previous definition is here
 #define kbase_io_history_term midgard_kbase_io_history_term
         ^

In file included from drivers/gpu/arm/midgard/mali_kbase_core_linux.c:42:
 drivers/gpu/arm/midgard/mali_kbase_regs_history_debugfs.h:46:9: warning: 'kbasep_regs_history_debugfs_init' macro redefined [-Wmacro-redefined]
 #define kbasep_regs_history_debugfs_init CSTD_NOP
         ^
 drivers/gpu/arm/midgard/rename.h:326:9: note: previous definition is here
 #define kbasep_regs_history_debugfs_init midgard_kbasep_regs_history_debugfs_init
         ^

Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Change-Id: I8de63444cdb8d5cf265f3d6a80ab0ad69bec3754
2022-07-26 14:49:34 +08:00
Finley Xiao 7d9a7b1eff MALI: bifrost: Fix NULL pointer dereference when only one regulator
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000078
Mem abort info:
  ESR = 0x96000005
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
Data abort info:
  ISV = 0, ISS = 0x00000005
  CM = 0, WnR = 0
[0000000000000078] user address but active_mm is swapper
Internal error: Oops: 96000005 [#1] PREEMPT SMP
Modules linked in:
CPU: 2 PID: 159 Comm: kworker/u8:2 Not tainted 5.10.66 #1719
Hardware name: Rockchip RK3566 EVB2 LP4X V10 Board (DT)
Workqueue: devfreq_wq devfreq_monitor
pstate: 20c00009 (nzCv daif +PAN +UAO -TCO BTYPE=--)
pc : regulator_set_voltage+0x34/0xa0
lr : kbase_devfreq_opp_helper+0x194/0x364
sp : ffffffc014133b20
x29: ffffffc014133b40 x28: 000000000bebc200
x27: 0000000000000000 x26: ffffff8005486268
x25: 0000000000000001 x24: ffffff8005c522b0
x23: ffffff8005483800 x22: ffffff80054839e0
x21: 000000000000314c x20: 0000000000000000
x19: ffffff8005483a00 x18: ffffffc0140b5050
x17: 0000000000000000 x16: 0000000000000001
x15: 0000000000000000 x14: ffffffffffffffc8
x13: 0000000000000000 x12: 0000000000000014
x11: 0000000000000000 x10: ffffff8005486100
x9 : 00000000ffffffff x8 : f06ef41598ba9d00
x7 : 00000000000c96a8 x6 : 0000000000000001
x5 : 0000000000000001 x4 : 000000000bebc200
x3 : 0000000000000000 x2 : 000000007fffffff
x1 : ffffffc014133b20 x0 : 0000000000000000
Call trace:
 regulator_set_voltage+0x34/0xa0
 kbase_devfreq_opp_helper+0x194/0x364
 dev_pm_opp_set_rate+0x2ec/0x92c
 kbase_devfreq_target+0x7c/0xd0
 devfreq_set_target+0x80/0x200
 update_devfreq+0x114/0x148
 devfreq_monitor+0x30/0x12c
 process_one_work+0x1f4/0x490
 worker_thread+0x278/0x4dc
 kthread+0x13c/0x344
 ret_from_fork+0x10/0x30

Fixes: 98a9b2cbb4 ("MALI: bifrost: Add memory regulator support")
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: Ie2a1f0f86169facf31de3cfc9aba5d42092a5d41
2022-07-08 17:31:29 +08:00
Zhen Chen ab86d8ad07 MALI: rockchip: upgrade bifrost DDK to g12p0-01eac0, from g11p0-01eac0o
Change-Id: Ifde51336daa7c735118a314fcfc2fde38d7132b3
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-06-21 11:27:08 +08:00
Finley Xiao 2598d85d44 MALI: bifrost: Add missing error code in kbase_devfreq_opp_helper()
Fixes: eb26be047e ("MALI: bifrost: Set intermediate rate before change read margin")
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: Id4df3e3b990762bc737d1b78f44e95fa00d12aff
2022-06-06 15:24:53 +08:00
Zhen Chen 8fd4cab89d MALI: bifrost: kernel_map_user_io_pages(): log error if vmap() returns NULL.
Change-Id: Ie1d3682cc32fc191815210f19198b1b4922d830d
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-06-06 11:10:53 +08:00
Zhen Chen 9eccd1f8a3 MALI: bifrost: prevent a rare null pointer exception in update_on_slot_queues_offsets()
The most recent situation is that the null pointer exception
is only reported from repeated reboot test on rk3588_EDGE_SDK,
not on rk3588_Linux_SDK or rk3588_Android_SDK.

Change-Id: I1e5ce9eb9fd32c29294e115e6014a8114c896754
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-06-06 11:09:35 +08:00
Finley Xiao e7fd42c35e MALI: bifrost: disable regulator when pm status is suspended
The system calls pm_runtime_get_noresume() to prevent device
from entering to runtime suspend status when reboot, and the
pm_runtime_put_sync_suspend() is called in a delay work,
so when reboot the power domain may be power on,
but the regulator is disabled, it's not allowed.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: Ie25451ddf4fc866e93e7272a8d9a809919a96e1d
2022-05-12 18:59:23 +08:00
Finley Xiao fe111758d6 MALI: bifrost: enable regulator when suspend
When system resume, all power domains will power on in
dpm_noirq_resume_devices(), if vdd gpu is disabled before system
suspend, the pd gpu will failed to power on when system resume,
the detail as follows:

rockchip-pm-domain fd8d8000.power-management:power-controller: failed to get ack on domain 'gpu', target_idle = 0, target_ack = 0, val=0x8080f
Kernel panic - not syncing: panic_on_set_idle set ...
CPU: 0 PID: 1947 Comm: Binder:352_2 Not tainted 5.10.66 #960
Hardware name: Rockchip RK3588 EVB1 LP4 V10 Board (DT)
Call trace:
 dump_backtrace+0x0/0x1c8
 show_stack+0x1c/0x2c
 dump_stack_lvl+0xdc/0x12c
 dump_stack+0x1c/0x64
 panic+0x150/0x3a4
 rockchip_pmu_set_idle_request+0x1f8/0x1fc
 rockchip_pd_power+0x11c/0x1e0
 rockchip_pd_power_on+0x28/0x38
 genpd_sync_power_on+0xf4/0x134
 genpd_resume_noirq+0x70/0xd0
 device_resume_noirq+0x1a8/0x410
 dpm_noirq_resume_devices+0x100/0x55c
 dpm_resume_noirq+0x18/0x34
 suspend_enter+0x33c/0x52c
 suspend_devices_and_enter+0xec/0x338
 enter_state+0x12c/0x3f8
 pm_suspend+0x60/0xcc
 state_store+0x108/0x148
 kobj_attr_store+0x1c/0x34
 sysfs_kf_write+0x40/0x58
 kernfs_fop_write_iter+0xf0/0x194
 vfs_write+0x328/0x390
 ksys_write+0x78/0xe8
 __arm64_sys_write+0x20/0x30
 el0_svc_common+0xc0/0x23c
 do_el0_svc+0x28/0x88
 el0_svc+0x14/0x24
 el0_sync_handler+0x88/0xec
 el0_sync+0x1a8/0x1c0
SMP: stopping secondary CPUs

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I89f80d37ab2cc61c715bce3f8a25c26552918922
2022-05-12 18:59:23 +08:00
Zhen Chen 5f5ce518ca MALI: bifrost: treat "Could not get a valid AS for group ..." as a debug log not warning
In mail 'RE: <rock-chips>: G610: Valhall Android DDK r36:
Does device driver warning log "Could not get a valid AS for group ..." matter?',
zhigang.yao@arm.com declared that it should not be a warning:

"This is expected behavior.
GPU has a limited present HW address space resource,
max is 16, and is implementation specific, (8 on Odin?).
So if there are more than 16 (8 on Odin) process,
some of it might not get a valid present address space,
and the warning would be printed as you have observed."

Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: Ic8324c37461776672d516b472db66549d91fe552
2022-04-22 14:22:37 +08:00
Finley Xiao cb62fa6675 MALI: bifrost: Change clock source to normal pll when suspend
When call pm_runtime_get_sync(), the runtime callback will change clock
source to normal pll, but now pm_runtime_get_sync() is called in a delay
work and the wakelock seems to be invalid on linux system,
so when suspend the pm_runtime_get_sync() may not be called.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I0a951b455c10158ca63d747e35e9001cdbdde91c
2022-04-01 09:33:18 +08:00
Finley Xiao 0f3739e0b7 MALI: bifrost: Kconfig: Don't select PM_DEVFREQ and DEVFREQ_THERMAL
If use savedefconfig to update defconfig, PM_DEVFREQ and DEVFREQ_THERMAL
will be removed, and dmc and opp_select also depend on PM_DEVFREQ,
enable them default.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: Ied5ac8e70fe195294df2752160ce6e56360f2db8
2022-03-11 11:00:00 +08:00
Zhen Chen 7c3725c8f1 MALI: bifrost: remove a verbose log
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
Change-Id: I06184a601d5817d87433cbcde19b39bccc12f774
2022-03-03 18:19:25 +08:00
Finley Xiao eb26be047e MALI: bifrost: Set intermediate rate before change read margin
Improve stability when change read margin.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I0ddb1d00c670cbc8e4c64f999382f1420a86c537
2022-03-03 18:01:38 +08:00
Finley Xiao f5f2d23805 soc: rockchip: opp_select: Implement rockchip_get_read_margin()
In order to get target read margin and scmi clk earlier,
and it will also be used in later submissions.

Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I75bd79dc4963fa0dcc73d7c66a696e1cc0c177b7
2022-03-03 18:01:38 +08:00
Zhen Chen 643f7908a0 MALI: rockchip: upgrade bifrost DDK to g11p0-01eac0, from g10p0-01eac0
Change-Id: I0642ec37f151711b8b19c3206488d3301422971d
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-03-01 19:53:20 +08:00
Zhen Chen c019aa3cbf MALI: bifrost: Fix incorrect dmesg warning for unexpected GPU activities
The warning logs fixed are "GPU activity takes longer than time interval, ...".

This fix is provided as 496f5e3.diff by Zhigang.Yao@arm.com of support_mali.
The original commit message within 496f5e3.diff:
{
From 496f5e37a803266e71cbf7b6eb5871fe2fcd8931 Mon Sep 17 00:00:00 2001
From: Tu Vuong <tu.vuong@arm.com>
Date: Wed, 09 Feb 2022 09:31:20 +0000
Subject: [PATCH] GPUCORE-30123 Fix incorrect dmesg warning for unexpected GPU activities

The DVFS utilisation calculation detects when the GPU has expended more
cycles than expected compared to the actual time passed. This margin was
not sufficient as it didn't take into account the worst-case scenario
where samples are taken TIMER_DEFAULT_VALUE_MS apart.
}

Change-Id: I16bb904fd77006f6ab1e4419e44a9834550e4c07
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-02-16 11:37:51 +08:00
Zhen Chen 8556e654d6 MALI: bifrost: fix panic "stack is corrupted in: kbase_get_real_power_locked"
The panic was triggered
by running "cat /sys/kernel/debug/mali0/ipa_current_power".

It is fixed by enlarging KBASE_IPA_BLOCK_TYPE_NUM according to the fact
that we set 4 clks for GPU in rk3588 dts.

Change-Id: I3a87f6f2d25cf296d95d033d3d98c51666ea482d
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-02-08 20:11:31 +08:00
Finley Xiao f4639a388e MALI: bifrost: Add support to only calculate dynamic power
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Change-Id: I62047acb6a57652c9473d117651f4bf75fcbbb28
2022-01-21 20:29:48 +08:00
Zhen Chen c7ac8c9aa3 MALI: bifrost: fix bug that GPU is not powered off after idle
The bug was found in the case of that system suspend process was broken off
for USB ADB being connected.

This fix is provided by Zhigang.Yao@arm.com of support_mali.

Related RK redmine case:
https://redmine.rock-chips.com/issues/334539

Change-Id: I4772ed901a7fe54884a79a53b3ca9f6fd7beed40
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-01-13 15:12:48 +08:00
Zhen Chen 3f89b26931 MALI: rockchip: upgrade bifrost DDK to g10p0-01eac0, from g9p0-01eac0
Change-Id: If5e4683a1da37e00eeaa5a16463206f6f45ecfb4
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2022-01-07 11:05:37 +08:00