summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Kumar Tiwari <sky.tiwari@samsung.com>2023-12-20 14:13:14 +0530
committerNecip Fazil Yildiran <necip@google.com>2023-12-27 21:12:49 +0000
commit1c483a2b3475759095e985c3a9c702e808d09ea3 (patch)
tree1bfefeb167a9242d0158aeb0f9e47ff61076f704
parent35830bc40a72a19e6b3c586d5c62b96ff163464d (diff)
downloadexynos-android-wear-13.0.0_r0.9.tar.gz
gpu: r29p0: CVE-2023-6143android-wear-13.0.0_r0.9
Bug: 316181677 Bug: 316197619 Change-Id: Ib459f144c1e0a904a9c0ee7247aafc9b1c959ce0 Signed-off-by: Sachin Kumar Tiwari <sky.tiwari@samsung.com> Signed-off-by: Necip Fazil Yildiran <necip@google.com>
-rw-r--r--drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_device_hw.c25
-rw-r--r--drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_defs.h3
-rw-r--r--drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_driver.c4
3 files changed, 24 insertions, 8 deletions
diff --git a/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_device_hw.c b/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_device_hw.c
index abb7c25b04fd..e93294a2c4ad 100644
--- a/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_device_hw.c
+++ b/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_device_hw.c
@@ -337,15 +337,24 @@ void kbase_gpu_interrupt(struct kbase_device *kbdev, u32 val)
if (val & CLEAN_CACHES_COMPLETED)
kbase_clean_caches_done(kbdev);
- /* When 'platform_power_down_only' is enabled, the L2 cache is not
- * powered down, but flushed before the GPU power down (which is done
- * by the platform code). So the L2 state machine requests a cache
- * flush. And when that flush completes, the L2 state machine needs to
- * be re-invoked to proceed with the GPU power down.
- */
- if (val & POWER_CHANGED_ALL ||
- (platform_power_down_only && (val & CLEAN_CACHES_COMPLETED)))
+ if (val & POWER_CHANGED_ALL) {
kbase_pm_power_changed(kbdev);
+ } else if (val & CLEAN_CACHES_COMPLETED) {
+ /* When 'platform_power_down_only' is enabled, the L2 cache is
+ * not powered down, but flushed before the GPU power down
+ * (which is done by the platform code). So the L2 state machine
+ * requests a cache flush. And when that flush completes, the L2
+ * state machine needs to be re-invoked to proceed with the GPU
+ * power down.
+ * If cache line evict messages can be lost when shader cores
+ * power down then we need to flush the L2 cache before powering
+ * down cores. When the flush completes, the shaders' state
+ * machine needs to be re-invoked to proceed with powering down
+ * cores.
+ */
+ if (platform_power_down_only)
+ kbase_pm_power_changed(kbdev);
+ }
KBASE_TRACE_ADD(kbdev, CORE_GPU_IRQ_DONE, NULL, NULL, 0u, val);
}
diff --git a/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_defs.h b/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_defs.h
index 439c03cc7768..7240c275215d 100644
--- a/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_defs.h
+++ b/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_defs.h
@@ -108,6 +108,8 @@ enum kbase_l2_core_state {
* power off, but they remain on for the
* duration of the hysteresis timer
* @KBASE_SHADERS_WAIT_FINISHED_CORESTACK_ON: The hysteresis timer has expired
+ * @KBASE_SHADERS_READY_OFF_CORESTACK_ON: The core stacks are on and the shaders
+ * are ready to be powered off.
* @KBASE_SHADERS_PEND_OFF_CORESTACK_ON: The core stacks are on, and the shaders
* have been requested to power off
* @KBASE_SHADERS_OFF_CORESTACK_PEND_OFF: The shaders are off, and the core stacks
@@ -127,6 +129,7 @@ enum kbase_shader_core_state {
KBASE_SHADERS_ON_CORESTACK_ON_RECHECK,
KBASE_SHADERS_WAIT_OFF_CORESTACK_ON,
KBASE_SHADERS_WAIT_FINISHED_CORESTACK_ON,
+ KBASE_SHADERS_READY_OFF_CORESTACK_ON,
KBASE_SHADERS_PEND_OFF_CORESTACK_ON,
KBASE_SHADERS_OFF_CORESTACK_PEND_OFF,
KBASE_SHADERS_OFF_CORESTACK_OFF_TIMER_PEND_OFF,
diff --git a/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_driver.c b/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_driver.c
index e8cca10c0d61..a28aa535f232 100644
--- a/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_driver.c
+++ b/drivers/gpu/arm/t72x/r29p0/backend/gpu/mali_kbase_pm_driver.c
@@ -903,7 +903,11 @@ static void kbase_pm_shaders_update_state(struct kbase_device *kbdev)
case KBASE_SHADERS_WAIT_FINISHED_CORESTACK_ON:
shader_poweroff_timer_queue_cancel(kbdev);
+ backend->shaders_state =
+ KBASE_SHADERS_READY_OFF_CORESTACK_ON;
+ break;
+ case KBASE_SHADERS_READY_OFF_CORESTACK_ON:
if (!platform_power_down_only)
kbase_pm_invoke(kbdev, KBASE_PM_CORE_SHADER,
shaders_ready, ACTION_PWROFF);