summaryrefslogtreecommitdiff
path: root/mali_kbase
diff options
context:
space:
mode:
authorPixelBot AutoMerger <android-nexus-securitybot@system.gserviceaccount.com>2023-06-18 18:27:00 -0700
committerSecurityBot <android-nexus-securitybot@system.gserviceaccount.com>2023-06-18 18:27:00 -0700
commitc65ea48a7a1cfabf08c130f270a5b749a5438a93 (patch)
tree4f256071e151ef159fab6a18563e56d3ee90ab40 /mali_kbase
parent81e3e9557df0dbe8414106b9a3f6057cd2c58d58 (diff)
parenta26b51ecfb9ac6fb8fa5b1998c7c1896ab5b1478 (diff)
downloadgpu-c65ea48a7a1cfabf08c130f270a5b749a5438a93.tar.gz
Merge android13-gs-pixel-5.10-udc into android13-gs-pixel-5.10-udc-qpr1
SBMerger: 526756187 Change-Id: Iddb56c0a11fefedd9d44d653ddf327d075e4d919 Signed-off-by: SecurityBot <android-nexus-securitybot@system.gserviceaccount.com>
Diffstat (limited to 'mali_kbase')
-rw-r--r--mali_kbase/csf/mali_kbase_csf.c17
-rw-r--r--mali_kbase/mali_kbase_jd.c8
2 files changed, 23 insertions, 2 deletions
diff --git a/mali_kbase/csf/mali_kbase_csf.c b/mali_kbase/csf/mali_kbase_csf.c
index 29542a6..fce6aaa 100644
--- a/mali_kbase/csf/mali_kbase_csf.c
+++ b/mali_kbase/csf/mali_kbase_csf.c
@@ -852,6 +852,15 @@ void kbase_csf_ring_csg_slots_doorbell(struct kbase_device *kbdev,
if (WARN_ON(slot_bitmap > allowed_bitmap))
return;
+ /* The access to GLB_DB_REQ/ACK needs to be ordered with respect to CSG_REQ/ACK and
+ * CSG_DB_REQ/ACK to avoid a scenario where a CSI request overlaps with a CSG request
+ * or 2 CSI requests overlap and FW ends up missing the 2nd request.
+ * Memory barrier is required, both on Host and FW side, to guarantee the ordering.
+ *
+ * 'osh' is used as CPU and GPU would be in the same Outer shareable domain.
+ */
+ dmb(osh);
+
value = kbase_csf_firmware_global_output(global_iface, GLB_DB_ACK);
value ^= slot_bitmap;
kbase_csf_firmware_global_input_mask(global_iface, GLB_DB_REQ, value,
@@ -890,6 +899,14 @@ void kbase_csf_ring_cs_kernel_doorbell(struct kbase_device *kbdev,
WARN_ON(csi_index >= ginfo->stream_num))
return;
+ /* The access to CSG_DB_REQ/ACK needs to be ordered with respect to
+ * CS_REQ/ACK to avoid a scenario where CSG_DB_REQ/ACK becomes visible to
+ * FW before CS_REQ/ACK is set.
+ *
+ * 'osh' is used as CPU and GPU would be in the same outer shareable domain.
+ */
+ dmb(osh);
+
value = kbase_csf_firmware_csg_output(ginfo, CSG_DB_ACK);
value ^= (1 << csi_index);
kbase_csf_firmware_csg_input_mask(ginfo, CSG_DB_REQ, value,
diff --git a/mali_kbase/mali_kbase_jd.c b/mali_kbase/mali_kbase_jd.c
index 8667819..66064ec 100644
--- a/mali_kbase/mali_kbase_jd.c
+++ b/mali_kbase/mali_kbase_jd.c
@@ -762,10 +762,13 @@ static void jd_mark_simple_gfx_frame_atoms(struct kbase_jd_atom *katom)
}
if (dep_fence && dep_vtx) {
+ unsigned long flags;
dev_dbg(kbdev->dev, "Simple gfx frame: {vtx=%pK, wait=%pK}->frag=%pK\n",
dep_vtx, dep_fence, katom);
+ spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
katom->atom_flags |= KBASE_KATOM_FLAG_SIMPLE_FRAME_FRAGMENT;
dep_vtx->atom_flags |= KBASE_KATOM_FLAG_DEFER_WHILE_POWEROFF;
+ spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
}
}
@@ -839,14 +842,15 @@ bool kbase_jd_done_nolock(struct kbase_jd_atom *katom, bool post_immediately)
dev_dbg(kctx->kbdev->dev,
"Simple-frame fragment atom %pK unblocked\n",
node);
- node->atom_flags &=
- ~KBASE_KATOM_FLAG_SIMPLE_FRAME_FRAGMENT;
for (i = 0; i < 2; i++) {
if (node->dep[i].atom &&
node->dep[i].atom->atom_flags &
KBASE_KATOM_FLAG_DEFER_WHILE_POWEROFF) {
+ unsigned long flags;
+ spin_lock_irqsave(&kctx->kbdev->hwaccess_lock, flags);
node->dep[i].atom->atom_flags &=
~KBASE_KATOM_FLAG_DEFER_WHILE_POWEROFF;
+ spin_unlock_irqrestore(&kctx->kbdev->hwaccess_lock, flags);
dev_dbg(kctx->kbdev->dev,
" Undeferred atom %pK\n",
node->dep[i].atom);