CHROMIUM: MALI: GPUSWERRATA-1031

This fixes the issue GPUCORE-26482.
See the internal discussion for details.

BUG=b:178054940,chromium:1169049
TEST=boot kukui 4.19 kernel

Change-Id: Ice6bd81e2adfb0e6fef36359e7d3717c4f042313
Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2726847
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
(cherry picked from commit bbfdeba67a9e7dca3c4d4ea623f738916ff0e568)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2754888
diff --git a/drivers/gpu/arm/bifrost/mali_kbase_debug_mem_view.c b/drivers/gpu/arm/bifrost/mali_kbase_debug_mem_view.c
index 4788137..0ca8e65 100644
--- a/drivers/gpu/arm/bifrost/mali_kbase_debug_mem_view.c
+++ b/drivers/gpu/arm/bifrost/mali_kbase_debug_mem_view.c
@@ -179,6 +179,13 @@
 			/* Empty region - ignore */
 			continue;
 
+		if (reg->flags & KBASE_REG_PROTECTED) {
+			/* CPU access to protected memory is forbidden - so
+			 * skip this GPU virtual region.
+			 */
+			continue;
+		}
+
 		mapping = kmalloc(sizeof(*mapping), GFP_KERNEL);
 		if (!mapping) {
 			ret = -ENOMEM;