summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/include/linux/dma-buf-test-exporter.h2
-rw-r--r--common/include/linux/memory_group_manager.h2
-rw-r--r--common/include/linux/protected_memory_allocator.h2
-rw-r--r--common/include/linux/protected_mode_switcher.h2
-rw-r--r--common/include/uapi/gpu/arm/midgard/backend/gpu/mali_kbase_model_dummy.h53
-rw-r--r--common/include/uapi/gpu/arm/midgard/csf/mali_gpu_csf_registers.h76
-rw-r--r--common/include/uapi/gpu/arm/midgard/csf/mali_kbase_csf_ioctl.h47
-rw-r--r--common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_id.h2
-rw-r--r--common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_regmap.h10
-rw-r--r--mali_kbase/Kbuild392
-rw-r--r--mali_kbase/Kconfig345
-rw-r--r--mali_kbase/Makefile231
-rw-r--r--mali_kbase/Mconfig275
-rw-r--r--mali_kbase/arbiter/Kbuild6
-rw-r--r--mali_kbase/arbiter/mali_kbase_arbif.c14
-rw-r--r--mali_kbase/arbiter/mali_kbase_arbif.h7
-rw-r--r--mali_kbase/arbiter/mali_kbase_arbiter_interface.h5
-rw-r--r--mali_kbase/arbiter/mali_kbase_arbiter_pm.c100
-rw-r--r--mali_kbase/arbiter/mali_kbase_arbiter_pm.h18
-rw-r--r--mali_kbase/backend/gpu/Kbuild65
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_backend_config.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c6
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c4
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_devfreq.c86
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_devfreq.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c6
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_instr_defs.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_instr_internal.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_irq_internal.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_irq_linux.c10
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_jm_as.c2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_jm_defs.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_jm_hw.c2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_jm_internal.h4
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_jm_rb.c19
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_jm_rb.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_js_internal.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_always_on.c2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_always_on.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_backend.c2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_ca.c9
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_ca.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_defs.h8
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_driver.c67
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_internal.h6
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_metrics.c22
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_policy.c30
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_pm_policy.h2
-rw-r--r--mali_kbase/backend/gpu/mali_kbase_time.c4
-rw-r--r--mali_kbase/build.bp189
-rw-r--r--mali_kbase/context/Kbuild (renamed from mali_kbase/tests/mali_kutf_irq_test/Kconfig)18
-rw-r--r--mali_kbase/context/backend/mali_kbase_context_csf.c4
-rw-r--r--mali_kbase/context/backend/mali_kbase_context_jm.c8
-rw-r--r--mali_kbase/context/mali_kbase_context.c4
-rw-r--r--mali_kbase/context/mali_kbase_context.h2
-rw-r--r--mali_kbase/context/mali_kbase_context_internal.h2
-rw-r--r--mali_kbase/csf/Kbuild41
-rw-r--r--mali_kbase/csf/ipa_control/Kbuild4
-rw-r--r--mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c4
-rw-r--r--mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf.c267
-rw-r--r--mali_kbase/csf/mali_kbase_csf.h18
-rw-r--r--mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_csg_debugfs.c39
-rw-r--r--mali_kbase/csf/mali_kbase_csf_csg_debugfs.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_defs.h10
-rw-r--r--mali_kbase/csf/mali_kbase_csf_firmware.c57
-rw-r--r--mali_kbase/csf/mali_kbase_csf_firmware.h25
-rw-r--r--mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c83
-rw-r--r--mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_kcpu.c18
-rw-r--r--mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c6
-rw-r--r--mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_protected_memory.c6
-rw-r--r--mali_kbase/csf/mali_kbase_csf_protected_memory.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_scheduler.c447
-rw-r--r--mali_kbase/csf/mali_kbase_csf_scheduler.h45
-rw-r--r--mali_kbase/csf/mali_kbase_csf_tiler_heap.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c4
-rw-r--r--mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_timeout.c4
-rw-r--r--mali_kbase/csf/mali_kbase_csf_timeout.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_tl_reader.c16
-rw-r--r--mali_kbase/csf/mali_kbase_csf_tl_reader.h2
-rw-r--r--mali_kbase/csf/mali_kbase_csf_trace_buffer.c4
-rw-r--r--mali_kbase/csf/mali_kbase_csf_trace_buffer.h2
-rw-r--r--mali_kbase/debug/Kbuild27
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h127
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h2
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c2
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h2
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h7
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c2
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h2
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h53
-rw-r--r--mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h2
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace.c6
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace.h4
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace_codes.h2
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace_defs.h4
-rw-r--r--mali_kbase/debug/mali_kbase_debug_ktrace_internal.h2
-rw-r--r--mali_kbase/device/Kbuild33
-rw-r--r--mali_kbase/device/backend/mali_kbase_device_csf.c355
-rw-r--r--mali_kbase/device/backend/mali_kbase_device_hw_jm.c2
-rw-r--r--mali_kbase/device/backend/mali_kbase_device_jm.c160
-rw-r--r--mali_kbase/device/mali_kbase_device.c91
-rw-r--r--mali_kbase/device/mali_kbase_device.h15
-rw-r--r--mali_kbase/device/mali_kbase_device_hw.c10
-rw-r--r--mali_kbase/device/mali_kbase_device_internal.h14
-rw-r--r--mali_kbase/gpu/Kbuild (renamed from mali_kbase/tests/kutf/Kconfig)15
-rw-r--r--mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c2
-rw-r--r--mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c4
-rw-r--r--mali_kbase/gpu/mali_kbase_gpu.c2
-rw-r--r--mali_kbase/ipa/Kbuild20
-rw-r--r--mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c2
-rw-r--r--mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h2
-rw-r--r--mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c2
-rw-r--r--mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h7
-rw-r--r--mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c19
-rw-r--r--mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c10
-rw-r--r--mali_kbase/ipa/mali_kbase_ipa.c13
-rw-r--r--mali_kbase/ipa/mali_kbase_ipa.h2
-rw-r--r--mali_kbase/ipa/mali_kbase_ipa_debugfs.c2
-rw-r--r--mali_kbase/ipa/mali_kbase_ipa_debugfs.h2
-rw-r--r--mali_kbase/ipa/mali_kbase_ipa_simple.c4
-rw-r--r--mali_kbase/ipa/mali_kbase_ipa_simple.h2
-rw-r--r--mali_kbase/jm/mali_kbase_jm_defs.h8
-rw-r--r--mali_kbase/jm/mali_kbase_js_defs.h4
-rw-r--r--mali_kbase/mali_base_hwconfig_features.h54
-rw-r--r--mali_kbase/mali_base_hwconfig_issues.h30
-rw-r--r--mali_kbase/mali_kbase.h4
-rw-r--r--mali_kbase/mali_kbase_as_fault_debugfs.c6
-rw-r--r--mali_kbase/mali_kbase_as_fault_debugfs.h4
-rw-r--r--mali_kbase/mali_kbase_bits.h2
-rw-r--r--mali_kbase/mali_kbase_cache_policy.c2
-rw-r--r--mali_kbase/mali_kbase_ccswe.c2
-rw-r--r--mali_kbase/mali_kbase_ccswe.h2
-rw-r--r--mali_kbase/mali_kbase_config.c24
-rw-r--r--mali_kbase/mali_kbase_config.h99
-rw-r--r--mali_kbase/mali_kbase_core_linux.c114
-rw-r--r--mali_kbase/mali_kbase_cs_experimental.h2
-rw-r--r--mali_kbase/mali_kbase_ctx_sched.c2
-rw-r--r--mali_kbase/mali_kbase_debug.c2
-rw-r--r--mali_kbase/mali_kbase_debug.h2
-rw-r--r--mali_kbase/mali_kbase_debug_job_fault.c2
-rw-r--r--mali_kbase/mali_kbase_debug_job_fault.h2
-rw-r--r--mali_kbase/mali_kbase_debug_mem_view.c4
-rw-r--r--mali_kbase/mali_kbase_debug_mem_view.h2
-rw-r--r--mali_kbase/mali_kbase_debugfs_helper.c31
-rw-r--r--mali_kbase/mali_kbase_debugfs_helper.h25
-rw-r--r--mali_kbase/mali_kbase_defs.h49
-rw-r--r--mali_kbase/mali_kbase_disjoint_events.c2
-rw-r--r--mali_kbase/mali_kbase_dma_fence.c23
-rw-r--r--mali_kbase/mali_kbase_dma_fence.h7
-rw-r--r--mali_kbase/mali_kbase_dummy_job_wa.c8
-rw-r--r--mali_kbase/mali_kbase_dummy_job_wa.h2
-rw-r--r--mali_kbase/mali_kbase_dvfs_debugfs.c4
-rw-r--r--mali_kbase/mali_kbase_dvfs_debugfs.h2
-rw-r--r--mali_kbase/mali_kbase_event.c2
-rw-r--r--mali_kbase/mali_kbase_fence.c2
-rw-r--r--mali_kbase/mali_kbase_fence.h2
-rw-r--r--mali_kbase/mali_kbase_fence_defs.h2
-rw-r--r--mali_kbase/mali_kbase_fence_ops.c2
-rw-r--r--mali_kbase/mali_kbase_gator.h2
-rw-r--r--mali_kbase/mali_kbase_gpu_memory_debugfs.c2
-rw-r--r--mali_kbase/mali_kbase_gpuprops.c16
-rw-r--r--mali_kbase/mali_kbase_gwt.c2
-rw-r--r--mali_kbase/mali_kbase_hw.c20
-rw-r--r--mali_kbase/mali_kbase_hwaccess_backend.h2
-rw-r--r--mali_kbase/mali_kbase_hwaccess_defs.h2
-rw-r--r--mali_kbase/mali_kbase_hwaccess_gpuprops.h2
-rw-r--r--mali_kbase/mali_kbase_hwaccess_instr.h4
-rw-r--r--mali_kbase/mali_kbase_hwaccess_pm.h2
-rw-r--r--mali_kbase/mali_kbase_hwcnt.c2
-rw-r--r--mali_kbase/mali_kbase_hwcnt_accumulator.h2
-rw-r--r--mali_kbase/mali_kbase_hwcnt_backend.h71
-rw-r--r--mali_kbase/mali_kbase_hwcnt_backend_csf.c11
-rw-r--r--mali_kbase/mali_kbase_hwcnt_backend_csf_if.h64
-rw-r--r--mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c37
-rw-r--r--mali_kbase/mali_kbase_hwcnt_backend_jm.c36
-rw-r--r--mali_kbase/mali_kbase_hwcnt_backend_jm.h2
-rw-r--r--mali_kbase/mali_kbase_hwcnt_context.h2
-rw-r--r--mali_kbase/mali_kbase_hwcnt_gpu.c150
-rw-r--r--mali_kbase/mali_kbase_hwcnt_gpu.h58
-rw-r--r--mali_kbase/mali_kbase_hwcnt_legacy.h2
-rw-r--r--mali_kbase/mali_kbase_hwcnt_types.c16
-rw-r--r--mali_kbase/mali_kbase_hwcnt_types.h38
-rw-r--r--mali_kbase/mali_kbase_hwcnt_virtualizer.c2
-rw-r--r--mali_kbase/mali_kbase_hwcnt_virtualizer.h2
-rw-r--r--mali_kbase/mali_kbase_jd.c12
-rw-r--r--mali_kbase/mali_kbase_jd_debugfs.c2
-rw-r--r--mali_kbase/mali_kbase_jm.h2
-rw-r--r--mali_kbase/mali_kbase_js.c14
-rw-r--r--mali_kbase/mali_kbase_kinstr_jm.c2
-rw-r--r--mali_kbase/mali_kbase_mem.c27
-rw-r--r--mali_kbase/mali_kbase_mem.h2
-rw-r--r--mali_kbase/mali_kbase_mem_linux.c36
-rw-r--r--mali_kbase/mali_kbase_mem_pool_debugfs.c2
-rw-r--r--mali_kbase/mali_kbase_mem_pool_debugfs.h2
-rw-r--r--mali_kbase/mali_kbase_mem_pool_group.c2
-rw-r--r--mali_kbase/mali_kbase_mem_pool_group.h2
-rw-r--r--mali_kbase/mali_kbase_mem_profile_debugfs.c2
-rw-r--r--mali_kbase/mali_kbase_native_mgm.c2
-rw-r--r--mali_kbase/mali_kbase_platform_fake.c1
-rw-r--r--mali_kbase/mali_kbase_pm.c4
-rw-r--r--mali_kbase/mali_kbase_regs_history_debugfs.c6
-rw-r--r--mali_kbase/mali_kbase_regs_history_debugfs.h17
-rw-r--r--mali_kbase/mali_kbase_smc.c4
-rw-r--r--mali_kbase/mali_kbase_smc.h4
-rw-r--r--mali_kbase/mali_kbase_strings.c2
-rw-r--r--mali_kbase/mali_kbase_strings.h2
-rw-r--r--mali_kbase/mali_kbase_sync.h4
-rw-r--r--mali_kbase/mali_kbase_sync_android.c2
-rw-r--r--mali_kbase/mali_kbase_sync_file.c2
-rw-r--r--mali_kbase/mali_kbase_trace_gpu_mem.c2
-rw-r--r--mali_kbase/mali_kbase_trace_gpu_mem.h6
-rw-r--r--mali_kbase/mali_kbase_utility.h2
-rw-r--r--mali_kbase/mali_kbase_vinstr.c62
-rw-r--r--mali_kbase/mali_kbase_vinstr.h2
-rw-r--r--mali_kbase/mali_power_gpu_frequency_trace.c2
-rw-r--r--mali_kbase/mali_power_gpu_frequency_trace.h2
-rw-r--r--mali_kbase/mmu/Kbuild30
-rw-r--r--mali_kbase/mmu/backend/mali_kbase_mmu_csf.c2
-rw-r--r--mali_kbase/mmu/backend/mali_kbase_mmu_jm.c2
-rw-r--r--mali_kbase/mmu/mali_kbase_mmu.c39
-rw-r--r--mali_kbase/mmu/mali_kbase_mmu.h2
-rw-r--r--mali_kbase/mmu/mali_kbase_mmu_internal.h2
-rw-r--r--mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c2
-rw-r--r--mali_kbase/platform/Kconfig2
-rw-r--r--mali_kbase/platform/devicetree/Kbuild9
-rw-r--r--mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c2
-rw-r--r--mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c15
-rw-r--r--mali_kbase/platform/devicetree/mali_kbase_config_platform.c43
-rw-r--r--mali_kbase/platform/devicetree/mali_kbase_config_platform.h6
-rw-r--r--mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c3
-rw-r--r--mali_kbase/platform/pixel/Kbuild16
-rw-r--r--mali_kbase/platform/vexpress/Kbuild6
-rw-r--r--mali_kbase/platform/vexpress/mali_kbase_config_platform.h2
-rw-r--r--mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c15
-rw-r--r--mali_kbase/platform/vexpress_1xv7_a57/Kbuild6
-rw-r--r--mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h2
-rw-r--r--mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c15
-rw-r--r--mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild8
-rw-r--r--mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h2
-rw-r--r--mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c15
-rw-r--r--mali_kbase/tests/Kbuild13
-rw-r--r--mali_kbase/tests/Kconfig42
-rw-r--r--mali_kbase/tests/Mconfig70
-rw-r--r--mali_kbase/tests/build.bp40
-rw-r--r--mali_kbase/tests/include/kutf/kutf_helpers.h2
-rw-r--r--mali_kbase/tests/include/kutf/kutf_helpers_user.h2
-rw-r--r--mali_kbase/tests/include/kutf/kutf_mem.h2
-rw-r--r--mali_kbase/tests/include/kutf/kutf_resultset.h2
-rw-r--r--mali_kbase/tests/include/kutf/kutf_suite.h2
-rw-r--r--mali_kbase/tests/include/kutf/kutf_utils.h2
-rw-r--r--mali_kbase/tests/kutf/Kbuild16
-rw-r--r--mali_kbase/tests/kutf/build.bp12
-rw-r--r--mali_kbase/tests/kutf/kutf_helpers.c2
-rw-r--r--mali_kbase/tests/kutf/kutf_helpers_user.c2
-rw-r--r--mali_kbase/tests/kutf/kutf_mem.c2
-rw-r--r--mali_kbase/tests/kutf/kutf_resultset.c2
-rw-r--r--mali_kbase/tests/kutf/kutf_suite.c4
-rw-r--r--mali_kbase/tests/kutf/kutf_utils.c2
-rw-r--r--mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild8
-rw-r--r--mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kconfig29
-rw-r--r--mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile56
-rw-r--r--mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/build.bp13
-rw-r--r--mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c102
-rw-r--r--mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h6
-rw-r--r--mali_kbase/tests/mali_kutf_irq_test/Kbuild8
-rw-r--r--mali_kbase/tests/mali_kutf_irq_test/Makefile50
-rw-r--r--mali_kbase/tests/mali_kutf_irq_test/build.bp9
-rw-r--r--mali_kbase/thirdparty/Kbuild (renamed from mali_kbase/Makefile.kbase)4
-rw-r--r--mali_kbase/thirdparty/mali_kbase_mmap.c4
-rw-r--r--mali_kbase/tl/Kbuild (renamed from mali_kbase/tests/kutf/Makefile)22
-rw-r--r--mali_kbase/tl/backend/mali_kbase_timeline_csf.c6
-rw-r--r--mali_kbase/tl/backend/mali_kbase_timeline_jm.c6
-rw-r--r--mali_kbase/tl/mali_kbase_tl_serialize.h2
-rw-r--r--mali_kbase/tl/mali_kbase_tracepoints.h10
288 files changed, 4269 insertions, 2215 deletions
diff --git a/common/include/linux/dma-buf-test-exporter.h b/common/include/linux/dma-buf-test-exporter.h
index 7abcc69..b6ca0bc 100644
--- a/common/include/linux/dma-buf-test-exporter.h
+++ b/common/include/linux/dma-buf-test-exporter.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2012-2013, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2013, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/common/include/linux/memory_group_manager.h b/common/include/linux/memory_group_manager.h
index 2045840..243e633 100644
--- a/common/include/linux/memory_group_manager.h
+++ b/common/include/linux/memory_group_manager.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/common/include/linux/protected_memory_allocator.h b/common/include/linux/protected_memory_allocator.h
index 1ccb403..4748fbb 100644
--- a/common/include/linux/protected_memory_allocator.h
+++ b/common/include/linux/protected_memory_allocator.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/common/include/linux/protected_mode_switcher.h b/common/include/linux/protected_mode_switcher.h
index d2c7eef..2d057dc 100644
--- a/common/include/linux/protected_mode_switcher.h
+++ b/common/include/linux/protected_mode_switcher.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/common/include/uapi/gpu/arm/midgard/backend/gpu/mali_kbase_model_dummy.h b/common/include/uapi/gpu/arm/midgard/backend/gpu/mali_kbase_model_dummy.h
deleted file mode 100644
index 61da071..0000000
--- a/common/include/uapi/gpu/arm/midgard/backend/gpu/mali_kbase_model_dummy.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- *
- * (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
- *
- * This program is free software and is provided to you under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation, and any use by you of this program is subject to the terms
- * of such GNU license.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, you can access it online at
- * http://www.gnu.org/licenses/gpl-2.0.html.
- *
- */
-
-/*
- * Dummy Model interface
- */
-
-#ifndef _UAPI_KBASE_MODEL_DUMMY_H_
-#define _UAPI_KBASE_MODEL_DUMMY_H_
-
-#include <linux/types.h>
-
-#define KBASE_DUMMY_MODEL_COUNTER_HEADER_DWORDS (4)
-#define KBASE_DUMMY_MODEL_COUNTER_PER_CORE (60)
-#define KBASE_DUMMY_MODEL_COUNTER_PER_CORE_TYPE \
- (64*KBASE_DUMMY_MODEL_COUNTER_PER_CORE)
-#define KBASE_DUMMY_MODEL_COUNTERS_PER_BIT (4)
-#define KBASE_DUMMY_MODEL_COUNTER_ENABLED(enable_mask, ctr_idx) \
- (enable_mask & (1 << (ctr_idx / KBASE_DUMMY_MODEL_COUNTERS_PER_BIT)))
-
-#define KBASE_DUMMY_MODEL_HEADERS_PER_BLOCK 4
-#define KBASE_DUMMY_MODEL_COUNTERS_PER_BLOCK 60
-#define KBASE_DUMMY_MODEL_VALUES_PER_BLOCK \
- (KBASE_DUMMY_MODEL_COUNTERS_PER_BLOCK + \
- KBASE_DUMMY_MODEL_HEADERS_PER_BLOCK)
-#define KBASE_DUMMY_MODEL_BLOCK_SIZE \
- (KBASE_DUMMY_MODEL_VALUES_PER_BLOCK * sizeof(__u32))
-#define KBASE_DUMMY_MODEL_MAX_MEMSYS_BLOCKS 8
-#define KBASE_DUMMY_MODEL_MAX_SHADER_CORES 32
-#define KBASE_DUMMY_MODEL_MAX_NUM_PERF_BLOCKS \
- (1 + 1 + KBASE_DUMMY_MODEL_MAX_MEMSYS_BLOCKS + KBASE_DUMMY_MODEL_MAX_SHADER_CORES)
-#define KBASE_DUMMY_MODEL_COUNTER_TOTAL \
- (KBASE_DUMMY_MODEL_MAX_NUM_PERF_BLOCKS * KBASE_DUMMY_MODEL_COUNTER_PER_CORE_TYPE)
-
-#endif /* _UAPI_KBASE_MODEL_DUMMY_H_ */
diff --git a/common/include/uapi/gpu/arm/midgard/csf/mali_gpu_csf_registers.h b/common/include/uapi/gpu/arm/midgard/csf/mali_gpu_csf_registers.h
index f233a0d..bed336c 100644
--- a/common/include/uapi/gpu/arm/midgard/csf/mali_gpu_csf_registers.h
+++ b/common/include/uapi/gpu/arm/midgard/csf/mali_gpu_csf_registers.h
@@ -104,6 +104,12 @@
#define CS_USER_INPUT_HI 0x0034 /* () CS user mode input page address, high word */
#define CS_USER_OUTPUT_LO 0x0038 /* () CS user mode input page address, low word */
#define CS_USER_OUTPUT_HI 0x003C /* () CS user mode input page address, high word */
+#define CS_INSTR_CONFIG 0x0040 /* () Instrumentation buffer configuration */
+#define CS_INSTR_BUFFER_SIZE 0x0044 /* () Instrumentation buffer size */
+#define CS_INSTR_BUFFER_BASE_LO 0x0048 /* () Instrumentation buffer base pointer, low word */
+#define CS_INSTR_BUFFER_BASE_HI 0x004C /* () Instrumentation buffer base pointer, high word */
+#define CS_INSTR_BUFFER_OFFSET_POINTER_LO 0x0050 /* () Instrumentation buffer pointer to insert offset, low word */
+#define CS_INSTR_BUFFER_OFFSET_POINTER_HI 0x0054 /* () Instrumentation buffer pointer to insert offset, high word */
/* CS_KERNEL_OUTPUT_BLOCK register offsets */
#define CS_ACK 0x0000 /* () CS acknowledge flags */
@@ -173,7 +179,8 @@
#define GLB_GROUP_NUM 0x0010 /* () Number of CSG interfaces */
#define GLB_GROUP_STRIDE 0x0014 /* () Stride between CSG interfaces */
#define GLB_PRFCNT_SIZE 0x0018 /* () Size of CSF performance counters */
-#define GLB_INSTR_FEATURES 0x001C /* () TRACE_POINT instrumentation features */
+#define GLB_INSTR_FEATURES \
+ 0x001C /* () TRACE_POINT instrumentation. (csf >= 1.1.0) */
#define GROUP_CONTROL_0 0x1000 /* () CSG control and capabilities */
#define GROUP_CONTROL(n) (GROUP_CONTROL_0 + (n)*256)
#define GROUP_CONTROL_REG(n, r) (GROUP_CONTROL(n) + GROUP_CONTROL_BLOCK_REG(r))
@@ -417,6 +424,57 @@
#define CS_USER_OUTPUT_POINTER_SET(reg_val, value) \
(((reg_val) & ~CS_USER_OUTPUT_POINTER_MASK) | \
(((value) << CS_USER_OUTPUT_POINTER_SHIFT) & CS_USER_OUTPUT_POINTER_MASK))
+
+/* CS_INSTR_CONFIG register */
+#define CS_INSTR_CONFIG_JASID_SHIFT (0)
+#define CS_INSTR_CONFIG_JASID_MASK ((u32)0xF << CS_INSTR_CONFIG_JASID_SHIFT)
+#define CS_INSTR_CONFIG_JASID_GET(reg_val) (((reg_val)&CS_INSTR_CONFIG_JASID_MASK) >> CS_INSTR_CONFIG_JASID_SHIFT)
+#define CS_INSTR_CONFIG_JASID_SET(reg_val, value) \
+ (((reg_val) & ~CS_INSTR_CONFIG_JASID_MASK) | \
+ (((value) << CS_INSTR_CONFIG_JASID_SHIFT) & CS_INSTR_CONFIG_JASID_MASK))
+#define CS_INSTR_CONFIG_EVENT_SIZE_SHIFT (4)
+#define CS_INSTR_CONFIG_EVENT_SIZE_MASK ((u32)0xF << CS_INSTR_CONFIG_EVENT_SIZE_SHIFT)
+#define CS_INSTR_CONFIG_EVENT_SIZE_GET(reg_val) \
+ (((reg_val)&CS_INSTR_CONFIG_EVENT_SIZE_MASK) >> CS_INSTR_CONFIG_EVENT_SIZE_SHIFT)
+#define CS_INSTR_CONFIG_EVENT_SIZE_SET(reg_val, value) \
+ (((reg_val) & ~CS_INSTR_CONFIG_EVENT_SIZE_MASK) | \
+ (((value) << CS_INSTR_CONFIG_EVENT_SIZE_SHIFT) & CS_INSTR_CONFIG_EVENT_SIZE_MASK))
+#define CS_INSTR_CONFIG_EVENT_STATE_SHIFT (16)
+#define CS_INSTR_CONFIG_EVENT_STATE_MASK ((u32)0xFF << CS_INSTR_CONFIG_EVENT_STATE_SHIFT)
+#define CS_INSTR_CONFIG_EVENT_STATE_GET(reg_val) \
+ (((reg_val)&CS_INSTR_CONFIG_EVENT_STATE_MASK) >> CS_INSTR_CONFIG_EVENT_STATE_SHIFT)
+#define CS_INSTR_CONFIG_EVENT_STATE_SET(reg_val, value) \
+ (((reg_val) & ~CS_INSTR_CONFIG_EVENT_STATE_MASK) | \
+ (((value) << CS_INSTR_CONFIG_EVENT_STATE_SHIFT) & CS_INSTR_CONFIG_EVENT_STATE_MASK))
+
+/* CS_INSTR_BUFFER_SIZE register */
+#define CS_INSTR_BUFFER_SIZE_SIZE_SHIFT (0)
+#define CS_INSTR_BUFFER_SIZE_SIZE_MASK ((u32)0xFFFFFFFF << CS_INSTR_BUFFER_SIZE_SIZE_SHIFT)
+#define CS_INSTR_BUFFER_SIZE_SIZE_GET(reg_val) \
+ (((reg_val)&CS_INSTR_BUFFER_SIZE_SIZE_MASK) >> CS_INSTR_BUFFER_SIZE_SIZE_SHIFT)
+#define CS_INSTR_BUFFER_SIZE_SIZE_SET(reg_val, value) \
+ (((reg_val) & ~CS_INSTR_BUFFER_SIZE_SIZE_MASK) | \
+ (((value) << CS_INSTR_BUFFER_SIZE_SIZE_SHIFT) & CS_INSTR_BUFFER_SIZE_SIZE_MASK))
+
+/* CS_INSTR_BUFFER_BASE register */
+#define CS_INSTR_BUFFER_BASE_POINTER_SHIFT (0)
+#define CS_INSTR_BUFFER_BASE_POINTER_MASK ((u64)0xFFFFFFFFFFFFFFFF << CS_INSTR_BUFFER_BASE_POINTER_SHIFT)
+#define CS_INSTR_BUFFER_BASE_POINTER_GET(reg_val) \
+ (((reg_val)&CS_INSTR_BUFFER_BASE_POINTER_MASK) >> CS_INSTR_BUFFER_BASE_POINTER_SHIFT)
+#define CS_INSTR_BUFFER_BASE_POINTER_SET(reg_val, value) \
+ (((reg_val) & ~CS_INSTR_BUFFER_BASE_POINTER_MASK) | \
+ (((value) << CS_INSTR_BUFFER_BASE_POINTER_SHIFT) & CS_INSTR_BUFFER_BASE_POINTER_MASK))
+
+/* CS_INSTR_BUFFER_OFFSET_POINTER register */
+#define CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_SHIFT (0)
+#define CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_MASK \
+ ((u64)0xFFFFFFFFFFFFFFFF) << CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_SHIFT)
+#define CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_GET(reg_val) \
+ (((reg_val)&CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_MASK) >> CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_SHIFT)
+#define CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_SET(reg_val, value) \
+ (((reg_val) & ~CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_MASK) | \
+ (((value) << CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_SHIFT) & CS_INSTR_BUFFER_OFFSET_POINTER_POINTER_MASK))
+
/* End of CS_KERNEL_INPUT_BLOCK register set definitions */
/* CS_KERNEL_OUTPUT_BLOCK register set definitions */
@@ -1401,6 +1459,22 @@
#define GLB_IDLE_TIMER_TIMER_SOURCE_GPU_COUNTER 0x1
/* End of GLB_IDLE_TIMER_TIMER_SOURCE values */
+/* GLB_INSTR_FEATURES register */
+#define GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_SHIFT (0)
+#define GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_MASK ((u32)0xF << GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_SHIFT)
+#define GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_GET(reg_val) \
+ (((reg_val)&GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_MASK) >> GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_SHIFT)
+#define GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_SET(reg_val, value) \
+ (((reg_val) & ~GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_MASK) | \
+ (((value) << GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_SHIFT) & GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_MASK))
+#define GLB_INSTR_FEATURES_EVENT_SIZE_MAX_SHIFT (4)
+#define GLB_INSTR_FEATURES_EVENT_SIZE_MAX_MASK ((u32)0xF << GLB_INSTR_FEATURES_EVENT_SIZE_MAX_SHIFT)
+#define GLB_INSTR_FEATURES_EVENT_SIZE_MAX_GET(reg_val) \
+ (((reg_val)&GLB_INSTR_FEATURES_EVENT_SIZE_MAX_MASK) >> GLB_INSTR_FEATURES_EVENT_SIZE_MAX_SHIFT)
+#define GLB_INSTR_FEATURES_EVENT_SIZE_MAX_SET(reg_val, value) \
+ (((reg_val) & ~GLB_INSTR_FEATURES_EVENT_SIZE_MAX_MASK) | \
+ (((value) << GLB_INSTR_FEATURES_EVENT_SIZE_MAX_SHIFT) & GLB_INSTR_FEATURES_EVENT_SIZE_MAX_MASK))
+
#define CSG_STATUS_STATE (0x0018) /* CSG state status register */
/* CSG_STATUS_STATE register */
#define CSG_STATUS_STATE_IDLE_SHIFT (0)
diff --git a/common/include/uapi/gpu/arm/midgard/csf/mali_kbase_csf_ioctl.h b/common/include/uapi/gpu/arm/midgard/csf/mali_kbase_csf_ioctl.h
index 237cc2e..337195a 100644
--- a/common/include/uapi/gpu/arm/midgard/csf/mali_kbase_csf_ioctl.h
+++ b/common/include/uapi/gpu/arm/midgard/csf/mali_kbase_csf_ioctl.h
@@ -40,10 +40,14 @@
* 1.4:
* - Replace padding in kbase_ioctl_cs_get_glb_iface with
* instr_features member of same size
+ * 1.5:
+ * - Add ioctl 40: kbase_ioctl_cs_queue_register_ex, this is a new
+ * queue registration call with extended format for supporting CS
+ * trace configurations with CSF trace_command.
*/
#define BASE_UK_VERSION_MAJOR 1
-#define BASE_UK_VERSION_MINOR 4
+#define BASE_UK_VERSION_MINOR 5
/**
* struct kbase_ioctl_version_check - Check version compatibility between
@@ -69,6 +73,9 @@ struct kbase_ioctl_version_check {
* @buffer_size: Size of the buffer in bytes
* @priority: Priority of the queue within a group when run within a process
* @padding: Currently unused, must be zero
+ *
+ * @Note: There is an identical sub-section in kbase_ioctl_cs_queue_register_ex.
+ * Any change of this struct should also be mirrored to the latter.
*/
struct kbase_ioctl_cs_queue_register {
__u64 buffer_gpu_addr;
@@ -120,7 +127,42 @@ union kbase_ioctl_cs_queue_bind {
#define KBASE_IOCTL_CS_QUEUE_BIND \
_IOWR(KBASE_IOCTL_TYPE, 39, union kbase_ioctl_cs_queue_bind)
-/* ioctl 40 is free to use */
+/**
+ * struct kbase_ioctl_cs_queue_register_ex - Register a GPU command queue with the
+ * base back-end in extended format,
+ * involving trace buffer configuration
+ *
+ * @buffer_gpu_addr: GPU address of the buffer backing the queue
+ * @buffer_size: Size of the buffer in bytes
+ * @priority: Priority of the queue within a group when run within a process
+ * @padding: Currently unused, must be zero
+ * @ex_offset_var_addr: GPU address of the trace buffer write offset variable
+ * @ex_buffer_base: Trace buffer GPU base address for the queue
+ * @ex_buffer_size: Size of the trace buffer in bytes
+ * @ex_event_size: Trace event write size, in log2 designation
+ * @ex_event_state: Trace event states configuration
+ * @ex_padding: Currently unused, must be zero
+ *
+ * @Note: There is an identical sub-section at the start of this struct to that
+ * of @ref kbase_ioctl_cs_queue_register. Any change of this sub-section
+ * must also be mirrored to the latter. Following the said sub-section,
+ * the remaining fields forms the extension, marked with ex_*.
+ */
+struct kbase_ioctl_cs_queue_register_ex {
+ __u64 buffer_gpu_addr;
+ __u32 buffer_size;
+ __u8 priority;
+ __u8 padding[3];
+ __u64 ex_offset_var_addr;
+ __u64 ex_buffer_base;
+ __u32 ex_buffer_size;
+ __u8 ex_event_size;
+ __u8 ex_event_state;
+ __u8 ex_padding[2];
+};
+
+#define KBASE_IOCTL_CS_QUEUE_REGISTER_EX \
+ _IOW(KBASE_IOCTL_TYPE, 40, struct kbase_ioctl_cs_queue_register_ex)
/**
* struct kbase_ioctl_cs_queue_terminate - Terminate a GPU command queue
@@ -314,6 +356,7 @@ struct kbase_ioctl_cs_tiler_heap_term {
* @out.total_stream_num: Total number of CSs, summed across all groups.
* @out.instr_features: Instrumentation features. Bits 7:4 hold the maximum
* size of events. Bits 3:0 hold the offset update rate.
+ * (csf >= 1.1.0)
*
*/
union kbase_ioctl_cs_get_glb_iface {
diff --git a/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_id.h b/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_id.h
index 0145920..74a95c1 100644
--- a/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_id.h
+++ b/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_id.h
@@ -106,6 +106,8 @@
#define GPU_ID2_PRODUCT_TBAX GPU_ID2_MODEL_MAKE(9, 5)
#define GPU_ID2_PRODUCT_TDUX GPU_ID2_MODEL_MAKE(10, 1)
#define GPU_ID2_PRODUCT_TODX GPU_ID2_MODEL_MAKE(10, 2)
+#define GPU_ID2_PRODUCT_TGRX GPU_ID2_MODEL_MAKE(10, 3)
+#define GPU_ID2_PRODUCT_TVAX GPU_ID2_MODEL_MAKE(10, 4)
#define GPU_ID2_PRODUCT_LODX GPU_ID2_MODEL_MAKE(10, 7)
/* Helper macro to create a GPU_ID assuming valid values for id, major,
diff --git a/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_regmap.h b/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_regmap.h
index 9977212..9c738ee 100644
--- a/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_regmap.h
+++ b/common/include/uapi/gpu/arm/midgard/gpu/mali_kbase_gpu_regmap.h
@@ -67,6 +67,9 @@
#define PWR_OVERRIDE1 0x058 /* (RW) Power manager override settings */
#define GPU_FEATURES_LO 0x060 /* (RO) GPU features, low word */
#define GPU_FEATURES_HI 0x064 /* (RO) GPU features, high word */
+#define PRFCNT_FEATURES 0x068 /* (RO) Performance counter features */
+#define TIMESTAMP_OFFSET_LO 0x088 /* (RW) Global time stamp offset, low word */
+#define TIMESTAMP_OFFSET_HI 0x08C /* (RW) Global time stamp offset, high word */
#define CYCLE_COUNT_LO 0x090 /* (RO) Cycle counter, low word */
#define CYCLE_COUNT_HI 0x094 /* (RO) Cycle counter, high word */
#define TIMESTAMP_LO 0x098 /* (RO) Global time stamp counter, low word */
@@ -285,6 +288,13 @@
#define AS_FAULTSTATUS_SOURCE_ID_GET(reg_val) \
(((reg_val)&AS_FAULTSTATUS_SOURCE_ID_MASK) >> AS_FAULTSTATUS_SOURCE_ID_SHIFT)
+#define PRFCNT_FEATURES_COUNTER_BLOCK_SIZE_SHIFT (0)
+#define PRFCNT_FEATURES_COUNTER_BLOCK_SIZE_MASK \
+ ((0xFF) << PRFCNT_FEATURES_COUNTER_BLOCK_SIZE_SHIFT)
+#define PRFCNT_FEATURES_COUNTER_BLOCK_SIZE_GET(reg_val) \
+ (((reg_val)&PRFCNT_FEATURES_COUNTER_BLOCK_SIZE_MASK) >> \
+ PRFCNT_FEATURES_COUNTER_BLOCK_SIZE_SHIFT)
+
/*
* Begin MMU TRANSCFG register values
*/
diff --git a/mali_kbase/Kbuild b/mali_kbase/Kbuild
index a3a15d8..e529e5e 100644
--- a/mali_kbase/Kbuild
+++ b/mali_kbase/Kbuild
@@ -18,236 +18,246 @@
#
#
+# make $(src) as absolute path if it is not already, by prefixing $(srctree)
+# This is to prevent any build issue due to wrong path.
+src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src))
+
+#
+# Prevent misuse when Kernel configurations are not present by default
+# in out-of-tree builds
+#
+ifneq ($(CONFIG_ANDROID),n)
+ifeq ($(CONFIG_GPU_TRACEPOINTS),n)
+ $(error CONFIG_GPU_TRACEPOINTS must be set in Kernel configuration)
+endif
+endif
+
+ifeq ($(CONFIG_DMA_SHARED_BUFFER),n)
+ $(error CONFIG_DMA_SHARED_BUFFER must be set in Kernel configuration)
+endif
+
+ifeq ($(CONFIG_PM_DEVFREQ),n)
+ $(error CONFIG_PM_DEVFREQ must be set in Kernel configuration)
+endif
+
+ifeq ($(CONFIG_DEVFREQ_THERMAL),n)
+ $(error CONFIG_DEVFREQ_THERMAL must be set in Kernel configuration)
+endif
+
+ifeq ($(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND),n)
+ $(error CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND must be set in Kernel configuration)
+endif
+
+ifeq ($(CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS), y)
+ ifneq ($(CONFIG_DEBUG_FS), y)
+ $(error CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS depends on CONFIG_DEBUG_FS to be set in Kernel configuration)
+ endif
+endif
+
+ifeq ($(CONFIG_MALI_FENCE_DEBUG), y)
+ ifneq ($(CONFIG_SYNC), y)
+ ifneq ($(CONFIG_SYNC_FILE), y)
+ $(error CONFIG_MALI_FENCE_DEBUG depends on CONFIG_SYNC || CONFIG_SYNC_FILE to be set in Kernel configuration)
+ endif
+ endif
+endif
+
+#
+# Configurations
+#
# Driver version string which is returned to userspace via an ioctl
-MALI_RELEASE_NAME ?= '"r31p0-01eac0"'
+MALI_RELEASE_NAME ?= '"r32p1-00bet0"'
# Append pixel to release name for debugging
MALI_RELEASE_NAME := $(subst "',-pixel"',$(MALI_RELEASE_NAME))
-
-# Paths required for build
-
-# make $(src) as absolute path if it is not already, by prefixing $(srctree)
-src:=$(if $(patsubst /%,,$(src)),$(srctree)/$(src),$(src))
-KBASE_PATH = $(src)
-KBASE_PLATFORM_PATH = $(KBASE_PATH)/platform_dummy
-UMP_PATH = $(src)/../../../base
+CONFIG_MALI_PLATFORM_NAME="pixel"
# Set up defaults if not defined by build system
-MALI_CUSTOMER_RELEASE ?= 1
-MALI_UNIT_TEST ?= 0
+ifeq ($(CONFIG_MALI_DEBUG), y)
+ MALI_UNIT_TEST = 1
+ MALI_CUSTOMER_RELEASE ?= 0
+else
+ MALI_UNIT_TEST ?= 0
+ MALI_CUSTOMER_RELEASE ?= 1
+endif
MALI_COVERAGE ?= 0
+
CONFIG_MALI_PLATFORM_NAME ?= "devicetree"
+
+# Kconfig passes in the name with quotes for in-tree builds - remove them.
+MALI_PLATFORM_DIR := $(shell echo $(CONFIG_MALI_PLATFORM_NAME))
+
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ MALI_JIT_PRESSURE_LIMIT_BASE = 0
+ MALI_USE_CSF = 1
+else
+ MALI_JIT_PRESSURE_LIMIT_BASE ?= 1
+ MALI_USE_CSF ?= 0
+endif
+
+ifneq ($(CONFIG_MALI_KUTF), n)
+ MALI_KERNEL_TEST_API ?= 1
+else
+ MALI_KERNEL_TEST_API ?= 0
+endif
+
# Experimental features (corresponding -D definition should be appended to
-# DEFINES below, e.g. for MALI_EXPERIMENTAL_FEATURE,
+# ccflags-y below, e.g. for MALI_EXPERIMENTAL_FEATURE,
# -DMALI_EXPERIMENTAL_FEATURE=$(MALI_EXPERIMENTAL_FEATURE) should be appended)
#
# Experimental features must default to disabled, e.g.:
# MALI_EXPERIMENTAL_FEATURE ?= 0
MALI_INCREMENTAL_RENDERING ?= 0
-ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
-MALI_JIT_PRESSURE_LIMIT_BASE = 0
-MALI_USE_CSF = 1
-else
-MALI_JIT_PRESSURE_LIMIT_BASE ?= 1
-MALI_USE_CSF ?= 0
-endif
+#
+# ccflags
+#
+ccflags-y = \
+ -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
+ -DMALI_USE_CSF=$(MALI_USE_CSF) \
+ -DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
+ -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
+ -DMALI_COVERAGE=$(MALI_COVERAGE) \
+ -DMALI_RELEASE_NAME=$(MALI_RELEASE_NAME) \
+ -DMALI_JIT_PRESSURE_LIMIT_BASE=$(MALI_JIT_PRESSURE_LIMIT_BASE) \
+ -DMALI_INCREMENTAL_RENDERING=$(MALI_INCREMENTAL_RENDERING) \
+ -DMALI_KBASE_BUILD \
+ -DMALI_PLATFORM_DIR=$(MALI_PLATFORM_DIR)
-ifneq ($(CONFIG_MALI_KUTF), n)
-MALI_KERNEL_TEST_API ?= 1
-else
-MALI_KERNEL_TEST_API ?= 0
-endif
-
-# Set up our defines, which will be passed to gcc
-DEFINES = \
- -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
- -DMALI_USE_CSF=$(MALI_USE_CSF) \
- -DMALI_KERNEL_TEST_API=$(MALI_KERNEL_TEST_API) \
- -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
- -DMALI_COVERAGE=$(MALI_COVERAGE) \
- -DMALI_RELEASE_NAME=$(MALI_RELEASE_NAME) \
- -DMALI_JIT_PRESSURE_LIMIT_BASE=$(MALI_JIT_PRESSURE_LIMIT_BASE) \
- -DMALI_INCREMENTAL_RENDERING=$(MALI_INCREMENTAL_RENDERING)
-
-# Pixel integration defines
-DEFINES += \
- -DCONFIG_MALI_MIDGARD_DVFS=$(CONFIG_MALI_MIDGARD_DVFS) \
- -DCONFIG_MALI_PIXEL_GPU_QOS=$(CONFIG_MALI_PIXEL_GPU_QOS) \
- -DCONFIG_MALI_PIXEL_GPU_BTS=$(CONFIG_MALI_PIXEL_GPU_BTS) \
- -DCONFIG_MALI_PIXEL_GPU_THERMAL=$(CONFIG_MALI_PIXEL_GPU_THERMAL) \
- -DCONFIG_MALI_PIXEL_GPU_SECURE_RENDERING=$(CONFIG_MALI_PIXEL_GPU_SECURE_RENDERING)
ifeq ($(KBUILD_EXTMOD),)
# in-tree
-DEFINES +=-DMALI_KBASE_PLATFORM_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
+ ccflags-y +=-DMALI_KBASE_PLATFORM_PATH=../../$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
else
# out-of-tree
-DEFINES +=-DMALI_KBASE_PLATFORM_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
+ ccflags-y +=-DMALI_KBASE_PLATFORM_PATH=$(src)/platform/$(CONFIG_MALI_PLATFORM_NAME)
endif
-DEFINES += -I$(srctree)/drivers/staging/android
-
-DEFINES += -DMALI_KBASE_BUILD
-
-# Use our defines when compiling
-ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
-subdir-ccflags-y += $(DEFINES) -I$(KBASE_PATH) -I$(KBASE_PLATFORM_PATH) -I$(UMP_PATH) -I$(srctree)/include/linux
+ccflags-y += \
+ -I$(srctree)/include/linux \
+ -I$(srctree)/drivers/staging/android \
+ -I$(src) \
+ -I$(src)/platform/$(MALI_PLATFORM_DIR) \
+ -I$(src)/../../../base \
+ -I$(src)/../../../../include
# Add include path for related GPU modules
ccflags-y += -I$(src)/../common/include
-SRC := \
- context/mali_kbase_context.c \
- debug/mali_kbase_debug_ktrace.c \
- device/mali_kbase_device.c \
- device/mali_kbase_device_hw.c \
- mali_kbase_cache_policy.c \
- mali_kbase_ccswe.c \
- mali_kbase_mem.c \
- mali_kbase_mem_pool_group.c \
- mali_kbase_native_mgm.c \
- mali_kbase_ctx_sched.c \
- mali_kbase_jm.c \
- mali_kbase_gpuprops.c \
- mali_kbase_pm.c \
- mali_kbase_config.c \
- mali_kbase_vinstr.c \
- mali_kbase_hwcnt.c \
- mali_kbase_hwcnt_gpu.c \
- mali_kbase_hwcnt_legacy.c \
- mali_kbase_hwcnt_types.c \
- mali_kbase_hwcnt_virtualizer.c \
- mali_kbase_softjobs.c \
- mali_kbase_hw.c \
- mali_kbase_debug.c \
- mali_kbase_gpu_memory_debugfs.c \
- mali_kbase_mem_linux.c \
- mali_kbase_core_linux.c \
- mali_kbase_mem_profile_debugfs.c \
- mmu/mali_kbase_mmu.c \
- mmu/mali_kbase_mmu_hw_direct.c \
- mmu/mali_kbase_mmu_mode_aarch64.c \
- mali_kbase_disjoint_events.c \
- mali_kbase_debug_mem_view.c \
- mali_kbase_smc.c \
- mali_kbase_mem_pool.c \
- mali_kbase_mem_pool_debugfs.c \
- mali_kbase_debugfs_helper.c \
- mali_kbase_strings.c \
- mali_kbase_as_fault_debugfs.c \
- mali_kbase_regs_history_debugfs.c \
- mali_kbase_dvfs_debugfs.c \
- mali_power_gpu_frequency_trace.c \
- mali_kbase_trace_gpu_mem.c \
- thirdparty/mali_kbase_mmap.c \
- tl/mali_kbase_timeline.c \
- tl/mali_kbase_timeline_io.c \
- tl/mali_kbase_tlstream.c \
- tl/mali_kbase_tracepoints.c \
- gpu/mali_kbase_gpu.c
-
-ifeq ($(MALI_USE_CSF),1)
- SRC += \
- mali_kbase_hwcnt_backend_csf.c \
- mali_kbase_hwcnt_backend_csf_if_fw.c \
- debug/backend/mali_kbase_debug_ktrace_csf.c \
- device/backend/mali_kbase_device_csf.c \
- device/backend/mali_kbase_device_hw_csf.c \
- gpu/backend/mali_kbase_gpu_fault_csf.c \
- tl/backend/mali_kbase_timeline_csf.c \
- mmu/backend/mali_kbase_mmu_csf.c \
- context/backend/mali_kbase_context_csf.c
-else
- SRC += \
- mali_kbase_hwcnt_backend_jm.c \
- mali_kbase_dummy_job_wa.c \
- mali_kbase_debug_job_fault.c \
- mali_kbase_event.c \
- mali_kbase_jd.c \
- mali_kbase_jd_debugfs.c \
- mali_kbase_js.c \
- mali_kbase_js_ctx_attr.c \
- mali_kbase_kinstr_jm.c \
- debug/backend/mali_kbase_debug_ktrace_jm.c \
- device/backend/mali_kbase_device_jm.c \
- device/backend/mali_kbase_device_hw_jm.c \
- gpu/backend/mali_kbase_gpu_fault_jm.c \
- tl/backend/mali_kbase_timeline_jm.c \
- mmu/backend/mali_kbase_mmu_jm.c \
- context/backend/mali_kbase_context_jm.c
-endif
-
-ifeq ($(CONFIG_MALI_CINSTR_GWT),y)
- SRC += mali_kbase_gwt.c
-endif
-
+subdir-ccflags-y += $(ccflags-y)
-ifeq ($(MALI_CUSTOMER_RELEASE),0)
- SRC += mali_kbase_regs_dump_debugfs.c
-endif
-
-
-ccflags-y += -I$(KBASE_PATH) -I$(KBASE_PATH)/debug \
- -I$(KBASE_PATH)/debug/backend
-
-# Tell the Linux build system from which .o file to create the kernel module
+#
+# Kernel Modules
+#
obj-$(CONFIG_MALI_MIDGARD) += mali_kbase.o
+obj-$(CONFIG_MALI_ARBITRATION) += arbitration/
+obj-$(CONFIG_MALI_KUTF) += tests/
+
+mali_kbase-y := \
+ mali_kbase_cache_policy.o \
+ mali_kbase_ccswe.o \
+ mali_kbase_mem.o \
+ mali_kbase_mem_pool_group.o \
+ mali_kbase_native_mgm.o \
+ mali_kbase_ctx_sched.o \
+ mali_kbase_gpuprops.o \
+ mali_kbase_pm.o \
+ mali_kbase_config.o \
+ mali_kbase_vinstr.o \
+ mali_kbase_hwcnt.o \
+ mali_kbase_hwcnt_gpu.o \
+ mali_kbase_hwcnt_legacy.o \
+ mali_kbase_hwcnt_types.o \
+ mali_kbase_hwcnt_virtualizer.o \
+ mali_kbase_softjobs.o \
+ mali_kbase_hw.o \
+ mali_kbase_debug.o \
+ mali_kbase_gpu_memory_debugfs.o \
+ mali_kbase_mem_linux.o \
+ mali_kbase_core_linux.o \
+ mali_kbase_mem_profile_debugfs.o \
+ mali_kbase_disjoint_events.o \
+ mali_kbase_debug_mem_view.o \
+ mali_kbase_smc.o \
+ mali_kbase_mem_pool.o \
+ mali_kbase_mem_pool_debugfs.o \
+ mali_kbase_debugfs_helper.o \
+ mali_kbase_strings.o \
+ mali_kbase_as_fault_debugfs.o \
+ mali_kbase_regs_history_debugfs.o \
+ mali_kbase_dvfs_debugfs.o \
+ mali_power_gpu_frequency_trace.o \
+ mali_kbase_trace_gpu_mem.o
+
+mali_kbase-$(CONFIG_MALI_CINSTR_GWT) += mali_kbase_gwt.o
-# Tell the Linux build system to enable building of our .c files
-mali_kbase-y := $(SRC:.c=.o)
-
-# Kconfig passes in the name with quotes for in-tree builds - remove them.
-platform_name := $(shell echo $(CONFIG_MALI_PLATFORM_NAME))
-MALI_PLATFORM_DIR := platform/$(platform_name)
-ccflags-y += -I$(src)/$(MALI_PLATFORM_DIR)
-include $(src)/$(MALI_PLATFORM_DIR)/Kbuild
+mali_kbase-$(CONFIG_SYNC) += \
+ mali_kbase_sync_android.o \
+ mali_kbase_sync_common.o
-ifeq ($(CONFIG_MALI_DEVFREQ),y)
- ifeq ($(CONFIG_DEVFREQ_THERMAL),y)
- include $(src)/ipa/Kbuild
- endif
-endif
+mali_kbase-$(CONFIG_SYNC_FILE) += \
+ mali_kbase_fence_ops.o \
+ mali_kbase_sync_file.o \
+ mali_kbase_sync_common.o
-ifeq ($(MALI_USE_CSF),1)
- include $(src)/csf/Kbuild
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ mali_kbase-y += \
+ mali_kbase_hwcnt_backend_csf.o \
+ mali_kbase_hwcnt_backend_csf_if_fw.o
else
-# empty
+ mali_kbase-y += \
+ mali_kbase_jm.o \
+ mali_kbase_hwcnt_backend_jm.o \
+ mali_kbase_dummy_job_wa.o \
+ mali_kbase_debug_job_fault.o \
+ mali_kbase_event.o \
+ mali_kbase_jd.o \
+ mali_kbase_jd_debugfs.o \
+ mali_kbase_js.o \
+ mali_kbase_js_ctx_attr.o \
+ mali_kbase_kinstr_jm.o
+
+ mali_kbase-$(CONFIG_MALI_DMA_FENCE) += \
+ mali_kbase_fence_ops.o \
+ mali_kbase_dma_fence.o \
+ mali_kbase_fence.o
+
+ mali_kbase-$(CONFIG_SYNC_FILE) += \
+ mali_kbase_fence_ops.o \
+ mali_kbase_fence.o
endif
-ifeq ($(CONFIG_MALI_ARBITER_SUPPORT),y)
- include $(src)/arbiter/Kbuild
-else
-# empty
-endif
-ifeq ($(MALI_USE_CSF),0)
- mali_kbase-$(CONFIG_MALI_DMA_FENCE) += \
- mali_kbase_fence_ops.o \
- mali_kbase_dma_fence.o \
- mali_kbase_fence.o
+INCLUDE_SUBDIR = \
+ $(src)/context/Kbuild \
+ $(src)/debug/Kbuild \
+ $(src)/device/Kbuild \
+ $(src)/backend/gpu/Kbuild \
+ $(src)/mmu/Kbuild \
+ $(src)/tl/Kbuild \
+ $(src)/gpu/Kbuild \
+ $(src)/thirdparty/Kbuild \
+ $(src)/platform/$(MALI_PLATFORM_DIR)/Kbuild
- mali_kbase-$(CONFIG_SYNC_FILE) += \
- mali_kbase_fence_ops.o \
- mali_kbase_fence.o
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ INCLUDE_SUBDIR += $(src)/csf/Kbuild
endif
-mali_kbase-$(CONFIG_SYNC) += \
- mali_kbase_sync_android.o \
- mali_kbase_sync_common.o
-
-mali_kbase-$(CONFIG_SYNC_FILE) += \
- mali_kbase_fence_ops.o \
- mali_kbase_sync_file.o \
- mali_kbase_sync_common.o
-
-include $(src)/backend/gpu/Kbuild
-mali_kbase-y += $(BACKEND:.c=.o)
-
+ifeq ($(CONFIG_MALI_ARBITER_SUPPORT),y)
+ INCLUDE_SUBDIR += $(src)/arbiter/Kbuild
+endif
-ccflags-y += -I$(src)/backend/gpu
-subdir-ccflags-y += -I$(src)/backend/gpu
+ifeq ($(CONFIG_MALI_DEVFREQ),y)
+ ifeq ($(CONFIG_DEVFREQ_THERMAL),y)
+ INCLUDE_SUBDIR += $(src)/ipa/Kbuild
+ endif
+endif
-# For kutf and mali_kutf_irq_latency_test
-obj-$(CONFIG_MALI_KUTF) += tests/
+ifeq ($(KBUILD_EXTMOD),)
+# in-tree
+ -include $(INCLUDE_SUBDIR)
+else
+# out-of-tree
+ include $(INCLUDE_SUBDIR)
+endif
diff --git a/mali_kbase/Kconfig b/mali_kbase/Kconfig
index 098424f..368c269 100644
--- a/mali_kbase/Kconfig
+++ b/mali_kbase/Kconfig
@@ -18,11 +18,12 @@
#
#
-
menuconfig MALI_MIDGARD
tristate "Mali Midgard series support"
select GPU_TRACEPOINTS if ANDROID
select DMA_SHARED_BUFFER
+ select PM_DEVFREQ
+ select DEVFREQ_THERMAL
default n
help
Enable this option to build support for a ARM Mali Midgard GPU.
@@ -30,20 +31,43 @@ menuconfig MALI_MIDGARD
To compile this driver as a module, choose M here:
this will generate a single module, called mali_kbase.
+if MALI_MIDGARD
+
+config MALI_PLATFORM_NAME
+ depends on MALI_MIDGARD
+ string "Platform name"
+ default "devicetree"
+ help
+ Enter the name of the desired platform configuration directory to
+ include in the build. 'platform/$(MALI_PLATFORM_NAME)/Makefile' must
+ exist.
+
+config MALI_REAL_HW
+ depends on MALI_MIDGARD
+ def_bool !MALI_NO_MALI
+
+menu "Platform specific options"
+source "drivers/gpu/arm/midgard/platform/Kconfig"
+endmenu
+
config MALI_CSF_SUPPORT
- bool "Mali CSF based GPU support"
+ bool "Enable Mali CSF based GPU support"
depends on MALI_MIDGARD=m
default n
help
Enables support for CSF based GPUs.
-config MALI_GATOR_SUPPORT
- bool "Enable Streamline tracing support"
- depends on MALI_MIDGARD
+config MALI_DEVFREQ
+ bool "Enable devfreq support for Mali"
+ depends on MALI_MIDGARD && PM_DEVFREQ
+ select DEVFREQ_GOV_SIMPLE_ONDEMAND
default y
help
- Enables kbase tracing used by the Arm Streamline Performance Analyzer.
- The tracepoints are used to derive GPU activity charts in Streamline.
+ Support devfreq for Mali.
+
+ Using the devfreq framework and, by default, the simple on-demand
+ governor, the frequency of Mali will be dynamically selected from the
+ available OPPs.
config MALI_MIDGARD_DVFS
bool "Enable legacy DVFS"
@@ -52,28 +76,25 @@ config MALI_MIDGARD_DVFS
help
Choose this option to enable legacy DVFS in the Mali Midgard DDK.
+config MALI_GATOR_SUPPORT
+ bool "Enable Streamline tracing support"
+ depends on MALI_MIDGARD
+ default y
+ help
+ Enables kbase tracing used by the Arm Streamline Performance Analyzer.
+ The tracepoints are used to derive GPU activity charts in Streamline.
+
config MALI_MIDGARD_ENABLE_TRACE
bool "Enable kbase tracing"
depends on MALI_MIDGARD
default y if MALI_DEBUG
default n
help
- Enables tracing in kbase. Trace log available through
+ Enables tracing in kbase. Trace log available through
the "mali_trace" debugfs file, when the CONFIG_DEBUG_FS is enabled
-config MALI_DEVFREQ
- bool "devfreq support for Mali"
- depends on MALI_MIDGARD && PM_DEVFREQ
- default y
- help
- Support devfreq for Mali.
-
- Using the devfreq framework and, by default, the simpleondemand
- governor, the frequency of Mali will be dynamically selected from the
- available OPPs.
-
config MALI_DMA_FENCE
- bool "DMA_BUF fence support for Mali"
+ bool "Enable DMA_BUF fence support for Mali"
depends on MALI_MIDGARD
default n
help
@@ -82,18 +103,9 @@ config MALI_DMA_FENCE
This option should only be enabled if the Linux Kernel has built in
support for DMA_BUF fences.
-config MALI_PLATFORM_NAME
- depends on MALI_MIDGARD
- string "Platform name"
- default "devicetree"
- help
- Enter the name of the desired platform configuration directory to
- include in the build. 'platform/$(MALI_PLATFORM_NAME)/Kbuild' must
- exist.
-
config MALI_ARBITER_SUPPORT
bool "Enable arbiter support for Mali"
- depends on MALI_MIDGARD
+ depends on MALI_MIDGARD && !MALI_CSF_SUPPORT
default n
help
Enable support for the arbiter interface in the driver.
@@ -102,85 +114,40 @@ config MALI_ARBITER_SUPPORT
If unsure, say N.
-# MALI_EXPERT configuration options
-
-menuconfig MALI_EXPERT
+config MALI_DMA_BUF_MAP_ON_DEMAND
+ bool "Enable map imported dma-bufs on demand"
depends on MALI_MIDGARD
- bool "Enable Expert Settings"
default n
help
- Enabling this option and modifying the default settings may produce a driver with performance or
- other limitations.
-
-config MALI_CORESTACK
- bool "Support controlling power to the GPU core stack"
- depends on MALI_MIDGARD && MALI_EXPERT
- default n
- help
- Enabling this feature on supported GPUs will let the driver powering
- on/off the GPU core stack independently without involving the Power
- Domain Controller. This should only be enabled on platforms which
- integration of the PDC to the Mali GPU is known to be problematic.
- This feature is currently only supported on t-Six and t-HEx GPUs.
-
- If unsure, say N.
-
-config MALI_DEBUG
- bool "Debug build"
- depends on MALI_MIDGARD && MALI_EXPERT
- default n
- help
- Select this option for increased checking and reporting of errors.
-
-config MALI_FENCE_DEBUG
- bool "Debug sync fence usage"
- depends on MALI_MIDGARD && MALI_EXPERT && (SYNC || SYNC_FILE)
- default y if MALI_DEBUG
- help
- Select this option to enable additional checking and reporting on the
- use of sync fences in the Mali driver.
-
- This will add a 3s timeout to all sync fence waits in the Mali
- driver, so that when work for Mali has been waiting on a sync fence
- for a long time a debug message will be printed, detailing what fence
- is causing the block, and which dependent Mali atoms are blocked as a
- result of this.
+ This option caused kbase to set up the GPU mapping of imported
+ dma-buf when needed to run atoms. This is the legacy behavior.
- The timeout can be changed at runtime through the js_soft_timeout
- device attribute, where the timeout is specified in milliseconds.
+ This is intended for testing and the option will get removed in the
+ future.
-config MALI_NO_MALI
- bool "No Mali"
- depends on MALI_MIDGARD && MALI_EXPERT
+config MALI_DMA_BUF_LEGACY_COMPAT
+ bool "Enable legacy compatibility cache flush on dma-buf map"
+ depends on MALI_MIDGARD && !MALI_DMA_BUF_MAP_ON_DEMAND
default n
help
- This can be used to test the driver in a simulated environment
- whereby the hardware is not physically present. If the hardware is physically
- present it will not be used. This can be used to test the majority of the
- driver without needing actual hardware or for software benchmarking.
- All calls to the simulated hardware will complete immediately as if the hardware
- completed the task.
+ This option enables compatibility with legacy dma-buf mapping
+ behavior, then the dma-buf is mapped on import, by adding cache
+ maintenance where MALI_DMA_BUF_MAP_ON_DEMAND would do the mapping,
+ including a cache flush.
-config MALI_REAL_HW
- def_bool !MALI_NO_MALI
+ This option might work-around issues related to missing cache
+ flushes in other drivers. This only has an effect for clients using
+ UK 11.18 or older. For later UK versions it is not possible.
-config MALI_ERROR_INJECT
- bool "Error injection"
- depends on MALI_MIDGARD && MALI_EXPERT && MALI_NO_MALI
+menuconfig MALI_EXPERT
+ depends on MALI_MIDGARD
+ bool "Enable Expert Settings"
default n
help
- Enables insertion of errors to test module failure and recovery mechanisms.
+ Enabling this option and modifying the default settings may produce
+ a driver with performance or other limitations.
-config MALI_SYSTEM_TRACE
- bool "Enable system event tracing support"
- depends on MALI_MIDGARD && MALI_EXPERT
- default y if MALI_DEBUG
- default n
- help
- Choose this option to enable system trace events for each
- kbase event. This is typically used for debugging but has
- minimal overhead when not in use. Enable only if you know what
- you are doing.
+if MALI_EXPERT
config MALI_2MB_ALLOC
bool "Attempt to allocate 2MB pages"
@@ -193,20 +160,8 @@ config MALI_2MB_ALLOC
If in doubt, say N
-config MALI_PWRSOFT_765
- bool "PWRSOFT-765 ticket"
- depends on MALI_MIDGARD && MALI_EXPERT
- default n
- help
- PWRSOFT-765 fixes devfreq cooling devices issues. The fix was merged
- in kernel v4.10, however if backported into the kernel then this
- option must be manually selected.
-
- If using kernel >= v4.10 then say N, otherwise if devfreq cooling
- changes have been backported say Y to avoid compilation errors.
-
config MALI_MEMORY_FULLY_BACKED
- bool "Memory fully physically-backed"
+ bool "Enable memory fully physically-backed"
depends on MALI_MIDGARD && MALI_EXPERT
default n
help
@@ -215,76 +170,92 @@ config MALI_MEMORY_FULLY_BACKED
option only affects allocations of grow-on-GPU-page-fault
memory.
-config MALI_DMA_BUF_MAP_ON_DEMAND
- bool "Map imported dma-bufs on demand"
- depends on MALI_MIDGARD
+config MALI_CORESTACK
+ bool "Enable support of GPU core stack power control"
+ depends on MALI_MIDGARD && MALI_EXPERT
default n
help
- This option caused kbase to set up the GPU mapping of imported
- dma-buf when needed to run atoms. This is the legacy behaviour.
-
- This is intended for testing and the option will get removed in the
- future.
+ Enabling this feature on supported GPUs will let the driver powering
+ on/off the GPU core stack independently without involving the Power
+ Domain Controller. This should only be enabled on platforms which
+ integration of the PDC to the Mali GPU is known to be problematic.
+ This feature is currently only supported on t-Six and t-HEx GPUs.
-config MALI_DMA_BUF_LEGACY_COMPAT
- bool "Enable legacy compatibility cache flush on dma-buf map"
- depends on MALI_MIDGARD && !MALI_DMA_BUF_MAP_ON_DEMAND
- default n
- help
- This option enables compatibility with legacy dma-buf mapping
- behavior, then the dma-buf is mapped on import, by adding cache
- maintenance where MALI_DMA_BUF_MAP_ON_DEMAND would do the mapping,
- including a cache flush.
+ If unsure, say N.
- This option might work-around issues related to missing cache
- flushes in other drivers. This only has an effect for clients using
- UK 11.18 or older. For later UK versions it is not possible.
+comment "Platform options"
+ depends on MALI_MIDGARD && MALI_EXPERT
-config MALI_HW_ERRATA_1485982_NOT_AFFECTED
- bool "Disable workaround for BASE_HW_ISSUE_GPU2017_1336"
+config MALI_NO_MALI
+ bool "Enable No Mali"
depends on MALI_MIDGARD && MALI_EXPERT
default n
help
- This option disables the default workaround for GPU2017-1336. The
- workaround keeps the L2 cache powered up except for powerdown and reset.
-
- The workaround introduces a limitation that will prevent the running of
- protected mode content on fully coherent platforms, as the switch to IO
- coherency mode requires the L2 to be turned off.
+ This can be used to test the driver in a simulated environment
+ whereby the hardware is not physically present. If the hardware is physically
+ present it will not be used. This can be used to test the majority of the
+ driver without needing actual hardware or for software benchmarking.
+ All calls to the simulated hardware will complete immediately as if the hardware
+ completed the task.
-config MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE
- bool "Use alternative workaround for BASE_HW_ISSUE_GPU2017_1336"
- depends on MALI_MIDGARD && MALI_EXPERT && !MALI_HW_ERRATA_1485982_NOT_AFFECTED
+config MALI_ERROR_INJECT
+ bool "Enable No Mali error injection"
+ depends on MALI_MIDGARD && MALI_EXPERT && MALI_NO_MALI
default n
help
- This option uses an alternative workaround for GPU2017-1336. Lowering
- the GPU clock to a, platform specific, known good frequeuncy before
- powering down the L2 cache. The clock can be specified in the device
- tree using the property, opp-mali-errata-1485982. Otherwise the
- slowest clock will be selected.
+ Enables insertion of errors to test module failure and recovery mechanisms.
config MALI_GEM5_BUILD
bool "Enable build of Mali kernel driver for GEM5"
- depends on MALI_MIDGARD
+ depends on MALI_MIDGARD && MALI_EXPERT
default n
help
This option is to do a Mali GEM5 build.
If unsure, say N.
-# Instrumentation options.
+comment "Debug options"
+ depends on MALI_MIDGARD && MALI_EXPERT
-config MALI_JOB_DUMP
- bool "Enable system level support needed for job dumping"
+config MALI_DEBUG
+ bool "Enable debug build"
depends on MALI_MIDGARD && MALI_EXPERT
default n
help
- Choose this option to enable system level support needed for
- job dumping. This is typically used for instrumentation but has
+ Select this option for increased checking and reporting of errors.
+
+config MALI_FENCE_DEBUG
+ bool "Enable debug sync fence usage"
+ depends on MALI_MIDGARD && MALI_EXPERT && (SYNC || SYNC_FILE)
+ default y if MALI_DEBUG
+ help
+ Select this option to enable additional checking and reporting on the
+ use of sync fences in the Mali driver.
+
+ This will add a 3s timeout to all sync fence waits in the Mali
+ driver, so that when work for Mali has been waiting on a sync fence
+ for a long time a debug message will be printed, detailing what fence
+ is causing the block, and which dependent Mali atoms are blocked as a
+ result of this.
+
+ The timeout can be changed at runtime through the js_soft_timeout
+ device attribute, where the timeout is specified in milliseconds.
+
+config MALI_SYSTEM_TRACE
+ bool "Enable system event tracing support"
+ depends on MALI_MIDGARD && MALI_EXPERT
+ default y if MALI_DEBUG
+ default n
+ help
+ Choose this option to enable system trace events for each
+ kbase event. This is typically used for debugging but has
minimal overhead when not in use. Enable only if you know what
you are doing.
+comment "Instrumentation options"
+ depends on MALI_MIDGARD && MALI_EXPERT
+
choice
- prompt "Performance counters set"
+ prompt "Select Performance counters set"
default MALI_PRFCNT_SET_PRIMARY
depends on MALI_MIDGARD && MALI_EXPERT
@@ -321,7 +292,7 @@ config MALI_PRFCNT_SET_TERTIARY
endchoice
config MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS
- bool "Allow runtime selection of performance counters set via debugfs"
+ bool "Enable runtime selection of performance counters set via debugfs"
depends on MALI_MIDGARD && MALI_EXPERT && DEBUG_FS
default n
help
@@ -343,5 +314,69 @@ config MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS
If unsure, say N.
-source "drivers/gpu/arm/midgard/platform/Kconfig"
+config MALI_JOB_DUMP
+ bool "Enable system level support needed for job dumping"
+ depends on MALI_MIDGARD && MALI_EXPERT
+ default n
+ help
+ Choose this option to enable system level support needed for
+ job dumping. This is typically used for instrumentation but has
+ minimal overhead when not in use. Enable only if you know what
+ you are doing.
+
+comment "Workarounds"
+ depends on MALI_MIDGARD && MALI_EXPERT
+
+config MALI_PWRSOFT_765
+ bool "Enable workaround for PWRSOFT-765"
+ depends on MALI_MIDGARD && MALI_EXPERT
+ default n
+ help
+ PWRSOFT-765 fixes devfreq cooling devices issues. The fix was merged
+ in kernel v4.10, however if backported into the kernel then this
+ option must be manually selected.
+
+ If using kernel >= v4.10 then say N, otherwise if devfreq cooling
+ changes have been backported say Y to avoid compilation errors.
+
+config MALI_HW_ERRATA_1485982_NOT_AFFECTED
+ bool "Disable workaround for BASE_HW_ISSUE_GPU2017_1336"
+ depends on MALI_MIDGARD && MALI_EXPERT
+ default n
+ help
+ This option disables the default workaround for GPU2017-1336. The
+ workaround keeps the L2 cache powered up except for powerdown and reset.
+
+ The workaround introduces a limitation that will prevent the running of
+ protected mode content on fully coherent platforms, as the switch to IO
+ coherency mode requires the L2 to be turned off.
+
+config MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE
+ bool "Use alternative workaround for BASE_HW_ISSUE_GPU2017_1336"
+ depends on MALI_MIDGARD && MALI_EXPERT && !MALI_HW_ERRATA_1485982_NOT_AFFECTED
+ default n
+ help
+ This option uses an alternative workaround for GPU2017-1336. Lowering
+ the GPU clock to a, platform specific, known good frequency before
+ powering down the L2 cache. The clock can be specified in the device
+ tree using the property, opp-mali-errata-1485982. Otherwise the
+ slowest clock will be selected.
+
+endif
+
+config MALI_ARBITRATION
+ bool "Enable Virtualization reference code"
+ depends on MALI_MIDGARD
+ default n
+ help
+ Enables the build of several reference modules used in the reference
+ virtualization setup for Mali
+ If unsure, say N.
+
+if MALI_ARBITRATION
+source "drivers/gpu/arm/midgard/arbitration/Kconfig"
+endif
+
source "drivers/gpu/arm/midgard/tests/Kconfig"
+
+endif
diff --git a/mali_kbase/Makefile b/mali_kbase/Makefile
index c78d023..dd35d54 100644
--- a/mali_kbase/Makefile
+++ b/mali_kbase/Makefile
@@ -18,58 +18,217 @@
#
#
-# Handle Android Common Kernel source naming
KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
KDIR ?= $(KERNEL_SRC)
# Ensure build intermediates are in OUT_DIR instead of alongside the source
M ?= $(shell pwd)
-# out-of-tree
-ifeq ($(KBUILD_EXTMOD),)
-export CONFIG_MALI_MIDGARD?=m
+ifeq ($(KDIR),)
+ $(error Must specify KDIR to point to the kernel to target))
+endif
-ifneq ($(CONFIG_MALI_MIDGARD),n)
-export CONFIG_MALI_CSF_SUPPORT?=n
-export CONFIG_MALI_KUTF?=n
-export CONFIG_MALI_REAL_HW?=y
-# Handle default y/m in Kconfig
-export CONFIG_MALI_GATOR_SUPPORT?=y
-export CONFIG_MALI_DEVFREQ?=n
-ifneq ($(CONFIG_PM_DEVFREQ),n)
-export CONFIG_MALI_DEVFREQ?=y
-endif
+#
+# Pixel integration configuration values
+#
-DEFINES += -DCONFIG_MALI_MIDGARD=$(CONFIG_MALI_MIDGARD) \
- -DCONFIG_MALI_CSF_SUPPORT=$(CONFIG_MALI_CSF_SUPPORT) \
- -DCONFIG_MALI_KUTF=$(CONFIG_MALI_KUTF) \
- -DCONFIG_MALI_REAL_HW=$(CONFIG_MALI_REAL_HW) \
- -DCONFIG_MALI_GATOR_SUPPORT=$(CONFIG_MALI_GATOR_SUPPORT) \
- -DCONFIG_MALI_DEVFREQ=$(CONFIG_MALI_DEVFREQ)
+# Core kbase configuration options
+CONFIG_MALI_EXPERT=y
+CONFIG_MALI_MIDGARD_DVFS=y
-export DEFINES
+# Pixel integration specific configuration options
+CONFIG_MALI_PLATFORM_NAME="pixel"
+CONFIG_MALI_PIXEL_GPU_QOS=y
+CONFIG_MALI_PIXEL_GPU_BTS=y
+CONFIG_MALI_PIXEL_GPU_THERMAL=y
+CONFIG_MALI_PIXEL_GPU_SECURE_RENDERING=y
-# Pixel integration exports
-export CONFIG_MALI_EXPERT=y
-export CONFIG_MALI_MIDGARD_DVFS=y
-export CONFIG_MALI_PLATFORM_NAME="pixel"
-export CONFIG_MALI_PIXEL_GPU_QOS=y
-export CONFIG_MALI_PIXEL_GPU_BTS=y
-export CONFIG_MALI_PIXEL_GPU_THERMAL=y
-export CONFIG_MALI_PIXEL_GPU_SECURE_RENDERING=y
+#
+# Default configuration values
+#
+# Dependency resolution is done through statements as Kconfig
+# is not supported for out-of-tree builds.
+#
+
+CONFIG_MALI_MIDGARD ?= m
+ifeq ($(CONFIG_MALI_MIDGARD),m)
+ CONFIG_MALI_GATOR_SUPPORT ?= y
+ CONFIG_MALI_ARBITRATION ?= n
+
+ ifneq ($(CONFIG_MALI_NO_MALI),y)
+ # Prevent misuse when CONFIG_MALI_NO_MALI=y
+ CONFIG_MALI_REAL_HW ?= y
+ endif
+
+ ifeq ($(CONFIG_MALI_MIDGARD_DVFS),y)
+ # Prevent misuse when CONFIG_MALI_MIDGARD_DVFS=y
+ CONFIG_MALI_DEVFREQ ?= n
+ else
+ CONFIG_MALI_DEVFREQ ?= y
+ endif
+
+ ifeq ($(CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND), y)
+ # Prevent misuse when CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y
+ CONFIG_MALI_DMA_BUF_LEGACY_COMPAT = n
+ endif
+
+ #
+ # Expert/Debug/Test released configurations
+ #
+ ifeq ($(CONFIG_MALI_EXPERT), y)
+ ifeq ($(CONFIG_MALI_NO_MALI), y)
+ CONFIG_MALI_REAL_HW = n
+ else
+ # Prevent misuse when CONFIG_MALI_NO_MALI=n
+ CONFIG_MALI_REAL_HW = y
+ CONFIG_MALI_ERROR_INJECT = n
+ endif
+
+ ifeq ($(CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED), y)
+ # Prevent misuse when CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED=y
+ CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE = n
+ endif
+
+ ifeq ($(CONFIG_MALI_DEBUG), y)
+ CONFIG_MALI_MIDGARD_ENABLE_TRACE ?= y
+ CONFIG_MALI_SYSTEM_TRACE ?= y
+
+ ifeq ($(CONFIG_SYNC), y)
+ CONFIG_MALI_FENCE_DEBUG ?= y
+ else
+ ifeq ($(CONFIG_SYNC_FILE), y)
+ CONFIG_MALI_FENCE_DEBUG ?= y
+ else
+ CONFIG_MALI_FENCE_DEBUG = n
+ endif
+ endif
+ else
+ # Prevent misuse when CONFIG_MALI_DEBUG=n
+ CONFIG_MALI_MIDGARD_ENABLE_TRACE = n
+ CONFIG_MALI_SYSTEM_TRACE = n
+ CONFIG_MALI_FENCE_DEBUG = n
+ endif
+ else
+ # Prevent misuse when CONFIG_MALI_EXPERT=n
+ CONFIG_MALI_CORESTACK = n
+ CONFIG_MALI_2MB_ALLOC = n
+ CONFIG_MALI_PWRSOFT_765 = n
+ CONFIG_MALI_MEMORY_FULLY_BACKED = n
+ CONFIG_MALI_JOB_DUMP = n
+ CONFIG_MALI_NO_MALI = n
+ CONFIG_MALI_REAL_HW = y
+ CONFIG_MALI_ERROR_INJECT = n
+ CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED = n
+ CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE = n
+ CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS = n
+ CONFIG_MALI_DEBUG = n
+ CONFIG_MALI_MIDGARD_ENABLE_TRACE = n
+ CONFIG_MALI_SYSTEM_TRACE = n
+ CONFIG_MALI_FENCE_DEBUG = n
+ endif
+
+ ifeq ($(CONFIG_MALI_DEBUG), y)
+ CONFIG_MALI_KUTF ?= y
+ ifeq ($(CONFIG_MALI_KUTF), y)
+ CONFIG_MALI_KUTF_IRQ_TEST ?= y
+ CONFIG_MALI_KUTF_CLK_RATE_TRACE ?= y
+ else
+ # Prevent misuse when CONFIG_MALI_KUTF=n
+ CONFIG_MALI_KUTF_IRQ_TEST = n
+ CONFIG_MALI_KUTF_CLK_RATE_TRACE = n
+ endif
+ else
+ # Prevent misuse when CONFIG_MALI_DEBUG=n
+ CONFIG_MALI_KUTF = n
+ CONFIG_MALI_KUTF_IRQ_TEST = n
+ CONFIG_MALI_KUTF_CLK_RATE_TRACE = n
+ endif
+else
+ # Prevent misuse when CONFIG_MALI_MIDGARD=n
+ CONFIG_MALI_ARBITRATION = n
+ CONFIG_MALI_KUTF = n
+ CONFIG_MALI_KUTF_IRQ_TEST = n
+ CONFIG_MALI_KUTF_CLK_RATE_TRACE = n
endif
-endif
-KBASE_PATH_RELATIVE = $(M)
+# All Mali CONFIG should be listed here
+CONFIGS := \
+ CONFIG_MALI_MIDGARD \
+ CONFIG_MALI_CSF_SUPPORT \
+ CONFIG_MALI_GATOR_SUPPORT \
+ CONFIG_MALI_DMA_FENCE \
+ CONFIG_MALI_ARBITER_SUPPORT \
+ CONFIG_MALI_ARBITRATION \
+ CONFIG_MALI_PARTITION_MANAGER \
+ CONFIG_MALI_REAL_HW \
+ CONFIG_MALI_GEM5_BUILD \
+ CONFIG_MALI_DEVFREQ \
+ CONFIG_MALI_MIDGARD_DVFS \
+ CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND \
+ CONFIG_MALI_DMA_BUF_LEGACY_COMPAT \
+ CONFIG_MALI_EXPERT \
+ CONFIG_MALI_CORESTACK \
+ CONFIG_MALI_2MB_ALLOC \
+ CONFIG_MALI_PWRSOFT_765 \
+ CONFIG_MALI_MEMORY_FULLY_BACKED \
+ CONFIG_MALI_JOB_DUMP \
+ CONFIG_MALI_NO_MALI \
+ CONFIG_MALI_ERROR_INJECT \
+ CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED \
+ CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE \
+ CONFIG_MALI_PRFCNT_SET_PRIMARY \
+ CONFIG_MALI_PRFCNT_SET_SECONDARY \
+ CONFIG_MALI_PRFCNT_SET_TERTIARY \
+ CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS \
+ CONFIG_MALI_DEBUG \
+ CONFIG_MALI_MIDGARD_ENABLE_TRACE \
+ CONFIG_MALI_SYSTEM_TRACE \
+ CONFIG_MALI_FENCE_DEBUG \
+ CONFIG_MALI_KUTF \
+ CONFIG_MALI_KUTF_IRQ_TEST \
+ CONFIG_MALI_KUTF_CLK_RATE_TRACE
+
+# Pixel integration CONFIG options
+CONFIGS += \
+ CONFIG_MALI_PIXEL_GPU_QOS \
+ CONFIG_MALI_PIXEL_GPU_BTS \
+ CONFIG_MALI_PIXEL_GPU_THERMAL \
+ CONFIG_MALI_PIXEL_GPU_SECURE_RENDERING
+
+
+#
+# MAKE_ARGS to pass the custom CONFIGs on out-of-tree build
+#
+# Generate the list of CONFIGs and values.
+# $(value config) is the name of the CONFIG option.
+# $(value $(value config)) is its value (y, m).
+# When the CONFIG is not set to y or m, it defaults to n.
+MAKE_ARGS := $(foreach config,$(CONFIGS), \
+ $(if $(filter y m,$(value $(value config))), \
+ $(value config)=$(value $(value config)), \
+ $(value config)=n))
+
+#
+# EXTRA_CFLAGS to define the custom CONFIGs on out-of-tree build
+#
+# Generate the list of CONFIGs defines with values from CONFIGS.
+# $(value config) is the name of the CONFIG option.
+# When set to y or m, the CONFIG gets defined to 1.
+EXTRA_CFLAGS := $(foreach config,$(CONFIGS), \
+ $(if $(filter y m,$(value $(value config))), \
+ -D$(value config)=1))
+
+#
+# KBUILD_EXTRA_SYMBOLS to prevent warnings about unknown functions
+#
-# we get the symbols from modules using KBUILD_EXTRA_SYMBOLS to prevent warnings about unknown functions
-modules:
- $(MAKE) -C $(KDIR) M=$(M) W=1 EXTRA_CFLAGS="-I$(M) -I$(M)/../common/include -I$(M)/../../../../tests/include $(SCONS_CFLAGS)" $(SCONS_CONFIGS) KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" modules $(@)
+all:
+ $(MAKE) -C $(KDIR) M=$(M) W=1 $(MAKE_ARGS) EXTRA_CFLAGS="$(EXTRA_CFLAGS)" KBUILD_EXTRA_SYMBOLS="$(EXTRA_SYMBOLS)" modules
modules_install:
- $(MAKE) -C $(KDIR) M=$(M) modules_install
+ $(MAKE) -C $(KDIR) M=$(M) W=1 $(MAKE_ARGS) modules_install
clean:
- $(MAKE) -C $(KDIR) M=$(M) clean
+ $(MAKE) -C $(KDIR) M=$(M) W=1 $(MAKE_ARGS) clean
diff --git a/mali_kbase/Mconfig b/mali_kbase/Mconfig
index cbb61d6..d71a113 100644
--- a/mali_kbase/Mconfig
+++ b/mali_kbase/Mconfig
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0
+# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
#
# (C) COPYRIGHT 2012-2021 ARM Limited. All rights reserved.
#
@@ -27,20 +27,44 @@ menuconfig MALI_MIDGARD
To compile this driver as a module, choose M here:
this will generate a single module, called mali_kbase.
+config MALI_PLATFORM_NAME
+ depends on MALI_MIDGARD
+ string "Platform name"
+ default "hisilicon" if PLATFORM_HIKEY960
+ default "hisilicon" if PLATFORM_HIKEY970
+ default "devicetree"
+ help
+ Enter the name of the desired platform configuration directory to
+ include in the build. 'platform/$(MALI_PLATFORM_NAME)/Makefile' must
+ exist.
+
+ When PLATFORM_CUSTOM is set, this needs to be set manually to
+ pick up the desired platform files.
+
+config MALI_REAL_HW
+ bool
+ depends on MALI_MIDGARD
+ default y
+ default n if NO_MALI
+
config MALI_CSF_SUPPORT
- bool "Mali CSF based GPU support"
+ bool "Enable Mali CSF based GPU support"
depends on MALI_MIDGARD
- default n
+ default y if GPU_HAS_CSF
help
Enables support for CSF based GPUs.
-config MALI_GATOR_SUPPORT
- bool "Enable Streamline tracing support"
- depends on MALI_MIDGARD && !BACKEND_USER
- default y
+config MALI_DEVFREQ
+ bool "Enable devfreq support for Mali"
+ depends on MALI_MIDGARD
+ default y if PLATFORM_JUNO
+ default y if PLATFORM_CUSTOM
help
- Enables kbase tracing used by the Arm Streamline Performance Analyzer.
- The tracepoints are used to derive GPU activity charts in Streamline.
+ Support devfreq for Mali.
+
+ Using the devfreq framework and, by default, the simple on-demand
+ governor, the frequency of Mali will be dynamically selected from the
+ available OPPs.
config MALI_MIDGARD_DVFS
bool "Enable legacy DVFS"
@@ -49,29 +73,25 @@ config MALI_MIDGARD_DVFS
help
Choose this option to enable legacy DVFS in the Mali Midgard DDK.
+config MALI_GATOR_SUPPORT
+ bool "Enable Streamline tracing support"
+ depends on MALI_MIDGARD && !BACKEND_USER
+ default y
+ help
+ Enables kbase tracing used by the Arm Streamline Performance Analyzer.
+ The tracepoints are used to derive GPU activity charts in Streamline.
+
config MALI_MIDGARD_ENABLE_TRACE
bool "Enable kbase tracing"
depends on MALI_MIDGARD
default y if MALI_DEBUG
default n
help
- Enables tracing in kbase. Trace log available through
+ Enables tracing in kbase. Trace log available through
the "mali_trace" debugfs file, when the CONFIG_DEBUG_FS is enabled
-config MALI_DEVFREQ
- bool "devfreq support for Mali"
- depends on MALI_MIDGARD
- default y if PLATFORM_JUNO
- default y if PLATFORM_CUSTOM
- help
- Support devfreq for Mali.
-
- Using the devfreq framework and, by default, the simpleondemand
- governor, the frequency of Mali will be dynamically selected from the
- available OPPs.
-
config MALI_DMA_FENCE
- bool "DMA_BUF fence support for Mali"
+ bool "Enable DMA_BUF fence support for Mali"
depends on MALI_MIDGARD
default n
help
@@ -80,23 +100,9 @@ config MALI_DMA_FENCE
This option should only be enabled if the Linux Kernel has built in
support for DMA_BUF fences.
-config MALI_PLATFORM_NAME
- depends on MALI_MIDGARD
- string "Platform name"
- default "hisilicon" if PLATFORM_HIKEY960
- default "hisilicon" if PLATFORM_HIKEY970
- default "devicetree"
- help
- Enter the name of the desired platform configuration directory to
- include in the build. 'platform/$(MALI_PLATFORM_NAME)/Kbuild' must
- exist.
-
- When PLATFORM_CUSTOM is set, this needs to be set manually to
- pick up the desired platform files.
-
config MALI_ARBITER_SUPPORT
bool "Enable arbiter support for Mali"
- depends on MALI_MIDGARD && !GPU_HAS_CSF
+ depends on MALI_MIDGARD && !MALI_CSF_SUPPORT
default n
help
Enable support for the arbiter interface in the driver.
@@ -105,62 +111,89 @@ config MALI_ARBITER_SUPPORT
If unsure, say N.
-# MALI_EXPERT configuration options
+config DMA_BUF_SYNC_IOCTL_SUPPORTED
+ bool "Enable Kernel DMA buffers support DMA_BUF_IOCTL_SYNC"
+ depends on MALI_MIDGARD && BACKEND_KERNEL
+ default y
+
+config MALI_DMA_BUF_MAP_ON_DEMAND
+ bool "Enable map imported dma-bufs on demand"
+ depends on MALI_MIDGARD
+ default n
+ default y if !DMA_BUF_SYNC_IOCTL_SUPPORTED
+ help
+ This option caused kbase to set up the GPU mapping of imported
+ dma-buf when needed to run atoms. This is the legacy behavior.
+
+ This is intended for testing and the option will get removed in the
+ future.
+
+config MALI_DMA_BUF_LEGACY_COMPAT
+ bool "Enable legacy compatibility cache flush on dma-buf map"
+ depends on MALI_MIDGARD && !MALI_DMA_BUF_MAP_ON_DEMAND
+ default n
+ help
+ This option enables compatibility with legacy dma-buf mapping
+ behavior, then the dma-buf is mapped on import, by adding cache
+ maintenance where MALI_DMA_BUF_MAP_ON_DEMAND would do the mapping,
+ including a cache flush.
+
+ This option might work-around issues related to missing cache
+ flushes in other drivers. This only has an effect for clients using
+ UK 11.18 or older. For later UK versions it is not possible.
menuconfig MALI_EXPERT
depends on MALI_MIDGARD
bool "Enable Expert Settings"
default y
help
- Enabling this option and modifying the default settings may produce a driver with performance or
- other limitations.
+ Enabling this option and modifying the default settings may produce
+ a driver with performance or other limitations.
-config MALI_CORESTACK
- bool "Support controlling power to the GPU core stack"
+config MALI_2MB_ALLOC
+ bool "Attempt to allocate 2MB pages"
depends on MALI_MIDGARD && MALI_EXPERT
default n
help
- Enabling this feature on supported GPUs will let the driver powering
- on/off the GPU core stack independently without involving the Power
- Domain Controller. This should only be enabled on platforms which
- integration of the PDC to the Mali GPU is known to be problematic.
- This feature is currently only supported on t-Six and t-HEx GPUs.
+ Rather than allocating all GPU memory page-by-page, attempt to
+ allocate 2MB pages from the kernel. This reduces TLB pressure and
+ helps to prevent memory fragmentation.
- If unsure, say N.
+ If in doubt, say N
-config MALI_DEBUG
- bool "Debug build"
+config MALI_MEMORY_FULLY_BACKED
+ bool "Enable memory fully physically-backed"
depends on MALI_MIDGARD && MALI_EXPERT
- default y if DEBUG
default n
help
- Select this option for increased checking and reporting of errors.
+ This option enables full physical backing of all virtual
+ memory allocations in the kernel. Notice that this build
+ option only affects allocations of grow-on-GPU-page-fault
+ memory.
-config MALI_FENCE_DEBUG
- bool "Debug sync fence usage"
+config MALI_CORESTACK
+ bool "Enable support of GPU core stack power control"
depends on MALI_MIDGARD && MALI_EXPERT
- default y if MALI_DEBUG
+ default n
help
- Select this option to enable additional checking and reporting on the
- use of sync fences in the Mali driver.
-
- This will add a 3s timeout to all sync fence waits in the Mali
- driver, so that when work for Mali has been waiting on a sync fence
- for a long time a debug message will be printed, detailing what fence
- is causing the block, and which dependent Mali atoms are blocked as a
- result of this.
+ Enabling this feature on supported GPUs will let the driver powering
+ on/off the GPU core stack independently without involving the Power
+ Domain Controller. This should only be enabled on platforms which
+ integration of the PDC to the Mali GPU is known to be problematic.
+ This feature is currently only supported on t-Six and t-HEx GPUs.
- The timeout can be changed at runtime through the js_soft_timeout
- device attribute, where the timeout is specified in milliseconds.
+ If unsure, say N.
choice
prompt "Error injection level"
+ depends on MALI_MIDGARD && MALI_EXPERT
default MALI_ERROR_INJECT_NONE
help
Enables insertion of errors to test module failure and recovery mechanisms.
config MALI_ERROR_INJECT_NONE
bool "disabled"
+ depends on MALI_MIDGARD && MALI_EXPERT
help
Error injection is disabled.
@@ -180,14 +213,49 @@ endchoice
config MALI_ERROR_INJECT_ON
string
+ depends on MALI_MIDGARD && MALI_EXPERT
default "0" if MALI_ERROR_INJECT_NONE
default "1" if MALI_ERROR_INJECT_TRACK_LIST
default "2" if MALI_ERROR_INJECT_RANDOM
config MALI_ERROR_INJECT
bool
+ depends on MALI_MIDGARD && MALI_EXPERT
default y if !MALI_ERROR_INJECT_NONE
+config MALI_GEM5_BUILD
+ bool "Enable build of Mali kernel driver for GEM5"
+ depends on MALI_MIDGARD && MALI_EXPERT
+ default n
+ help
+ This option is to do a Mali GEM5 build.
+ If unsure, say N.
+
+config MALI_DEBUG
+ bool "Enable debug build"
+ depends on MALI_MIDGARD && MALI_EXPERT
+ default y if DEBUG
+ default n
+ help
+ Select this option for increased checking and reporting of errors.
+
+config MALI_FENCE_DEBUG
+ bool "Enable debug sync fence usage"
+ depends on MALI_MIDGARD && MALI_EXPERT
+ default y if MALI_DEBUG
+ help
+ Select this option to enable additional checking and reporting on the
+ use of sync fences in the Mali driver.
+
+ This will add a 3s timeout to all sync fence waits in the Mali
+ driver, so that when work for Mali has been waiting on a sync fence
+ for a long time a debug message will be printed, detailing what fence
+ is causing the block, and which dependent Mali atoms are blocked as a
+ result of this.
+
+ The timeout can be changed at runtime through the js_soft_timeout
+ device attribute, where the timeout is specified in milliseconds.
+
config MALI_SYSTEM_TRACE
bool "Enable system event tracing support"
depends on MALI_MIDGARD && MALI_EXPERT
@@ -199,56 +267,35 @@ config MALI_SYSTEM_TRACE
minimal overhead when not in use. Enable only if you know what
you are doing.
-config MALI_2MB_ALLOC
- bool "Attempt to allocate 2MB pages"
- depends on MALI_MIDGARD && MALI_EXPERT
- default n
- help
- Rather than allocating all GPU memory page-by-page, attempt to
- allocate 2MB pages from the kernel. This reduces TLB pressure and
- helps to prevent memory fragmentation.
+# Instrumentation options.
- If in doubt, say N
+# config MALI_PRFCNT_SET_PRIMARY exists in the Kernel Kconfig but is configured using CINSTR_PRIMARY_HWC in Mconfig.
+# config MALI_PRFCNT_SET_SECONDARY exists in the Kernel Kconfig but is configured using CINSTR_SECONDARY_HWC in Mconfig.
+# config MALI_PRFCNT_SET_TERTIARY exists in the Kernel Kconfig but is configured using CINSTR_TERTIARY_HWC in Mconfig.
+# config MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS exists in the Kernel Kconfig but is configured using CINSTR_HWC_SET_SELECT_VIA_DEBUG_FS in Mconfig.
-config MALI_PWRSOFT_765
- bool "PWRSOFT-765 ticket"
+config MALI_JOB_DUMP
+ bool "Enable system level support needed for job dumping"
depends on MALI_MIDGARD && MALI_EXPERT
default n
help
- PWRSOFT-765 fixes devfreq cooling devices issues. However, they are
- not merged in mainline kernel yet. So this define helps to guard those
- parts of the code.
-
-config MALI_MEMORY_FULLY_BACKED
- bool "Memory fully physically-backed"
- default n
- help
- This option enables full backing of all virtual memory allocations
- for the kernel. This only affects grow-on-GPU-page-fault memory.
+ Choose this option to enable system level support needed for
+ job dumping. This is typically used for instrumentation but has
+ minimal overhead when not in use. Enable only if you know what
+ you are doing.
-config MALI_DMA_BUF_MAP_ON_DEMAND
- bool "Map imported dma-bufs on demand"
- depends on MALI_MIDGARD
+config MALI_PWRSOFT_765
+ bool "Enable workaround for PWRSOFT-765"
+ depends on MALI_MIDGARD && MALI_EXPERT
default n
- default y if !DMA_BUF_SYNC_IOCTL_SUPPORTED
help
- This option caused kbase to set up the GPU mapping of imported
- dma-buf when needed to run atoms. This is the legacy behaviour.
+ PWRSOFT-765 fixes devfreq cooling devices issues. The fix was merged
+ in kernel v4.10, however if backported into the kernel then this
+ option must be manually selected.
-config MALI_DMA_BUF_LEGACY_COMPAT
- bool "Enable legacy compatibility cache flush on dma-buf map"
- depends on MALI_MIDGARD && !MALI_DMA_BUF_MAP_ON_DEMAND
- default n
- help
- This option enables compatibility with legacy dma-buf mapping
- behavior, then the dma-buf is mapped on import, by adding cache
- maintenance where MALI_DMA_BUF_MAP_ON_DEMAND would do the mapping,
- including a cache flush.
+ If using kernel >= v4.10 then say N, otherwise if devfreq cooling
+ changes have been backported say Y to avoid compilation errors.
-config MALI_REAL_HW
- bool
- default y
- default n if NO_MALI
config MALI_HW_ERRATA_1485982_NOT_AFFECTED
bool "Disable workaround for BASE_HW_ISSUE_GPU2017_1336"
@@ -274,20 +321,6 @@ config MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE
tree using the property, opp-mali-errata-1485982. Otherwise the
slowest clock will be selected.
-config MALI_GEM5_BUILD
- bool "Enable build of Mali kernel driver for GEM5"
- depends on MALI_MIDGARD
- default n
- help
- This option is to do a Mali GEM5 build.
- If unsure, say N.
-
-# Instrumentation options.
-
-# config MALI_JOB_DUMP exists in the Kernel Kconfig but is configured using CINSTR_JOB_DUMP in Mconfig.
-# config MALI_PRFCNT_SET_PRIMARY exists in the Kernel Kconfig but is configured using CINSTR_PRIMARY_HWC in Mconfig.
-# config MALI_PRFCNT_SET_SECONDARY exists in the Kernel Kconfig but is configured using CINSTR_SECONDARY_HWC in Mconfig.
-# config MALI_PRFCNT_SET_TERTIARY exists in the Kernel Kconfig but is configured using CINSTR_TERTIARY_HWC in Mconfig.
-# config MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS exists in the Kernel Kconfig but is configured using CINSTR_HWC_SET_SELECT_VIA_DEBUG_FS in Mconfig.
+source "kernel/drivers/gpu/arm/midgard/arbitration/Mconfig"
source "kernel/drivers/gpu/arm/midgard/tests/Mconfig"
diff --git a/mali_kbase/arbiter/Kbuild b/mali_kbase/arbiter/Kbuild
index f81aa75..4491fc6 100644
--- a/mali_kbase/arbiter/Kbuild
+++ b/mali_kbase/arbiter/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,5 +19,5 @@
#
mali_kbase-y += \
- arbiter/mali_kbase_arbif.o \
- arbiter/mali_kbase_arbiter_pm.o
+ arbiter/mali_kbase_arbif.o \
+ arbiter/mali_kbase_arbiter_pm.o
diff --git a/mali_kbase/arbiter/mali_kbase_arbif.c b/mali_kbase/arbiter/mali_kbase_arbif.c
index 7d6ab0c..bd78c66 100644
--- a/mali_kbase/arbiter/mali_kbase_arbif.c
+++ b/mali_kbase/arbiter/mali_kbase_arbif.c
@@ -170,11 +170,15 @@ static void on_gpu_lost(struct device *dev)
*
* Initialise Kbase Arbiter interface and assign callback functions.
*
- * Return: 0 on success else a Linux error code
+ * Return:
+ * * 0 - the interface was initialized or was not specified
+ * * in the device tree.
+ * * -EFAULT - the interface was specified but failed to initialize.
+ * * -EPROBE_DEFER - module dependencies are not yet available.
*/
int kbase_arbif_init(struct kbase_device *kbdev)
{
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
struct arbiter_if_arb_vm_ops ops;
struct arbiter_if_dev *arb_if;
struct device_node *arbiter_if_node;
@@ -218,8 +222,8 @@ int kbase_arbif_init(struct kbase_device *kbdev)
ops.arb_vm_max_config = on_max_config;
ops.arb_vm_update_freq = on_update_freq;
-
kbdev->arb.arb_freq.arb_freq = 0;
+ kbdev->arb.arb_freq.freq_updated = false;
mutex_init(&kbdev->arb.arb_freq.arb_freq_lock);
/* register kbase arbiter_if callbacks */
@@ -229,6 +233,8 @@ int kbase_arbif_init(struct kbase_device *kbdev)
if (err) {
dev_err(&pdev->dev, "Failed to register with arbiter\n");
module_put(pdev->dev.driver->owner);
+ if (err != -EPROBE_DEFER)
+ err = -EFAULT;
return err;
}
}
@@ -307,6 +313,8 @@ void kbase_arbif_gpu_stopped(struct kbase_device *kbdev, u8 gpu_required)
if (arb_if && arb_if->vm_ops.vm_arb_gpu_stopped) {
dev_dbg(kbdev->dev, "%s\n", __func__);
KBASE_TLSTREAM_TL_ARBITER_STOPPED(kbdev, kbdev);
+ if (gpu_required)
+ KBASE_TLSTREAM_TL_ARBITER_REQUESTED(kbdev, kbdev);
arb_if->vm_ops.vm_arb_gpu_stopped(arb_if, gpu_required);
}
}
diff --git a/mali_kbase/arbiter/mali_kbase_arbif.h b/mali_kbase/arbiter/mali_kbase_arbif.h
index 710559c..531c910 100644
--- a/mali_kbase/arbiter/mali_kbase_arbif.h
+++ b/mali_kbase/arbiter/mali_kbase_arbif.h
@@ -57,8 +57,11 @@ enum kbase_arbif_evt {
* Initialize the arbiter interface and also determines
* if Arbiter functionality is required.
*
- * Return: 0 if the Arbiter interface was successfully initialized or the
- * Arbiter was not required.
+ * Return:
+ * * 0 - the interface was initialized or was not specified
+ * * in the device tree.
+ * * -EFAULT - the interface was specified but failed to initialize.
+ * * -EPROBE_DEFER - module dependencies are not yet available.
*/
int kbase_arbif_init(struct kbase_device *kbdev);
diff --git a/mali_kbase/arbiter/mali_kbase_arbiter_interface.h b/mali_kbase/arbiter/mali_kbase_arbiter_interface.h
index 84389e8..1b4365e 100644
--- a/mali_kbase/arbiter/mali_kbase_arbiter_interface.h
+++ b/mali_kbase/arbiter/mali_kbase_arbiter_interface.h
@@ -132,6 +132,11 @@ struct arbiter_if_vm_arb_ops {
* @dev: The device structure to supply in the callbacks.
* @ops: The callbacks that the device driver supports
* (none are optional).
+ *
+ * Return:
+ * * 0 - successful.
+ * * -EINVAL - invalid argument.
+ * * -EPROBE_DEFER - module dependencies are not yet available.
*/
int (*vm_arb_register_dev)(struct arbiter_if_dev *arbif_dev,
struct device *dev, struct arbiter_if_arb_vm_ops *ops);
diff --git a/mali_kbase/arbiter/mali_kbase_arbiter_pm.c b/mali_kbase/arbiter/mali_kbase_arbiter_pm.c
index 456cc70..a5deded 100644
--- a/mali_kbase/arbiter/mali_kbase_arbiter_pm.c
+++ b/mali_kbase/arbiter/mali_kbase_arbiter_pm.c
@@ -27,9 +27,9 @@
#include <mali_kbase.h>
#include <mali_kbase_pm.h>
#include <mali_kbase_hwaccess_jm.h>
-#include <mali_kbase_irq_internal.h>
+#include <backend/gpu/mali_kbase_irq_internal.h>
#include <mali_kbase_hwcnt_context.h>
-#include <mali_kbase_pm_internal.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
#include <tl/mali_kbase_tracepoints.h>
#include <mali_kbase_gpuprops.h>
@@ -37,6 +37,7 @@
* after the following time (in milliseconds) has ellapsed.
*/
#define GPU_REQUEST_TIMEOUT 1000
+#define KHZ_TO_HZ 1000
#define MAX_L2_SLICES_MASK 0xFF
@@ -528,8 +529,16 @@ int kbase_arbiter_pm_gpu_assigned(struct kbase_device *kbdev)
static void kbase_arbiter_pm_vm_gpu_start(struct kbase_device *kbdev)
{
struct kbase_arbiter_vm_state *arb_vm_state = kbdev->pm.arb_vm_state;
+ bool freq_updated = false;
lockdep_assert_held(&arb_vm_state->vm_state_lock);
+ mutex_lock(&kbdev->arb.arb_freq.arb_freq_lock);
+ if (kbdev->arb.arb_freq.freq_updated) {
+ kbdev->arb.arb_freq.freq_updated = false;
+ freq_updated = true;
+ }
+ mutex_unlock(&kbdev->arb.arb_freq.arb_freq_lock);
+
cancel_request_timer(kbdev);
switch (arb_vm_state->vm_state) {
case KBASE_VM_STATE_INITIALIZING:
@@ -555,9 +564,16 @@ static void kbase_arbiter_pm_vm_gpu_start(struct kbase_device *kbdev)
kbase_arbiter_pm_vm_set_state(kbdev, KBASE_VM_STATE_SUSPENDED);
break;
default:
- dev_warn(kbdev->dev,
- "GPU_GRANTED when not expected - state %s\n",
- kbase_arbiter_pm_vm_state_str(arb_vm_state->vm_state));
+ /*
+ * GPU_GRANTED can be received when there is a frequency update
+ * Only show a warning if received in an unexpected state
+ * without a frequency update
+ */
+ if (!freq_updated)
+ dev_warn(kbdev->dev,
+ "GPU_GRANTED when not expected - state %s\n",
+ kbase_arbiter_pm_vm_state_str(
+ arb_vm_state->vm_state));
break;
}
}
@@ -1005,13 +1021,25 @@ int kbase_arbiter_pm_ctx_active_handle_suspend(struct kbase_device *kbdev,
* kbase_arbiter_pm_update_gpu_freq() - Updates GPU clock frequency received
* from arbiter.
* @arb_freq - Pointer to struchture holding GPU clock frequenecy data
- * @freq - New frequency value
+ * @freq - New frequency value in KHz
*/
void kbase_arbiter_pm_update_gpu_freq(struct kbase_arbiter_freq *arb_freq,
- uint32_t freq)
+ uint32_t freq)
{
+ struct kbase_gpu_clk_notifier_data ndata;
+
mutex_lock(&arb_freq->arb_freq_lock);
- arb_freq->arb_freq = freq;
+ if (arb_freq->arb_freq != freq) {
+ ndata.new_rate = freq * KHZ_TO_HZ;
+ ndata.old_rate = arb_freq->arb_freq * KHZ_TO_HZ;
+ ndata.gpu_clk_handle = arb_freq;
+ arb_freq->arb_freq = freq;
+ arb_freq->freq_updated = true;
+ if (arb_freq->nb)
+ arb_freq->nb->notifier_call(arb_freq->nb,
+ POST_RATE_CHANGE, &ndata);
+ }
+
mutex_unlock(&arb_freq->arb_freq_lock);
}
@@ -1046,14 +1074,64 @@ static unsigned long get_arb_gpu_clk_rate(struct kbase_device *kbdev,
(struct kbase_arbiter_freq *) gpu_clk_handle;
mutex_lock(&arb_dev_freq->arb_freq_lock);
- freq = arb_dev_freq->arb_freq;
+ /* Convert from KHz to Hz */
+ freq = arb_dev_freq->arb_freq * KHZ_TO_HZ;
mutex_unlock(&arb_dev_freq->arb_freq_lock);
return freq;
}
+/**
+ * arb_gpu_clk_notifier_register() - Register a clock rate change notifier.
+ * @kbdev - kbase_device pointer
+ * @gpu_clk_handle - Handle unique to the enumerated GPU clock
+ * @nb - notifier block containing the callback function pointer
+ *
+ * Returns 0 on success, negative error code otherwise.
+ *
+ * This function registers a callback function that is invoked whenever the
+ * frequency of the clock corresponding to @gpu_clk_handle changes.
+ */
+static int arb_gpu_clk_notifier_register(struct kbase_device *kbdev,
+ void *gpu_clk_handle, struct notifier_block *nb)
+{
+ int ret = 0;
+ struct kbase_arbiter_freq *arb_dev_freq =
+ (struct kbase_arbiter_freq *)gpu_clk_handle;
+
+ if (!arb_dev_freq->nb)
+ arb_dev_freq->nb = nb;
+ else
+ ret = -EBUSY;
+
+ return ret;
+}
+
+/**
+ * gpu_clk_notifier_unregister() - Unregister clock rate change notifier
+ * @kbdev - kbase_device pointer
+ * @gpu_clk_handle - Handle unique to the enumerated GPU clock
+ * @nb - notifier block containing the callback function pointer
+ *
+ * This function pointer is used to unregister a callback function that
+ * was previously registered to get notified of a frequency change of the
+ * clock corresponding to @gpu_clk_handle.
+ */
+static void arb_gpu_clk_notifier_unregister(struct kbase_device *kbdev,
+ void *gpu_clk_handle, struct notifier_block *nb)
+{
+ struct kbase_arbiter_freq *arb_dev_freq =
+ (struct kbase_arbiter_freq *)gpu_clk_handle;
+ if (arb_dev_freq->nb == nb) {
+ arb_dev_freq->nb = NULL;
+ } else {
+ dev_err(kbdev->dev, "%s - notifier did not match\n",
+ __func__);
+ }
+}
+
struct kbase_clk_rate_trace_op_conf arb_clk_rate_trace_ops = {
.get_gpu_clk_rate = get_arb_gpu_clk_rate,
.enumerate_gpu_clk = enumerate_arb_gpu_clk,
- .gpu_clk_notifier_register = NULL,
- .gpu_clk_notifier_unregister = NULL
+ .gpu_clk_notifier_register = arb_gpu_clk_notifier_register,
+ .gpu_clk_notifier_unregister = arb_gpu_clk_notifier_unregister
};
diff --git a/mali_kbase/arbiter/mali_kbase_arbiter_pm.h b/mali_kbase/arbiter/mali_kbase_arbiter_pm.h
index 0f74b63..b35d1b7 100644
--- a/mali_kbase/arbiter/mali_kbase_arbiter_pm.h
+++ b/mali_kbase/arbiter/mali_kbase_arbiter_pm.h
@@ -168,15 +168,27 @@ extern struct kbase_clk_rate_trace_op_conf arb_clk_rate_trace_ops;
/**
* struct kbase_arbiter_freq - Holding the GPU clock frequency data retrieved
* from arbiter
- * @arb_freq: GPU clock frequency value
- * @arb_freq_lock: Mutex protecting access to arbfreq value
+ * @arb_freq: GPU clock frequency value
+ * @arb_freq_lock: Mutex protecting access to arbfreq value
+ * @nb: Notifier block to receive rate change callbacks
+ * @freq_updated: Flag to indicate whether a frequency changed has just been
+ * communicated to avoid "GPU_GRANTED when not expected" warning
*/
struct kbase_arbiter_freq {
uint32_t arb_freq;
struct mutex arb_freq_lock;
+ struct notifier_block *nb;
+ bool freq_updated;
};
+/**
+ * kbase_arbiter_pm_update_gpu_freq() - Update GPU frequency
+ * @arb_freq: Pointer to GPU clock frequency data
+ * @freq: The new frequency
+ *
+ * Updates the GPU frequency and triggers any notifications
+ */
void kbase_arbiter_pm_update_gpu_freq(struct kbase_arbiter_freq *arb_freq,
- uint32_t freq);
+ uint32_t freq);
#endif /*_MALI_KBASE_ARBITER_PM_H_ */
diff --git a/mali_kbase/backend/gpu/Kbuild b/mali_kbase/backend/gpu/Kbuild
index d2df00e..a741135 100644
--- a/mali_kbase/backend/gpu/Kbuild
+++ b/mali_kbase/backend/gpu/Kbuild
@@ -18,48 +18,33 @@
#
#
-BACKEND += \
- backend/gpu/mali_kbase_cache_policy_backend.c \
- backend/gpu/mali_kbase_gpuprops_backend.c \
- backend/gpu/mali_kbase_irq_linux.c \
- backend/gpu/mali_kbase_js_backend.c \
- backend/gpu/mali_kbase_pm_backend.c \
- backend/gpu/mali_kbase_pm_driver.c \
- backend/gpu/mali_kbase_pm_metrics.c \
- backend/gpu/mali_kbase_pm_ca.c \
- backend/gpu/mali_kbase_pm_always_on.c \
- backend/gpu/mali_kbase_pm_coarse_demand.c \
- backend/gpu/mali_kbase_pm_adaptive.c \
- backend/gpu/mali_kbase_pm_policy.c \
- backend/gpu/mali_kbase_time.c \
- backend/gpu/mali_kbase_l2_mmu_config.c \
- backend/gpu/mali_kbase_clk_rate_trace_mgr.c
+mali_kbase-y += \
+ backend/gpu/mali_kbase_cache_policy_backend.o \
+ backend/gpu/mali_kbase_gpuprops_backend.o \
+ backend/gpu/mali_kbase_irq_linux.o \
+ backend/gpu/mali_kbase_js_backend.o \
+ backend/gpu/mali_kbase_pm_backend.o \
+ backend/gpu/mali_kbase_pm_driver.o \
+ backend/gpu/mali_kbase_pm_metrics.o \
+ backend/gpu/mali_kbase_pm_ca.o \
+ backend/gpu/mali_kbase_pm_always_on.o \
+ backend/gpu/mali_kbase_pm_coarse_demand.o \
+ backend/gpu/mali_kbase_pm_adaptive.o \
+ backend/gpu/mali_kbase_pm_policy.o \
+ backend/gpu/mali_kbase_time.o \
+ backend/gpu/mali_kbase_l2_mmu_config.o \
+ backend/gpu/mali_kbase_clk_rate_trace_mgr.o
-ifeq ($(MALI_USE_CSF),1)
-# empty
-else
- BACKEND += \
- backend/gpu/mali_kbase_instr_backend.c \
- backend/gpu/mali_kbase_jm_as.c \
- backend/gpu/mali_kbase_debug_job_fault_backend.c \
- backend/gpu/mali_kbase_jm_hw.c \
- backend/gpu/mali_kbase_jm_rb.c
+ifeq ($(MALI_USE_CSF),0)
+ mali_kbase-y += \
+ backend/gpu/mali_kbase_instr_backend.o \
+ backend/gpu/mali_kbase_jm_as.o \
+ backend/gpu/mali_kbase_debug_job_fault_backend.o \
+ backend/gpu/mali_kbase_jm_hw.o \
+ backend/gpu/mali_kbase_jm_rb.o
endif
-ifeq ($(MALI_CUSTOMER_RELEASE),0)
-BACKEND += \
- backend/gpu/mali_kbase_pm_always_on_demand.c
-endif
-ifeq ($(CONFIG_MALI_DEVFREQ),y)
-BACKEND += \
- backend/gpu/mali_kbase_devfreq.c
-endif
+mali_kbase-$(CONFIG_MALI_DEVFREQ) += \
+ backend/gpu/mali_kbase_devfreq.o
-ifeq ($(CONFIG_MALI_NO_MALI),y)
- # Dummy model
- BACKEND += backend/gpu/mali_kbase_model_dummy.c
- BACKEND += backend/gpu/mali_kbase_model_linux.c
- # HW error simulation
- BACKEND += backend/gpu/mali_kbase_model_error_generator.c
-endif
diff --git a/mali_kbase/backend/gpu/mali_kbase_backend_config.h b/mali_kbase/backend/gpu/mali_kbase_backend_config.h
index a6bbdbb..f5cf94a 100644
--- a/mali_kbase/backend/gpu/mali_kbase_backend_config.h
+++ b/mali_kbase/backend/gpu/mali_kbase_backend_config.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c
index fee9464..e69007b 100644
--- a/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c
+++ b/mali_kbase/backend/gpu/mali_kbase_cache_policy_backend.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014-2016, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2016, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c b/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c
index b5096ec..e1270a1 100644
--- a/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c
+++ b/mali_kbase/backend/gpu/mali_kbase_clk_rate_trace_mgr.c
@@ -27,7 +27,7 @@
#include <mali_kbase_config_defaults.h>
#include <linux/clk.h>
#include <asm/div64.h>
-#include "mali_kbase_clk_rate_trace_mgr.h"
+#include "backend/gpu/mali_kbase_clk_rate_trace_mgr.h"
#ifdef CONFIG_TRACE_POWER_GPU_FREQUENCY
#include <trace/events/power_gpu_frequency.h>
@@ -299,8 +299,8 @@ void kbase_clk_rate_trace_manager_notify_all(
kbdev = container_of(clk_rtm, struct kbase_device, pm.clk_rtm);
- dev_dbg(kbdev->dev, "GPU clock %u rate changed to %lu",
- clk_index, new_rate);
+ dev_dbg(kbdev->dev, "%s - GPU clock %u rate changed to %lu, pid: %d",
+ __func__, clk_index, new_rate, current->pid);
/* Raise standard `power/gpu_frequency` ftrace event */
{
diff --git a/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c b/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c
index b5ca79d..280ea56 100644
--- a/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c
+++ b/mali_kbase/backend/gpu/mali_kbase_debug_job_fault_backend.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2012-2015, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2015, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -23,7 +23,7 @@
#include <device/mali_kbase_device.h>
#include "mali_kbase_debug_job_fault.h"
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/*GPU_CONTROL_REG(r)*/
static int gpu_control_reg_snapshot[] = {
diff --git a/mali_kbase/backend/gpu/mali_kbase_devfreq.c b/mali_kbase/backend/gpu/mali_kbase_devfreq.c
index 9b82184..80c1470 100644
--- a/mali_kbase/backend/gpu/mali_kbase_devfreq.c
+++ b/mali_kbase/backend/gpu/mali_kbase_devfreq.c
@@ -26,7 +26,7 @@
#include <linux/of.h>
#include <linux/clk.h>
#include <linux/devfreq.h>
-#ifdef CONFIG_DEVFREQ_THERMAL
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
#include <linux/devfreq_cooling.h>
#endif
@@ -147,7 +147,7 @@ kbase_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
kbase_devfreq_opp_translate(kbdev, nominal_freq, &core_mask,
freqs, volts);
-#ifdef CONFIG_REGULATOR
+#if IS_ENABLED(CONFIG_REGULATOR)
/* Regulators and clocks work in pairs: every clock has a regulator,
* and we never expect to have more regulators than clocks.
*
@@ -195,7 +195,7 @@ kbase_devfreq_target(struct device *dev, unsigned long *target_freq, u32 flags)
}
}
-#ifdef CONFIG_REGULATOR
+#if IS_ENABLED(CONFIG_REGULATOR)
for (i = 0; i < kbdev->nr_clocks; i++) {
if (kbdev->regulators[i] &&
kbdev->current_voltages[i] != volts[i] &&
@@ -331,18 +331,21 @@ static void kbase_devfreq_term_freq_table(struct kbase_device *kbdev)
struct devfreq_dev_profile *dp = &kbdev->devfreq_profile;
kfree(dp->freq_table);
+ dp->freq_table = NULL;
}
static void kbase_devfreq_term_core_mask_table(struct kbase_device *kbdev)
{
kfree(kbdev->devfreq_table);
+ kbdev->devfreq_table = NULL;
}
static void kbase_devfreq_exit(struct device *dev)
{
struct kbase_device *kbdev = dev_get_drvdata(dev);
- kbase_devfreq_term_freq_table(kbdev);
+ if (kbdev)
+ kbase_devfreq_term_freq_table(kbdev);
}
static void kbasep_devfreq_read_suspend_clock(struct kbase_device *kbdev,
@@ -414,7 +417,7 @@ static int kbase_devfreq_init_core_mask_table(struct kbase_device *kbdev)
u64 core_mask, opp_freq,
real_freqs[BASE_MAX_NR_CLOCKS_REGULATORS];
int err;
-#ifdef CONFIG_REGULATOR
+#if IS_ENABLED(CONFIG_REGULATOR)
u32 opp_volts[BASE_MAX_NR_CLOCKS_REGULATORS];
#endif
@@ -442,7 +445,7 @@ static int kbase_devfreq_init_core_mask_table(struct kbase_device *kbdev)
err);
continue;
}
-#ifdef CONFIG_REGULATOR
+#if IS_ENABLED(CONFIG_REGULATOR)
err = of_property_read_u32_array(node,
"opp-microvolt", opp_volts, kbdev->nr_regulators);
if (err < 0) {
@@ -496,7 +499,7 @@ static int kbase_devfreq_init_core_mask_table(struct kbase_device *kbdev)
kbdev->devfreq_table[i].real_freqs[j] =
real_freqs[j];
}
-#ifdef CONFIG_REGULATOR
+#if IS_ENABLED(CONFIG_REGULATOR)
if (kbdev->nr_regulators > 0) {
int j;
@@ -581,8 +584,12 @@ void kbase_devfreq_enqueue_work(struct kbase_device *kbdev,
WARN_ON(work_type == DEVFREQ_WORK_NONE);
spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
- kbdev->devfreq_queue.req_type = work_type;
- queue_work(kbdev->devfreq_queue.workq, &kbdev->devfreq_queue.work);
+ /* Skip enqueuing a work if workqueue has already been terminated. */
+ if (likely(kbdev->devfreq_queue.workq)) {
+ kbdev->devfreq_queue.req_type = work_type;
+ queue_work(kbdev->devfreq_queue.workq,
+ &kbdev->devfreq_queue.work);
+ }
spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
dev_dbg(kbdev->dev, "Enqueuing devfreq req: %s\n",
kbase_devfreq_req_type_name(work_type));
@@ -604,9 +611,18 @@ static int kbase_devfreq_work_init(struct kbase_device *kbdev)
static void kbase_devfreq_work_term(struct kbase_device *kbdev)
{
- destroy_workqueue(kbdev->devfreq_queue.workq);
+ unsigned long flags;
+ struct workqueue_struct *workq;
+
+ spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
+ workq = kbdev->devfreq_queue.workq;
+ kbdev->devfreq_queue.workq = NULL;
+ spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
+
+ destroy_workqueue(workq);
}
+
int kbase_devfreq_init(struct kbase_device *kbdev)
{
struct devfreq_dev_profile *dp;
@@ -651,20 +667,25 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
return err;
}
- /* Initialise devfreq suspend/resume workqueue */
- err = kbase_devfreq_work_init(kbdev);
- if (err) {
- kbase_devfreq_term_freq_table(kbdev);
- dev_err(kbdev->dev, "Devfreq initialization failed");
- return err;
- }
-
kbdev->devfreq = devfreq_add_device(kbdev->dev, dp,
"simple_ondemand", NULL);
if (IS_ERR(kbdev->devfreq)) {
err = PTR_ERR(kbdev->devfreq);
- kbase_devfreq_work_term(kbdev);
+ kbdev->devfreq = NULL;
+ kbase_devfreq_term_core_mask_table(kbdev);
kbase_devfreq_term_freq_table(kbdev);
+ dev_err(kbdev->dev, "Fail to add devfreq device(%d)\n", err);
+ return err;
+ }
+
+ /* Initialize devfreq suspend/resume workqueue */
+ err = kbase_devfreq_work_init(kbdev);
+ if (err) {
+ if (devfreq_remove_device(kbdev->devfreq))
+ dev_err(kbdev->dev, "Fail to rm devfreq\n");
+ kbdev->devfreq = NULL;
+ kbase_devfreq_term_core_mask_table(kbdev);
+ dev_err(kbdev->dev, "Fail to init devfreq workqueue\n");
return err;
}
@@ -680,11 +701,11 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
goto opp_notifier_failed;
}
-#ifdef CONFIG_DEVFREQ_THERMAL
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
err = kbase_ipa_init(kbdev);
if (err) {
dev_err(kbdev->dev, "IPA initialization failed\n");
- goto cooling_failed;
+ goto ipa_init_failed;
}
kbdev->devfreq_cooling = of_devfreq_cooling_register_power(
@@ -696,23 +717,28 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
dev_err(kbdev->dev,
"Failed to register cooling device (%d)\n",
err);
- goto cooling_failed;
+ goto cooling_reg_failed;
}
#endif
return 0;
-#ifdef CONFIG_DEVFREQ_THERMAL
-cooling_failed:
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
+cooling_reg_failed:
+ kbase_ipa_term(kbdev);
+ipa_init_failed:
devfreq_unregister_opp_notifier(kbdev->dev, kbdev->devfreq);
#endif /* CONFIG_DEVFREQ_THERMAL */
+
opp_notifier_failed:
+ kbase_devfreq_work_term(kbdev);
+
if (devfreq_remove_device(kbdev->devfreq))
dev_err(kbdev->dev, "Failed to terminate devfreq (%d)\n", err);
- else
- kbdev->devfreq = NULL;
- kbase_devfreq_work_term(kbdev);
+ kbdev->devfreq = NULL;
+
+ kbase_devfreq_term_core_mask_table(kbdev);
return err;
}
@@ -723,7 +749,7 @@ void kbase_devfreq_term(struct kbase_device *kbdev)
dev_dbg(kbdev->dev, "Term Mali devfreq\n");
-#ifdef CONFIG_DEVFREQ_THERMAL
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
if (kbdev->devfreq_cooling)
devfreq_cooling_unregister(kbdev->devfreq_cooling);
@@ -732,6 +758,8 @@ void kbase_devfreq_term(struct kbase_device *kbdev)
devfreq_unregister_opp_notifier(kbdev->dev, kbdev->devfreq);
+ kbase_devfreq_work_term(kbdev);
+
err = devfreq_remove_device(kbdev->devfreq);
if (err)
dev_err(kbdev->dev, "Failed to terminate devfreq (%d)\n", err);
@@ -739,6 +767,4 @@ void kbase_devfreq_term(struct kbase_device *kbdev)
kbdev->devfreq = NULL;
kbase_devfreq_term_core_mask_table(kbdev);
-
- kbase_devfreq_work_term(kbdev);
}
diff --git a/mali_kbase/backend/gpu/mali_kbase_devfreq.h b/mali_kbase/backend/gpu/mali_kbase_devfreq.h
index cfff483..9c61c5c 100644
--- a/mali_kbase/backend/gpu/mali_kbase_devfreq.h
+++ b/mali_kbase/backend/gpu/mali_kbase_devfreq.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c b/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c
index 7542209..712a0c1 100644
--- a/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c
+++ b/mali_kbase/backend/gpu/mali_kbase_gpuprops_backend.c
@@ -45,6 +45,12 @@ int kbase_backend_gpuprops_get(struct kbase_device *kbdev,
registers.core_features = kbase_reg_read(kbdev,
GPU_CONTROL_REG(CORE_FEATURES));
#else /* !MALI_USE_CSF */
+ if (((registers.gpu_id & GPU_ID2_PRODUCT_MODEL) ==
+ GPU_ID2_PRODUCT_TGRX) ||
+ ((registers.gpu_id & GPU_ID2_PRODUCT_MODEL) ==
+ GPU_ID2_PRODUCT_TVAX))
+ registers.core_features =
+ kbase_reg_read(kbdev, GPU_CONTROL_REG(CORE_FEATURES));
#endif /* MALI_USE_CSF */
registers.tiler_features = kbase_reg_read(kbdev,
GPU_CONTROL_REG(TILER_FEATURES));
diff --git a/mali_kbase/backend/gpu/mali_kbase_instr_defs.h b/mali_kbase/backend/gpu/mali_kbase_instr_defs.h
index 05d5193..23c45d2 100644
--- a/mali_kbase/backend/gpu/mali_kbase_instr_defs.h
+++ b/mali_kbase/backend/gpu/mali_kbase_instr_defs.h
@@ -26,7 +26,7 @@
#ifndef _KBASE_INSTR_DEFS_H_
#define _KBASE_INSTR_DEFS_H_
-#include "../../mali_kbase_hwcnt_gpu.h"
+#include <mali_kbase_hwcnt_gpu.h>
/*
* Instrumentation State Machine States
diff --git a/mali_kbase/backend/gpu/mali_kbase_instr_internal.h b/mali_kbase/backend/gpu/mali_kbase_instr_internal.h
index c0472fa..1f7a9bc 100644
--- a/mali_kbase/backend/gpu/mali_kbase_instr_internal.h
+++ b/mali_kbase/backend/gpu/mali_kbase_instr_internal.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h
index bad249c..f05a46a 100644
--- a/mali_kbase/backend/gpu/mali_kbase_irq_internal.h
+++ b/mali_kbase/backend/gpu/mali_kbase_irq_internal.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2015, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2015, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_irq_linux.c b/mali_kbase/backend/gpu/mali_kbase_irq_linux.c
index 0306003..76e3e01 100644
--- a/mali_kbase/backend/gpu/mali_kbase_irq_linux.c
+++ b/mali_kbase/backend/gpu/mali_kbase_irq_linux.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014-2016,2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2016, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -25,7 +25,7 @@
#include <linux/interrupt.h>
-#if !defined(CONFIG_MALI_NO_MALI)
+#if !IS_ENABLED(CONFIG_MALI_NO_MALI)
/* GPU IRQ Tags */
#define JOB_IRQ_TAG 0
@@ -232,7 +232,7 @@ int kbase_set_custom_irq_handler(struct kbase_device *kbdev,
result = -EINVAL;
dev_err(kbdev->dev, "Can't request interrupt %d (index %d)\n",
kbdev->irqs[irq_type].irq, irq_type);
-#ifdef CONFIG_SPARSE_IRQ
+#if IS_ENABLED(CONFIG_SPARSE_IRQ)
dev_err(kbdev->dev, "You have CONFIG_SPARSE_IRQ support enabled - is the interrupt number correct for this configuration?\n");
#endif /* CONFIG_SPARSE_IRQ */
}
@@ -461,7 +461,7 @@ int kbase_install_interrupts(struct kbase_device *kbdev)
if (err) {
dev_err(kbdev->dev, "Can't request interrupt %d (index %d)\n",
kbdev->irqs[i].irq, i);
-#ifdef CONFIG_SPARSE_IRQ
+#if IS_ENABLED(CONFIG_SPARSE_IRQ)
dev_err(kbdev->dev, "You have CONFIG_SPARSE_IRQ support enabled - is the interrupt number correct for this configuration?\n");
#endif /* CONFIG_SPARSE_IRQ */
goto release;
@@ -501,4 +501,4 @@ void kbase_synchronize_irqs(struct kbase_device *kbdev)
KBASE_EXPORT_TEST_API(kbase_synchronize_irqs);
-#endif /* !defined(CONFIG_MALI_NO_MALI) */
+#endif /* !IS_ENABLED(CONFIG_MALI_NO_MALI) */
diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_as.c b/mali_kbase/backend/gpu/mali_kbase_jm_as.c
index 57ff67b..9c754ed 100644
--- a/mali_kbase/backend/gpu/mali_kbase_jm_as.c
+++ b/mali_kbase/backend/gpu/mali_kbase_jm_as.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_defs.h b/mali_kbase/backend/gpu/mali_kbase_jm_defs.h
index 97663c7..00495a3 100644
--- a/mali_kbase/backend/gpu/mali_kbase_jm_defs.h
+++ b/mali_kbase/backend/gpu/mali_kbase_jm_defs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_hw.c b/mali_kbase/backend/gpu/mali_kbase_jm_hw.c
index e84f3a9..58f6405 100644
--- a/mali_kbase/backend/gpu/mali_kbase_jm_hw.c
+++ b/mali_kbase/backend/gpu/mali_kbase_jm_hw.c
@@ -300,7 +300,7 @@ void kbase_job_hw_submit(struct kbase_device *kbdev,
&kbdev->gpu_props.props.raw_props.js_features[js],
"ctx_nr,atom_nr");
kbase_kinstr_jm_atom_hw_submit(katom);
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
if (!kbase_backend_nr_atoms_submitted(kbdev, js)) {
/* If this is the only job on the slot, trace it as starting */
char js_string[16];
diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_internal.h b/mali_kbase/backend/gpu/mali_kbase_jm_internal.h
index 6761cbd..7eecd35 100644
--- a/mali_kbase/backend/gpu/mali_kbase_jm_internal.h
+++ b/mali_kbase/backend/gpu/mali_kbase_jm_internal.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2011-2016, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2016, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -59,7 +59,7 @@ void kbase_job_submit_nolock(struct kbase_device *kbdev,
void kbase_job_done_slot(struct kbase_device *kbdev, int s, u32 completion_code,
u64 job_tail, ktime_t *end_timestamp);
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
static inline char *kbasep_make_job_slot_string(int js, char *js_string,
size_t js_size)
{
diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c
index 07d9573..076cd8a 100644
--- a/mali_kbase/backend/gpu/mali_kbase_jm_rb.c
+++ b/mali_kbase/backend/gpu/mali_kbase_jm_rb.c
@@ -289,11 +289,11 @@ static void kbase_gpu_release_atom(struct kbase_device *kbdev,
katom->gpu_rb_state = KBASE_ATOM_GPU_RB_READY;
kbase_pm_metrics_update(kbdev, end_timestamp);
+ /* Inform platform at start/finish of atom */
kbasep_platform_event_atom_complete(katom);
if (katom->core_req & BASE_JD_REQ_PERMON)
kbase_pm_release_gpu_cycle_counter_nolock(kbdev);
- /* ***FALLTHROUGH: TRANSITION TO LOWER STATE*** */
KBASE_TLSTREAM_TL_NRET_ATOM_LPU(kbdev, katom,
&kbdev->gpu_props.props.raw_props.js_features
@@ -303,6 +303,8 @@ static void kbase_gpu_release_atom(struct kbase_device *kbdev,
&kbdev->gpu_props.props.raw_props.js_features
[katom->slot_nr]);
+ /* ***FALLTHROUGH: TRANSITION TO LOWER STATE*** */
+
case KBASE_ATOM_GPU_RB_READY:
/* ***FALLTHROUGH: TRANSITION TO LOWER STATE*** */
@@ -849,7 +851,7 @@ void kbase_backend_slot_update(struct kbase_device *kbdev)
break;
katom[idx]->gpu_rb_state =
- KBASE_ATOM_GPU_RB_WAITING_PROTECTED_MODE_PREV;
+ KBASE_ATOM_GPU_RB_WAITING_PROTECTED_MODE_PREV;
/* ***TRANSITION TO HIGHER STATE*** */
/* fallthrough */
@@ -989,7 +991,11 @@ void kbase_backend_slot_update(struct kbase_device *kbdev)
kbase_job_hw_submit(kbdev, katom[idx], js);
katom[idx]->gpu_rb_state =
- KBASE_ATOM_GPU_RB_SUBMITTED;
+ KBASE_ATOM_GPU_RB_SUBMITTED;
+
+ /* ***TRANSITION TO HIGHER STATE*** */
+ /* fallthrough */
+ case KBASE_ATOM_GPU_RB_SUBMITTED:
/* Inform power management at start/finish of
* atom so it can update its GPU utilisation
@@ -998,12 +1004,9 @@ void kbase_backend_slot_update(struct kbase_device *kbdev)
kbase_pm_metrics_update(kbdev,
&katom[idx]->start_timestamp);
+ /* Inform platform at start/finish of atom */
kbasep_platform_event_atom_submit(katom[idx]);
- /* ***TRANSITION TO HIGHER STATE*** */
- /* fallthrough */
- case KBASE_ATOM_GPU_RB_SUBMITTED:
- /* Atom submitted to HW, nothing else to do */
break;
case KBASE_ATOM_GPU_RB_RETURN_TO_JS:
@@ -1229,7 +1232,7 @@ void kbase_gpu_complete_hw(struct kbase_device *kbdev, int js,
* - Schedule out the parent context if necessary, and schedule a new
* one in.
*/
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
{
/* The atom in the HEAD */
struct kbase_jd_atom *next_katom = kbase_gpu_inspect(kbdev, js,
diff --git a/mali_kbase/backend/gpu/mali_kbase_jm_rb.h b/mali_kbase/backend/gpu/mali_kbase_jm_rb.h
index 14da981..8731486 100644
--- a/mali_kbase/backend/gpu/mali_kbase_jm_rb.h
+++ b/mali_kbase/backend/gpu/mali_kbase_jm_rb.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_js_internal.h b/mali_kbase/backend/gpu/mali_kbase_js_internal.h
index e15528d..aa2eb81 100644
--- a/mali_kbase/backend/gpu/mali_kbase_js_internal.h
+++ b/mali_kbase/backend/gpu/mali_kbase_js_internal.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2015, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2015, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c
index 884cbd6..d2e319d 100644
--- a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c
+++ b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h
index 2dfeadb..0921c65 100644
--- a/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h
+++ b/mali_kbase/backend/gpu/mali_kbase_l2_mmu_config.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c
index 2b371a0..472e768 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2010-2015, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2015, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h
index e500d46..266226b 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_always_on.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2011-2015, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2015, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_backend.c b/mali_kbase/backend/gpu/mali_kbase_pm_backend.c
index 0cfa93c..fff134b 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_backend.c
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_backend.c
@@ -37,7 +37,7 @@
#include <backend/gpu/mali_kbase_pm_internal.h>
#include <backend/gpu/mali_kbase_devfreq.h>
#include <mali_kbase_dummy_job_wa.h>
-#include <mali_kbase_irq_internal.h>
+#include <backend/gpu/mali_kbase_irq_internal.h>
static void kbase_pm_gpu_poweroff_wait_wq(struct work_struct *data);
static void kbase_pm_hwcnt_disable_worker(struct work_struct *data);
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca.c b/mali_kbase/backend/gpu/mali_kbase_pm_ca.c
index 3cf7608..8b7ca3e 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_ca.c
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2013-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2013-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -26,9 +26,6 @@
#include <mali_kbase.h>
#include <mali_kbase_pm.h>
#include <backend/gpu/mali_kbase_pm_internal.h>
-#ifdef CONFIG_MALI_NO_MALI
-#include <backend/gpu/mali_kbase_model_dummy.h>
-#endif
#include <mali_kbase_dummy_job_wa.h>
int kbase_pm_ca_init(struct kbase_device *kbdev)
@@ -123,9 +120,7 @@ u64 kbase_pm_ca_get_instr_core_mask(struct kbase_device *kbdev)
{
lockdep_assert_held(&kbdev->hwaccess_lock);
-#ifdef CONFIG_MALI_NO_MALI
- return (((1ull) << KBASE_DUMMY_MODEL_MAX_SHADER_CORES) - 1);
-#elif MALI_USE_CSF
+#if MALI_USE_CSF
return kbase_pm_get_ready_cores(kbdev, KBASE_PM_CORE_SHADER);
#else
return kbdev->pm.backend.pm_shaders_core_mask;
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca.h b/mali_kbase/backend/gpu/mali_kbase_pm_ca.h
index c20bf6f..fd34210 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_ca.h
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2011-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h b/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h
index d24bccd..4dfab1f 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_ca_devfreq.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c
index 0a1dbf5..06054a9 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2012-2016, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2016, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h
index f1a0e3a..ddf091d 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_coarse_demand.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2012-2015, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2015, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h
index 635dc00..2899f88 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_defs.h
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_defs.h
@@ -29,9 +29,6 @@
#include "mali_kbase_pm_always_on.h"
#include "mali_kbase_pm_coarse_demand.h"
#include "mali_kbase_pm_adaptive.h"
-#if !MALI_CUSTOMER_RELEASE
-#include "mali_kbase_pm_always_on_demand.h"
-#endif
/* Forward definition - see mali_kbase.h */
struct kbase_device;
@@ -211,9 +208,6 @@ union kbase_pm_policy_data {
struct kbasep_pm_policy_always_on always_on;
struct kbasep_pm_policy_coarse_demand coarse_demand;
struct kbasep_pm_policy_adaptive adaptive;
-#if !MALI_CUSTOMER_RELEASE
- struct kbasep_pm_policy_always_on_demand always_on_demand;
-#endif
};
/**
@@ -584,7 +578,7 @@ struct kbase_pm_policy {
* @event: The id of the power event that has occurred
*/
void (*handle_event)(struct kbase_device *kbdev,
- enum kbase_pm_policy_event event);
+ enum kbase_pm_policy_event event);
enum kbase_pm_policy_id id;
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_driver.c b/mali_kbase/backend/gpu/mali_kbase_pm_driver.c
index 0a087df..da70123 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_driver.c
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_driver.c
@@ -244,7 +244,7 @@ static u32 core_type_to_reg(enum kbase_pm_core_type core_type,
return (u32)core_type + (u32)action;
}
-#ifdef CONFIG_ARM64
+#if IS_ENABLED(CONFIG_ARM64)
static void mali_cci_flush_l2(struct kbase_device *kbdev)
{
const u32 mask = CLEAN_CACHES_COMPLETED | RESET_COMPLETED;
@@ -1343,8 +1343,10 @@ static int kbase_pm_shaders_update_state(struct kbase_device *kbdev)
kbase_pm_invoke(kbdev, KBASE_PM_CORE_SHADER,
backend->shaders_avail, ACTION_PWRON);
- if (backend->pm_current_policy->handle_event)
- backend->pm_current_policy->handle_event(kbdev,
+ if (backend->pm_current_policy &&
+ backend->pm_current_policy->handle_event)
+ backend->pm_current_policy->handle_event(
+ kbdev,
KBASE_PM_POLICY_EVENT_POWER_ON);
backend->shaders_state = KBASE_SHADERS_PEND_ON_CORESTACK_ON;
@@ -1399,8 +1401,10 @@ static int kbase_pm_shaders_update_state(struct kbase_device *kbdev)
/* Wait for being disabled */
;
} else if (!backend->shaders_desired) {
- if (backend->pm_current_policy->handle_event)
- backend->pm_current_policy->handle_event(kbdev,
+ if (backend->pm_current_policy &&
+ backend->pm_current_policy->handle_event)
+ backend->pm_current_policy->handle_event(
+ kbdev,
KBASE_PM_POLICY_EVENT_IDLE);
if (kbdev->pm.backend.protected_transition_override ||
@@ -1463,15 +1467,19 @@ static int kbase_pm_shaders_update_state(struct kbase_device *kbdev)
}
if (backend->shaders_desired) {
- if (backend->pm_current_policy->handle_event)
- backend->pm_current_policy->handle_event(kbdev,
+ if (backend->pm_current_policy &&
+ backend->pm_current_policy->handle_event)
+ backend->pm_current_policy->handle_event(
+ kbdev,
KBASE_PM_POLICY_EVENT_TIMER_HIT);
stt->remaining_ticks = 0;
backend->shaders_state = KBASE_SHADERS_ON_CORESTACK_ON_RECHECK;
} else if (stt->remaining_ticks == 0) {
- if (backend->pm_current_policy->handle_event)
- backend->pm_current_policy->handle_event(kbdev,
+ if (backend->pm_current_policy &&
+ backend->pm_current_policy->handle_event)
+ backend->pm_current_policy->handle_event(
+ kbdev,
KBASE_PM_POLICY_EVENT_TIMER_MISS);
backend->shaders_state = KBASE_SHADERS_WAIT_FINISHED_CORESTACK_ON;
@@ -1929,24 +1937,43 @@ static void kbase_pm_timed_out(struct kbase_device *kbdev)
kbase_reset_gpu(kbdev);
}
-void kbase_pm_wait_for_l2_powered(struct kbase_device *kbdev)
+int kbase_pm_wait_for_l2_powered(struct kbase_device *kbdev)
{
unsigned long flags;
unsigned long timeout;
- int err;
+ long remaining;
+ int err = 0;
spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
kbase_pm_update_state(kbdev);
spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
- timeout = jiffies + msecs_to_jiffies(PM_TIMEOUT_MS);
+#if MALI_USE_CSF
+ timeout = kbase_csf_timeout_in_jiffies(PM_TIMEOUT_MS);
+#else
+ timeout = msecs_to_jiffies(PM_TIMEOUT_MS);
+#endif
/* Wait for cores */
- err = wait_event_killable(kbdev->pm.backend.gpu_in_desired_state_wait,
- kbase_pm_is_in_desired_state_with_l2_powered(kbdev));
+#if KERNEL_VERSION(4, 13, 1) <= LINUX_VERSION_CODE
+ remaining = wait_event_killable_timeout(
+#else
+ remaining = wait_event_timeout(
+#endif
+ kbdev->pm.backend.gpu_in_desired_state_wait,
+ kbase_pm_is_in_desired_state_with_l2_powered(kbdev), timeout);
- if (err < 0 && time_after(jiffies, timeout))
+ if (!remaining) {
kbase_pm_timed_out(kbdev);
+ err = -ETIMEDOUT;
+ } else if (remaining < 0) {
+ dev_info(
+ kbdev->dev,
+ "Wait for desired PM state with L2 powered got interrupted");
+ err = (int)remaining;
+ }
+
+ return err;
}
int kbase_pm_wait_for_desired_state(struct kbase_device *kbdev)
@@ -2062,6 +2089,7 @@ static void update_user_reg_page_mapping(struct kbase_device *kbdev)
}
#endif
+
/*
* pmu layout:
* 0x0000: PMU TAG (RO) (0xCAFECAFE)
@@ -2479,7 +2507,7 @@ void kbase_pm_cache_snoop_enable(struct kbase_device *kbdev)
{
if ((kbdev->current_gpu_coherency_mode == COHERENCY_ACE) &&
!kbdev->cci_snoop_enabled) {
-#ifdef CONFIG_ARM64
+#if IS_ENABLED(CONFIG_ARM64)
if (kbdev->snoop_enable_smc != 0)
kbase_invoke_smc_fid(kbdev->snoop_enable_smc, 0, 0, 0);
#endif /* CONFIG_ARM64 */
@@ -2491,7 +2519,7 @@ void kbase_pm_cache_snoop_enable(struct kbase_device *kbdev)
void kbase_pm_cache_snoop_disable(struct kbase_device *kbdev)
{
if (kbdev->cci_snoop_enabled) {
-#ifdef CONFIG_ARM64
+#if IS_ENABLED(CONFIG_ARM64)
if (kbdev->snoop_disable_smc != 0) {
mali_cci_flush_l2(kbdev);
kbase_invoke_smc_fid(kbdev->snoop_disable_smc, 0, 0, 0);
@@ -2771,9 +2799,8 @@ kbase_pm_request_gpu_cycle_counter_do_request(struct kbase_device *kbdev)
/* This might happen after GPU reset.
* Then counter needs to be kicked.
*/
- if (!IS_ENABLED(CONFIG_MALI_NO_MALI) &&
- (!(kbase_reg_read(kbdev, GPU_CONTROL_REG(GPU_STATUS)) &
- GPU_STATUS_CYCLE_COUNT_ACTIVE))) {
+ if (!(kbase_reg_read(kbdev, GPU_CONTROL_REG(GPU_STATUS)) &
+ GPU_STATUS_CYCLE_COUNT_ACTIVE)) {
kbase_reg_write(kbdev, GPU_CONTROL_REG(GPU_COMMAND),
GPU_COMMAND_CYCLE_COUNT_START);
}
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_internal.h b/mali_kbase/backend/gpu/mali_kbase_pm_internal.h
index 500578f..a52bb0d 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_internal.h
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_internal.h
@@ -28,7 +28,7 @@
#include <mali_kbase_hwaccess_pm.h>
-#include "mali_kbase_pm_ca.h"
+#include "backend/gpu/mali_kbase_pm_ca.h"
#include "mali_kbase_pm_policy.h"
@@ -263,8 +263,10 @@ int kbase_pm_wait_for_desired_state(struct kbase_device *kbdev);
* because this function will take that lock itself.
*
* @kbdev: The kbase device structure for the device (must be a valid pointer)
+ *
+ * Return: 0 on success, error code on error
*/
-void kbase_pm_wait_for_l2_powered(struct kbase_device *kbdev);
+int kbase_pm_wait_for_l2_powered(struct kbase_device *kbdev);
/**
* kbase_pm_update_dynamic_cores_onoff - Update the L2 and shader power state
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c b/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c
index 769888f..b791004 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_metrics.c
@@ -28,7 +28,7 @@
#include <backend/gpu/mali_kbase_pm_internal.h>
#if MALI_USE_CSF
-#include "mali_kbase_clk_rate_trace_mgr.h"
+#include "backend/gpu/mali_kbase_clk_rate_trace_mgr.h"
#include <csf/ipa_control/mali_kbase_csf_ipa_control.h>
#else
#include <backend/gpu/mali_kbase_jm_rb.h>
@@ -206,7 +206,7 @@ static void kbase_pm_get_dvfs_utilisation_calc(struct kbase_device *kbdev)
"Failed to query the increment of GPU_ACTIVE counter: err=%d",
err);
} else {
- u64 diff_ns, margin_ns;
+ u64 diff_ns;
s64 diff_ns_signed;
u32 ns_time;
ktime_t diff = ktime_sub(
@@ -219,15 +219,7 @@ static void kbase_pm_get_dvfs_utilisation_calc(struct kbase_device *kbdev)
diff_ns = (u64)diff_ns_signed;
- /* Use a margin value that is approximately 1% of the time
- * difference.
- */
- margin_ns = diff_ns >> 6;
-
- /* Calculate time difference in units of 256ns */
- ns_time = (u32)(diff_ns >> KBASE_PM_TIME_SHIFT);
-
-#ifndef CONFIG_MALI_NO_MALI
+#if !IS_ENABLED(CONFIG_MALI_NO_MALI)
/* The GPU_ACTIVE counter shouldn't clock-up more time than has
* actually elapsed - but still some margin needs to be given
* when doing the comparison. There could be some drift between
@@ -239,6 +231,10 @@ static void kbase_pm_get_dvfs_utilisation_calc(struct kbase_device *kbdev)
* time.
*/
if (!kbdev->pm.backend.metrics.skip_gpu_active_sanity_check) {
+ /* Use a margin value that is approximately 1% of the time
+ * difference.
+ */
+ u64 margin_ns = diff_ns >> 6;
if (gpu_active_counter > (diff_ns + margin_ns)) {
dev_info(
kbdev->dev,
@@ -247,9 +243,9 @@ static void kbase_pm_get_dvfs_utilisation_calc(struct kbase_device *kbdev)
(unsigned long long)diff_ns);
}
}
-#else
- CSTD_UNUSED(margin_ns);
#endif
+ /* Calculate time difference in units of 256ns */
+ ns_time = (u32)(diff_ns >> KBASE_PM_TIME_SHIFT);
/* Add protected_time to gpu_active_counter so that time in
* protected mode is included in the apparent GPU active time,
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_policy.c b/mali_kbase/backend/gpu/mali_kbase_pm_policy.c
index cdf6fd6..621d6f8 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_policy.c
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_policy.c
@@ -36,20 +36,9 @@
#include <linux/of.h>
static const struct kbase_pm_policy *const all_policy_list[] = {
-#ifdef CONFIG_MALI_NO_MALI
- &kbase_pm_always_on_policy_ops,
- &kbase_pm_coarse_demand_policy_ops,
-#if !MALI_CUSTOMER_RELEASE
- &kbase_pm_always_on_demand_policy_ops,
-#endif
-#else /* CONFIG_MALI_NO_MALI */
&kbase_pm_coarse_demand_policy_ops,
&kbase_pm_adaptive_policy_ops,
-#if !MALI_CUSTOMER_RELEASE
- &kbase_pm_always_on_demand_policy_ops,
-#endif
&kbase_pm_always_on_policy_ops
-#endif /* CONFIG_MALI_NO_MALI */
};
void kbase_pm_policy_init(struct kbase_device *kbdev)
@@ -60,14 +49,6 @@ void kbase_pm_policy_init(struct kbase_device *kbdev)
unsigned long flags;
int i;
-#if MALI_USE_CSF && defined(CONFIG_MALI_DEBUG)
- /* Use always_on policy if module param fw_debug=1 is
- * passed, to aid firmware debugging.
- */
- if (fw_debug)
- default_policy = &kbase_pm_always_on_policy_ops;
-#endif
-
if (of_property_read_string(np, "power_policy", &power_policy_name) == 0) {
for (i = 0; i < ARRAY_SIZE(all_policy_list); i++)
if (sysfs_streq(all_policy_list[i]->name, power_policy_name)) {
@@ -76,6 +57,14 @@ void kbase_pm_policy_init(struct kbase_device *kbdev)
}
}
+#if MALI_USE_CSF && defined(CONFIG_MALI_DEBUG)
+ /* Use always_on policy if module param fw_debug=1 is
+ * passed, to aid firmware debugging.
+ */
+ if (fw_debug)
+ default_policy = &kbase_pm_always_on_policy_ops;
+#endif
+
default_policy->init(kbdev);
#if MALI_USE_CSF
@@ -373,7 +362,8 @@ void kbase_pm_set_policy(struct kbase_device *kbdev,
if (old_policy->term)
old_policy->term(kbdev);
- memset(&kbdev->pm.backend.pm_policy_data, 0, sizeof(union kbase_pm_policy_data));
+ memset(&kbdev->pm.backend.pm_policy_data, 0,
+ sizeof(union kbase_pm_policy_data));
KBASE_KTRACE_ADD(kbdev, PM_CURRENT_POLICY_INIT, NULL, new_policy->id);
if (new_policy->init)
diff --git a/mali_kbase/backend/gpu/mali_kbase_pm_policy.h b/mali_kbase/backend/gpu/mali_kbase_pm_policy.h
index a513a26..c4ecbb9 100644
--- a/mali_kbase/backend/gpu/mali_kbase_pm_policy.h
+++ b/mali_kbase/backend/gpu/mali_kbase_pm_policy.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2010-2015, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2015, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/backend/gpu/mali_kbase_time.c b/mali_kbase/backend/gpu/mali_kbase_time.c
index ea7b21a..37b7dd9 100644
--- a/mali_kbase/backend/gpu/mali_kbase_time.c
+++ b/mali_kbase/backend/gpu/mali_kbase_time.c
@@ -76,9 +76,6 @@ void kbase_backend_get_gpu_time_norequest(struct kbase_device *kbdev,
*/
static bool timedwait_cycle_count_active(struct kbase_device *kbdev)
{
-#ifdef CONFIG_MALI_NO_MALI
- return true;
-#else
bool success = false;
const unsigned int timeout = 100;
const unsigned long remaining = jiffies + msecs_to_jiffies(timeout);
@@ -91,7 +88,6 @@ static bool timedwait_cycle_count_active(struct kbase_device *kbdev)
}
}
return success;
-#endif
}
#endif
diff --git a/mali_kbase/build.bp b/mali_kbase/build.bp
index 13b4d8f..979e06f 100644
--- a/mali_kbase/build.bp
+++ b/mali_kbase/build.bp
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
*
* (C) COPYRIGHT 2017-2021 ARM Limited. All rights reserved.
@@ -25,14 +25,17 @@
* both mali_kbase and the test modules. */
bob_defaults {
name: "mali_kbase_shared_config_defaults",
+ defaults: [
+ "kernel_defaults",
+ ],
no_mali: {
- kbuild_options: ["CONFIG_MALI_NO_MALI=y"],
- },
- mali_real_hw: {
- kbuild_options: ["CONFIG_MALI_REAL_HW=y"],
+ kbuild_options: [
+ "CONFIG_MALI_NO_MALI=y",
+ "CONFIG_MALI_NO_MALI_DEFAULT_GPU={{.gpu}}",
+ ],
},
- mali_dma_fence: {
- kbuild_options: ["CONFIG_MALI_DMA_FENCE=y"],
+ gpu_has_csf: {
+ kbuild_options: ["CONFIG_MALI_CSF_SUPPORT=y"],
},
mali_devfreq: {
kbuild_options: ["CONFIG_MALI_DEVFREQ=y"],
@@ -40,8 +43,62 @@ bob_defaults {
mali_midgard_dvfs: {
kbuild_options: ["CONFIG_MALI_MIDGARD_DVFS=y"],
},
+ mali_gator_support: {
+ kbuild_options: ["CONFIG_MALI_GATOR_SUPPORT=y"],
+ },
+ mali_midgard_enable_trace: {
+ kbuild_options: ["CONFIG_MALI_MIDGARD_ENABLE_TRACE=y"],
+ },
+ mali_dma_fence: {
+ kbuild_options: ["CONFIG_MALI_DMA_FENCE=y"],
+ },
+ mali_arbiter_support: {
+ kbuild_options: ["CONFIG_MALI_ARBITER_SUPPORT=y"],
+ },
+ mali_dma_buf_map_on_demand: {
+ kbuild_options: ["CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y"],
+ },
+ mali_dma_buf_legacy_compat: {
+ kbuild_options: ["CONFIG_MALI_DMA_BUF_LEGACY_COMPAT=y"],
+ },
+ mali_2mb_alloc: {
+ kbuild_options: ["CONFIG_MALI_2MB_ALLOC=y"],
+ },
+ mali_memory_fully_backed: {
+ kbuild_options: ["CONFIG_MALI_MEMORY_FULLY_BACKED=y"],
+ },
+ mali_corestack: {
+ kbuild_options: ["CONFIG_MALI_CORESTACK=y"],
+ },
+ mali_real_hw: {
+ kbuild_options: ["CONFIG_MALI_REAL_HW=y"],
+ },
+ mali_error_inject_none: {
+ kbuild_options: ["CONFIG_MALI_ERROR_INJECT_NONE=y"],
+ },
+ mali_error_inject_track_list: {
+ kbuild_options: ["CONFIG_MALI_ERROR_INJECT_TRACK_LIST=y"],
+ },
+ mali_error_inject_random: {
+ kbuild_options: ["CONFIG_MALI_ERROR_INJECT_RANDOM=y"],
+ },
+ mali_error_inject: {
+ kbuild_options: ["CONFIG_MALI_ERROR_INJECT=y"],
+ },
+ mali_gem5_build: {
+ kbuild_options: ["CONFIG_MALI_GEM5_BUILD=y"],
+ },
mali_debug: {
- kbuild_options: ["CONFIG_MALI_DEBUG=y"],
+ kbuild_options: [
+ "CONFIG_MALI_DEBUG=y",
+ "MALI_KERNEL_TEST_API={{.debug}}",
+ ],
+ },
+ mali_fence_debug: {
+ kbuild_options: ["CONFIG_MALI_FENCE_DEBUG=y"],
+ },
+ mali_system_trace: {
+ kbuild_options: ["CONFIG_MALI_SYSTEM_TRACE=y"],
},
buslog: {
kbuild_options: ["CONFIG_MALI_BUSLOG=y"],
@@ -52,44 +109,60 @@ bob_defaults {
cinstr_gwt: {
kbuild_options: ["CONFIG_MALI_CINSTR_GWT=y"],
},
- mali_gator_support: {
- kbuild_options: ["CONFIG_MALI_GATOR_SUPPORT=y"],
+ cinstr_primary_hwc: {
+ kbuild_options: ["CONFIG_MALI_PRFCNT_SET_PRIMARY=y"],
},
- mali_midgard_enable_trace: {
- kbuild_options: ["CONFIG_MALI_MIDGARD_ENABLE_TRACE=y"],
- },
- mali_system_trace: {
- kbuild_options: ["CONFIG_MALI_SYSTEM_TRACE=y"],
+ cinstr_secondary_hwc: {
+ kbuild_options: ["CONFIG_MALI_PRFCNT_SET_SECONDARY=y"],
},
- mali_pwrsoft_765: {
- kbuild_options: ["CONFIG_MALI_PWRSOFT_765=y"],
+ cinstr_tertiary_hwc: {
+ kbuild_options: ["CONFIG_MALI_PRFCNT_SET_TERTIARY=y"],
},
- mali_memory_fully_backed: {
- kbuild_options: ["CONFIG_MALI_MEMORY_FULLY_BACKED=y"],
+ cinstr_hwc_set_select_via_debug_fs: {
+ kbuild_options: ["CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS=y"],
},
- mali_dma_buf_map_on_demand: {
- kbuild_options: ["CONFIG_MALI_DMA_BUF_MAP_ON_DEMAND=y"],
+ mali_job_dump: {
+ kbuild_options: ["CONFIG_MALI_JOB_DUMP"],
},
- mali_dma_buf_legacy_compat: {
- kbuild_options: ["CONFIG_MALI_DMA_BUF_LEGACY_COMPAT=y"],
+ mali_pwrsoft_765: {
+ kbuild_options: ["CONFIG_MALI_PWRSOFT_765=y"],
},
- mali_arbiter_support: {
- kbuild_options: ["CONFIG_MALI_ARBITER_SUPPORT=y"],
+ mali_hw_errata_1485982_not_affected: {
+ kbuild_options: ["CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED=y"],
},
- mali_gem5_build: {
- kbuild_options: ["CONFIG_MALI_GEM5_BUILD=y"],
+ mali_hw_errata_1485982_use_clock_alternative: {
+ kbuild_options: ["CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE=y"],
},
kbuild_options: [
- "MALI_UNIT_TEST={{.unit_test_code}}",
+ "CONFIG_MALI_PLATFORM_NAME={{.mali_platform_name}}",
"MALI_CUSTOMER_RELEASE={{.release}}",
+ "MALI_UNIT_TEST={{.unit_test_code}}",
"MALI_USE_CSF={{.gpu_has_csf}}",
- "MALI_KERNEL_TEST_API={{.debug}}",
+ "MALI_JIT_PRESSURE_LIMIT_BASE={{.jit_pressure_limit_base}}",
+
+ // Start of CS experimental features definitions.
+ // If there is nothing below, definition should be added as follows:
+ // "MALI_EXPERIMENTAL_FEATURE={{.experimental_feature}}"
+ // experimental_feature above comes from Mconfig in
+ // <ddk_root>/product/base/
+ // However, in Mconfig, experimental_feature should be looked up (for
+ // similar explanation to this one) as ALLCAPS, i.e.
+ // EXPERIMENTAL_FEATURE.
+ //
+ // IMPORTANT: MALI_CS_EXPERIMENTAL should NEVER be defined below as it
+ // is an umbrella feature that would be open for inappropriate use
+ // (catch-all for experimental CS code without separating it into
+ // different features).
+ "MALI_INCREMENTAL_RENDERING={{.incremental_rendering}}",
+ "GPU_TIMESTAMP_CORRECTION={{.gpu_timestamp_correction}}",
],
- defaults: ["kernel_defaults"],
}
bob_kernel_module {
name: "mali_kbase",
+ defaults: [
+ "mali_kbase_shared_config_defaults",
+ ],
srcs: [
"*.c",
"*.h",
@@ -99,6 +172,7 @@ bob_kernel_module {
"backend/gpu/Kbuild",
"context/*.c",
"context/*.h",
+ "context/Kbuild",
"ipa/*.c",
"ipa/*.h",
"ipa/Kbuild",
@@ -107,55 +181,23 @@ bob_kernel_module {
"platform/*/*.h",
"platform/*/Kbuild",
"thirdparty/*.c",
+ "thirdparty/Kbuild",
"debug/*.c",
"debug/*.h",
+ "debug/Kbuild",
"device/*.c",
"device/*.h",
+ "device/Kbuild",
"gpu/*.c",
"gpu/*.h",
+ "gpu/Kbuild",
"tl/*.c",
"tl/*.h",
+ "tl/Kbuild",
"mmu/*.c",
"mmu/*.h",
+ "mmu/Kbuild",
],
- kbuild_options: [
- "CONFIG_MALI_KUTF=n",
- "CONFIG_MALI_MIDGARD=m",
- "CONFIG_MALI_NO_MALI_DEFAULT_GPU={{.gpu}}",
- "CONFIG_MALI_PLATFORM_NAME={{.mali_platform_name}}",
- ],
- buslog: {
- extra_symbols: [
- "bus_logger",
- ],
- },
- mali_corestack: {
- kbuild_options: ["CONFIG_MALI_CORESTACK=y"],
- },
- mali_error_inject: {
- kbuild_options: ["CONFIG_MALI_ERROR_INJECT=y"],
- },
- mali_error_inject_random: {
- kbuild_options: ["CONFIG_MALI_ERROR_INJECT_RANDOM=y"],
- },
- cinstr_secondary_hwc: {
- kbuild_options: ["CONFIG_MALI_PRFCNT_SET_SECONDARY=y"],
- },
- cinstr_tertiary_hwc: {
- kbuild_options: ["CONFIG_MALI_PRFCNT_SET_TERTIARY=y"],
- },
- cinstr_hwc_set_select_via_debug_fs: {
- kbuild_options: ["CONFIG_MALI_PRFCNT_SET_SELECT_VIA_DEBUG_FS=y"],
- },
- mali_2mb_alloc: {
- kbuild_options: ["CONFIG_MALI_2MB_ALLOC=y"],
- },
- mali_hw_errata_1485982_not_affected: {
- kbuild_options: ["CONFIG_MALI_HW_ERRATA_1485982_NOT_AFFECTED=y"],
- },
- mali_hw_errata_1485982_use_clock_alternative: {
- kbuild_options: ["CONFIG_MALI_HW_ERRATA_1485982_USE_CLOCK_ALTERNATIVE=y"],
- },
gpu_has_job_manager: {
srcs: [
"context/backend/*_jm.c",
@@ -172,7 +214,6 @@ bob_kernel_module {
],
},
gpu_has_csf: {
- kbuild_options: ["CONFIG_MALI_CSF_SUPPORT=y"],
srcs: [
"context/backend/*_csf.c",
"csf/*.c",
@@ -199,5 +240,13 @@ bob_kernel_module {
"arbiter/Kbuild",
],
},
- defaults: ["mali_kbase_shared_config_defaults"],
+ kbuild_options: [
+ "CONFIG_MALI_MIDGARD=m",
+ "CONFIG_MALI_KUTF=n",
+ ],
+ buslog: {
+ extra_symbols: [
+ "bus_logger",
+ ],
+ },
}
diff --git a/mali_kbase/tests/mali_kutf_irq_test/Kconfig b/mali_kbase/context/Kbuild
index e28106b..edce455 100644
--- a/mali_kbase/tests/mali_kutf_irq_test/Kconfig
+++ b/mali_kbase/context/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2012-2013, 2016-2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,11 +18,11 @@
#
#
-config MALI_IRQ_LATENCY
- tristate "Mali GPU IRQ latency measurement"
- depends on MALI_MIDGARD && MALI_DEBUG && MALI_KUTF
- default m
- help
- This option will build a test module mali_kutf_irq_test that
- can determine the latency of the Mali GPU IRQ on your system.
- Choosing M here will generate a single module called mali_kutf_irq_test.
+mali_kbase-y += context/mali_kbase_context.o
+
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ mali_kbase-y += context/backend/mali_kbase_context_csf.o
+else
+ mali_kbase-y += context/backend/mali_kbase_context_jm.o
+endif
+
diff --git a/mali_kbase/context/backend/mali_kbase_context_csf.c b/mali_kbase/context/backend/mali_kbase_context_csf.c
index c660247..fc74744 100644
--- a/mali_kbase/context/backend/mali_kbase_context_csf.c
+++ b/mali_kbase/context/backend/mali_kbase_context_csf.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -32,7 +32,7 @@
#include <mmu/mali_kbase_mmu.h>
#include <tl/mali_kbase_timeline.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#include <csf/mali_kbase_csf_csg_debugfs.h>
#include <csf/mali_kbase_csf_kcpu_debugfs.h>
#include <csf/mali_kbase_csf_tiler_heap_debugfs.h>
diff --git a/mali_kbase/context/backend/mali_kbase_context_jm.c b/mali_kbase/context/backend/mali_kbase_context_jm.c
index 649ba7a..f41b919 100644
--- a/mali_kbase/context/backend/mali_kbase_context_jm.c
+++ b/mali_kbase/context/backend/mali_kbase_context_jm.c
@@ -34,7 +34,7 @@
#include <mmu/mali_kbase_mmu.h>
#include <tl/mali_kbase_timeline.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#include <mali_kbase_debug_mem_view.h>
#include <mali_kbase_mem_pool_debugfs.h>
@@ -147,7 +147,7 @@ static const struct kbase_context_init context_init[] = {
"JS kctx initialization failed" },
{ kbase_jd_init, kbase_jd_exit, "JD initialization failed" },
{ kbase_context_submit_check, NULL, "Enabling job submission failed" },
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
{ kbase_debug_job_fault_context_init,
kbase_debug_job_fault_context_term,
"Job fault context initialization failed" },
@@ -155,8 +155,8 @@ static const struct kbase_context_init context_init[] = {
{ NULL, kbase_context_flush_jobs, NULL },
{ kbase_context_add_to_dev_list, kbase_context_remove_from_dev_list,
"Adding kctx to device failed" },
- {kbasep_platform_context_init, kbasep_platform_context_term,
- "Platform callback for kctx initialization failed"},
+ { kbasep_platform_context_init, kbasep_platform_context_term,
+ "Platform callback for kctx initialization failed" },
};
static void kbase_context_term_partial(
diff --git a/mali_kbase/context/mali_kbase_context.c b/mali_kbase/context/mali_kbase_context.c
index fa4970b..20142af 100644
--- a/mali_kbase/context/mali_kbase_context.c
+++ b/mali_kbase/context/mali_kbase_context.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -154,7 +154,7 @@ int kbase_context_common_init(struct kbase_context *kctx)
atomic_set(&kctx->event_count, 0);
#if !MALI_USE_CSF
atomic_set(&kctx->event_closed, false);
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
atomic_set(&kctx->jctx.work_id, 0);
#endif
#endif
diff --git a/mali_kbase/context/mali_kbase_context.h b/mali_kbase/context/mali_kbase_context.h
index f18f64b..f7ee79d 100644
--- a/mali_kbase/context/mali_kbase_context.h
+++ b/mali_kbase/context/mali_kbase_context.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2011-2017, 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2017, 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/context/mali_kbase_context_internal.h b/mali_kbase/context/mali_kbase_context_internal.h
index fd009b8..75da8cf 100644
--- a/mali_kbase/context/mali_kbase_context_internal.h
+++ b/mali_kbase/context/mali_kbase_context_internal.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/Kbuild b/mali_kbase/csf/Kbuild
index c82b21a..6c64e40 100644
--- a/mali_kbase/csf/Kbuild
+++ b/mali_kbase/csf/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2018-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,24 +19,29 @@
#
mali_kbase-y += \
- csf/mali_kbase_csf_firmware_cfg.o \
- csf/mali_kbase_csf_trace_buffer.o \
- csf/mali_kbase_csf.o \
- csf/mali_kbase_csf_scheduler.o \
- csf/mali_kbase_csf_kcpu.o \
- csf/mali_kbase_csf_tiler_heap.o \
- csf/mali_kbase_csf_timeout.o \
- csf/mali_kbase_csf_tl_reader.o \
- csf/mali_kbase_csf_heap_context_alloc.o \
- csf/mali_kbase_csf_reset_gpu.o \
- csf/mali_kbase_csf_csg_debugfs.o \
- csf/mali_kbase_csf_kcpu_debugfs.o \
- csf/mali_kbase_csf_protected_memory.o \
- csf/mali_kbase_csf_tiler_heap_debugfs.o \
- csf/mali_kbase_csf_cpu_queue_debugfs.o
+ csf/mali_kbase_csf_firmware_cfg.o \
+ csf/mali_kbase_csf_trace_buffer.o \
+ csf/mali_kbase_csf.o \
+ csf/mali_kbase_csf_scheduler.o \
+ csf/mali_kbase_csf_kcpu.o \
+ csf/mali_kbase_csf_tiler_heap.o \
+ csf/mali_kbase_csf_timeout.o \
+ csf/mali_kbase_csf_tl_reader.o \
+ csf/mali_kbase_csf_heap_context_alloc.o \
+ csf/mali_kbase_csf_reset_gpu.o \
+ csf/mali_kbase_csf_csg_debugfs.o \
+ csf/mali_kbase_csf_kcpu_debugfs.o \
+ csf/mali_kbase_csf_protected_memory.o \
+ csf/mali_kbase_csf_tiler_heap_debugfs.o \
+ csf/mali_kbase_csf_cpu_queue_debugfs.o
mali_kbase-$(CONFIG_MALI_REAL_HW) += csf/mali_kbase_csf_firmware.o
-mali_kbase-$(CONFIG_MALI_NO_MALI) += csf/mali_kbase_csf_firmware_no_mali.o
-include $(src)/csf/ipa_control/Kbuild \ No newline at end of file
+ifeq ($(KBUILD_EXTMOD),)
+# in-tree
+ -include $(src)/csf/ipa_control/Kbuild
+else
+# out-of-tree
+ include $(src)/csf/ipa_control/Kbuild
+endif
diff --git a/mali_kbase/csf/ipa_control/Kbuild b/mali_kbase/csf/ipa_control/Kbuild
index cbff4dd..68f80de 100644
--- a/mali_kbase/csf/ipa_control/Kbuild
+++ b/mali_kbase/csf/ipa_control/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,4 +19,4 @@
#
mali_kbase-y += \
- csf/ipa_control/mali_kbase_csf_ipa_control.o \ No newline at end of file
+ csf/ipa_control/mali_kbase_csf_ipa_control.o
diff --git a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c
index 7b0845c..07ce9b9 100644
--- a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c
+++ b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -20,7 +20,7 @@
*/
#include <mali_kbase.h>
-#include "mali_kbase_clk_rate_trace_mgr.h"
+#include "backend/gpu/mali_kbase_clk_rate_trace_mgr.h"
#include "mali_kbase_csf_ipa_control.h"
/*
diff --git a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h
index a828e01..38bcf63 100644
--- a/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h
+++ b/mali_kbase/csf/ipa_control/mali_kbase_csf_ipa_control.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf.c b/mali_kbase/csf/mali_kbase_csf.c
index e3e046c..e57ac2e 100644
--- a/mali_kbase/csf/mali_kbase_csf.c
+++ b/mali_kbase/csf/mali_kbase_csf.c
@@ -144,14 +144,21 @@ static void gpu_munmap_user_io_pages(struct kbase_context *kctx,
mutex_unlock(&kctx->kbdev->csf.reg_lock);
}
-static void init_user_output_page(struct kbase_queue *queue)
+static void init_user_io_pages(struct kbase_queue *queue)
{
- u32 *addr = (u32 *)(queue->user_io_addr + PAGE_SIZE);
+ u32 *input_addr = (u32 *)(queue->user_io_addr);
+ u32 *output_addr = (u32 *)(queue->user_io_addr + PAGE_SIZE);
- addr[CS_EXTRACT_LO/4] = 0;
- addr[CS_EXTRACT_HI/4] = 0;
+ input_addr[CS_INSERT_LO/4] = 0;
+ input_addr[CS_INSERT_HI/4] = 0;
- addr[CS_ACTIVE/4] = 0;
+ input_addr[CS_EXTRACT_INIT_LO/4] = 0;
+ input_addr[CS_EXTRACT_INIT_HI/4] = 0;
+
+ output_addr[CS_EXTRACT_LO/4] = 0;
+ output_addr[CS_EXTRACT_HI/4] = 0;
+
+ output_addr[CS_ACTIVE/4] = 0;
}
/* Map the input/output pages in the shared interface segment of MCU firmware
@@ -350,7 +357,7 @@ int kbase_csf_alloc_command_stream_user_pages(struct kbase_context *kctx,
if (ret)
goto kernel_map_failed;
- init_user_output_page(queue);
+ init_user_io_pages(queue);
ret = gpu_mmap_user_io_pages(kctx->kbdev, queue->phys, reg);
if (ret)
@@ -455,19 +462,39 @@ static void release_queue(struct kbase_queue *queue)
static void oom_event_worker(struct work_struct *data);
static void fatal_event_worker(struct work_struct *data);
-int kbase_csf_queue_register(struct kbase_context *kctx,
- struct kbase_ioctl_cs_queue_register *reg)
+/* Between reg and reg_ex, one and only one must be null */
+static int csf_queue_register_internal(struct kbase_context *kctx,
+ struct kbase_ioctl_cs_queue_register *reg,
+ struct kbase_ioctl_cs_queue_register_ex *reg_ex)
{
struct kbase_queue *queue;
int ret = 0;
struct kbase_va_region *region;
- u64 queue_addr = reg->buffer_gpu_addr;
- size_t queue_size = reg->buffer_size >> PAGE_SHIFT;
+ u64 queue_addr;
+ size_t queue_size;
+
+ /* Only one pointer expected, otherwise coding error */
+ if ((reg == NULL && reg_ex == NULL) || (reg && reg_ex)) {
+ dev_err(kctx->kbdev->dev,
+ "Error, one and only one param-ptr expected!");
+ return -EINVAL;
+ }
+
+ /* struct kbase_ioctl_cs_queue_register_ex contains a full
+ * struct kbase_ioctl_cs_queue_register at the start address. So
+ * the pointer can be safely cast to pointing to a
+ * kbase_ioctl_cs_queue_register object.
+ */
+ if (reg_ex)
+ reg = (struct kbase_ioctl_cs_queue_register *)reg_ex;
/* Validate the queue priority */
if (reg->priority > BASE_QUEUE_MAX_PRIORITY)
return -EINVAL;
+ queue_addr = reg->buffer_gpu_addr;
+ queue_size = reg->buffer_size >> PAGE_SHIFT;
+
mutex_lock(&kctx->csf.lock);
/* Check if queue is already registered */
@@ -492,6 +519,35 @@ int kbase_csf_queue_register(struct kbase_context *kctx,
goto out_unlock_vm;
}
+ /* Check address validity on cs_trace buffer etc. Don't care
+ * if not enabled (i.e. when size is 0).
+ */
+ if (reg_ex && reg_ex->ex_buffer_size) {
+ int buf_pages = (reg_ex->ex_buffer_size +
+ (1 << PAGE_SHIFT) - 1) >> PAGE_SHIFT;
+
+ region = kbase_region_tracker_find_region_enclosing_address(
+ kctx, reg_ex->ex_buffer_base);
+ if (kbase_is_region_invalid_or_free(region)) {
+ ret = -ENOENT;
+ goto out_unlock_vm;
+ }
+
+ if (buf_pages > (region->nr_pages -
+ ((reg_ex->ex_buffer_base >> PAGE_SHIFT) -
+ region->start_pfn))) {
+ ret = -EINVAL;
+ goto out_unlock_vm;
+ }
+
+ region = kbase_region_tracker_find_region_enclosing_address(
+ kctx, reg_ex->ex_offset_var_addr);
+ if (kbase_is_region_invalid_or_free(region)) {
+ ret = -ENOENT;
+ goto out_unlock_vm;
+ }
+ }
+
queue = kzalloc(sizeof(struct kbase_queue), GFP_KERNEL);
if (!queue) {
@@ -529,6 +585,22 @@ int kbase_csf_queue_register(struct kbase_context *kctx,
region->flags |= KBASE_REG_NO_USER_FREE;
+ /* Initialize the cs_trace configuration parameters, When buffer_size
+ * is 0, trace is disabled. Here we only update the fields when
+ * enabled, otherwise leave them as default zeros.
+ */
+ if (reg_ex && reg_ex->ex_buffer_size) {
+ u32 cfg = CS_INSTR_CONFIG_EVENT_SIZE_SET(
+ 0, reg_ex->ex_event_size);
+ cfg = CS_INSTR_CONFIG_EVENT_STATE_SET(
+ cfg, reg_ex->ex_event_state);
+
+ queue->trace_cfg = cfg;
+ queue->trace_buffer_size = reg_ex->ex_buffer_size;
+ queue->trace_buffer_base = reg_ex->ex_buffer_base;
+ queue->trace_offset_ptr = reg_ex->ex_offset_var_addr;
+ }
+
out_unlock_vm:
kbase_gpu_vm_unlock(kctx);
out:
@@ -537,6 +609,37 @@ out:
return ret;
}
+int kbase_csf_queue_register(struct kbase_context *kctx,
+ struct kbase_ioctl_cs_queue_register *reg)
+{
+ return csf_queue_register_internal(kctx, reg, NULL);
+}
+
+int kbase_csf_queue_register_ex(struct kbase_context *kctx,
+ struct kbase_ioctl_cs_queue_register_ex *reg)
+{
+ struct kbase_csf_global_iface const *const iface =
+ &kctx->kbdev->csf.global_iface;
+ u32 const glb_version = iface->version;
+ u32 instr = iface->instr_features;
+ u8 max_size = GLB_INSTR_FEATURES_EVENT_SIZE_MAX_GET(instr);
+ u32 min_buf_size = (1u << reg->ex_event_size) *
+ GLB_INSTR_FEATURES_OFFSET_UPDATE_RATE_GET(instr);
+
+ /* If cs_trace_command not supported, the call fails */
+ if (glb_version < kbase_csf_interface_version(1, 1, 0))
+ return -EINVAL;
+
+ /* Validate the cs_trace configuration parameters */
+ if (reg->ex_buffer_size &&
+ ((reg->ex_event_size > max_size) ||
+ (reg->ex_buffer_size & (reg->ex_buffer_size - 1)) ||
+ (reg->ex_buffer_size < min_buf_size)))
+ return -EINVAL;
+
+ return csf_queue_register_internal(kctx, NULL, reg);
+}
+
static void unbind_queue(struct kbase_context *kctx,
struct kbase_queue *queue);
@@ -787,6 +890,8 @@ static void unbind_stopped_queue(struct kbase_context *kctx,
kbase_csf_scheduler_spin_lock(kctx->kbdev, &flags);
bitmap_clear(queue->group->protm_pending_bitmap,
queue->csi_index, 1);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kctx->kbdev, PROTM_PENDING_CLEAR,
+ queue->group, queue, queue->group->protm_pending_bitmap[0]);
queue->group->bound_queues[queue->csi_index] = NULL;
queue->group = NULL;
kbase_csf_scheduler_spin_unlock(kctx->kbdev, flags);
@@ -1913,6 +2018,7 @@ void kbase_csf_event_signal(struct kbase_context *kctx, bool notify_gpu)
spin_lock_irqsave(&kctx->kbdev->hwaccess_lock, flags);
if (kctx->kbdev->pm.backend.gpu_powered)
kbase_csf_ring_doorbell(kctx->kbdev, CSF_KERNEL_DOORBELL_NR);
+ KBASE_KTRACE_ADD(kctx->kbdev, SYNC_UPDATE_EVENT_NOTIFY_GPU, kctx, 0u);
spin_unlock_irqrestore(&kctx->kbdev->hwaccess_lock, flags);
}
@@ -2251,32 +2357,11 @@ static void protm_event_worker(struct work_struct *data)
struct kbase_queue_group *const group =
container_of(data, struct kbase_queue_group, protm_event_work);
+ KBASE_KTRACE_ADD_CSF_GRP(group->kctx->kbdev, PROTM_EVENT_WORKER_BEGIN,
+ group, 0u);
kbase_csf_scheduler_group_protm_enter(group);
-}
-
-static void report_queue_fatal_error(struct kbase_queue *const queue,
- u32 cs_fatal, u64 cs_fatal_info,
- u8 group_handle)
-{
- struct base_csf_notification error =
- { .type = BASE_CSF_NOTIFICATION_GPU_QUEUE_GROUP_ERROR,
- .payload = {
- .csg_error = {
- .handle = group_handle,
- .error = {
- .error_type =
- BASE_GPU_QUEUE_GROUP_QUEUE_ERROR_FATAL,
- .payload = {
- .fatal_queue = {
- .sideband =
- cs_fatal_info,
- .status = cs_fatal,
- .csi_index =
- queue->csi_index,
- } } } } } };
-
- add_error(queue->kctx, &queue->error, &error);
- kbase_event_wakeup(queue->kctx);
+ KBASE_KTRACE_ADD_CSF_GRP(group->kctx->kbdev, PROTM_EVENT_WORKER_END,
+ group, 0u);
}
/**
@@ -2308,18 +2393,44 @@ handle_fault_event(struct kbase_queue *const queue,
kbase_csf_scheduler_spin_lock_assert_held(kbdev);
- dev_warn(kbdev->dev, "CSI: %d\n"
- "CS_FAULT.EXCEPTION_TYPE: 0x%x (%s)\n"
- "CS_FAULT.EXCEPTION_DATA: 0x%x\n"
- "CS_FAULT_INFO.EXCEPTION_DATA: 0x%llx\n",
- queue->csi_index, cs_fault_exception_type,
- kbase_gpu_exception_name(cs_fault_exception_type),
- cs_fault_exception_data, cs_fault_info_exception_data);
+ dev_warn(kbdev->dev,
+ "Ctx %d_%d Group %d CSG %d CSI: %d\n"
+ "CS_FAULT.EXCEPTION_TYPE: 0x%x (%s)\n"
+ "CS_FAULT.EXCEPTION_DATA: 0x%x\n"
+ "CS_FAULT_INFO.EXCEPTION_DATA: 0x%llx\n",
+ queue->kctx->tgid, queue->kctx->id, queue->group->handle,
+ queue->group->csg_nr, queue->csi_index,
+ cs_fault_exception_type,
+ kbase_gpu_exception_name(cs_fault_exception_type),
+ cs_fault_exception_data, cs_fault_info_exception_data);
+}
- if (cs_fault_exception_type ==
- CS_FAULT_EXCEPTION_TYPE_RESOURCE_EVICTION_TIMEOUT)
- report_queue_fatal_error(queue, GPU_EXCEPTION_TYPE_SW_FAULT_2,
- 0, queue->group->handle);
+static void report_queue_fatal_error(struct kbase_queue *const queue,
+ u32 cs_fatal, u64 cs_fatal_info,
+ u8 group_handle)
+{
+ struct base_csf_notification error = {
+ .type = BASE_CSF_NOTIFICATION_GPU_QUEUE_GROUP_ERROR,
+ .payload = {
+ .csg_error = {
+ .handle = group_handle,
+ .error = {
+ .error_type =
+ BASE_GPU_QUEUE_GROUP_QUEUE_ERROR_FATAL,
+ .payload = {
+ .fatal_queue = {
+ .sideband = cs_fatal_info,
+ .status = cs_fatal,
+ .csi_index = queue->csi_index,
+ }
+ }
+ }
+ }
+ }
+ };
+
+ add_error(queue->kctx, &queue->error, &error);
+ kbase_event_wakeup(queue->kctx);
}
/**
@@ -2398,11 +2509,12 @@ handle_fatal_event(struct kbase_queue *const queue,
kbase_csf_scheduler_spin_lock_assert_held(kbdev);
dev_warn(kbdev->dev,
- "CSG: %d, CSI: %d\n"
+ "Ctx %d_%d Group %d CSG %d CSI: %d\n"
"CS_FATAL.EXCEPTION_TYPE: 0x%x (%s)\n"
"CS_FATAL.EXCEPTION_DATA: 0x%x\n"
"CS_FATAL_INFO.EXCEPTION_DATA: 0x%llx\n",
- queue->group->handle, queue->csi_index,
+ queue->kctx->tgid, queue->kctx->id, queue->group->handle,
+ queue->group->csg_nr, queue->csi_index,
cs_fatal_exception_type,
kbase_gpu_exception_name(cs_fatal_exception_type),
cs_fatal_exception_data, cs_fatal_info_exception_data);
@@ -2505,23 +2617,28 @@ static void process_cs_interrupts(struct kbase_queue_group *const group,
if ((cs_req & CS_REQ_EXCEPTION_MASK) ^
(cs_ack & CS_ACK_EXCEPTION_MASK)) {
KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, CSI_FAULT_INTERRUPT, group, queue, cs_req ^ cs_ack);
- handle_queue_exception_event(queue, cs_req,
- cs_ack);
+ handle_queue_exception_event(queue, cs_req, cs_ack);
}
/* PROTM_PEND and TILER_OOM can be safely ignored
* because they will be raised again if the group
* is assigned a CSG slot in future.
*/
- if (group_suspending)
+ if (group_suspending) {
+ u32 const cs_req_remain = cs_req & ~CS_REQ_EXCEPTION_MASK;
+ u32 const cs_ack_remain = cs_ack & ~CS_ACK_EXCEPTION_MASK;
+
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, CSI_IGNORED_INTERRUPTS_GROUP_SUSPEND,
+ group, queue, cs_req_remain ^ cs_ack_remain);
continue;
+ }
if (((cs_req & CS_REQ_TILER_OOM_MASK) ^
(cs_ack & CS_ACK_TILER_OOM_MASK))) {
get_queue(queue);
- KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, CSI_TILER_OOM_INTERRUPT, group, queue, cs_req ^ cs_ack);
- if (WARN_ON(!queue_work(
- wq, &queue->oom_event_work))) {
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, CSI_TILER_OOM_INTERRUPT, group, queue,
+ cs_req ^ cs_ack);
+ if (WARN_ON(!queue_work(wq, &queue->oom_event_work))) {
/* The work item shall not have been
* already queued, there can be only
* one pending OoM event for a
@@ -2533,12 +2650,17 @@ static void process_cs_interrupts(struct kbase_queue_group *const group,
if ((cs_req & CS_REQ_PROTM_PEND_MASK) ^
(cs_ack & CS_ACK_PROTM_PEND_MASK)) {
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, CSI_PROTM_PEND_INTERRUPT, group, queue,
+ cs_req ^ cs_ack);
+
dev_dbg(kbdev->dev,
"Protected mode entry request for queue on csi %d bound to group-%d on slot %d",
queue->csi_index, group->handle,
group->csg_nr);
bitmap_set(group->protm_pending_bitmap, i, 1);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, PROTM_PENDING_SET, group, queue,
+ group->protm_pending_bitmap[0]);
protm_pend = true;
}
}
@@ -2567,7 +2689,7 @@ static void process_csg_interrupts(struct kbase_device *const kbdev,
int const csg_nr)
{
struct kbase_csf_cmd_stream_group_info *ginfo;
- struct kbase_queue_group *group;
+ struct kbase_queue_group *group = NULL;
u32 req, ack, irqreq, irqack;
kbase_csf_scheduler_spin_lock_assert_held(kbdev);
@@ -2575,6 +2697,8 @@ static void process_csg_interrupts(struct kbase_device *const kbdev,
if (WARN_ON(csg_nr >= kbdev->csf.global_iface.group_num))
return;
+ KBASE_KTRACE_ADD(kbdev, CSG_INTERRUPT_PROCESS, NULL, csg_nr);
+
ginfo = &kbdev->csf.global_iface.groups[csg_nr];
req = kbase_csf_firmware_csg_input_read(ginfo, CSG_REQ);
ack = kbase_csf_firmware_csg_output(ginfo, CSG_ACK);
@@ -2583,7 +2707,7 @@ static void process_csg_interrupts(struct kbase_device *const kbdev,
/* There may not be any pending CSG/CS interrupts to process */
if ((req == ack) && (irqreq == irqack))
- return;
+ goto out;
/* Immediately set IRQ_ACK bits to be same as the IRQ_REQ bits before
* examining the CS_ACK & CS_REQ bits. This would ensure that Host
@@ -2604,10 +2728,10 @@ static void process_csg_interrupts(struct kbase_device *const kbdev,
* slot scheduler spinlock is required.
*/
if (!group)
- return;
+ goto out;
if (WARN_ON(kbase_csf_scheduler_group_get_slot_locked(group) != csg_nr))
- return;
+ goto out;
if ((req ^ ack) & CSG_REQ_SYNC_UPDATE_MASK) {
kbase_csf_firmware_csg_input_mask(ginfo,
@@ -2624,7 +2748,8 @@ static void process_csg_interrupts(struct kbase_device *const kbdev,
CSG_REQ_IDLE_MASK);
set_bit(csg_nr, scheduler->csg_slots_idle_mask);
-
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_SLOT_IDLE_SET, group,
+ scheduler->csg_slots_idle_mask[0]);
KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_IDLE_INTERRUPT, group, req ^ ack);
dev_dbg(kbdev->dev, "Idle notification received for Group %u on slot %d\n",
group->handle, csg_nr);
@@ -2640,6 +2765,8 @@ static void process_csg_interrupts(struct kbase_device *const kbdev,
kbase_csf_firmware_csg_input_mask(ginfo, CSG_REQ, ack,
CSG_REQ_PROGRESS_TIMER_EVENT_MASK);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_PROGRESS_TIMER_INTERRUPT,
+ group, req ^ ack);
dev_info(kbdev->dev,
"Timeout notification received for group %u of ctx %d_%d on slot %d\n",
group->handle, group->kctx->tgid, group->kctx->id, csg_nr);
@@ -2648,6 +2775,11 @@ static void process_csg_interrupts(struct kbase_device *const kbdev,
}
process_cs_interrupts(group, ginfo, irqreq, irqack);
+
+out:
+ /* group may still be NULL here */
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_INTERRUPT_PROCESS_END, group,
+ ((u64)req ^ ack) | (((u64)irqreq ^ irqack) << 32));
}
/**
@@ -2741,6 +2873,7 @@ void kbase_csf_interrupt(struct kbase_device *kbdev, u32 val)
lockdep_assert_held(&kbdev->hwaccess_lock);
+ KBASE_KTRACE_ADD(kbdev, CSF_INTERRUPT, NULL, val);
kbase_reg_write(kbdev, JOB_CONTROL_REG(JOB_IRQ_CLEAR), val);
if (val & JOB_IRQ_GLOBAL_IF) {
@@ -2761,6 +2894,7 @@ void kbase_csf_interrupt(struct kbase_device *kbdev, u32 val)
global_iface, GLB_REQ);
glb_ack = kbase_csf_firmware_global_output(
global_iface, GLB_ACK);
+ KBASE_KTRACE_ADD(kbdev, GLB_REQ_ACQ, NULL, glb_req ^ glb_ack);
if ((glb_req ^ glb_ack) & GLB_REQ_PROTM_EXIT_MASK) {
dev_dbg(kbdev->dev, "Protected mode exit interrupt received");
@@ -2768,8 +2902,8 @@ void kbase_csf_interrupt(struct kbase_device *kbdev, u32 val)
global_iface, GLB_REQ, glb_ack,
GLB_REQ_PROTM_EXIT_MASK);
WARN_ON(!kbase_csf_scheduler_protected_mode_in_use(kbdev));
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_EXIT_PROTM, scheduler->active_protm_grp, 0u);
scheduler->active_protm_grp = NULL;
- KBASE_KTRACE_ADD(kbdev, SCHEDULER_EXIT_PROTM, NULL, 0u);
kbdev->protected_mode = false;
kbase_ipa_control_protm_exited(kbdev);
kbase_hwcnt_backend_csf_protm_exited(
@@ -2778,13 +2912,20 @@ void kbase_csf_interrupt(struct kbase_device *kbdev, u32 val)
/* Handle IDLE Hysteresis notification event */
if ((glb_req ^ glb_ack) & GLB_REQ_IDLE_EVENT_MASK) {
+ int non_idle_offslot_grps;
+ bool can_suspend_on_idle;
dev_dbg(kbdev->dev, "Idle-hysteresis event flagged");
kbase_csf_firmware_global_input_mask(
global_iface, GLB_REQ, glb_ack,
GLB_REQ_IDLE_EVENT_MASK);
- if (!atomic_read(&scheduler->non_idle_offslot_grps)) {
- if (kbase_pm_idle_groups_sched_suspendable(kbdev))
+ non_idle_offslot_grps = atomic_read(&scheduler->non_idle_offslot_grps);
+ can_suspend_on_idle = kbase_pm_idle_groups_sched_suspendable(kbdev);
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_CAN_IDLE, NULL,
+ ((u64)(u32)non_idle_offslot_grps) | (((u64)can_suspend_on_idle) << 32));
+
+ if (!non_idle_offslot_grps) {
+ if (can_suspend_on_idle)
queue_work(system_highpri_wq,
&scheduler->gpu_idle_work);
} else {
@@ -2809,6 +2950,7 @@ void kbase_csf_interrupt(struct kbase_device *kbdev, u32 val)
if (!remaining) {
wake_up_all(&kbdev->csf.event_wait);
+ KBASE_KTRACE_ADD(kbdev, CSF_INTERRUPT_END, NULL, val);
return;
}
}
@@ -2823,6 +2965,7 @@ void kbase_csf_interrupt(struct kbase_device *kbdev, u32 val)
kbase_csf_scheduler_spin_unlock(kbdev, flags);
wake_up_all(&kbdev->csf.event_wait);
+ KBASE_KTRACE_ADD(kbdev, CSF_INTERRUPT_END, NULL, val);
}
void kbase_csf_doorbell_mapping_term(struct kbase_device *kbdev)
diff --git a/mali_kbase/csf/mali_kbase_csf.h b/mali_kbase/csf/mali_kbase_csf.h
index effd468..5292d14 100644
--- a/mali_kbase/csf/mali_kbase_csf.h
+++ b/mali_kbase/csf/mali_kbase_csf.h
@@ -39,7 +39,7 @@
*/
#define KBASEP_USER_DB_NR_INVALID ((s8)-1)
-#define FIRMWARE_PING_INTERVAL_MS (2000) /* 2 seconds */
+#define FIRMWARE_PING_INTERVAL_MS (4000) /* 4 seconds */
#define FIRMWARE_IDLE_HYSTERESIS_TIME_MS (10) /* Default 10 milliseconds */
@@ -213,6 +213,22 @@ int kbase_csf_queue_register(struct kbase_context *kctx,
struct kbase_ioctl_cs_queue_register *reg);
/**
+ * kbase_csf_queue_register_ex - Register a GPU command queue with
+ * extended format.
+ *
+ * @kctx: Pointer to the kbase context within which the
+ * queue is to be registered.
+ * @reg: Pointer to the structure which contains details of the
+ * queue to be registered within the provided
+ * context, together with the extended parameter fields
+ * for supporting cs trace command.
+ *
+ * Return: 0 on success, or negative on failure.
+ */
+int kbase_csf_queue_register_ex(struct kbase_context *kctx,
+ struct kbase_ioctl_cs_queue_register_ex *reg);
+
+/**
* kbase_csf_queue_terminate - Terminate a GPU command queue.
*
* @kctx: Pointer to the kbase context within which the
diff --git a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c
index b54b2fc..4dea39e 100644
--- a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c
+++ b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.c
@@ -23,7 +23,7 @@
#include <mali_kbase.h>
#include <linux/seq_file.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
bool kbase_csf_cpu_queue_read_dump_req(struct kbase_context *kctx,
struct base_csf_notification *req)
diff --git a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h
index 3633649..2ed1520 100644
--- a/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h
+++ b/mali_kbase/csf/mali_kbase_csf_cpu_queue_debugfs.h
@@ -68,7 +68,7 @@ bool kbase_csf_cpu_queue_read_dump_req(struct kbase_context *kctx,
*/
static inline bool kbase_csf_cpu_queue_dump_needed(struct kbase_context *kctx)
{
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
return (atomic_read(&kctx->csf.cpu_queue.dump_req_status) ==
BASE_CSF_CPU_QUEUE_DUMP_ISSUED);
#else
diff --git a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c
index 3894683..4d9f606 100644
--- a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c
+++ b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -25,7 +25,7 @@
#include <linux/delay.h>
#include <csf/mali_kbase_csf_trace_buffer.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#include "mali_kbase_csf_tl_reader.h"
/**
@@ -87,6 +87,32 @@ static void kbasep_csf_scheduler_dump_active_queue_cs_status_wait(
blocked_reason)));
}
+static void kbasep_csf_scheduler_dump_active_cs_trace(struct seq_file *file,
+ struct kbase_csf_cmd_stream_info const *const stream)
+{
+ u32 val = kbase_csf_firmware_cs_input_read(stream,
+ CS_INSTR_BUFFER_BASE_LO);
+ u64 addr = ((u64)kbase_csf_firmware_cs_input_read(stream,
+ CS_INSTR_BUFFER_BASE_HI) << 32) | val;
+ val = kbase_csf_firmware_cs_input_read(stream,
+ CS_INSTR_BUFFER_SIZE);
+
+ seq_printf(file, "CS_TRACE_BUF_ADDR: 0x%16llx, SIZE: %u\n", addr, val);
+
+ /* Write offset variable address (pointer) */
+ val = kbase_csf_firmware_cs_input_read(stream,
+ CS_INSTR_BUFFER_OFFSET_POINTER_LO);
+ addr = ((u64)kbase_csf_firmware_cs_input_read(stream,
+ CS_INSTR_BUFFER_OFFSET_POINTER_HI) << 32) | val;
+ seq_printf(file, "CS_TRACE_BUF_OFFSET_PTR: 0x%16llx\n", addr);
+
+ /* EVENT_SIZE and EVENT_STATEs */
+ val = kbase_csf_firmware_cs_input_read(stream, CS_INSTR_CONFIG);
+ seq_printf(file, "TRACE_EVENT_SIZE: 0x%x, TRACE_EVENT_STAES 0x%x\n",
+ CS_INSTR_CONFIG_EVENT_SIZE_GET(val),
+ CS_INSTR_CONFIG_EVENT_STATE_GET(val));
+}
+
/**
* kbasep_csf_scheduler_dump_active_queue() - Print GPU command queue
* debug information
@@ -134,7 +160,9 @@ static void kbasep_csf_scheduler_dump_active_queue(struct seq_file *file,
queue->csi_index, queue->base_addr, queue->priority,
cs_insert, cs_extract, cs_active, queue->doorbell_nr);
- /* Print status information for blocked group waiting for sync object */
+ /* Print status information for blocked group waiting for sync object. For on-slot queues,
+ * if cs_trace is enabled, dump the interface's cs_trace configuration.
+ */
if (kbase_csf_scheduler_group_get_slot(queue->group) < 0) {
if (CS_STATUS_WAIT_SYNC_WAIT_GET(queue->status_wait)) {
wait_status = queue->status_wait;
@@ -212,6 +240,11 @@ static void kbasep_csf_scheduler_dump_active_queue(struct seq_file *file,
file, wait_status, wait_sync_value,
wait_sync_live_value, wait_sync_pointer, sb_status,
blocked_reason);
+ /* Dealing with cs_trace */
+ if (kbase_csf_scheduler_queue_has_trace(queue))
+ kbasep_csf_scheduler_dump_active_cs_trace(file, stream);
+ else
+ seq_puts(file, "NO CS_TRACE\n");
}
seq_puts(file, "\n");
diff --git a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h
index c6a86b6..d1f05e4 100644
--- a/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h
+++ b/mali_kbase/csf/mali_kbase_csf_csg_debugfs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_defs.h b/mali_kbase/csf/mali_kbase_csf_defs.h
index 0517399..0328aa5 100644
--- a/mali_kbase/csf/mali_kbase_csf_defs.h
+++ b/mali_kbase/csf/mali_kbase_csf_defs.h
@@ -314,6 +314,10 @@ struct kbase_csf_notification {
* are non-zero
* @blocked_reason: Value shows if the queue is blocked, and if so,
* the reason why it is blocked
+ * @trace_buffer_base: CS trace buffer base address.
+ * @trace_offset_ptr: Pointer to the CS trace buffer offset variable.
+ * @trace_buffer_size: CS trace buffer size for the queue.
+ * @trace_cfg: CS trace configuration parameters.
* @error: GPU command queue fatal information to pass to user space.
* @fatal_event_work: Work item to handle the CS fatal event reported for this
* queue.
@@ -344,6 +348,10 @@ struct kbase_queue {
u32 sync_value;
u32 sb_status;
u32 blocked_reason;
+ u64 trace_buffer_base;
+ u64 trace_offset_ptr;
+ u32 trace_buffer_size;
+ u32 trace_cfg;
struct kbase_csf_notification error;
struct work_struct fatal_event_work;
u64 cs_fatal_info;
@@ -667,7 +675,7 @@ struct kbase_csf_context {
struct vm_area_struct *user_reg_vma;
struct kbase_csf_scheduler_context sched;
struct list_head error_list;
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
struct kbase_csf_cpu_queue_context cpu_queue;
#endif
};
diff --git a/mali_kbase/csf/mali_kbase_csf_firmware.c b/mali_kbase/csf/mali_kbase_csf_firmware.c
index 73b8e03..87a2b11 100644
--- a/mali_kbase/csf/mali_kbase_csf_firmware.c
+++ b/mali_kbase/csf/mali_kbase_csf_firmware.c
@@ -993,7 +993,12 @@ static int parse_capabilities(struct kbase_device *kbdev)
iface->group_stride = shared_info[GLB_GROUP_STRIDE/4];
iface->prfcnt_size = shared_info[GLB_PRFCNT_SIZE/4];
- iface->instr_features = shared_info[GLB_INSTR_FEATURES / 4];
+
+ if (iface->version >= kbase_csf_interface_version(1, 1, 0)) {
+ iface->instr_features = shared_info[GLB_INSTR_FEATURES / 4];
+ } else {
+ iface->instr_features = 0;
+ }
if ((GROUP_CONTROL_0 +
(unsigned long)iface->group_num * iface->group_stride) >
@@ -1671,6 +1676,25 @@ u32 kbase_csf_firmware_set_mcu_core_pwroff_time(struct kbase_device *kbdev, u32
}
+int kbase_csf_firmware_early_init(struct kbase_device *kbdev)
+{
+ init_waitqueue_head(&kbdev->csf.event_wait);
+ kbdev->csf.interrupt_received = false;
+ kbdev->csf.fw_timeout_ms = CSF_FIRMWARE_TIMEOUT_MS;
+
+ INIT_LIST_HEAD(&kbdev->csf.firmware_interfaces);
+ INIT_LIST_HEAD(&kbdev->csf.firmware_config);
+ INIT_LIST_HEAD(&kbdev->csf.firmware_timeline_metadata);
+ INIT_LIST_HEAD(&kbdev->csf.firmware_trace_buffers.list);
+ INIT_WORK(&kbdev->csf.firmware_reload_work,
+ kbase_csf_firmware_reload_worker);
+ INIT_WORK(&kbdev->csf.fw_error_work, firmware_error_worker);
+
+ mutex_init(&kbdev->csf.reg_lock);
+
+ return 0;
+}
+
int kbase_csf_firmware_init(struct kbase_device *kbdev)
{
const struct firmware *firmware;
@@ -1681,6 +1705,8 @@ int kbase_csf_firmware_init(struct kbase_device *kbdev)
u32 entry_offset;
int ret;
+ lockdep_assert_held(&kbdev->fw_load_lock);
+
if (WARN_ON((kbdev->as_free & MCU_AS_BITMASK) == 0))
return -EINVAL;
kbdev->as_free &= ~MCU_AS_BITMASK;
@@ -1694,31 +1720,18 @@ int kbase_csf_firmware_init(struct kbase_device *kbdev)
return ret;
}
- init_waitqueue_head(&kbdev->csf.event_wait);
- kbdev->csf.interrupt_received = false;
- kbdev->csf.fw_timeout_ms = CSF_FIRMWARE_TIMEOUT_MS;
-
- INIT_LIST_HEAD(&kbdev->csf.firmware_interfaces);
- INIT_LIST_HEAD(&kbdev->csf.firmware_config);
- INIT_LIST_HEAD(&kbdev->csf.firmware_timeline_metadata);
- INIT_LIST_HEAD(&kbdev->csf.firmware_trace_buffers.list);
- INIT_WORK(&kbdev->csf.firmware_reload_work,
- kbase_csf_firmware_reload_worker);
- INIT_WORK(&kbdev->csf.fw_error_work, firmware_error_worker);
-
- mutex_init(&kbdev->csf.reg_lock);
-
kbdev->csf.gpu_idle_hysteresis_ms = FIRMWARE_IDLE_HYSTERESIS_TIME_MS;
- kbdev->csf.gpu_idle_dur_count = convert_dur_to_idle_count(kbdev,
- FIRMWARE_IDLE_HYSTERESIS_TIME_MS);
+ kbdev->csf.gpu_idle_dur_count = convert_dur_to_idle_count(
+ kbdev, FIRMWARE_IDLE_HYSTERESIS_TIME_MS);
kbdev->csf.mcu_core_pwroff_dur_us = DEFAULT_GLB_PWROFF_TIMEOUT_US;
- kbdev->csf.mcu_core_pwroff_dur_count =
- convert_dur_to_core_pwroff_count(kbdev, DEFAULT_GLB_PWROFF_TIMEOUT_US);
+ kbdev->csf.mcu_core_pwroff_dur_count = convert_dur_to_core_pwroff_count(
+ kbdev, DEFAULT_GLB_PWROFF_TIMEOUT_US);
ret = kbase_mcu_shared_interface_region_tracker_init(kbdev);
if (ret != 0) {
- dev_err(kbdev->dev, "Failed to setup the rb tree for managing shared interface segment\n");
+ dev_err(kbdev->dev,
+ "Failed to setup the rb tree for managing shared interface segment\n");
goto error;
}
@@ -2081,7 +2094,7 @@ int kbase_csf_trigger_firmware_config_update(struct kbase_device *kbdev)
int err = 0;
/* Ensure GPU is powered-up until we complete config update.*/
- kbase_pm_context_active(kbdev);
+ kbase_csf_scheduler_pm_active(kbdev);
/* The 'reg_lock' is also taken and is held till the update is
* complete, to ensure the config update gets serialized.
@@ -2098,7 +2111,7 @@ int kbase_csf_trigger_firmware_config_update(struct kbase_device *kbdev)
GLB_REQ_FIRMWARE_CONFIG_UPDATE_MASK);
mutex_unlock(&kbdev->csf.reg_lock);
- kbase_pm_context_idle(kbdev);
+ kbase_csf_scheduler_pm_idle(kbdev);
return err;
}
diff --git a/mali_kbase/csf/mali_kbase_csf_firmware.h b/mali_kbase/csf/mali_kbase_csf_firmware.h
index 13ff701..a7e9fc2 100644
--- a/mali_kbase/csf/mali_kbase_csf_firmware.h
+++ b/mali_kbase/csf/mali_kbase_csf_firmware.h
@@ -79,7 +79,7 @@
#define MAX_SUPPORTED_STREAMS_PER_GROUP 32
/* Waiting timeout for status change acknowledgment, in milliseconds */
-#define CSF_FIRMWARE_TIMEOUT_MS (800) /* Relaxed to 800ms from 100ms */
+#define CSF_FIRMWARE_TIMEOUT_MS (3000) /* Relaxed to 3000ms from 800ms due to Android */
struct kbase_device;
@@ -266,7 +266,7 @@ u32 kbase_csf_firmware_csg_output(
* @group_stride: Stride in bytes in JASID0 virtual address between
* CSG capability structures.
* @prfcnt_size: Performance counters size.
- * @instr_features: Instrumentation features.
+ * @instr_features: Instrumentation features. (csf >= 1.1.0)
* @groups: Address of an array of CSG capability structures.
*/
struct kbase_csf_global_iface {
@@ -377,22 +377,30 @@ void kbase_csf_update_firmware_memory(struct kbase_device *kbdev,
u32 gpu_addr, u32 value);
/**
+ * kbase_csf_firmware_early_init() - Early initializatin for the firmware.
+ * @kbdev: Kbase device
+ *
+ * Initialize resources related to the firmware. Must be called at kbase probe.
+ *
+ * Return: 0 if successful, negative error code on failure
+ */
+int kbase_csf_firmware_early_init(struct kbase_device *kbdev);
+
+/**
* kbase_csf_firmware_init() - Load the firmware for the CSF MCU
+ * @kbdev: Kbase device
*
* Request the firmware from user space and load it into memory.
*
* Return: 0 if successful, negative error code on failure
- *
- * @kbdev: Kbase device
*/
int kbase_csf_firmware_init(struct kbase_device *kbdev);
/**
* kbase_csf_firmware_term() - Unload the firmware
+ * @kbdev: Kbase device
*
* Frees the memory allocated by kbase_csf_firmware_init()
- *
- * @kbdev: Kbase device
*/
void kbase_csf_firmware_term(struct kbase_device *kbdev);
@@ -443,12 +451,8 @@ void kbase_csf_enter_protected_mode(struct kbase_device *kbdev);
static inline bool kbase_csf_firmware_mcu_halted(struct kbase_device *kbdev)
{
-#ifndef CONFIG_MALI_NO_MALI
return (kbase_reg_read(kbdev, GPU_CONTROL_REG(MCU_STATUS)) ==
MCU_STATUS_HALTED);
-#else
- return true;
-#endif
}
/**
@@ -584,6 +588,7 @@ bool kbase_csf_firmware_core_attr_updated(struct kbase_device *kbdev);
* hardware performance counter data.
* @instr_features: Instrumentation features. Bits 7:4 hold the max size
* of events. Bits 3:0 hold the offset update rate.
+ * (csf >= 1,1,0)
*/
u32 kbase_csf_firmware_get_glb_iface(
struct kbase_device *kbdev, struct basep_cs_group_control *group_data,
diff --git a/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c b/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c
index a3901cd..df9d474 100644
--- a/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c
+++ b/mali_kbase/csf/mali_kbase_csf_firmware_no_mali.c
@@ -158,7 +158,7 @@ static int invent_memory_setup_entry(struct kbase_device *kbdev)
/* Allocate enough memory for the struct dummy_firmware_interface.
*/
- interface = kmalloc(sizeof(*interface), GFP_KERNEL);
+ interface = kzalloc(sizeof(*interface), GFP_KERNEL);
if (!interface)
return -ENOMEM;
@@ -237,8 +237,13 @@ static int invent_capabilities(struct kbase_device *kbdev)
iface->kbdev = kbdev;
iface->features = 0;
iface->prfcnt_size = 64;
- iface->instr_features =
- 0x81; /* update rate=1, max event size = 1<<8 = 256 */
+
+ if (iface->version >= kbase_csf_interface_version(1, 1, 0)) {
+ /* update rate=1, max event size = 1<<8 = 256 */
+ iface->instr_features = 0x81;
+ } else {
+ iface->instr_features = 0;
+ }
iface->group_num = ARRAY_SIZE(interface->csg);
iface->group_stride = 0;
@@ -375,6 +380,37 @@ u32 kbase_csf_firmware_csg_output(
return val;
}
+static void
+csf_firmware_prfcnt_process(const struct kbase_csf_global_iface *const iface,
+ const u32 glb_req)
+{
+ struct kbase_device *kbdev = iface->kbdev;
+ u32 glb_ack = output_page_read(iface->output, GLB_ACK);
+ /* If the value of GLB_REQ.PRFCNT_SAMPLE is different from the value of
+ * GLB_ACK.PRFCNT_SAMPLE, the CSF will sample the performance counters.
+ */
+ if ((glb_req ^ glb_ack) & GLB_REQ_PRFCNT_SAMPLE_MASK) {
+ /* NO_MALI only uses the first buffer in the ring buffer. */
+ input_page_write(iface->input, GLB_PRFCNT_EXTRACT, 0);
+ output_page_write(iface->output, GLB_PRFCNT_INSERT, 1);
+ kbase_reg_write(kbdev, GPU_COMMAND, GPU_COMMAND_PRFCNT_SAMPLE);
+ }
+
+ /* Propagate enable masks to model if request to enable. */
+ if (glb_req & GLB_REQ_PRFCNT_ENABLE_MASK) {
+ u32 tiler_en, l2_en, sc_en;
+
+ tiler_en = input_page_read(iface->input, GLB_PRFCNT_TILER_EN);
+ l2_en = input_page_read(iface->input, GLB_PRFCNT_MMU_L2_EN);
+ sc_en = input_page_read(iface->input, GLB_PRFCNT_SHADER_EN);
+
+ /* NO_MALI platform enabled all CSHW counters by default. */
+ kbase_reg_write(kbdev, PRFCNT_TILER_EN, tiler_en);
+ kbase_reg_write(kbdev, PRFCNT_MMU_L2_EN, l2_en);
+ kbase_reg_write(kbdev, PRFCNT_SHADER_EN, sc_en);
+ }
+}
+
void kbase_csf_firmware_global_input(
const struct kbase_csf_global_iface *const iface, const u32 offset,
const u32 value)
@@ -385,6 +421,7 @@ void kbase_csf_firmware_global_input(
input_page_write(iface->input, offset, value);
if (offset == GLB_REQ) {
+ csf_firmware_prfcnt_process(iface, value);
/* NO_MALI: Immediately acknowledge requests */
output_page_write(iface->output, GLB_ACK, value);
}
@@ -854,10 +891,30 @@ u32 kbase_csf_firmware_set_mcu_core_pwroff_time(struct kbase_device *kbdev, u32
return pwroff;
}
+int kbase_csf_firmware_early_init(struct kbase_device *kbdev)
+{
+ init_waitqueue_head(&kbdev->csf.event_wait);
+ kbdev->csf.interrupt_received = false;
+ kbdev->csf.fw_timeout_ms = CSF_FIRMWARE_TIMEOUT_MS;
+
+ INIT_LIST_HEAD(&kbdev->csf.firmware_interfaces);
+ INIT_LIST_HEAD(&kbdev->csf.firmware_config);
+ INIT_LIST_HEAD(&kbdev->csf.firmware_trace_buffers.list);
+ INIT_WORK(&kbdev->csf.firmware_reload_work,
+ kbase_csf_firmware_reload_worker);
+ INIT_WORK(&kbdev->csf.fw_error_work, firmware_error_worker);
+
+ mutex_init(&kbdev->csf.reg_lock);
+
+ return 0;
+}
+
int kbase_csf_firmware_init(struct kbase_device *kbdev)
{
int ret;
+ lockdep_assert_held(&kbdev->fw_load_lock);
+
if (WARN_ON((kbdev->as_free & MCU_AS_BITMASK) == 0))
return -EINVAL;
kbdev->as_free &= ~MCU_AS_BITMASK;
@@ -871,26 +928,14 @@ int kbase_csf_firmware_init(struct kbase_device *kbdev)
return ret;
}
- init_waitqueue_head(&kbdev->csf.event_wait);
- kbdev->csf.interrupt_received = false;
- kbdev->csf.fw_timeout_ms = CSF_FIRMWARE_TIMEOUT_MS;
-
- INIT_LIST_HEAD(&kbdev->csf.firmware_interfaces);
- INIT_LIST_HEAD(&kbdev->csf.firmware_config);
- INIT_LIST_HEAD(&kbdev->csf.firmware_trace_buffers.list);
- INIT_WORK(&kbdev->csf.firmware_reload_work,
- kbase_csf_firmware_reload_worker);
- INIT_WORK(&kbdev->csf.fw_error_work, firmware_error_worker);
-
- mutex_init(&kbdev->csf.reg_lock);
-
kbdev->csf.gpu_idle_hysteresis_ms = FIRMWARE_IDLE_HYSTERESIS_TIME_MS;
- kbdev->csf.gpu_idle_dur_count = convert_dur_to_idle_count(kbdev,
- FIRMWARE_IDLE_HYSTERESIS_TIME_MS);
+ kbdev->csf.gpu_idle_dur_count = convert_dur_to_idle_count(
+ kbdev, FIRMWARE_IDLE_HYSTERESIS_TIME_MS);
ret = kbase_mcu_shared_interface_region_tracker_init(kbdev);
if (ret != 0) {
- dev_err(kbdev->dev, "Failed to setup the rb tree for managing shared interface segment\n");
+ dev_err(kbdev->dev,
+ "Failed to setup the rb tree for managing shared interface segment\n");
goto error;
}
diff --git a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c
index 6c6d181..2c850af 100644
--- a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c
+++ b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h
index a39ee92..415e7f8 100644
--- a/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h
+++ b/mali_kbase/csf/mali_kbase_csf_heap_context_alloc.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu.c b/mali_kbase/csf/mali_kbase_csf_kcpu.c
index 1203d2c..47efefd 100644
--- a/mali_kbase/csf/mali_kbase_csf_kcpu.c
+++ b/mali_kbase/csf/mali_kbase_csf_kcpu.c
@@ -26,7 +26,7 @@
#include "mali_kbase_csf.h"
#include <linux/export.h>
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
#include "mali_kbase_fence.h"
#include "mali_kbase_sync.h"
@@ -758,9 +758,7 @@ static int kbase_kcpu_cqs_wait_process(struct kbase_device *kbdev,
KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_EXECUTE_CQS_WAIT_END(
kbdev, queue,
- queue->has_error ?
- evt[BASEP_EVENT_ERR_INDEX] :
- 0);
+ evt[BASEP_EVENT_ERR_INDEX]);
queue->command_started = false;
}
@@ -1170,7 +1168,7 @@ static int kbase_kcpu_cqs_set_operation_prepare(
return 0;
}
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
#if (KERNEL_VERSION(4, 10, 0) > LINUX_VERSION_CODE)
static void kbase_csf_fence_wait_callback(struct fence *fence,
struct fence_cb *cb)
@@ -1549,7 +1547,7 @@ static void kcpu_queue_process(struct kbase_kcpu_command_queue *queue,
}
status = 0;
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
if (ignore_waits) {
kbase_kcpu_fence_wait_cancel(queue,
&cmd->info.fence);
@@ -1582,7 +1580,7 @@ static void kcpu_queue_process(struct kbase_kcpu_command_queue *queue,
status = 0;
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
status = kbase_kcpu_fence_signal_process(
queue, &cmd->info.fence);
@@ -2021,7 +2019,7 @@ int kbase_csf_kcpu_queue_enqueue(struct kbase_context *kctx,
kcpu_cmd->enqueue_ts = kctx->csf.kcpu_queues.num_cmds;
switch (command.type) {
case BASE_KCPU_COMMAND_TYPE_FENCE_WAIT:
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
ret = kbase_kcpu_fence_wait_prepare(queue,
&command.info.fence, kcpu_cmd);
#else
@@ -2030,7 +2028,7 @@ int kbase_csf_kcpu_queue_enqueue(struct kbase_context *kctx,
#endif
break;
case BASE_KCPU_COMMAND_TYPE_FENCE_SIGNAL:
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
ret = kbase_kcpu_fence_signal_prepare(queue,
&command.info.fence, kcpu_cmd);
#else
@@ -2231,7 +2229,7 @@ int kbase_csf_kcpu_queue_new(struct kbase_context *kctx,
queue->kctx = kctx;
queue->start_offset = 0;
queue->num_pending_cmds = 0;
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
queue->fence_context = dma_fence_context_alloc(1);
queue->fence_seqno = 0;
queue->fence_wait_processed = false;
diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c
index d59e77c..557dabc 100644
--- a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c
+++ b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.c
@@ -23,11 +23,11 @@
#include <mali_kbase.h>
#include <linux/seq_file.h>
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
#include "mali_kbase_sync.h"
#endif
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbasep_csf_kcpu_debugfs_print_queue() - Print additional info for KCPU
@@ -89,7 +89,7 @@ static void kbasep_csf_kcpu_debugfs_print_queue(struct seq_file *file,
struct kbase_kcpu_command *cmd =
&queue->commands[queue->start_offset];
switch (cmd->type) {
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
case BASE_KCPU_COMMAND_TYPE_FENCE_WAIT:
{
struct kbase_sync_fence_info info;
diff --git a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h
index 58b8e34..8841073 100644
--- a/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h
+++ b/mali_kbase/csf/mali_kbase_csf_kcpu_debugfs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_protected_memory.c b/mali_kbase/csf/mali_kbase_csf_protected_memory.c
index 09e7271..f34e97c 100644
--- a/mali_kbase/csf/mali_kbase_csf_protected_memory.c
+++ b/mali_kbase/csf/mali_kbase_csf_protected_memory.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -22,7 +22,7 @@
#include "mali_kbase_csf_protected_memory.h"
#include <linux/protected_memory_allocator.h>
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
#include <linux/of_platform.h>
#endif
@@ -30,7 +30,7 @@ int kbase_csf_protected_memory_init(struct kbase_device *const kbdev)
{
int err = 0;
-#if CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
struct device_node *pma_node = of_parse_phandle(kbdev->dev->of_node,
"protected-memory-allocator", 0);
if (!pma_node) {
diff --git a/mali_kbase/csf/mali_kbase_csf_protected_memory.h b/mali_kbase/csf/mali_kbase_csf_protected_memory.h
index 95f507f..0d9da9e 100644
--- a/mali_kbase/csf/mali_kbase_csf_protected_memory.h
+++ b/mali_kbase/csf/mali_kbase_csf_protected_memory.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_scheduler.c b/mali_kbase/csf/mali_kbase_csf_scheduler.c
index 84d6f81..6e99946 100644
--- a/mali_kbase/csf/mali_kbase_csf_scheduler.c
+++ b/mali_kbase/csf/mali_kbase_csf_scheduler.c
@@ -25,8 +25,8 @@
#include <mali_kbase_reset_gpu.h>
#include <mali_kbase_as_fault_debugfs.h>
#include "mali_kbase_csf.h"
-#include "../tl/mali_kbase_tracepoints.h"
-#include "backend/gpu/mali_kbase_pm_internal.h"
+#include <tl/mali_kbase_tracepoints.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
#include <linux/export.h>
#include <uapi/gpu/arm/midgard/csf/mali_gpu_csf_registers.h>
#include <uapi/gpu/arm/midgard/mali_base_kernel.h>
@@ -307,7 +307,7 @@ static u32 get_nr_active_csgs(struct kbase_device *kbdev)
*
* Return: the interface is actively engaged flag.
*/
-bool csgs_active(struct kbase_device *kbdev)
+static bool csgs_active(struct kbase_device *kbdev)
{
u32 nr_active_csgs;
@@ -388,11 +388,17 @@ static void scheduler_wait_protm_quit(struct kbase_device *kbdev)
lockdep_assert_held(&scheduler->lock);
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_WAIT_PROTM_QUIT, NULL,
+ jiffies_to_msecs(wt));
+
remaining = wait_event_timeout(kbdev->csf.event_wait,
!kbase_csf_scheduler_protected_mode_in_use(kbdev), wt);
if (!remaining)
dev_warn(kbdev->dev, "Timeout, protm_quit wait skipped");
+
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_WAIT_PROTM_QUIT_DONE, NULL,
+ jiffies_to_msecs(remaining));
}
/**
@@ -514,7 +520,7 @@ static void scheduler_suspend(struct kbase_device *kbdev)
* This function is called to change the state of queue group to non-idle
* suspended state, if the group was suspended when all the queues bound to it
* became empty or when some queues got blocked on a sync wait & others became
- * empty. The group is also moved to the runnbale list from idle wait list in
+ * empty. The group is also moved to the runnable list from idle wait list in
* the latter case.
* So the function gets called when a queue is kicked or sync wait condition
* gets satisfied.
@@ -523,6 +529,7 @@ static void update_idle_suspended_group_state(struct kbase_queue_group *group)
{
struct kbase_csf_scheduler *scheduler =
&group->kctx->kbdev->csf.scheduler;
+ int new_val;
lockdep_assert_held(&scheduler->lock);
@@ -543,7 +550,9 @@ static void update_idle_suspended_group_state(struct kbase_queue_group *group)
} else
return;
- atomic_inc(&scheduler->non_idle_offslot_grps);
+ new_val = atomic_inc_return(&scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(group->kctx->kbdev, SCHEDULER_NONIDLE_OFFSLOT_INC,
+ group, new_val);
}
int kbase_csf_scheduler_group_get_slot_locked(struct kbase_queue_group *group)
@@ -898,16 +907,8 @@ int kbase_csf_scheduler_queue_stop(struct kbase_queue *queue)
static void update_hw_active(struct kbase_queue *queue, bool active)
{
-#ifdef CONFIG_MALI_NO_MALI
- if (queue && queue->enabled) {
- u32 *output_addr = (u32 *)(queue->user_io_addr + PAGE_SIZE);
-
- output_addr[CS_ACTIVE / sizeof(u32)] = active;
- }
-#else
CSTD_UNUSED(queue);
CSTD_UNUSED(active);
-#endif
}
static void program_cs_extract_init(struct kbase_queue *queue)
@@ -919,6 +920,50 @@ static void program_cs_extract_init(struct kbase_queue *queue)
output_addr[CS_EXTRACT_LO / sizeof(u64)];
}
+static void program_cs_trace_cfg(struct kbase_csf_cmd_stream_info *stream,
+ struct kbase_queue *queue)
+{
+ struct kbase_device *kbdev = queue->kctx->kbdev;
+ u32 const glb_version = kbdev->csf.global_iface.version;
+
+ lockdep_assert_held(&kbdev->csf.scheduler.lock);
+
+ /* If cs_trace_command not supported, nothing to program */
+ if (glb_version < kbase_csf_interface_version(1, 1, 0))
+ return;
+
+ /* Program for cs_trace if enabled. In the current arrangement, it is
+ * possible for the context to enable the cs_trace after some queues
+ * has been registered in cs_trace in disabled state. This is tracked by
+ * the queue's trace buffer base address, which had been validated at the
+ * queue's register_ex call.
+ */
+ if (kbase_csf_scheduler_queue_has_trace(queue)) {
+ u32 cs_cfg = CS_INSTR_CONFIG_JASID_SET(
+ queue->trace_cfg, queue->kctx->as_nr);
+
+ kbase_csf_firmware_cs_input(stream, CS_INSTR_CONFIG, cs_cfg);
+ kbase_csf_firmware_cs_input(stream, CS_INSTR_BUFFER_SIZE,
+ queue->trace_buffer_size);
+
+ kbase_csf_firmware_cs_input(stream, CS_INSTR_BUFFER_BASE_LO,
+ queue->trace_buffer_base & U32_MAX);
+ kbase_csf_firmware_cs_input(stream, CS_INSTR_BUFFER_BASE_HI,
+ queue->trace_buffer_base >> 32);
+
+ kbase_csf_firmware_cs_input(
+ stream, CS_INSTR_BUFFER_OFFSET_POINTER_LO,
+ queue->trace_offset_ptr & U32_MAX);
+ kbase_csf_firmware_cs_input(
+ stream, CS_INSTR_BUFFER_OFFSET_POINTER_HI,
+ queue->trace_offset_ptr >> 32);
+ } else {
+ /* Place the configuration to the disabled condition */
+ kbase_csf_firmware_cs_input(stream, CS_INSTR_CONFIG, 0);
+ kbase_csf_firmware_cs_input(stream, CS_INSTR_BUFFER_SIZE, 0);
+ }
+}
+
static void program_cs(struct kbase_device *kbdev,
struct kbase_queue *queue, bool ring_csg_doorbell)
{
@@ -976,6 +1021,9 @@ static void program_cs(struct kbase_device *kbdev,
kbase_csf_firmware_cs_input(stream, CS_CONFIG,
(queue->doorbell_nr << 8) | (queue->priority & 0xF));
+ /* Program the queue's cs_trace configuration */
+ program_cs_trace_cfg(stream, queue);
+
/* Enable all interrupts for now */
kbase_csf_firmware_cs_input(stream, CS_ACK_IRQ_MASK, ~((u32)0));
@@ -1016,7 +1064,10 @@ int kbase_csf_scheduler_queue_start(struct kbase_queue *queue)
mutex_lock(&kbdev->csf.scheduler.lock);
- KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_START, group, queue, group->run_state);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_START, group, queue,
+ group->run_state);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_SYNC_STATUS_WAIT, queue->group,
+ queue, queue->status_wait);
if (group->run_state == KBASE_CSF_GROUP_FAULT_EVICTED) {
err = -EIO;
@@ -1228,19 +1279,27 @@ static bool evaluate_sync_update(struct kbase_queue *queue)
bool updated = false;
u32 *sync_ptr;
u32 sync_wait_cond;
+ u32 sync_current_val;
+ struct kbase_device *kbdev;
if (WARN_ON(!queue))
return false;
- lockdep_assert_held(&queue->kctx->kbdev->csf.scheduler.lock);
+ kbdev = queue->kctx->kbdev;
+ lockdep_assert_held(&kbdev->csf.scheduler.lock);
sync_ptr = kbase_phy_alloc_mapping_get(queue->kctx, queue->sync_ptr,
&mapping);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_SYNC_UPDATE, queue->group,
+ queue, queue->sync_ptr);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_SYNC_BLOCKED_REASON,
+ queue->group, queue, queue->blocked_reason);
+
if (!sync_ptr) {
dev_dbg(queue->kctx->kbdev->dev, "sync memory VA 0x%016llX already freed",
queue->sync_ptr);
- return false;
+ goto out;
}
sync_wait_cond =
@@ -1249,21 +1308,30 @@ static bool evaluate_sync_update(struct kbase_queue *queue)
WARN_ON((sync_wait_cond != CS_STATUS_WAIT_SYNC_WAIT_CONDITION_GT) &&
(sync_wait_cond != CS_STATUS_WAIT_SYNC_WAIT_CONDITION_LE));
+ sync_current_val = READ_ONCE(*sync_ptr);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_SYNC_CURRENT_VAL, queue->group,
+ queue, sync_current_val);
+
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_SYNC_TEST_VAL, queue->group,
+ queue, queue->sync_value);
+
if (((sync_wait_cond == CS_STATUS_WAIT_SYNC_WAIT_CONDITION_GT) &&
- (*sync_ptr > queue->sync_value)) ||
+ (sync_current_val > queue->sync_value)) ||
((sync_wait_cond == CS_STATUS_WAIT_SYNC_WAIT_CONDITION_LE) &&
- (*sync_ptr <= queue->sync_value))) {
+ (sync_current_val <= queue->sync_value))) {
/* The sync wait condition is satisfied so the group to which
* queue is bound can be re-scheduled.
*/
updated = true;
} else {
- dev_dbg(queue->kctx->kbdev->dev, "sync memory not updated yet(%u)",
- *sync_ptr);
+ dev_dbg(queue->kctx->kbdev->dev,
+ "sync memory not updated yet(%u)", sync_current_val);
}
kbase_phy_alloc_mapping_put(queue->kctx, mapping);
-
+out:
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_SYNC_UPDATE_EVALUATED,
+ queue->group, queue, updated);
return updated;
}
@@ -1290,6 +1358,9 @@ bool save_slot_cs(struct kbase_csf_cmd_stream_group_info const *const ginfo,
u32 status = kbase_csf_firmware_cs_output(stream, CS_STATUS_WAIT);
bool is_waiting = false;
+ KBASE_KTRACE_ADD_CSF_GRP_Q(stream->kbdev, QUEUE_SYNC_STATUS_WAIT,
+ queue->group, queue, status);
+
if (CS_STATUS_WAIT_SYNC_WAIT_GET(status)) {
queue->status_wait = status;
queue->sync_ptr = kbase_csf_firmware_cs_output(stream,
@@ -1408,11 +1479,15 @@ void insert_group_to_runnable(struct kbase_csf_scheduler *const scheduler,
list_add_tail(&group->link,
&kctx->csf.sched.runnable_groups[group->priority]);
kctx->csf.sched.num_runnable_grps++;
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, GROUP_INSERT_RUNNABLE, group,
+ kctx->csf.sched.num_runnable_grps);
+
/* Add the kctx if not yet in runnable kctxs */
if (kctx->csf.sched.num_runnable_grps == 1) {
/* First runnable csg, adds to the runnable_kctxs */
INIT_LIST_HEAD(&kctx->csf.link);
list_add_tail(&kctx->csf.link, &scheduler->runnable_kctxs);
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_INSERT_RUNNABLE, kctx, 0u);
}
scheduler->total_runnable_grps++;
@@ -1438,6 +1513,9 @@ void remove_group_from_runnable(struct kbase_csf_scheduler *const scheduler,
enum kbase_csf_group_state run_state)
{
struct kbase_context *kctx = group->kctx;
+ struct kbase_queue_group *new_head_grp;
+ struct list_head *list =
+ &kctx->csf.sched.runnable_groups[group->priority];
lockdep_assert_held(&scheduler->lock);
@@ -1470,11 +1548,28 @@ void remove_group_from_runnable(struct kbase_csf_scheduler *const scheduler,
}
kctx->csf.sched.num_runnable_grps--;
+ KBASE_KTRACE_ADD_CSF_GRP(kctx->kbdev, GROUP_REMOVE_RUNNABLE, group,
+ kctx->csf.sched.num_runnable_grps);
+ new_head_grp = (!list_empty(list)) ?
+ list_first_entry(list, struct kbase_queue_group, link) :
+ NULL;
+ KBASE_KTRACE_ADD_CSF_GRP(kctx->kbdev, GROUP_HEAD_RUNNABLE, new_head_grp,
+ 0u);
+
if (kctx->csf.sched.num_runnable_grps == 0) {
+ struct kbase_context *new_head_kctx;
+ struct list_head *kctx_list = &scheduler->runnable_kctxs;
/* drop the kctx */
list_del_init(&kctx->csf.link);
if (scheduler->top_ctx == kctx)
scheduler->top_ctx = NULL;
+ KBASE_KTRACE_ADD(kctx->kbdev, SCHEDULER_REMOVE_RUNNABLE, kctx,
+ 0u);
+ new_head_kctx = (!list_empty(kctx_list)) ?
+ list_first_entry(kctx_list, struct kbase_context, csf.link) :
+ NULL;
+ KBASE_KTRACE_ADD(kctx->kbdev, SCHEDULER_HEAD_RUNNABLE,
+ new_head_kctx, 0u);
}
WARN_ON(scheduler->total_runnable_grps == 0);
@@ -1501,6 +1596,8 @@ static void insert_group_to_idle_wait(struct kbase_queue_group *const group)
list_add_tail(&group->link, &kctx->csf.sched.idle_wait_groups);
kctx->csf.sched.num_idle_wait_grps++;
+ KBASE_KTRACE_ADD_CSF_GRP(kctx->kbdev, GROUP_INSERT_IDLE_WAIT, group,
+ kctx->csf.sched.num_idle_wait_grps);
group->run_state = KBASE_CSF_GROUP_SUSPENDED_ON_WAIT_SYNC;
dev_dbg(kctx->kbdev->dev,
"Group-%d suspended on sync_wait, total wait_groups: %u\n",
@@ -1510,6 +1607,8 @@ static void insert_group_to_idle_wait(struct kbase_queue_group *const group)
static void remove_group_from_idle_wait(struct kbase_queue_group *const group)
{
struct kbase_context *kctx = group->kctx;
+ struct list_head *list = &kctx->csf.sched.idle_wait_groups;
+ struct kbase_queue_group *new_head_grp;
lockdep_assert_held(&kctx->kbdev->csf.scheduler.lock);
@@ -1518,6 +1617,13 @@ static void remove_group_from_idle_wait(struct kbase_queue_group *const group)
list_del_init(&group->link);
WARN_ON(kctx->csf.sched.num_idle_wait_grps == 0);
kctx->csf.sched.num_idle_wait_grps--;
+ KBASE_KTRACE_ADD_CSF_GRP(kctx->kbdev, GROUP_REMOVE_IDLE_WAIT, group,
+ kctx->csf.sched.num_idle_wait_grps);
+ new_head_grp = (!list_empty(list)) ?
+ list_first_entry(list, struct kbase_queue_group, link) :
+ NULL;
+ KBASE_KTRACE_ADD_CSF_GRP(kctx->kbdev, GROUP_HEAD_IDLE_WAIT,
+ new_head_grp, 0u);
group->run_state = KBASE_CSF_GROUP_INACTIVE;
}
@@ -1540,8 +1646,12 @@ static void update_offslot_non_idle_cnt_for_faulty_grp(struct kbase_queue_group
lockdep_assert_held(&scheduler->lock);
- if (group->prepared_seq_num < scheduler->non_idle_scanout_grps)
- atomic_dec(&scheduler->non_idle_offslot_grps);
+ if (group->prepared_seq_num < scheduler->non_idle_scanout_grps) {
+ int new_val =
+ atomic_dec_return(&scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_DEC,
+ group, new_val);
+ }
}
static void update_offslot_non_idle_cnt_for_onslot_grp(struct kbase_queue_group *group)
@@ -1553,8 +1663,12 @@ static void update_offslot_non_idle_cnt_for_onslot_grp(struct kbase_queue_group
WARN_ON(group->csg_nr < 0);
- if (group->prepared_seq_num < scheduler->non_idle_scanout_grps)
- atomic_dec(&scheduler->non_idle_offslot_grps);
+ if (group->prepared_seq_num < scheduler->non_idle_scanout_grps) {
+ int new_val =
+ atomic_dec_return(&scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_DEC,
+ group, new_val);
+ }
}
static void update_offslot_non_idle_cnt_on_grp_suspend(
@@ -1570,16 +1684,28 @@ static void update_offslot_non_idle_cnt_on_grp_suspend(
if (group->prepared_seq_num >=
scheduler->non_idle_scanout_grps) {
/* At scanout, it was tagged as on-slot idle */
- if (group->run_state == KBASE_CSF_GROUP_SUSPENDED)
- atomic_inc(&scheduler->non_idle_offslot_grps);
+ if (group->run_state == KBASE_CSF_GROUP_SUSPENDED) {
+ int new_val = atomic_inc_return(
+ &scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_INC,
+ group, new_val);
+ }
} else {
- if (group->run_state != KBASE_CSF_GROUP_SUSPENDED)
- atomic_dec(&scheduler->non_idle_offslot_grps);
+ if (group->run_state != KBASE_CSF_GROUP_SUSPENDED) {
+ int new_val = atomic_dec_return(
+ &scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_DEC,
+ group, new_val);
+ }
}
} else {
/* async phases */
- if (group->run_state == KBASE_CSF_GROUP_SUSPENDED)
- atomic_inc(&scheduler->non_idle_offslot_grps);
+ if (group->run_state == KBASE_CSF_GROUP_SUSPENDED) {
+ int new_val = atomic_inc_return(
+ &scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_INC,
+ group, new_val);
+ }
}
}
@@ -1641,11 +1767,6 @@ static void save_csg_slot(struct kbase_queue_group *group)
bool sync_wait = false;
bool idle = kbase_csf_firmware_csg_output(ginfo, CSG_STATUS_STATE) &
CSG_STATUS_STATE_IDLE_MASK;
-
-#ifdef CONFIG_MALI_NO_MALI
- for (i = 0; i < max_streams; i++)
- update_hw_active(group->bound_queues[i], false);
-#endif
for (i = 0; idle && i < max_streams; i++) {
struct kbase_queue *const queue =
group->bound_queues[i];
@@ -1745,8 +1866,11 @@ static bool cleanup_csg_slot(struct kbase_queue_group *group)
/* now marking the slot is vacant */
spin_lock_irqsave(&kbdev->csf.scheduler.interrupt_lock, flags);
kbdev->csf.scheduler.csg_slots[slot].resident_group = NULL;
- group->csg_nr = KBASEP_CSG_NR_INVALID;
clear_bit(slot, kbdev->csf.scheduler.csg_slots_idle_mask);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_SLOT_IDLE_CLEAR, group,
+ kbdev->csf.scheduler.csg_slots_idle_mask[0]);
+
+ group->csg_nr = KBASEP_CSG_NR_INVALID;
set_bit(slot, kbdev->csf.scheduler.csgs_events_enable_mask);
clear_bit(slot, kbdev->csf.scheduler.csg_inuse_bitmap);
spin_unlock_irqrestore(&kbdev->csf.scheduler.interrupt_lock, flags);
@@ -2001,8 +2125,12 @@ static void sched_evict_group(struct kbase_queue_group *group, bool fault,
if (update_non_idle_offslot_grps_cnt &&
(group->run_state == KBASE_CSF_GROUP_SUSPENDED ||
- group->run_state == KBASE_CSF_GROUP_RUNNABLE))
- atomic_dec(&scheduler->non_idle_offslot_grps);
+ group->run_state == KBASE_CSF_GROUP_RUNNABLE)) {
+ int new_val = atomic_dec_return(
+ &scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_DEC,
+ group, new_val);
+ }
for (i = 0; i < MAX_SUPPORTED_STREAMS_PER_GROUP; i++) {
if (group->bound_queues[i])
@@ -2047,8 +2175,9 @@ static int term_group_sync(struct kbase_queue_group *group)
csg_slot_stopped_locked(kbdev, group->csg_nr), remaining);
if (!remaining) {
- dev_warn(kbdev->dev, "term request timed out for group %d on slot %d",
- group->handle, group->csg_nr);
+ dev_warn(kbdev->dev, "term request timed out for group %d of context %d_%d on slot %d",
+ group->handle, group->kctx->tgid,
+ group->kctx->id, group->csg_nr);
if (kbase_prepare_to_reset_gpu(kbdev, RESET_FLAGS_NONE))
kbase_reset_gpu(kbdev);
err = -ETIMEDOUT;
@@ -2147,9 +2276,12 @@ static int scheduler_group_schedule(struct kbase_queue_group *group)
*/
spin_lock_irqsave(&scheduler->interrupt_lock, flags);
protm_grp = scheduler->active_protm_grp;
- if (protm_grp && protm_grp != group)
+ if (protm_grp && protm_grp != group) {
clear_bit((unsigned int)group->csg_nr,
scheduler->csg_slots_idle_mask);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_SLOT_IDLE_CLEAR, group,
+ scheduler->csg_slots_idle_mask[0]);
+ }
spin_unlock_irqrestore(&scheduler->interrupt_lock,
flags);
@@ -2166,10 +2298,14 @@ static int scheduler_group_schedule(struct kbase_queue_group *group)
}
}
} else if (!queue_group_scheduled_locked(group)) {
+ int new_val;
insert_group_to_runnable(&kbdev->csf.scheduler, group,
KBASE_CSF_GROUP_RUNNABLE);
/* A new group into the scheduler */
- atomic_inc(&kbdev->csf.scheduler.non_idle_offslot_grps);
+ new_val = atomic_inc_return(
+ &kbdev->csf.scheduler.non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_INC,
+ group, new_val);
}
/* Since a group has become active now, check if GPU needs to be
@@ -2224,13 +2360,12 @@ static inline void count_active_address_space(struct kbase_device *kbdev,
kbdev->nr_hw_address_spaces - NUM_RESERVED_AS_SLOTS;
if (scheduler->ngrp_to_schedule <= total_csg_slots) {
- if (kctx->csf.sched.ngrp_to_schedule == 1) {
+ if (kctx->csf.sched.ngrp_to_schedule == 1)
scheduler->num_active_address_spaces++;
- if (scheduler->num_active_address_spaces <=
- max_address_space_slots)
- scheduler->num_csg_slots_for_tick++;
- }
+ if (scheduler->num_active_address_spaces <=
+ max_address_space_slots)
+ scheduler->num_csg_slots_for_tick++;
}
}
@@ -2549,8 +2684,9 @@ static void program_suspending_csg_slots(struct kbase_device *kbdev)
*/
dev_warn(
kbdev->dev,
- "Group %pK on slot %u failed to suspend\n",
- (void *)group, i);
+ "Group %d of context %d_%d on slot %u failed to suspend",
+ group->handle, group->kctx->tgid,
+ group->kctx->id, i);
/* The group has failed suspension, stop
* further examination.
@@ -2878,6 +3014,8 @@ static bool scheduler_slot_protm_ack(struct kbase_device *const kbdev,
struct kbase_queue *queue = group->bound_queues[i];
clear_bit(i, group->protm_pending_bitmap);
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, PROTM_PENDING_CLEAR, group,
+ queue, group->protm_pending_bitmap[0]);
if (!WARN_ON(!queue) && queue->enabled) {
struct kbase_csf_cmd_stream_info *stream =
@@ -2889,6 +3027,9 @@ static bool scheduler_slot_protm_ack(struct kbase_device *const kbdev,
stream, CS_REQ) &
CS_REQ_PROTM_PEND_MASK;
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, CSI_PROTM_ACK, group,
+ queue, cs_protm_ack ^ cs_protm_req);
+
if (cs_protm_ack == cs_protm_req) {
dev_dbg(kbdev->dev,
"PROTM-ack already done for queue-%d group-%d slot-%d",
@@ -2928,11 +3069,16 @@ static void scheduler_group_check_protm_enter(struct kbase_device *const kbdev,
{
struct kbase_csf_scheduler *scheduler = &kbdev->csf.scheduler;
unsigned long flags;
+ bool protm_in_use;
lockdep_assert_held(&scheduler->lock);
spin_lock_irqsave(&scheduler->interrupt_lock, flags);
+ protm_in_use = kbase_csf_scheduler_protected_mode_in_use(kbdev);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_CHECK_PROTM_ENTER, input_grp,
+ protm_in_use);
+
/* Firmware samples the PROTM_PEND ACK bit for CSs when
* Host sends PROTM_ENTER global request. So if PROTM_PEND ACK bit
* is set for a CS after Host has sent the PROTM_ENTER
@@ -2951,40 +3097,35 @@ static void scheduler_group_check_protm_enter(struct kbase_device *const kbdev,
* be replacement, and that it is currently in a stable state (i.e. the
* slot state is running).
*/
- if (!kbase_csf_scheduler_protected_mode_in_use(kbdev)) {
- if (!WARN_ON(!input_grp)) {
- const int slot =
- kbase_csf_scheduler_group_get_slot_locked(
- input_grp);
-
- /* check the input_grp is running and requesting
- * protected mode
- */
- if (slot >= 0 &&
- atomic_read(
- &scheduler->csg_slots[slot].state) ==
- CSG_SLOT_RUNNING) {
- if (kctx_as_enabled(input_grp->kctx) &&
- scheduler_slot_protm_ack(kbdev,
- input_grp, slot)) {
- /* Option of acknowledging to multiple
- * CSGs from the same kctx is dropped,
- * after consulting with the
- * architecture team. See the comment in
- * GPUCORE-21394.
- */
+ if (!protm_in_use && !WARN_ON(!input_grp)) {
+ const int slot =
+ kbase_csf_scheduler_group_get_slot_locked(input_grp);
- /* Disable the idle timer */
- disable_gpu_idle_fw_timer_locked(kbdev);
+ /* check the input_grp is running and requesting protected mode
+ */
+ if (slot >= 0 &&
+ atomic_read(&scheduler->csg_slots[slot].state) ==
+ CSG_SLOT_RUNNING) {
+ if (kctx_as_enabled(input_grp->kctx) &&
+ scheduler_slot_protm_ack(kbdev, input_grp, slot)) {
+ /* Option of acknowledging to multiple
+ * CSGs from the same kctx is dropped,
+ * after consulting with the
+ * architecture team. See the comment in
+ * GPUCORE-21394.
+ */
- /* Switch to protected mode */
- scheduler->active_protm_grp = input_grp;
- KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_ENTER_PROTM, input_grp, 0u);
+ /* Disable the idle timer */
+ disable_gpu_idle_fw_timer_locked(kbdev);
- spin_unlock_irqrestore(&scheduler->interrupt_lock, flags);
- kbase_csf_enter_protected_mode(kbdev);
- return;
- }
+ /* Switch to protected mode */
+ scheduler->active_protm_grp = input_grp;
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_ENTER_PROTM,
+ input_grp, 0u);
+
+ spin_unlock_irqrestore(&scheduler->interrupt_lock, flags);
+ kbase_csf_enter_protected_mode(kbdev);
+ return;
}
}
}
@@ -3175,7 +3316,15 @@ static void scheduler_rotate_groups(struct kbase_device *kbdev)
WARN_ON(top_grp->kctx != top_ctx);
if (!WARN_ON(list_empty(list))) {
+ struct kbase_queue_group *new_head_grp;
list_move_tail(&top_grp->link, list);
+ new_head_grp = (!list_empty(list)) ?
+ list_first_entry(list, struct kbase_queue_group, link) :
+ NULL;
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, GROUP_ROTATE_RUNNABLE,
+ top_grp, top_ctx->csf.sched.num_runnable_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, GROUP_HEAD_RUNNABLE,
+ new_head_grp, 0u);
dev_dbg(kbdev->dev,
"groups rotated for a context, num_runnable_groups: %u\n",
scheduler->top_ctx->csf.sched.num_runnable_grps);
@@ -3203,7 +3352,15 @@ static void scheduler_rotate_ctxs(struct kbase_device *kbdev)
}
if (!WARN_ON(!found)) {
+ struct kbase_context *new_head_kctx;
list_move_tail(&pos->csf.link, list);
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_ROTATE_RUNNABLE, pos,
+ 0u);
+ new_head_kctx = (!list_empty(list)) ?
+ list_first_entry(list, struct kbase_context, csf.link) :
+ NULL;
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_HEAD_RUNNABLE,
+ new_head_kctx, 0u);
dev_dbg(kbdev->dev, "contexts rotated\n");
}
}
@@ -3247,10 +3404,14 @@ static void scheduler_update_idle_slots_status(struct kbase_device *kbdev,
u32 csg_req;
clear_bit(i, scheduler->csg_slots_idle_mask);
-
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_SLOT_IDLE_CLEAR, group,
+ scheduler->csg_slots_idle_mask[0]);
if (WARN_ON(!group))
continue;
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_SLOT_STATUS_UPDATE, group,
+ i);
+
csg_req = kbase_csf_firmware_csg_output(ginfo, CSG_ACK);
csg_req ^= CSG_REQ_STATUS_UPDATE_MASK;
kbase_csf_firmware_csg_input_mask(ginfo, CSG_REQ, csg_req,
@@ -3279,6 +3440,8 @@ static void scheduler_update_idle_slots_status(struct kbase_device *kbdev,
bitmap_copy(failed_csg_bitmap, csg_bitmap, num_groups);
csg_bitmap[0] = ~csg_bitmap[0] & db_slots;
} else {
+ KBASE_KTRACE_ADD(kbdev, SLOTS_STATUS_UPDATE_ACK, NULL,
+ db_slots);
csg_bitmap[0] = db_slots;
}
}
@@ -3336,6 +3499,8 @@ static void scheduler_handle_idle_slots(struct kbase_device *kbdev)
if (group_on_slot_is_idle(kbdev, i)) {
group->run_state = KBASE_CSF_GROUP_IDLE;
set_bit(i, scheduler->csg_slots_idle_mask);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_SLOT_IDLE_SET,
+ group, scheduler->csg_slots_idle_mask[0]);
} else
group->run_state = KBASE_CSF_GROUP_RUNNABLE;
}
@@ -3343,6 +3508,8 @@ static void scheduler_handle_idle_slots(struct kbase_device *kbdev)
bitmap_or(scheduler->csg_slots_idle_mask,
scheduler->csg_slots_idle_mask,
failed_csg_bitmap, num_groups);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, CSG_SLOT_IDLE_SET, NULL,
+ scheduler->csg_slots_idle_mask[0]);
spin_unlock_irqrestore(&scheduler->interrupt_lock, flags);
}
@@ -3477,20 +3644,32 @@ static void gpu_idle_worker(struct work_struct *work)
struct kbase_device *kbdev = container_of(
work, struct kbase_device, csf.scheduler.gpu_idle_work);
struct kbase_csf_scheduler *const scheduler = &kbdev->csf.scheduler;
+ bool reset_active = false;
+ bool scheduler_is_idle_suspendable = false;
+ bool all_groups_suspended = false;
+
+ KBASE_KTRACE_ADD(kbdev, IDLE_WORKER_BEGIN, NULL, 0u);
+
+#define __ENCODE_KTRACE_INFO(reset, idle, all_suspend) \
+ (((u32)reset) | (((u32)idle) << 4) | (((u32)all_suspend) << 8))
if (kbase_reset_gpu_try_prevent(kbdev)) {
dev_warn(kbdev->dev, "Quit idle for failing to prevent gpu reset.\n");
+ KBASE_KTRACE_ADD(kbdev, IDLE_WORKER_END, NULL,
+ __ENCODE_KTRACE_INFO(true, false, false));
return;
}
mutex_lock(&scheduler->lock);
/* Cycle completed, disable the firmware idle timer */
disable_gpu_idle_fw_timer(kbdev);
- if (scheduler_idle_suspendable(kbdev) &&
- !kbase_reset_gpu_is_active(kbdev)) {
- int ret = suspend_active_groups_on_powerdown(kbdev, false);
+ scheduler_is_idle_suspendable = scheduler_idle_suspendable(kbdev);
+ reset_active = kbase_reset_gpu_is_active(kbdev);
+ if (scheduler_is_idle_suspendable && !reset_active) {
+ all_groups_suspended =
+ !suspend_active_groups_on_powerdown(kbdev, false);
- if (!ret) {
+ if (all_groups_suspended) {
dev_dbg(kbdev->dev, "Scheduler becomes idle suspended now");
scheduler_suspend(kbdev);
cancel_tick_timer(kbdev);
@@ -3504,6 +3683,9 @@ static void gpu_idle_worker(struct work_struct *work)
mutex_unlock(&scheduler->lock);
kbase_reset_gpu_allow(kbdev);
+ KBASE_KTRACE_ADD(kbdev, IDLE_WORKER_END, NULL,
+ __ENCODE_KTRACE_INFO(reset_active, scheduler_is_idle_suspendable, all_groups_suspended));
+#undef __ENCODE_KTRACE_INFO
}
static int scheduler_prepare(struct kbase_device *kbdev)
@@ -3552,6 +3734,8 @@ static int scheduler_prepare(struct kbase_device *kbdev)
*/
atomic_set(&scheduler->non_idle_offslot_grps,
scheduler->non_idle_scanout_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_INC, NULL,
+ scheduler->non_idle_scanout_grps);
/* Adds those idle but runnable groups to the scanout list */
scheduler_scan_idle_groups(kbdev);
@@ -3634,9 +3818,12 @@ static void schedule_actions(struct kbase_device *kbdev)
* queue jobs.
*/
if (protm_grp && scheduler->top_grp == protm_grp) {
+ int new_val;
dev_dbg(kbdev->dev, "Scheduler keep protm exec: group-%d",
protm_grp->handle);
- atomic_dec(&scheduler->non_idle_offslot_grps);
+ new_val = atomic_dec_return(&scheduler->non_idle_offslot_grps);
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_NONIDLE_OFFSLOT_DEC,
+ protm_grp, new_val);
} else if (scheduler->top_grp) {
if (protm_grp)
dev_dbg(kbdev->dev, "Scheduler drop protm exec: group-%d",
@@ -3725,6 +3912,7 @@ static void schedule_on_tock(struct work_struct *work)
dev_dbg(kbdev->dev,
"Waking up for event after schedule-on-tock completes.");
wake_up_all(&kbdev->csf.event_wait);
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_TOCK_END, NULL, 0u);
return;
exit_no_schedule_unlock:
@@ -3756,7 +3944,8 @@ static void schedule_on_tick(struct work_struct *work)
scheduler_rotate(kbdev);
/* Undertaking schedule action steps */
- KBASE_KTRACE_ADD(kbdev, SCHEDULER_TICK, NULL, 0u);
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_TICK, NULL,
+ scheduler->total_runnable_grps);
schedule_actions(kbdev);
/* Record time information */
@@ -3777,6 +3966,8 @@ static void schedule_on_tick(struct work_struct *work)
dev_dbg(kbdev->dev, "Waking up for event after schedule-on-tick completes.");
wake_up_all(&kbdev->csf.event_wait);
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_TICK_END, NULL,
+ scheduler->total_runnable_grps);
return;
exit_no_schedule_unlock:
@@ -3784,7 +3975,7 @@ exit_no_schedule_unlock:
kbase_reset_gpu_allow(kbdev);
}
-int wait_csg_slots_suspend(struct kbase_device *kbdev,
+static int wait_csg_slots_suspend(struct kbase_device *kbdev,
const unsigned long *slot_mask,
unsigned int timeout_ms)
{
@@ -3926,6 +4117,9 @@ static void scheduler_inner_reset(struct kbase_device *kbdev)
spin_lock_irqsave(&scheduler->interrupt_lock, flags);
bitmap_fill(scheduler->csgs_events_enable_mask, MAX_SUPPORTED_CSGS);
+ if (scheduler->active_protm_grp)
+ KBASE_KTRACE_ADD_CSF_GRP(kbdev, SCHEDULER_EXIT_PROTM,
+ scheduler->active_protm_grp, 0u);
scheduler->active_protm_grp = NULL;
memset(kbdev->csf.scheduler.csg_slots, 0,
num_groups * sizeof(struct kbase_csf_csg_slot));
@@ -4194,20 +4388,24 @@ static bool group_sync_updated(struct kbase_queue_group *group)
* This function is called outside the scheduling tick/tock to determine
* if the given GPU queue group can now execute in protected mode or not.
* If the group pointer passed is NULL then the evaluation is done for the
- * scheduler->top_grp (or the second top-group).
+ * highest priority group on the scheduler maintained group lists without
+ * tick associated rotation actions. This is referred as the 'top-group'
+ * in a tock action sense.
*
* It returns the same group pointer, that was passed as an argument, if that
- * group matches the scheduler->top_grp and has pending protected region
+ * group matches the highest priority group and has pending protected region
* requests otherwise NULL is returned.
*
- * If the group pointer passed is NULL then the pointer to scheduler->top_grp
- * is returned if that has pending protected region requests otherwise NULL is
- * returned.
+ * If the group pointer passed is NULL then the internal evaluated highest
+ * priority group is returned if that has pending protected region requests
+ * otherwise NULL is returned.
*
- * If the scheduler->top_grp is NULL, which may happen when the top-group is
- * evicted during the tick, the second top-group (as a replacement of the
- * top-group) is used for the match check and also for the evaluation of
- * pending protected region requests if the group pointer passed is NULL.
+ * The evaluated highest priority group may not necessarily be the same as the
+ * scheduler->top_grp. This can happen if there is dynamic de-idle update
+ * during the tick interval for some on-slots groups that were idle during the
+ * scheduler normal scheduling action, where the scheduler->top_grp was set.
+ * The recorded scheduler->top_grp is untouched by this evualuation, so will not
+ * affect the scheduler context/priority list rotation arrangement.
*
* Return: the pointer to queue group that can currently execute in protected
* mode or NULL.
@@ -4224,8 +4422,7 @@ static struct kbase_queue_group *scheduler_get_protm_enter_async_group(
if (scheduler->state != SCHED_INACTIVE)
return NULL;
- match_grp = scheduler->top_grp ? scheduler->top_grp :
- get_tock_top_group(scheduler);
+ match_grp = get_tock_top_group(scheduler);
input_grp = group ? group : match_grp;
if (input_grp && (input_grp == match_grp)) {
@@ -4308,6 +4505,9 @@ static bool check_sync_update_for_idle_group_protm(
stream, CS_STATUS_WAIT);
unsigned long flags;
+ KBASE_KTRACE_ADD_CSF_GRP_Q(kbdev, QUEUE_SYNC_STATUS_WAIT,
+ queue->group, queue, status);
+
if (!CS_STATUS_WAIT_SYNC_WAIT_GET(status))
continue;
@@ -4323,17 +4523,32 @@ static bool check_sync_update_for_idle_group_protm(
stream, CS_STATUS_WAIT_SYNC_POINTER_HI) << 32;
queue->sync_value = kbase_csf_firmware_cs_output(
stream, CS_STATUS_WAIT_SYNC_VALUE);
+ queue->blocked_reason =
+ CS_STATUS_BLOCKED_REASON_REASON_GET(
+ kbase_csf_firmware_cs_output(
+ stream,
+ CS_STATUS_BLOCKED_REASON));
if (!evaluate_sync_update(queue))
continue;
/* Update csg_slots_idle_mask and group's run_state */
- spin_lock_irqsave(&scheduler->interrupt_lock, flags);
- clear_bit((unsigned int)group->csg_nr,
- scheduler->csg_slots_idle_mask);
- spin_unlock_irqrestore(&scheduler->interrupt_lock,
- flags);
- group->run_state = KBASE_CSF_GROUP_RUNNABLE;
+ if (group->run_state != KBASE_CSF_GROUP_RUNNABLE) {
+ /* Only clear the group's idle flag if it has been dealt
+ * with by the scheduler's tick/tock action, otherwise
+ * leave it untouched.
+ */
+ spin_lock_irqsave(&scheduler->interrupt_lock,
+ flags);
+ clear_bit((unsigned int)group->csg_nr,
+ scheduler->csg_slots_idle_mask);
+ KBASE_KTRACE_ADD_CSF_GRP(
+ kbdev, CSG_SLOT_IDLE_CLEAR, group,
+ scheduler->csg_slots_idle_mask[0]);
+ spin_unlock_irqrestore(
+ &scheduler->interrupt_lock, flags);
+ group->run_state = KBASE_CSF_GROUP_RUNNABLE;
+ }
KBASE_KTRACE_ADD_CSF_GRP(kbdev, GROUP_SYNC_UPDATE_DONE, group, 0u);
sync_update_done = true;
@@ -4419,6 +4634,7 @@ static void check_group_sync_update_worker(struct work_struct *work)
mutex_lock(&scheduler->lock);
+ KBASE_KTRACE_ADD(kbdev, GROUP_SYNC_UPDATE_WORKER_BEGIN, kctx, 0u);
if (kctx->csf.sched.num_idle_wait_grps != 0) {
struct kbase_queue_group *group, *temp;
@@ -4438,6 +4654,7 @@ static void check_group_sync_update_worker(struct work_struct *work)
if (check_sync_update_for_idle_groups_protm(kbdev))
scheduler_force_protm_exit(kbdev);
+ KBASE_KTRACE_ADD(kbdev, GROUP_SYNC_UPDATE_WORKER_END, kctx, 0u);
mutex_unlock(&scheduler->lock);
}
@@ -4515,15 +4732,18 @@ int kbase_csf_scheduler_init(struct kbase_device *kbdev)
return -ENOMEM;
}
+ return 0;
+}
+
+int kbase_csf_scheduler_early_init(struct kbase_device *kbdev)
+{
+ struct kbase_csf_scheduler *scheduler = &kbdev->csf.scheduler;
+
scheduler->timer_enabled = true;
scheduler->wq = alloc_ordered_workqueue("csf_scheduler_wq", WQ_HIGHPRI);
if (!scheduler->wq) {
dev_err(kbdev->dev, "Failed to allocate scheduler workqueue\n");
-
- kfree(scheduler->csg_slots);
- scheduler->csg_slots = NULL;
-
return -ENOMEM;
}
@@ -4581,13 +4801,18 @@ void kbase_csf_scheduler_term(struct kbase_device *kbdev)
cancel_tick_timer(kbdev);
cancel_work_sync(&kbdev->csf.scheduler.tick_work);
cancel_delayed_work_sync(&kbdev->csf.scheduler.tock_work);
- destroy_workqueue(kbdev->csf.scheduler.wq);
mutex_destroy(&kbdev->csf.scheduler.lock);
kfree(kbdev->csf.scheduler.csg_slots);
kbdev->csf.scheduler.csg_slots = NULL;
}
}
+void kbase_csf_scheduler_early_term(struct kbase_device *kbdev)
+{
+ if (kbdev->csf.scheduler.wq)
+ destroy_workqueue(kbdev->csf.scheduler.wq);
+}
+
/**
* scheduler_enable_tick_timer_nolock - Enable the scheduler tick timer.
*
diff --git a/mali_kbase/csf/mali_kbase_csf_scheduler.h b/mali_kbase/csf/mali_kbase_csf_scheduler.h
index 1607ff6..9afed56 100644
--- a/mali_kbase/csf/mali_kbase_csf_scheduler.h
+++ b/mali_kbase/csf/mali_kbase_csf_scheduler.h
@@ -168,12 +168,25 @@ int kbase_csf_scheduler_context_init(struct kbase_context *kctx);
* The scheduler does the arbitration for the CSG slots
* provided by the firmware between the GPU command queue groups created
* by the Clients.
+ * This function must be called after loading firmware and parsing its capabilities.
*
* Return: 0 on success, or negative on failure.
*/
int kbase_csf_scheduler_init(struct kbase_device *kbdev);
/**
+ * kbase_csf_scheduler_early_init - Early initialization for the CSF scheduler
+ *
+ * @kbdev: Instance of a GPU platform device that implements a CSF interface.
+ *
+ * Initialize necessary resources such as locks, workqueue for CSF scheduler.
+ * This must be called at kbase probe.
+ *
+ * Return: 0 on success, or negative on failure.
+ */
+int kbase_csf_scheduler_early_init(struct kbase_device *kbdev);
+
+/**
* kbase_csf_scheduler_context_term() - Terminate the context-specific part
* for CSF scheduler.
*
@@ -194,6 +207,15 @@ void kbase_csf_scheduler_context_term(struct kbase_context *kctx);
void kbase_csf_scheduler_term(struct kbase_device *kbdev);
/**
+ * kbase_csf_scheduler_early_term - Early termination of the CSF scheduler.
+ *
+ * @kbdev: Instance of a GPU platform device that implements a CSF interface.
+ *
+ * This should be called only when kbase probe fails or gets rmmoded.
+ */
+void kbase_csf_scheduler_early_term(struct kbase_device *kbdev);
+
+/**
* kbase_csf_scheduler_reset - Reset the state of all active GPU command
* queue groups.
*
@@ -422,8 +444,11 @@ kbase_csf_scheduler_advance_tick_nolock(struct kbase_device *kbdev)
lockdep_assert_held(&scheduler->interrupt_lock);
if (scheduler->tick_timer_active) {
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_ADVANCE_TICK, NULL, 0u);
scheduler->tick_timer_active = false;
queue_work(scheduler->wq, &scheduler->tick_work);
+ } else {
+ KBASE_KTRACE_ADD(kbdev, SCHEDULER_NOADVANCE_TICK, NULL, 0u);
}
}
@@ -446,4 +471,24 @@ static inline void kbase_csf_scheduler_advance_tick(struct kbase_device *kbdev)
spin_unlock_irqrestore(&scheduler->interrupt_lock, flags);
}
+/**
+ * kbase_csf_scheduler_queue_has_trace() - report whether the queue has been
+ * configured to operate with the
+ * cs_trace feature.
+ *
+ * @queue: Pointer to the queue.
+ *
+ * Return: True if the gpu queue is configured to operate with the cs_trace
+ * feature, otherwise false.
+ */
+static inline bool kbase_csf_scheduler_queue_has_trace(struct kbase_queue *queue)
+{
+ lockdep_assert_held(&queue->kctx->kbdev->csf.scheduler.lock);
+ /* In the current arrangement, it is possible for the context to enable
+ * the cs_trace after some queues have been registered with cs_trace in
+ * disabled state. So each queue has its own enabled/disabled condition.
+ */
+ return (queue->trace_buffer_size && queue->trace_buffer_base);
+}
+
#endif /* _KBASE_CSF_SCHEDULER_H_ */
diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap.h b/mali_kbase/csf/mali_kbase_csf_tiler_heap.h
index 683aeca..7acabc8 100644
--- a/mali_kbase/csf/mali_kbase_csf_tiler_heap.h
+++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c
index 0f69500..1c17e97 100644
--- a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c
+++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -24,7 +24,7 @@
#include <mali_kbase.h>
#include <linux/seq_file.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbasep_csf_tiler_heap_debugfs_show() - Print tiler heap information for per context
diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h
index 65dfaf7..60ec74b 100644
--- a/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h
+++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap_debugfs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h b/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h
index 0bf6551..dbd0386 100644
--- a/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h
+++ b/mali_kbase/csf/mali_kbase_csf_tiler_heap_def.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_timeout.c b/mali_kbase/csf/mali_kbase_csf_timeout.c
index 854aad5..6a8d8ac 100644
--- a/mali_kbase/csf/mali_kbase_csf_timeout.c
+++ b/mali_kbase/csf/mali_kbase_csf_timeout.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -147,7 +147,7 @@ int kbase_csf_timeout_init(struct kbase_device *const kbdev)
u64 timeout = DEFAULT_PROGRESS_TIMEOUT;
int err;
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
err = of_property_read_u64(kbdev->dev->of_node,
"progress_timeout", &timeout);
if (!err)
diff --git a/mali_kbase/csf/mali_kbase_csf_timeout.h b/mali_kbase/csf/mali_kbase_csf_timeout.h
index 48c7181..1f699a5 100644
--- a/mali_kbase/csf/mali_kbase_csf_timeout.h
+++ b/mali_kbase/csf/mali_kbase_csf_timeout.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/csf/mali_kbase_csf_tl_reader.c b/mali_kbase/csf/mali_kbase_csf_tl_reader.c
index fb7e86a..70e02d9 100644
--- a/mali_kbase/csf/mali_kbase_csf_tl_reader.c
+++ b/mali_kbase/csf/mali_kbase_csf_tl_reader.c
@@ -35,7 +35,7 @@
#include <linux/math64.h>
#include <asm/arch_timer.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#include "tl/mali_kbase_timeline_priv.h"
#include <linux/debugfs.h>
@@ -64,7 +64,7 @@ struct kbase_csffw_tl_message {
u64 cycle_counter;
} __packed __aligned(4);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
static int kbase_csf_tl_debugfs_poll_interval_read(void *data, u64 *val)
{
struct kbase_device *kbdev = (struct kbase_device *)data;
@@ -93,11 +93,13 @@ DEFINE_DEBUGFS_ATTRIBUTE(kbase_csf_tl_poll_interval_fops,
kbase_csf_tl_debugfs_poll_interval_read,
kbase_csf_tl_debugfs_poll_interval_write, "%llu\n");
+
void kbase_csf_tl_reader_debugfs_init(struct kbase_device *kbdev)
{
debugfs_create_file("csf_tl_poll_interval_in_ms", S_IRUGO | S_IWUSR,
kbdev->debugfs_instr_directory, kbdev,
&kbase_csf_tl_poll_interval_fops);
+
}
#endif
@@ -125,6 +127,7 @@ static void get_cpu_gpu_time(
*cpu_ts = ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec;
}
+
/**
* kbase_ts_converter_init() - Initialize system timestamp converter.
*
@@ -168,7 +171,7 @@ static int kbase_ts_converter_init(
*
* Return: The CPU timestamp.
*/
-void kbase_ts_converter_convert(
+static void kbase_ts_converter_convert(
const struct kbase_ts_converter *self,
u64 *gpu_ts)
{
@@ -474,14 +477,7 @@ int kbase_csf_tl_reader_start(struct kbase_csf_tl_reader *self,
return 0;
if (tl_reader_init_late(self, kbdev)) {
-#if defined(CONFIG_MALI_NO_MALI)
- dev_warn(
- kbdev->dev,
- "CSFFW timeline is not available for MALI_NO_MALI builds!");
- return 0;
-#else
return -EINVAL;
-#endif
}
tl_reader_reset(self);
diff --git a/mali_kbase/csf/mali_kbase_csf_tl_reader.h b/mali_kbase/csf/mali_kbase_csf_tl_reader.h
index c691871..9473224 100644
--- a/mali_kbase/csf/mali_kbase_csf_tl_reader.h
+++ b/mali_kbase/csf/mali_kbase_csf_tl_reader.h
@@ -164,7 +164,7 @@ int kbase_csf_tl_reader_start(struct kbase_csf_tl_reader *self,
*/
void kbase_csf_tl_reader_stop(struct kbase_csf_tl_reader *self);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbase_csf_tl_reader_debugfs_init() -
* Initialize debugfs for CSFFW Timelime Stream Reader.
diff --git a/mali_kbase/csf/mali_kbase_csf_trace_buffer.c b/mali_kbase/csf/mali_kbase_csf_trace_buffer.c
index afcc90b..44d256c 100644
--- a/mali_kbase/csf/mali_kbase_csf_trace_buffer.c
+++ b/mali_kbase/csf/mali_kbase_csf_trace_buffer.c
@@ -29,7 +29,7 @@
#include <linux/list.h>
#include <linux/mman.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#if (KERNEL_VERSION(4, 7, 0) > LINUX_VERSION_CODE)
#define DEFINE_DEBUGFS_ATTRIBUTE DEFINE_SIMPLE_ATTRIBUTE
#endif
@@ -513,7 +513,7 @@ unsigned int kbase_csf_firmware_trace_buffer_read_data(
}
EXPORT_SYMBOL(kbase_csf_firmware_trace_buffer_read_data);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#define U32_BITS 32
static u64 get_trace_buffer_active_mask64(struct firmware_trace_buffer *tb)
diff --git a/mali_kbase/csf/mali_kbase_csf_trace_buffer.h b/mali_kbase/csf/mali_kbase_csf_trace_buffer.h
index e6babef..b6d9286 100644
--- a/mali_kbase/csf/mali_kbase_csf_trace_buffer.h
+++ b/mali_kbase/csf/mali_kbase_csf_trace_buffer.h
@@ -168,7 +168,7 @@ bool kbase_csf_firmware_trace_buffer_is_empty(
unsigned int kbase_csf_firmware_trace_buffer_read_data(
struct firmware_trace_buffer *trace_buffer, u8 *data, unsigned int num_bytes);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbase_csf_fw_trace_buffer_debugfs_init() - Add debugfs entries for setting
* enable mask and dumping the binary
diff --git a/mali_kbase/debug/Kbuild b/mali_kbase/debug/Kbuild
new file mode 100644
index 0000000..fc2c7b9
--- /dev/null
+++ b/mali_kbase/debug/Kbuild
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
+#
+# This program is free software and is provided to you under the terms of the
+# GNU General Public License version 2 as published by the Free Software
+# Foundation, and any use by you of this program is subject to the terms
+# of such GNU license.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+#
+
+mali_kbase-y += debug/mali_kbase_debug_ktrace.o
+
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ mali_kbase-y += debug/backend/mali_kbase_debug_ktrace_csf.o
+else
+ mali_kbase-y += debug/backend/mali_kbase_debug_ktrace_jm.o
+endif
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h
index 7ed62aa..5ebd228 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_csf.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -50,10 +50,52 @@ int dummy_array[] = {
KBASE_KTRACE_CODE_MAKE_CODE(FIRMWARE_BOOT),
KBASE_KTRACE_CODE_MAKE_CODE(FIRMWARE_REBOOT),
KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_TOCK),
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_TOCK_END),
+ /* info_val == total number of runnable groups across all kctxs */
KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_TICK),
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_TICK_END),
KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_RESET),
- KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_EXIT_PROTM),
+ /* info_val = timeout in ms */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_WAIT_PROTM_QUIT),
+ /* info_val = remaining ms timeout, or 0 if timedout */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_WAIT_PROTM_QUIT_DONE),
KBASE_KTRACE_CODE_MAKE_CODE(SYNC_UPDATE_EVENT),
+ KBASE_KTRACE_CODE_MAKE_CODE(SYNC_UPDATE_EVENT_NOTIFY_GPU),
+
+ /* info_val = JOB_IRQ_STATUS */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSF_INTERRUPT),
+ /* info_val = JOB_IRQ_STATUS */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSF_INTERRUPT_END),
+ /* info_val = JOB_IRQ_STATUS */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSG_INTERRUPT_PROCESS),
+ /* info_val = GLB_REQ ^ GLB_ACQ */
+ KBASE_KTRACE_CODE_MAKE_CODE(GLB_REQ_ACQ),
+ /* info_val[31:0] = num non idle offslot groups
+ * info_val[32] = scheduler can suspend on idle
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_CAN_IDLE),
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_ADVANCE_TICK),
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_NOADVANCE_TICK),
+ /* kctx is added to the back of the list */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_INSERT_RUNNABLE),
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_REMOVE_RUNNABLE),
+ /* kctx is moved to the back of the list */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_ROTATE_RUNNABLE),
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_HEAD_RUNNABLE),
+
+ KBASE_KTRACE_CODE_MAKE_CODE(IDLE_WORKER_BEGIN),
+ /* 4-bit encoding of boolean values (ease of reading as hex values)
+ *
+ * info_val[3:0] = was reset active/failed to be prevented
+ * info_val[7:4] = whether scheduler was both idle and suspendable
+ * info_val[11:8] = whether all groups were suspended
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(IDLE_WORKER_END),
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_SYNC_UPDATE_WORKER_BEGIN),
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_SYNC_UPDATE_WORKER_END),
+
+ /* info_val = bitmask of slots that gave an ACK for STATUS_UPDATE */
+ KBASE_KTRACE_CODE_MAKE_CODE(SLOTS_STATUS_UPDATE_ACK),
/*
* Group events
@@ -71,12 +113,30 @@ int dummy_array[] = {
KBASE_KTRACE_CODE_MAKE_CODE(CSG_SLOT_STOPPED),
/* info_val == slot cleaned */
KBASE_KTRACE_CODE_MAKE_CODE(CSG_SLOT_CLEANED),
+ /* info_val = slot requesting STATUS_UPDATE */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSG_SLOT_STATUS_UPDATE),
+ /* info_val = scheduler's new csg_slots_idle_mask[0]
+ * group->csg_nr indicates which bit was set
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSG_SLOT_IDLE_SET),
+ /* info_val = scheduler's new csg_slots_idle_mask[0]
+ * group->csg_nr indicates which bit was cleared
+ *
+ * in case of no group, multiple bits may have been updated
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSG_SLOT_IDLE_CLEAR),
/* info_val == previous priority */
KBASE_KTRACE_CODE_MAKE_CODE(CSG_PRIO_UPDATE),
/* info_val == CSG_REQ ^ CSG_ACK */
KBASE_KTRACE_CODE_MAKE_CODE(CSG_SYNC_UPDATE_INTERRUPT),
/* info_val == CSG_REQ ^ CSG_ACK */
KBASE_KTRACE_CODE_MAKE_CODE(CSG_IDLE_INTERRUPT),
+ /* info_val == CSG_REQ ^ CSG_ACK */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSG_PROGRESS_TIMER_INTERRUPT),
+ /* info_val[31:0] == CSG_REQ ^ CSG_ACQ
+ * info_val[63:32] == CSG_IRQ_REQ ^ CSG_IRQ_ACK
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSG_INTERRUPT_PROCESS_END),
KBASE_KTRACE_CODE_MAKE_CODE(GROUP_SYNC_UPDATE_DONE),
/* info_val == run state of the group */
KBASE_KTRACE_CODE_MAKE_CODE(GROUP_DESCHEDULE),
@@ -86,11 +146,46 @@ int dummy_array[] = {
* info_val[63:32] == number of runnable groups
*/
KBASE_KTRACE_CODE_MAKE_CODE(GROUP_EVICT_SCHED),
+
+ /* info_val == new num_runnable_grps
+ * group is added to the back of the list for its priority level
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_INSERT_RUNNABLE),
+ /* info_val == new num_runnable_grps
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_REMOVE_RUNNABLE),
+ /* info_val == num_runnable_grps
+ * group is moved to the back of the list for its priority level
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_ROTATE_RUNNABLE),
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_HEAD_RUNNABLE),
+ /* info_val == new num_idle_wait_grps
+ * group is added to the back of the list
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_INSERT_IDLE_WAIT),
+ /* info_val == new num_idle_wait_grps
+ * group is added to the back of the list
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_REMOVE_IDLE_WAIT),
+ KBASE_KTRACE_CODE_MAKE_CODE(GROUP_HEAD_IDLE_WAIT),
+
+ /* info_val == is scheduler running with protected mode tasks */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_CHECK_PROTM_ENTER),
KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_ENTER_PROTM),
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_EXIT_PROTM),
/* info_val[31:0] == number of GPU address space slots in use
* info_val[63:32] == number of runnable groups
*/
KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_TOP_GRP),
+ /* info_val == new count of off-slot non-idle groups
+ * no group indicates it was set rather than incremented
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_NONIDLE_OFFSLOT_INC),
+ /* info_val == new count of off-slot non-idle groups */
+ KBASE_KTRACE_CODE_MAKE_CODE(SCHEDULER_NONIDLE_OFFSLOT_DEC),
+
+ KBASE_KTRACE_CODE_MAKE_CODE(PROTM_EVENT_WORKER_BEGIN),
+ KBASE_KTRACE_CODE_MAKE_CODE(PROTM_EVENT_WORKER_END),
/*
* Group + Queue events
@@ -100,13 +195,41 @@ int dummy_array[] = {
/* info_val == queue->enabled before stop */
KBASE_KTRACE_CODE_MAKE_CODE(CSI_STOP),
KBASE_KTRACE_CODE_MAKE_CODE(CSI_STOP_REQUESTED),
+ /* info_val == CS_REQ ^ CS_ACK that were not processed due to the group
+ * being suspended
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSI_IGNORED_INTERRUPTS_GROUP_SUSPEND),
/* info_val == CS_REQ ^ CS_ACK */
KBASE_KTRACE_CODE_MAKE_CODE(CSI_FAULT_INTERRUPT),
/* info_val == CS_REQ ^ CS_ACK */
KBASE_KTRACE_CODE_MAKE_CODE(CSI_TILER_OOM_INTERRUPT),
+ /* info_val == CS_REQ ^ CS_ACK */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSI_PROTM_PEND_INTERRUPT),
+ /* info_val == CS_ACK_PROTM_PEND ^ CS_REQ_PROTM_PEND */
+ KBASE_KTRACE_CODE_MAKE_CODE(CSI_PROTM_ACK),
/* info_val == group->run_State (for group the queue is bound to) */
KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_START),
KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_STOP),
+ /* info_val == contents of CS_STATUS_WAIT_SYNC_POINTER */
+ KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_SYNC_UPDATE),
+ /* info_val == bool for result of the evaluation */
+ KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_SYNC_UPDATE_EVALUATED),
+ /* info_val == contents of CS_STATUS_WAIT */
+ KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_SYNC_STATUS_WAIT),
+ /* info_val == current sync value pointed to by queue->sync_ptr */
+ KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_SYNC_CURRENT_VAL),
+ /* info_val == current value of CS_STATUS_WAIT_SYNC_VALUE */
+ KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_SYNC_TEST_VAL),
+ /* info_val == current value of CS_STATUS_BLOCKED_REASON */
+ KBASE_KTRACE_CODE_MAKE_CODE(QUEUE_SYNC_BLOCKED_REASON),
+ /* info_val = group's new protm_pending_bitmap[0]
+ * queue->csi_index indicates which bit was set
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(PROTM_PENDING_SET),
+ /* info_val = group's new protm_pending_bitmap[0]
+ * queue->csi_index indicates which bit was cleared
+ */
+ KBASE_KTRACE_CODE_MAKE_CODE(PROTM_PENDING_CLEAR),
/*
* KCPU queue events
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h
index a616f2b..c057ba6 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_codes_jm.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2011-2015, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2015, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c
index 9183520..2a65ec7 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h
index 2b8ff85..0cd12de 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_csf.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h
index ef75afa..6a43294 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_defs_csf.h
@@ -43,9 +43,14 @@
* ringbuffer RBUF (mali_trace) between csi and info_val, which is empty
* for non-kcpu related traces, and usually displays the KCPU Queue ID and
* an extra information value. ftrace also displays these KCPU traces.
+ *
+ * 1.3:
+ * Add a lot of extra new traces. Tweak some existing scheduler related traces
+ * to contain extra information information/happen at slightly different times.
+ * SCHEDULER_EXIT_PROTM now has group information
*/
#define KBASE_KTRACE_VERSION_MAJOR 1
-#define KBASE_KTRACE_VERSION_MINOR 2
+#define KBASE_KTRACE_VERSION_MINOR 3
/* indicates if the trace message has valid queue-group related info. */
#define KBASE_KTRACE_FLAG_CSF_GROUP (((kbase_ktrace_flag_t)1) << 0)
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c
index 2762909..5051a74 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h
index 38ea753..3499300 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_ktrace_jm.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h
index 4ed175e..eb2a7b8 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_csf.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -34,10 +34,30 @@ DEFINE_MALI_ADD_EVENT(EVICT_CTX_SLOTS);
DEFINE_MALI_ADD_EVENT(FIRMWARE_BOOT);
DEFINE_MALI_ADD_EVENT(FIRMWARE_REBOOT);
DEFINE_MALI_ADD_EVENT(SCHEDULER_TOCK);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_TOCK_END);
DEFINE_MALI_ADD_EVENT(SCHEDULER_TICK);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_TICK_END);
DEFINE_MALI_ADD_EVENT(SCHEDULER_RESET);
-DEFINE_MALI_ADD_EVENT(SCHEDULER_EXIT_PROTM);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_WAIT_PROTM_QUIT);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_WAIT_PROTM_QUIT_DONE);
DEFINE_MALI_ADD_EVENT(SYNC_UPDATE_EVENT);
+DEFINE_MALI_ADD_EVENT(SYNC_UPDATE_EVENT_NOTIFY_GPU);
+DEFINE_MALI_ADD_EVENT(CSF_INTERRUPT);
+DEFINE_MALI_ADD_EVENT(CSF_INTERRUPT_END);
+DEFINE_MALI_ADD_EVENT(CSG_INTERRUPT_PROCESS);
+DEFINE_MALI_ADD_EVENT(GLB_REQ_ACQ);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_CAN_IDLE);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_ADVANCE_TICK);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_NOADVANCE_TICK);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_INSERT_RUNNABLE);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_REMOVE_RUNNABLE);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_ROTATE_RUNNABLE);
+DEFINE_MALI_ADD_EVENT(SCHEDULER_HEAD_RUNNABLE);
+DEFINE_MALI_ADD_EVENT(IDLE_WORKER_BEGIN);
+DEFINE_MALI_ADD_EVENT(IDLE_WORKER_END);
+DEFINE_MALI_ADD_EVENT(GROUP_SYNC_UPDATE_WORKER_BEGIN);
+DEFINE_MALI_ADD_EVENT(GROUP_SYNC_UPDATE_WORKER_END);
+DEFINE_MALI_ADD_EVENT(SLOTS_STATUS_UPDATE_ACK);
DECLARE_EVENT_CLASS(mali_csf_grp_q_template,
TP_PROTO(struct kbase_device *kbdev, struct kbase_queue_group *group,
@@ -112,15 +132,33 @@ DEFINE_MALI_CSF_GRP_EVENT(CSG_SLOT_STOP);
DEFINE_MALI_CSF_GRP_EVENT(CSG_SLOT_STARTED);
DEFINE_MALI_CSF_GRP_EVENT(CSG_SLOT_STOPPED);
DEFINE_MALI_CSF_GRP_EVENT(CSG_SLOT_CLEANED);
+DEFINE_MALI_CSF_GRP_EVENT(CSG_SLOT_STATUS_UPDATE);
+DEFINE_MALI_CSF_GRP_EVENT(CSG_SLOT_IDLE_SET);
+DEFINE_MALI_CSF_GRP_EVENT(CSG_SLOT_IDLE_CLEAR);
DEFINE_MALI_CSF_GRP_EVENT(CSG_PRIO_UPDATE);
DEFINE_MALI_CSF_GRP_EVENT(CSG_SYNC_UPDATE_INTERRUPT);
DEFINE_MALI_CSF_GRP_EVENT(CSG_IDLE_INTERRUPT);
+DEFINE_MALI_CSF_GRP_EVENT(CSG_PROGRESS_TIMER_INTERRUPT);
+DEFINE_MALI_CSF_GRP_EVENT(CSG_INTERRUPT_PROCESS_END);
DEFINE_MALI_CSF_GRP_EVENT(GROUP_SYNC_UPDATE_DONE);
DEFINE_MALI_CSF_GRP_EVENT(GROUP_DESCHEDULE);
DEFINE_MALI_CSF_GRP_EVENT(GROUP_SCHEDULE);
DEFINE_MALI_CSF_GRP_EVENT(GROUP_EVICT_SCHED);
+DEFINE_MALI_CSF_GRP_EVENT(GROUP_INSERT_RUNNABLE);
+DEFINE_MALI_CSF_GRP_EVENT(GROUP_REMOVE_RUNNABLE);
+DEFINE_MALI_CSF_GRP_EVENT(GROUP_ROTATE_RUNNABLE);
+DEFINE_MALI_CSF_GRP_EVENT(GROUP_HEAD_RUNNABLE);
+DEFINE_MALI_CSF_GRP_EVENT(GROUP_INSERT_IDLE_WAIT);
+DEFINE_MALI_CSF_GRP_EVENT(GROUP_REMOVE_IDLE_WAIT);
+DEFINE_MALI_CSF_GRP_EVENT(GROUP_HEAD_IDLE_WAIT);
+DEFINE_MALI_CSF_GRP_EVENT(SCHEDULER_CHECK_PROTM_ENTER);
DEFINE_MALI_CSF_GRP_EVENT(SCHEDULER_ENTER_PROTM);
+DEFINE_MALI_CSF_GRP_EVENT(SCHEDULER_EXIT_PROTM);
DEFINE_MALI_CSF_GRP_EVENT(SCHEDULER_TOP_GRP);
+DEFINE_MALI_CSF_GRP_EVENT(SCHEDULER_NONIDLE_OFFSLOT_INC);
+DEFINE_MALI_CSF_GRP_EVENT(SCHEDULER_NONIDLE_OFFSLOT_DEC);
+DEFINE_MALI_CSF_GRP_EVENT(PROTM_EVENT_WORKER_BEGIN);
+DEFINE_MALI_CSF_GRP_EVENT(PROTM_EVENT_WORKER_END);
#undef DEFINE_MALI_CSF_GRP_EVENT
@@ -136,10 +174,21 @@ DEFINE_MALI_CSF_GRP_EVENT(SCHEDULER_TOP_GRP);
DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_START);
DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_STOP);
DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_STOP_REQUESTED);
+DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_IGNORED_INTERRUPTS_GROUP_SUSPEND);
DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_FAULT_INTERRUPT);
DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_TILER_OOM_INTERRUPT);
+DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_PROTM_PEND_INTERRUPT);
+DEFINE_MALI_CSF_GRP_Q_EVENT(CSI_PROTM_ACK);
DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_START);
DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_STOP);
+DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_SYNC_UPDATE);
+DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_SYNC_UPDATE_EVALUATED);
+DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_SYNC_STATUS_WAIT);
+DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_SYNC_CURRENT_VAL);
+DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_SYNC_TEST_VAL);
+DEFINE_MALI_CSF_GRP_Q_EVENT(QUEUE_SYNC_BLOCKED_REASON);
+DEFINE_MALI_CSF_GRP_Q_EVENT(PROTM_PENDING_SET);
+DEFINE_MALI_CSF_GRP_Q_EVENT(PROTM_PENDING_CLEAR);
#undef DEFINE_MALI_CSF_GRP_Q_EVENT
diff --git a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h
index b368a85..bffcdb4 100644
--- a/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h
+++ b/mali_kbase/debug/backend/mali_kbase_debug_linux_ktrace_jm.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace.c b/mali_kbase/debug/mali_kbase_debug_ktrace.c
index 443b048..8548794 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace.c
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -240,7 +240,7 @@ void kbasep_ktrace_dump(struct kbase_device *kbdev)
spin_unlock_irqrestore(&kbdev->ktrace.lock, flags);
}
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
struct trace_seq_state {
struct kbase_ktrace_msg trace_buf[KBASE_KTRACE_SIZE];
u32 start;
@@ -348,7 +348,7 @@ void kbase_ktrace_debugfs_init(struct kbase_device *kbdev)
#else /* KBASE_KTRACE_TARGET_RBUF */
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
void kbase_ktrace_debugfs_init(struct kbase_device *kbdev)
{
CSTD_UNUSED(kbdev);
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace.h b/mali_kbase/debug/mali_kbase_debug_ktrace.h
index d8c1beb..eecac90 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -65,7 +65,7 @@ void kbase_ktrace_term(struct kbase_device *kbdev);
*/
void kbase_ktrace_hook_wrapper(void *param);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbase_ktrace_debugfs_init - initialize kbase ktrace for debugfs usage, if
* the selected targets support it.
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h b/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h
index c5ca08e..19b621e 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace_codes.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2011-2015, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2015, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h b/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h
index 5ed32ae..f4fd231 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace_defs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -114,7 +114,7 @@ union kbase_ktrace_backend;
#define KBASE_KTRACE_FLAG_ALL \
(KBASE_KTRACE_FLAG_COMMON_ALL | KBASE_KTRACE_FLAG_BACKEND_ALL)
-#define KBASE_KTRACE_SHIFT 8 /* 256 entries */
+#define KBASE_KTRACE_SHIFT (9) /* 512 entries */
#define KBASE_KTRACE_SIZE (1 << KBASE_KTRACE_SHIFT)
#define KBASE_KTRACE_MASK ((1 << KBASE_KTRACE_SHIFT)-1)
diff --git a/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h b/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h
index 1f0fa5e..9a565c1 100644
--- a/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h
+++ b/mali_kbase/debug/mali_kbase_debug_ktrace_internal.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/device/Kbuild b/mali_kbase/device/Kbuild
new file mode 100644
index 0000000..3d92d7d
--- /dev/null
+++ b/mali_kbase/device/Kbuild
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
+#
+# This program is free software and is provided to you under the terms of the
+# GNU General Public License version 2 as published by the Free Software
+# Foundation, and any use by you of this program is subject to the terms
+# of such GNU license.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+#
+
+mali_kbase-y += \
+ device/mali_kbase_device.o \
+ device/mali_kbase_device_hw.o
+
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ mali_kbase-y += \
+ device/backend/mali_kbase_device_csf.o \
+ device/backend/mali_kbase_device_hw_csf.o
+else
+ mali_kbase-y += \
+ device/backend/mali_kbase_device_jm.o \
+ device/backend/mali_kbase_device_hw_jm.o
+endif
diff --git a/mali_kbase/device/backend/mali_kbase_device_csf.c b/mali_kbase/device/backend/mali_kbase_device_csf.c
index cb2c2e2..c747c85 100644
--- a/mali_kbase/device/backend/mali_kbase_device_csf.c
+++ b/mali_kbase/device/backend/mali_kbase_device_csf.c
@@ -19,8 +19,8 @@
*
*/
-#include "../mali_kbase_device_internal.h"
-#include "../mali_kbase_device.h"
+#include <device/mali_kbase_device_internal.h>
+#include <device/mali_kbase_device.h>
#include <mali_kbase_hwaccess_backend.h>
#include <mali_kbase_hwcnt_backend_csf_if_fw.h>
@@ -29,40 +29,33 @@
#include <csf/mali_kbase_csf.h>
#include <csf/ipa_control/mali_kbase_csf_ipa_control.h>
-#ifdef CONFIG_MALI_NO_MALI
-#include <mali_kbase_model_linux.h>
-#endif
#include <mali_kbase.h>
#include <backend/gpu/mali_kbase_irq_internal.h>
#include <backend/gpu/mali_kbase_pm_internal.h>
#include <backend/gpu/mali_kbase_js_internal.h>
#include <backend/gpu/mali_kbase_clk_rate_trace_mgr.h>
+#include <csf/mali_kbase_csf_csg_debugfs.h>
+#include <mali_kbase_hwcnt_virtualizer.h>
+#include <mali_kbase_vinstr.h>
-static void kbase_device_csf_firmware_term(struct kbase_device *kbdev)
-{
- kbase_csf_firmware_term(kbdev);
-}
-
-static int kbase_device_csf_firmware_init(struct kbase_device *kbdev)
+/**
+ * kbase_device_firmware_hwcnt_term - Terminate CSF firmware and HWC
+ *
+ * @kbdev: An instance of the GPU platform device, allocated from the probe
+ * method of the driver.
+ *
+ * When a kbase driver is removed, terminate CSF firmware and hardware counter
+ * components.
+ */
+static void kbase_device_firmware_hwcnt_term(struct kbase_device *kbdev)
{
- int err = kbase_csf_firmware_init(kbdev);
-
- if (!err) {
- unsigned long flags;
-
- spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
- kbdev->pm.backend.mcu_state = KBASE_MCU_ON;
- kbdev->csf.firmware_inited = true;
- spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
+ if (kbdev->csf.firmware_inited) {
+ kbase_vinstr_term(kbdev->vinstr_ctx);
+ kbase_hwcnt_virtualizer_term(kbdev->hwcnt_gpu_virt);
+ kbase_hwcnt_backend_csf_metadata_term(&kbdev->hwcnt_gpu_iface);
+ kbase_csf_firmware_term(kbdev);
}
-
- /* Post firmware init, idle condition is restored. Note this is
- * a deferral action step from the late init stage for CSF.
- */
- kbase_pm_context_idle(kbdev);
-
- return err;
}
/**
@@ -128,7 +121,9 @@ static int kbase_backend_late_init(struct kbase_device *kbdev)
init_waitqueue_head(&kbdev->hwaccess.backend.reset_wait);
- /* kbase_pm_context_idle is called after the boot of firmware */
+ kbase_pm_context_idle(kbdev);
+
+ mutex_init(&kbdev->fw_load_lock);
return 0;
@@ -172,6 +167,33 @@ static void kbase_backend_late_term(struct kbase_device *kbdev)
}
/**
+ * kbase_csf_early_init - Early initialization for firmware & scheduler.
+ * @kbdev: Device pointer
+ *
+ * Return: 0 on success, error code otherwise.
+ */
+static int kbase_csf_early_init(struct kbase_device *kbdev)
+{
+ int err = kbase_csf_firmware_early_init(kbdev);
+
+ if (err)
+ return err;
+
+ err = kbase_csf_scheduler_early_init(kbdev);
+
+ return err;
+}
+
+/**
+ * kbase_csf_early_init - Early termination for firmware & scheduler.
+ * @kbdev: Device pointer
+ */
+static void kbase_csf_early_term(struct kbase_device *kbdev)
+{
+ kbase_csf_scheduler_early_term(kbdev);
+}
+
+/**
* kbase_device_hwcnt_backend_csf_if_init - Create hardware counter backend
* firmware interface.
* @kbdev: Device pointer
@@ -214,96 +236,52 @@ static void kbase_device_hwcnt_backend_csf_term(struct kbase_device *kbdev)
kbase_hwcnt_backend_csf_destroy(&kbdev->hwcnt_gpu_iface);
}
-/**
- * kbase_device_hwcnt_backend_csf_metadata_init - Initialize hardware counter
- * metadata.
- * @kbdev: Device pointer
- */
-static int
-kbase_device_hwcnt_backend_csf_metadata_init(struct kbase_device *kbdev)
-{
- /* For CSF GPUs, HWC metadata needs to query information from CSF
- * firmware, so the initialization of HWC metadata only can be called
- * after firmware initialized, but firmware initialization depends on
- * HWC backend initialization, so we need to separate HWC backend
- * metadata initialization from HWC backend initialization.
- */
- return kbase_hwcnt_backend_csf_metadata_init(&kbdev->hwcnt_gpu_iface);
-}
-
-/**
- * kbase_device_hwcnt_backend_csf_metadata_term - Terminate hardware counter
- * metadata.
- * @kbdev: Device pointer
- */
-static void
-kbase_device_hwcnt_backend_csf_metadata_term(struct kbase_device *kbdev)
-{
- kbase_hwcnt_backend_csf_metadata_term(&kbdev->hwcnt_gpu_iface);
-}
-
static const struct kbase_device_init dev_init[] = {
-#ifdef CONFIG_MALI_NO_MALI
- {kbase_gpu_device_create, kbase_gpu_device_destroy,
- "Dummy model initialization failed"},
-#else
- {assign_irqs, NULL,
- "IRQ search failed"},
- {registers_map, registers_unmap,
- "Register map failed"},
-#endif
- {power_control_init, power_control_term,
- "Power control initialization failed"},
- {kbase_device_io_history_init, kbase_device_io_history_term,
- "Register access history initialization failed"},
- {kbase_device_early_init, kbase_device_early_term,
- "Early device initialization failed"},
- {kbase_device_populate_max_freq, NULL,
- "Populating max frequency failed"},
- {kbase_device_misc_init, kbase_device_misc_term,
- "Miscellaneous device initialization failed"},
- {kbase_device_pcm_dev_init, kbase_device_pcm_dev_term,
- "Priority control manager initialization failed"},
- {kbase_ctx_sched_init, kbase_ctx_sched_term,
- "Context scheduler initialization failed"},
- {kbase_mem_init, kbase_mem_term,
- "Memory subsystem initialization failed"},
- {kbase_csf_protected_memory_init, kbase_csf_protected_memory_term,
- "Protected memory allocator initialization failed"},
- {kbase_device_coherency_init, NULL,
- "Device coherency init failed"},
- {kbase_protected_mode_init, kbase_protected_mode_term,
- "Protected mode subsystem initialization failed"},
- {kbase_device_list_init, kbase_device_list_term,
- "Device list setup failed"},
- {kbase_device_timeline_init, kbase_device_timeline_term,
- "Timeline stream initialization failed"},
- {kbase_clk_rate_trace_manager_init,
- kbase_clk_rate_trace_manager_term,
- "Clock rate trace manager initialization failed"},
- {kbase_device_hwcnt_backend_csf_if_init,
- kbase_device_hwcnt_backend_csf_if_term,
- "GPU hwcnt backend CSF interface creation failed"},
- {kbase_device_hwcnt_backend_csf_init,
- kbase_device_hwcnt_backend_csf_term,
- "GPU hwcnt backend creation failed"},
- {kbase_device_hwcnt_context_init, kbase_device_hwcnt_context_term,
- "GPU hwcnt context initialization failed"},
- {kbase_backend_late_init, kbase_backend_late_term,
- "Late backend initialization failed"},
- {kbase_device_csf_firmware_init, kbase_device_csf_firmware_term,
- "Firmware initialization failed"},
- {kbase_device_hwcnt_backend_csf_metadata_init,
- kbase_device_hwcnt_backend_csf_metadata_term,
- "GPU hwcnt backend metadata creation failed"},
- {kbase_device_hwcnt_virtualizer_init,
- kbase_device_hwcnt_virtualizer_term,
- "GPU hwcnt virtualizer initialization failed"},
- {kbase_device_vinstr_init, kbase_device_vinstr_term,
- "Virtual instrumentation initialization failed"},
+ { assign_irqs, NULL, "IRQ search failed" },
+ { registers_map, registers_unmap, "Register map failed" },
+ { power_control_init, power_control_term,
+ "Power control initialization failed" },
+ { kbase_device_io_history_init, kbase_device_io_history_term,
+ "Register access history initialization failed" },
+ { kbase_device_early_init, kbase_device_early_term,
+ "Early device initialization failed" },
+ { kbase_device_populate_max_freq, NULL,
+ "Populating max frequency failed" },
+ { kbase_device_misc_init, kbase_device_misc_term,
+ "Miscellaneous device initialization failed" },
+ { kbase_device_pcm_dev_init, kbase_device_pcm_dev_term,
+ "Priority control manager initialization failed" },
+ { kbase_ctx_sched_init, kbase_ctx_sched_term,
+ "Context scheduler initialization failed" },
+ { kbase_mem_init, kbase_mem_term,
+ "Memory subsystem initialization failed" },
+ { kbase_csf_protected_memory_init, kbase_csf_protected_memory_term,
+ "Protected memory allocator initialization failed" },
+ { kbase_device_coherency_init, NULL, "Device coherency init failed" },
+ { kbase_protected_mode_init, kbase_protected_mode_term,
+ "Protected mode subsystem initialization failed" },
+ { kbase_device_list_init, kbase_device_list_term,
+ "Device list setup failed" },
+ { kbase_device_timeline_init, kbase_device_timeline_term,
+ "Timeline stream initialization failed" },
+ { kbase_clk_rate_trace_manager_init, kbase_clk_rate_trace_manager_term,
+ "Clock rate trace manager initialization failed" },
+ { kbase_device_hwcnt_backend_csf_if_init,
+ kbase_device_hwcnt_backend_csf_if_term,
+ "GPU hwcnt backend CSF interface creation failed" },
+ { kbase_device_hwcnt_backend_csf_init,
+ kbase_device_hwcnt_backend_csf_term,
+ "GPU hwcnt backend creation failed" },
+ { kbase_device_hwcnt_context_init, kbase_device_hwcnt_context_term,
+ "GPU hwcnt context initialization failed" },
+ { kbase_backend_late_init, kbase_backend_late_term,
+ "Late backend initialization failed" },
+ { kbase_csf_early_init, kbase_csf_early_term,
+ "Early CSF initialization failed" },
+ { NULL, kbase_device_firmware_hwcnt_term, NULL },
#ifdef MALI_KBASE_BUILD
- {kbase_device_debugfs_init, kbase_device_debugfs_term,
- "DebugFS initialization failed"},
+ { kbase_device_debugfs_init, kbase_device_debugfs_term,
+ "DebugFS initialization failed" },
/* Sysfs init needs to happen before registering the device with
* misc_register(), otherwise it causes a race condition between
* registering the device and a uevent event being generated for
@@ -316,12 +294,13 @@ static const struct kbase_device_init dev_init[] = {
* paragraph that starts with "Word of warning", currently the
* second-last paragraph.
*/
- {kbase_sysfs_init, kbase_sysfs_term,
- "SysFS group creation failed"},
- {kbase_device_misc_register, kbase_device_misc_deregister,
- "Misc device registration failed"},
- {kbase_gpuprops_populate_user_buffer, kbase_gpuprops_free_user_buffer,
- "GPU property population failed"},
+ { kbase_sysfs_init, kbase_sysfs_term, "SysFS group creation failed" },
+ { kbase_device_misc_register, kbase_device_misc_deregister,
+ "Misc device registration failed" },
+ { kbase_gpuprops_populate_user_buffer, kbase_gpuprops_free_user_buffer,
+ "GPU property population failed" },
+ { kbase_device_late_init, kbase_device_late_term,
+ "Late device initialization failed" },
#endif
};
@@ -352,14 +331,134 @@ int kbase_device_init(struct kbase_device *kbdev)
kbase_disjoint_init(kbdev);
for (i = 0; i < ARRAY_SIZE(dev_init); i++) {
- err = dev_init[i].init(kbdev);
- if (err) {
- dev_err(kbdev->dev, "%s error = %d\n",
- dev_init[i].err_mes, err);
- kbase_device_term_partial(kbdev, i);
- break;
+ if (dev_init[i].init) {
+ err = dev_init[i].init(kbdev);
+ if (err) {
+ dev_err(kbdev->dev, "%s error = %d\n",
+ dev_init[i].err_mes, err);
+ kbase_device_term_partial(kbdev, i);
+ break;
+ }
}
}
return err;
}
+
+/**
+ * kbase_device_hwcnt_csf_deferred_init - Initialize CSF deferred HWC components
+ *
+ * @kbdev: An instance of the GPU platform device, allocated from the probe
+ * method of the driver.
+ *
+ * Hardware counter components depending on firmware are initialized after CSF
+ * firmware is loaded.
+ *
+ * @return 0 on success. An error code on failure.
+ */
+static int kbase_device_hwcnt_csf_deferred_init(struct kbase_device *kbdev)
+{
+ int ret = 0;
+
+ /* For CSF GPUs, HWC metadata needs to query information from CSF
+ * firmware, so the initialization of HWC metadata only can be called
+ * after firmware initialized, but firmware initialization depends on
+ * HWC backend initialization, so we need to separate HWC backend
+ * metadata initialization from HWC backend initialization.
+ */
+ ret = kbase_hwcnt_backend_csf_metadata_init(&kbdev->hwcnt_gpu_iface);
+ if (ret) {
+ dev_err(kbdev->dev,
+ "GPU hwcnt backend metadata creation failed");
+ return ret;
+ }
+
+ ret = kbase_hwcnt_virtualizer_init(
+ kbdev->hwcnt_gpu_ctx,
+ KBASE_HWCNT_GPU_VIRTUALIZER_DUMP_THRESHOLD_NS,
+ &kbdev->hwcnt_gpu_virt);
+ if (ret) {
+ dev_err(kbdev->dev,
+ "GPU hwcnt virtualizer initialization failed");
+ goto virt_fail;
+ }
+
+ ret = kbase_vinstr_init(kbdev->hwcnt_gpu_virt, &kbdev->vinstr_ctx);
+ if (ret) {
+ dev_err(kbdev->dev,
+ "Virtual instrumentation initialization failed");
+ goto vinstr_fail;
+ }
+
+ return ret;
+
+vinstr_fail:
+ kbase_hwcnt_virtualizer_term(kbdev->hwcnt_gpu_virt);
+
+virt_fail:
+ kbase_hwcnt_backend_csf_metadata_term(&kbdev->hwcnt_gpu_iface);
+ return ret;
+}
+
+/**
+ * kbase_csf_firmware_deferred_init - Load and initialize CSF firmware
+ *
+ * @kbdev: An instance of the GPU platform device, allocated from the probe
+ * method of the driver.
+ *
+ * Called when a device file is opened for the first time.
+ * To meet Android GKI vendor guideline, firmware load is deferred at
+ * the time when @ref kbase_open is called for the first time.
+ *
+ * @return 0 on success. An error code on failure.
+ */
+static int kbase_csf_firmware_deferred_init(struct kbase_device *kbdev)
+{
+ int err = 0;
+
+ lockdep_assert_held(&kbdev->fw_load_lock);
+
+ kbase_pm_context_active(kbdev);
+
+ err = kbase_csf_firmware_init(kbdev);
+ if (!err) {
+ unsigned long flags;
+
+ spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
+ kbdev->pm.backend.mcu_state = KBASE_MCU_ON;
+ kbdev->csf.firmware_inited = true;
+ spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
+ } else {
+ dev_err(kbdev->dev, "Firmware initialization failed");
+ }
+
+ kbase_pm_context_idle(kbdev);
+
+ return err;
+}
+
+int kbase_device_firmware_init_once(struct kbase_device *kbdev)
+{
+ int ret = 0;
+
+ mutex_lock(&kbdev->fw_load_lock);
+
+ if (!kbdev->csf.firmware_inited) {
+ ret = kbase_csf_firmware_deferred_init(kbdev);
+ if (ret)
+ goto out;
+
+ ret = kbase_device_hwcnt_csf_deferred_init(kbdev);
+ if (ret) {
+ kbase_csf_firmware_term(kbdev);
+ goto out;
+ }
+
+ kbase_csf_debugfs_init(kbdev);
+ }
+
+out:
+ mutex_unlock(&kbdev->fw_load_lock);
+
+ return ret;
+}
diff --git a/mali_kbase/device/backend/mali_kbase_device_hw_jm.c b/mali_kbase/device/backend/mali_kbase_device_hw_jm.c
index 33ebe09..407a76f 100644
--- a/mali_kbase/device/backend/mali_kbase_device_hw_jm.c
+++ b/mali_kbase/device/backend/mali_kbase_device_hw_jm.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/device/backend/mali_kbase_device_jm.c b/mali_kbase/device/backend/mali_kbase_device_jm.c
index ccb2036..3871df3 100644
--- a/mali_kbase/device/backend/mali_kbase_device_jm.c
+++ b/mali_kbase/device/backend/mali_kbase_device_jm.c
@@ -21,18 +21,15 @@
#include <linux/sched/rt.h>
#include <uapi/linux/sched/types.h>
-#include "../mali_kbase_device_internal.h"
-#include "../mali_kbase_device.h"
-#include "../mali_kbase_hwaccess_instr.h"
+#include <device/mali_kbase_device_internal.h>
+#include <device/mali_kbase_device.h>
+#include <mali_kbase_hwaccess_instr.h>
#include <mali_kbase_config_defaults.h>
#include <mali_kbase_hwaccess_backend.h>
#include <mali_kbase_ctx_sched.h>
#include <mali_kbase_reset_gpu.h>
-#ifdef CONFIG_MALI_NO_MALI
-#include <mali_kbase_model_linux.h>
-#endif
#ifdef CONFIG_MALI_ARBITER_SUPPORT
#include <arbiter/mali_kbase_arbiter_pm.h>
@@ -107,6 +104,8 @@ static int kbase_backend_late_init(struct kbase_device *kbdev)
/* Idle the GPU and/or cores, if the policy wants it to */
kbase_pm_context_idle(kbdev);
+ mutex_init(&kbdev->fw_load_lock);
+
return 0;
fail_update_l2_features:
@@ -159,63 +158,54 @@ static void kbase_device_hwcnt_backend_jm_term(struct kbase_device *kbdev)
}
static const struct kbase_device_init dev_init[] = {
-#ifdef CONFIG_MALI_NO_MALI
- {kbase_gpu_device_create, kbase_gpu_device_destroy,
- "Dummy model initialization failed"},
-#else
- {assign_irqs, NULL,
- "IRQ search failed"},
- {registers_map, registers_unmap,
- "Register map failed"},
-#endif
- {kbase_device_io_history_init, kbase_device_io_history_term,
- "Register access history initialization failed"},
- {kbase_device_pm_init, kbase_device_pm_term,
- "Power management initialization failed"},
- {kbase_device_early_init, kbase_device_early_term,
- "Early device initialization failed"},
- {kbase_device_populate_max_freq, NULL,
- "Populating max frequency failed"},
- {kbase_device_misc_init, kbase_device_misc_term,
- "Miscellaneous device initialization failed"},
- {kbase_device_pcm_dev_init, kbase_device_pcm_dev_term,
- "Priority control manager initialization failed"},
- {kbase_ctx_sched_init, kbase_ctx_sched_term,
- "Context scheduler initialization failed"},
- {kbase_mem_init, kbase_mem_term,
- "Memory subsystem initialization failed"},
- {kbase_device_coherency_init, NULL,
- "Device coherency init failed"},
- {kbase_protected_mode_init, kbase_protected_mode_term,
- "Protected mode subsystem initialization failed"},
- {kbase_device_list_init, kbase_device_list_term,
- "Device list setup failed"},
- {kbasep_js_devdata_init, kbasep_js_devdata_term,
- "Job JS devdata initialization failed"},
- {kbase_device_timeline_init, kbase_device_timeline_term,
- "Timeline stream initialization failed"},
- {kbase_clk_rate_trace_manager_init,
- kbase_clk_rate_trace_manager_term,
- "Clock rate trace manager initialization failed"},
- {kbase_instr_backend_init, kbase_instr_backend_term,
- "Instrumentation backend initialization failed"},
- {kbase_device_hwcnt_backend_jm_init,
- kbase_device_hwcnt_backend_jm_term,
- "GPU hwcnt backend creation failed"},
- {kbase_device_hwcnt_context_init, kbase_device_hwcnt_context_term,
- "GPU hwcnt context initialization failed"},
- {kbase_device_hwcnt_virtualizer_init,
- kbase_device_hwcnt_virtualizer_term,
- "GPU hwcnt virtualizer initialization failed"},
- {kbase_device_vinstr_init, kbase_device_vinstr_term,
- "Virtual instrumentation initialization failed"},
- {kbase_backend_late_init, kbase_backend_late_term,
- "Late backend initialization failed"},
+ { assign_irqs, NULL, "IRQ search failed" },
+ { registers_map, registers_unmap, "Register map failed" },
+ { kbase_device_io_history_init, kbase_device_io_history_term,
+ "Register access history initialization failed" },
+ { kbase_device_pm_init, kbase_device_pm_term,
+ "Power management initialization failed" },
+ { kbase_device_early_init, kbase_device_early_term,
+ "Early device initialization failed" },
+ { kbase_device_populate_max_freq, NULL,
+ "Populating max frequency failed" },
+ { kbase_device_misc_init, kbase_device_misc_term,
+ "Miscellaneous device initialization failed" },
+ { kbase_device_pcm_dev_init, kbase_device_pcm_dev_term,
+ "Priority control manager initialization failed" },
+ { kbase_ctx_sched_init, kbase_ctx_sched_term,
+ "Context scheduler initialization failed" },
+ { kbase_mem_init, kbase_mem_term,
+ "Memory subsystem initialization failed" },
+ { kbase_device_coherency_init, NULL, "Device coherency init failed" },
+ { kbase_protected_mode_init, kbase_protected_mode_term,
+ "Protected mode subsystem initialization failed" },
+ { kbase_device_list_init, kbase_device_list_term,
+ "Device list setup failed" },
+ { kbasep_js_devdata_init, kbasep_js_devdata_term,
+ "Job JS devdata initialization failed" },
+ { kbase_device_timeline_init, kbase_device_timeline_term,
+ "Timeline stream initialization failed" },
+ { kbase_clk_rate_trace_manager_init, kbase_clk_rate_trace_manager_term,
+ "Clock rate trace manager initialization failed" },
+ { kbase_instr_backend_init, kbase_instr_backend_term,
+ "Instrumentation backend initialization failed" },
+ { kbase_device_hwcnt_backend_jm_init,
+ kbase_device_hwcnt_backend_jm_term,
+ "GPU hwcnt backend creation failed" },
+ { kbase_device_hwcnt_context_init, kbase_device_hwcnt_context_term,
+ "GPU hwcnt context initialization failed" },
+ { kbase_device_hwcnt_virtualizer_init,
+ kbase_device_hwcnt_virtualizer_term,
+ "GPU hwcnt virtualizer initialization failed" },
+ { kbase_device_vinstr_init, kbase_device_vinstr_term,
+ "Virtual instrumentation initialization failed" },
+ { kbase_backend_late_init, kbase_backend_late_term,
+ "Late backend initialization failed" },
#ifdef MALI_KBASE_BUILD
- {kbase_debug_job_fault_dev_init, kbase_debug_job_fault_dev_term,
- "Job fault debug initialization failed"},
- {kbase_device_debugfs_init, kbase_device_debugfs_term,
- "DebugFS initialization failed"},
+ { kbase_debug_job_fault_dev_init, kbase_debug_job_fault_dev_term,
+ "Job fault debug initialization failed" },
+ { kbase_device_debugfs_init, kbase_device_debugfs_term,
+ "DebugFS initialization failed" },
/* Sysfs init needs to happen before registering the device with
* misc_register(), otherwise it causes a race condition between
* registering the device and a uevent event being generated for
@@ -228,14 +218,15 @@ static const struct kbase_device_init dev_init[] = {
* paragraph that starts with "Word of warning", currently the
* second-last paragraph.
*/
- {kbase_sysfs_init, kbase_sysfs_term, "SysFS group creation failed"},
- {kbase_device_misc_register, kbase_device_misc_deregister,
- "Misc device registration failed"},
- {kbase_gpuprops_populate_user_buffer, kbase_gpuprops_free_user_buffer,
- "GPU property population failed"},
+ { kbase_sysfs_init, kbase_sysfs_term, "SysFS group creation failed" },
+ { kbase_device_misc_register, kbase_device_misc_deregister,
+ "Misc device registration failed" },
+ { kbase_gpuprops_populate_user_buffer, kbase_gpuprops_free_user_buffer,
+ "GPU property population failed" },
#endif
- {kbase_dummy_job_wa_load, kbase_dummy_job_wa_cleanup,
- "Dummy job workaround load failed"},
+ { NULL, kbase_dummy_job_wa_cleanup, NULL },
+ { kbase_device_late_init, kbase_device_late_term,
+ "Late device initialization failed" },
};
static void kbase_device_term_partial(struct kbase_device *kbdev,
@@ -266,13 +257,15 @@ int kbase_device_init(struct kbase_device *kbdev)
kbase_disjoint_init(kbdev);
for (i = 0; i < ARRAY_SIZE(dev_init); i++) {
- err = dev_init[i].init(kbdev);
- if (err) {
- if (err != -EPROBE_DEFER)
- dev_err(kbdev->dev, "%s error = %d\n",
+ if (dev_init[i].init) {
+ err = dev_init[i].init(kbdev);
+ if (err) {
+ if (err != -EPROBE_DEFER)
+ dev_err(kbdev->dev, "%s error = %d\n",
dev_init[i].err_mes, err);
- kbase_device_term_partial(kbdev, i);
- break;
+ kbase_device_term_partial(kbdev, i);
+ break;
+ }
}
}
@@ -295,3 +288,20 @@ int kbase_device_init(struct kbase_device *kbdev)
return err;
}
+
+int kbase_device_firmware_init_once(struct kbase_device *kbdev)
+{
+ int ret = 0;
+
+ mutex_lock(&kbdev->fw_load_lock);
+
+ if (!kbdev->dummy_job_wa_loaded) {
+ ret = kbase_dummy_job_wa_load(kbdev);
+ if (!ret)
+ kbdev->dummy_job_wa_loaded = true;
+ }
+
+ mutex_unlock(&kbdev->fw_load_lock);
+
+ return ret;
+}
diff --git a/mali_kbase/device/mali_kbase_device.c b/mali_kbase/device/mali_kbase_device.c
index 5e900d0..c4de6a0 100644
--- a/mali_kbase/device/mali_kbase_device.c
+++ b/mali_kbase/device/mali_kbase_device.c
@@ -30,6 +30,7 @@
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/types.h>
+#include <linux/oom.h>
#include <mali_kbase.h>
#include <mali_kbase_defs.h>
@@ -110,7 +111,7 @@ int kbase_device_pcm_dev_init(struct kbase_device *const kbdev)
{
int err = 0;
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
struct device_node *prio_ctrl_node;
/* Check to see whether or not a platform specific priority control manager
@@ -155,16 +156,70 @@ void kbase_device_pcm_dev_term(struct kbase_device *const kbdev)
module_put(kbdev->pcm_dev->owner);
}
+#define KBASE_PAGES_TO_KIB(pages) (((unsigned int)pages) << (PAGE_SHIFT - 10))
+
+/**
+ * mali_oom_notifier_handler - Mali driver out-of-memory handler
+ *
+ * @nb: notifier block - used to retrieve kbdev pointer
+ * @action: action (unused)
+ * @data: data pointer (unused)
+ * This function simply lists memory usage by the Mali driver, per GPU device,
+ * for diagnostic purposes.
+ */
+static int mali_oom_notifier_handler(struct notifier_block *nb,
+ unsigned long action, void *data)
+{
+ struct kbase_device *kbdev;
+ struct kbase_context *kctx = NULL;
+ unsigned long kbdev_alloc_total;
+
+ if (WARN_ON(nb == NULL))
+ return NOTIFY_BAD;
+
+ kbdev = container_of(nb, struct kbase_device, oom_notifier_block);
+
+ kbdev_alloc_total =
+ KBASE_PAGES_TO_KIB(atomic_read(&(kbdev->memdev.used_pages)));
+
+ dev_err(kbdev->dev, "OOM notifier: dev %s %lu kB\n", kbdev->devname,
+ kbdev_alloc_total);
+
+ mutex_lock(&kbdev->kctx_list_lock);
+
+ list_for_each_entry (kctx, &kbdev->kctx_list, kctx_list_link) {
+ struct pid *pid_struct;
+ struct task_struct *task;
+ unsigned long task_alloc_total =
+ KBASE_PAGES_TO_KIB(atomic_read(&(kctx->used_pages)));
+
+ rcu_read_lock();
+ pid_struct = find_get_pid(kctx->pid);
+ task = pid_task(pid_struct, PIDTYPE_PID);
+
+ dev_err(kbdev->dev,
+ "OOM notifier: tsk %s tgid (%u) pid (%u) %lu kB\n",
+ task ? task->comm : "[null task]", kctx->tgid,
+ kctx->pid, task_alloc_total);
+
+ put_pid(pid_struct);
+ rcu_read_unlock();
+ }
+
+ mutex_unlock(&kbdev->kctx_list_lock);
+ return NOTIFY_OK;
+}
+
int kbase_device_misc_init(struct kbase_device * const kbdev)
{
int err;
-#ifdef CONFIG_ARM64
+#if IS_ENABLED(CONFIG_ARM64)
struct device_node *np = NULL;
#endif /* CONFIG_ARM64 */
spin_lock_init(&kbdev->mmu_mask_change);
mutex_init(&kbdev->mmu_hw_mutex);
-#ifdef CONFIG_ARM64
+#if IS_ENABLED(CONFIG_ARM64)
kbdev->cci_snoop_enabled = false;
np = kbdev->dev->of_node;
if (np != NULL) {
@@ -243,8 +298,15 @@ int kbase_device_misc_init(struct kbase_device * const kbdev)
mutex_init(&kbdev->kctx_list_lock);
INIT_LIST_HEAD(&kbdev->kctx_list);
- spin_lock_init(&kbdev->hwaccess_lock);
+ dev_dbg(kbdev->dev, "Registering mali_oom_notifier_handlern");
+ kbdev->oom_notifier_block.notifier_call = mali_oom_notifier_handler;
+ err = register_oom_notifier(&kbdev->oom_notifier_block);
+ if (err) {
+ dev_err(kbdev->dev,
+ "Unable to register OOM notifier for Mali - but will continue\n");
+ kbdev->oom_notifier_block.notifier_call = NULL;
+ }
return 0;
term_as:
@@ -267,6 +329,9 @@ void kbase_device_misc_term(struct kbase_device *kbdev)
kbase_ktrace_term(kbdev);
kbase_device_all_as_term(kbdev);
+
+ if (kbdev->oom_notifier_block.notifier_call)
+ unregister_oom_notifier(&kbdev->oom_notifier_block);
}
void kbase_device_free(struct kbase_device *kbdev)
@@ -405,6 +470,10 @@ int kbase_device_early_init(struct kbase_device *kbdev)
/* We're done accessing the GPU registers for now. */
kbase_pm_register_access_disable(kbdev);
+ /* This spinlock has to be initialized before installing interrupt
+ * handlers that require to hold it to process interrupts.
+ */
+ spin_lock_init(&kbdev->hwaccess_lock);
#ifdef CONFIG_MALI_ARBITER_SUPPORT
if (kbdev->arb.arb_if)
err = kbase_arbiter_pm_install_interrupts(kbdev);
@@ -439,3 +508,17 @@ void kbase_device_early_term(struct kbase_device *kbdev)
kbase_pm_runtime_term(kbdev);
kbasep_platform_device_term(kbdev);
}
+
+int kbase_device_late_init(struct kbase_device *kbdev)
+{
+ int err;
+
+ err = kbasep_platform_device_late_init(kbdev);
+
+ return err;
+}
+
+void kbase_device_late_term(struct kbase_device *kbdev)
+{
+ kbasep_platform_device_late_term(kbdev);
+}
diff --git a/mali_kbase/device/mali_kbase_device.h b/mali_kbase/device/mali_kbase_device.h
index 3a774fc..9c6c66c 100644
--- a/mali_kbase/device/mali_kbase_device.h
+++ b/mali_kbase/device/mali_kbase_device.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -47,6 +47,19 @@ void kbase_device_put_list(const struct list_head *dev_list);
void kbase_increment_device_id(void);
/**
+ * kbase_device_firmware_init_once - Initialize firmware and HWC
+ *
+ * @kbdev: An instance of the GPU platform device, allocated from the probe
+ * method of the driver.
+ *
+ * When a device file is opened for the first time,
+ * load firmware and initialize hardware counter components.
+ *
+ * @return 0 on success. An error code on failure.
+ */
+int kbase_device_firmware_init_once(struct kbase_device *kbdev);
+
+/**
* kbase_device_init - Device initialisation.
*
* This is called from device probe to initialise various other
diff --git a/mali_kbase/device/mali_kbase_device_hw.c b/mali_kbase/device/mali_kbase_device_hw.c
index 5ea2890..a5d41d3 100644
--- a/mali_kbase/device/mali_kbase_device_hw.c
+++ b/mali_kbase/device/mali_kbase_device_hw.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014-2016, 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2016, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -27,7 +27,7 @@
#include <mali_kbase_reset_gpu.h>
#include <mmu/mali_kbase_mmu.h>
-#if !defined(CONFIG_MALI_NO_MALI)
+#if !IS_ENABLED(CONFIG_MALI_NO_MALI)
void kbase_reg_write(struct kbase_device *kbdev, u32 offset, u32 value)
{
KBASE_DEBUG_ASSERT(kbdev->pm.backend.gpu_powered);
@@ -35,7 +35,7 @@ void kbase_reg_write(struct kbase_device *kbdev, u32 offset, u32 value)
writel(value, kbdev->reg + offset);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
if (unlikely(kbdev->io_history.enabled))
kbase_io_history_add(&kbdev->io_history, kbdev->reg + offset,
value, 1);
@@ -54,7 +54,7 @@ u32 kbase_reg_read(struct kbase_device *kbdev, u32 offset)
val = readl(kbdev->reg + offset);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
if (unlikely(kbdev->io_history.enabled))
kbase_io_history_add(&kbdev->io_history, kbdev->reg + offset,
val, 0);
@@ -74,7 +74,7 @@ bool kbase_is_gpu_removed(struct kbase_device *kbdev)
return val == 0;
}
-#endif /* !defined(CONFIG_MALI_NO_MALI) */
+#endif /* !IS_ENABLED(CONFIG_MALI_NO_MALI) */
void kbase_gpu_start_cache_clean_nolock(struct kbase_device *kbdev)
{
diff --git a/mali_kbase/device/mali_kbase_device_internal.h b/mali_kbase/device/mali_kbase_device_internal.h
index 067f33c..e5c4bf9 100644
--- a/mali_kbase/device/mali_kbase_device_internal.h
+++ b/mali_kbase/device/mali_kbase_device_internal.h
@@ -72,3 +72,17 @@ int kbase_device_early_init(struct kbase_device *kbdev);
* @kbdev: Device pointer
*/
void kbase_device_early_term(struct kbase_device *kbdev);
+
+/**
+ * kbase_device_late_init - Complete any device-specific initialization.
+ * @kbdev: Device pointer
+ *
+ * Return: 0 on success, or an error code on failure.
+ */
+int kbase_device_late_init(struct kbase_device *kbdev);
+
+/**
+ * kbase_device_late_term - Complete any device-specific termination.
+ * @kbdev: Device pointer
+ */
+void kbase_device_late_term(struct kbase_device *kbdev);
diff --git a/mali_kbase/tests/kutf/Kconfig b/mali_kbase/gpu/Kbuild
index 7ea95b6..621f4e0 100644
--- a/mali_kbase/tests/kutf/Kconfig
+++ b/mali_kbase/gpu/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2012, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,9 +18,10 @@
#
#
-config MALI_KUTF
- tristate "Mali Kernel Unit Test Framework"
- default m
- help
- Enables MALI testing framework. To compile it as a module,
- choose M here - this will generate a single module called kutf.
+mali_kbase-y += gpu/mali_kbase_gpu.o
+
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ mali_kbase-y += gpu/backend/mali_kbase_gpu_fault_csf.o
+else
+ mali_kbase-y += gpu/backend/mali_kbase_gpu_fault_jm.o
+endif
diff --git a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c
index 16eae0a..949f55e 100644
--- a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c
+++ b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_csf.c
@@ -21,7 +21,7 @@
#include <mali_kbase.h>
#include <uapi/gpu/arm/midgard/csf/mali_gpu_csf_registers.h>
-#include "../mali_kbase_gpu_fault.h"
+#include <gpu/mali_kbase_gpu_fault.h>
const char *kbase_gpu_exception_name(u32 const exception_code)
{
diff --git a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c
index 110e5b3..1931a50 100644
--- a/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c
+++ b/mali_kbase/gpu/backend/mali_kbase_gpu_fault_jm.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -21,7 +21,7 @@
#include <mali_kbase.h>
-#include "../mali_kbase_gpu_fault.h"
+#include <gpu/mali_kbase_gpu_fault.h>
const char *kbase_gpu_exception_name(u32 const exception_code)
{
diff --git a/mali_kbase/gpu/mali_kbase_gpu.c b/mali_kbase/gpu/mali_kbase_gpu.c
index 92aa593..91a126a 100644
--- a/mali_kbase/gpu/mali_kbase_gpu.c
+++ b/mali_kbase/gpu/mali_kbase_gpu.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/ipa/Kbuild b/mali_kbase/ipa/Kbuild
index 287f797..3139431 100644
--- a/mali_kbase/ipa/Kbuild
+++ b/mali_kbase/ipa/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2016-2018, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2016-2018, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,17 +19,17 @@
#
mali_kbase-y += \
- ipa/mali_kbase_ipa_simple.o \
- ipa/mali_kbase_ipa.o
+ ipa/mali_kbase_ipa_simple.o \
+ ipa/mali_kbase_ipa.o
mali_kbase-$(CONFIG_DEBUG_FS) += ipa/mali_kbase_ipa_debugfs.o
ifeq ($(MALI_USE_CSF),1)
- mali_kbase-y += \
- ipa/backend/mali_kbase_ipa_counter_csf.o \
- ipa/backend/mali_kbase_ipa_counter_common_csf.o
+ mali_kbase-y += \
+ ipa/backend/mali_kbase_ipa_counter_csf.o \
+ ipa/backend/mali_kbase_ipa_counter_common_csf.o
else
- mali_kbase-y += \
- ipa/backend/mali_kbase_ipa_counter_jm.o \
- ipa/backend/mali_kbase_ipa_counter_common_jm.o
-endif \ No newline at end of file
+ mali_kbase-y += \
+ ipa/backend/mali_kbase_ipa_counter_jm.o \
+ ipa/backend/mali_kbase_ipa_counter_common_jm.o
+endif
diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c
index 89bba49..24713d5 100644
--- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c
+++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h
index 8e29931..10c1d22 100644
--- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h
+++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_csf.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c
index 076dcd0..bc4139c 100644
--- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c
+++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2017-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h
index 24602be..0ad05d1 100644
--- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h
+++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_common_jm.h
@@ -41,7 +41,8 @@
struct kbase_ipa_model_vinstr_data;
-typedef u32 (*kbase_ipa_get_active_cycles_callback)(struct kbase_ipa_model_vinstr_data *);
+typedef u32
+kbase_ipa_get_active_cycles_callback(struct kbase_ipa_model_vinstr_data *);
/**
* struct kbase_ipa_model_vinstr_data - IPA context per device
@@ -73,7 +74,7 @@ struct kbase_ipa_model_vinstr_data {
s32 group_values[KBASE_IPA_MAX_GROUP_DEF_NUM];
const struct kbase_ipa_group *groups_def;
size_t groups_def_num;
- kbase_ipa_get_active_cycles_callback get_active_cycles;
+ kbase_ipa_get_active_cycles_callback *get_active_cycles;
struct kbase_hwcnt_virtualizer_client *hvirt_cli;
struct kbase_hwcnt_dump_buffer dump_buf;
s32 reference_voltage;
@@ -215,7 +216,7 @@ void kbase_ipa_vinstr_reset_data(struct kbase_ipa_model *model);
int kbase_ipa_vinstr_common_model_init(struct kbase_ipa_model *model,
const struct kbase_ipa_group *ipa_groups_def,
size_t ipa_group_size,
- kbase_ipa_get_active_cycles_callback get_active_cycles,
+ kbase_ipa_get_active_cycles_callback *get_active_cycles,
s32 reference_voltage);
/**
diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c
index 9326b01..2afe9b4 100644
--- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c
+++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_csf.c
@@ -24,11 +24,15 @@
/* MEMSYS counter block offsets */
#define L2_RD_MSG_IN (16)
+#define L2_WR_MSG_IN (18)
+#define L2_READ_LOOKUP (26)
#define L2_EXT_WRITE_NOSNP_FULL (43)
/* SC counter block offsets */
#define FRAG_QUADS_EZS_UPDATE (13)
+#define FULL_QUAD_WARPS (21)
#define EXEC_INSTR_FMA (27)
+#define EXEC_INSTR_CVT (28)
#define TEX_FILT_NUM_OPS (39)
#define LS_MEM_READ_SHORT (45)
#define LS_MEM_WRITE_SHORT (47)
@@ -38,6 +42,7 @@
#define IDVS_POS_SHAD_STALL (23)
#define PREFETCH_STALL (25)
#define VFETCH_POS_READ_WAIT (29)
+#define VFETCH_VERTEX_WAIT (30)
#define IDVS_VAR_SHAD_STALL (38)
#define COUNTER_DEF(cnt_name, coeff, cnt_idx, block_type) \
@@ -60,9 +65,9 @@
#define TILER_COUNTER_DEF(cnt_name, coeff, cnt_idx) \
COUNTER_DEF(cnt_name, coeff, cnt_idx, KBASE_IPA_CORE_TYPE_TILER)
-/* Table of description of HW counters used by IPA counter model.
+/* Tables of description of HW counters used by IPA counter model.
*
- * This table provides a description of each performance counter
+ * These tables provide a description of each performance counter
* used by the top level counter model for energy estimation.
*/
static const struct kbase_ipa_counter ipa_top_level_cntrs_def_todx[] = {
@@ -75,10 +80,11 @@ static const struct kbase_ipa_counter ipa_top_level_cntrs_def_todx[] = {
TILER_COUNTER_DEF("vfetch_pos_read_wait", -119118, VFETCH_POS_READ_WAIT),
};
- /* This table provides a description of each performance counter
+
+/* These tables provide a description of each performance counter
* used by the shader cores counter model for energy estimation.
*/
- static const struct kbase_ipa_counter ipa_shader_core_cntrs_def_todx[] = {
+static const struct kbase_ipa_counter ipa_shader_core_cntrs_def_todx[] = {
SC_COUNTER_DEF("exec_instr_fma", 505449, EXEC_INSTR_FMA),
SC_COUNTER_DEF("tex_filt_num_operations", 574869, TEX_FILT_NUM_OPS),
SC_COUNTER_DEF("ls_mem_read_short", 60917, LS_MEM_READ_SHORT),
@@ -87,6 +93,7 @@ static const struct kbase_ipa_counter ipa_top_level_cntrs_def_todx[] = {
SC_COUNTER_DEF("vary_slot_16", 181069, VARY_SLOT_16),
};
+
#define IPA_POWER_MODEL_OPS(gpu, init_token) \
const struct kbase_ipa_model_ops kbase_ ## gpu ## _ipa_model_ops = { \
.name = "mali-" #gpu "-power-model", \
@@ -122,12 +129,12 @@ static const struct kbase_ipa_counter ipa_top_level_cntrs_def_todx[] = {
*/
STANDARD_POWER_MODEL(todx, 750);
+
/* Assuming LODX is an alias of TODX for IPA */
ALIAS_POWER_MODEL(lodx, todx);
static const struct kbase_ipa_model_ops *ipa_counter_model_ops[] = {
- &kbase_todx_ipa_model_ops,
- &kbase_lodx_ipa_model_ops
+ &kbase_todx_ipa_model_ops, &kbase_lodx_ipa_model_ops,
};
const struct kbase_ipa_model_ops *kbase_ipa_counter_model_ops_find(
diff --git a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c
index 00c0f60..b0cd360 100644
--- a/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c
+++ b/mali_kbase/ipa/backend/mali_kbase_ipa_counter_jm.c
@@ -23,9 +23,7 @@
#include "mali_kbase_ipa_counter_common_jm.h"
#include "mali_kbase.h"
-#ifdef CONFIG_MALI_NO_MALI
-#include <backend/gpu/mali_kbase_model_dummy.h>
-#endif
+
/* Performance counter blocks base offsets */
#define JM_BASE (0 * KBASE_IPA_NR_BYTES_PER_BLOCK)
@@ -96,15 +94,9 @@ static u32 kbase_g7x_power_model_get_memsys_counter(struct kbase_ipa_model_vinst
static u32 kbase_g7x_power_model_get_sc_counter(struct kbase_ipa_model_vinstr_data *model_data,
u32 counter_block_offset)
{
-#ifdef CONFIG_MALI_NO_MALI
- const u32 sc_base = MEMSYS_BASE +
- (KBASE_DUMMY_MODEL_MAX_MEMSYS_BLOCKS *
- KBASE_IPA_NR_BYTES_PER_BLOCK);
-#else
const u32 sc_base = MEMSYS_BASE +
(model_data->kbdev->gpu_props.props.l2_props.num_l2_slices *
KBASE_IPA_NR_BYTES_PER_BLOCK);
-#endif
return sc_base + counter_block_offset;
}
diff --git a/mali_kbase/ipa/mali_kbase_ipa.c b/mali_kbase/ipa/mali_kbase_ipa.c
index 180dcb9..2d2d0c3 100644
--- a/mali_kbase/ipa/mali_kbase_ipa.c
+++ b/mali_kbase/ipa/mali_kbase_ipa.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2016-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2016-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -537,7 +537,6 @@ static void opp_translate_freq_voltage(struct kbase_device *kbdev,
unsigned long *freqs,
unsigned long *volts)
{
-#ifndef CONFIG_MALI_NO_MALI
u64 core_mask;
kbase_devfreq_opp_translate(kbdev, nominal_freq, &core_mask,
@@ -550,16 +549,6 @@ static void opp_translate_freq_voltage(struct kbase_device *kbdev,
volts[KBASE_IPA_BLOCK_TYPE_SHADER_CORES] =
volts[KBASE_IPA_BLOCK_TYPE_TOP_LEVEL];
}
-#else
- /* An arbitrary voltage and frequency value can be chosen for testing
- * in no mali configuration which may not match with any OPP level.
- */
- freqs[KBASE_IPA_BLOCK_TYPE_TOP_LEVEL] = nominal_freq;
- volts[KBASE_IPA_BLOCK_TYPE_TOP_LEVEL] = nominal_voltage;
-
- freqs[KBASE_IPA_BLOCK_TYPE_SHADER_CORES] = nominal_freq;
- volts[KBASE_IPA_BLOCK_TYPE_SHADER_CORES] = nominal_voltage;
-#endif
}
#if KERNEL_VERSION(5, 10, 0) > LINUX_VERSION_CODE
diff --git a/mali_kbase/ipa/mali_kbase_ipa.h b/mali_kbase/ipa/mali_kbase_ipa.h
index 006b31c..f53f95f 100644
--- a/mali_kbase/ipa/mali_kbase_ipa.h
+++ b/mali_kbase/ipa/mali_kbase_ipa.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2016-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2016-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/ipa/mali_kbase_ipa_debugfs.c b/mali_kbase/ipa/mali_kbase_ipa_debugfs.c
index 2672146..017aa08 100644
--- a/mali_kbase/ipa/mali_kbase_ipa_debugfs.c
+++ b/mali_kbase/ipa/mali_kbase_ipa_debugfs.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2017-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/ipa/mali_kbase_ipa_debugfs.h b/mali_kbase/ipa/mali_kbase_ipa_debugfs.h
index 189b43c..a85b39a 100644
--- a/mali_kbase/ipa/mali_kbase_ipa_debugfs.h
+++ b/mali_kbase/ipa/mali_kbase_ipa_debugfs.h
@@ -27,7 +27,7 @@ enum kbase_ipa_model_param_type {
PARAM_TYPE_STRING,
};
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
void kbase_ipa_debugfs_init(struct kbase_device *kbdev);
int kbase_ipa_model_param_add(struct kbase_ipa_model *model, const char *name,
diff --git a/mali_kbase/ipa/mali_kbase_ipa_simple.c b/mali_kbase/ipa/mali_kbase_ipa_simple.c
index 55d44e9..3664e6d 100644
--- a/mali_kbase/ipa/mali_kbase_ipa_simple.c
+++ b/mali_kbase/ipa/mali_kbase_ipa_simple.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2016-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2016-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -21,7 +21,7 @@
#include <uapi/linux/thermal.h>
#include <linux/thermal.h>
-#ifdef CONFIG_DEVFREQ_THERMAL
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
#include <linux/devfreq_cooling.h>
#endif
#include <linux/of.h>
diff --git a/mali_kbase/ipa/mali_kbase_ipa_simple.h b/mali_kbase/ipa/mali_kbase_ipa_simple.h
index c338b01..c71891a 100644
--- a/mali_kbase/ipa/mali_kbase_ipa_simple.h
+++ b/mali_kbase/ipa/mali_kbase_ipa_simple.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/jm/mali_kbase_jm_defs.h b/mali_kbase/jm/mali_kbase_jm_defs.h
index 0dd5035..2e22af1 100644
--- a/mali_kbase/jm/mali_kbase_jm_defs.h
+++ b/mali_kbase/jm/mali_kbase_jm_defs.h
@@ -134,7 +134,7 @@
/* Reset the GPU after each atom completion */
#define KBASE_SERIALIZE_RESET (1 << 2)
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* struct base_job_fault_event - keeps track of the atom which faulted or which
* completed after the faulty atom but before the
@@ -610,7 +610,7 @@ struct kbase_jd_atom {
wait_queue_head_t completed;
enum kbase_jd_atom_state status;
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
int work_id;
#endif
int slot_nr;
@@ -635,7 +635,7 @@ struct kbase_jd_atom {
u32 flush_id;
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
struct base_job_fault_event fault_event;
#endif
struct list_head queue;
@@ -807,7 +807,7 @@ struct kbase_jd_context {
u32 job_nr;
size_t tb_wrap_offset;
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
atomic_t work_id;
#endif
diff --git a/mali_kbase/jm/mali_kbase_js_defs.h b/mali_kbase/jm/mali_kbase_js_defs.h
index 183f0b0..095a042 100644
--- a/mali_kbase/jm/mali_kbase_js_defs.h
+++ b/mali_kbase/jm/mali_kbase_js_defs.h
@@ -37,8 +37,8 @@ typedef u32 kbase_context_flags;
* typedef kbasep_js_ctx_job_cb - Callback function run on all of a context's
* jobs registered with the Job Scheduler
*/
-typedef void (*kbasep_js_ctx_job_cb)(struct kbase_device *kbdev,
- struct kbase_jd_atom *katom);
+typedef void kbasep_js_ctx_job_cb(struct kbase_device *kbdev,
+ struct kbase_jd_atom *katom);
/*
* @brief Maximum number of jobs that can be submitted to a job slot whilst
diff --git a/mali_kbase/mali_base_hwconfig_features.h b/mali_kbase/mali_base_hwconfig_features.h
index bdc769f..58bf5fd 100644
--- a/mali_kbase/mali_base_hwconfig_features.h
+++ b/mali_kbase/mali_base_hwconfig_features.h
@@ -386,5 +386,59 @@ static const enum base_hw_feature base_hw_features_tODx[] = {
BASE_HW_FEATURE_END
};
+static const enum base_hw_feature base_hw_features_tGRx[] = {
+ BASE_HW_FEATURE_JOBCHAIN_DISAMBIGUATION,
+ BASE_HW_FEATURE_PWRON_DURING_PWROFF_TRANS,
+ BASE_HW_FEATURE_XAFFINITY,
+ BASE_HW_FEATURE_WARPING,
+ BASE_HW_FEATURE_INTERPIPE_REG_ALIASING,
+ BASE_HW_FEATURE_32_BIT_UNIFORM_ADDRESS,
+ BASE_HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL,
+ BASE_HW_FEATURE_BRNDOUT_CC,
+ BASE_HW_FEATURE_BRNDOUT_KILL,
+ BASE_HW_FEATURE_LD_ST_LEA_TEX,
+ BASE_HW_FEATURE_LD_ST_TILEBUFFER,
+ BASE_HW_FEATURE_LINEAR_FILTER_FLOAT,
+ BASE_HW_FEATURE_MRT,
+ BASE_HW_FEATURE_MSAA_16X,
+ BASE_HW_FEATURE_NEXT_INSTRUCTION_TYPE,
+ BASE_HW_FEATURE_OUT_OF_ORDER_EXEC,
+ BASE_HW_FEATURE_T7XX_PAIRING_RULES,
+ BASE_HW_FEATURE_TEST4_DATUM_MODE,
+ BASE_HW_FEATURE_FLUSH_REDUCTION,
+ BASE_HW_FEATURE_PROTECTED_DEBUG_MODE,
+ BASE_HW_FEATURE_COHERENCY_REG,
+ BASE_HW_FEATURE_L2_CONFIG,
+ BASE_HW_FEATURE_CLEAN_ONLY_SAFE,
+ BASE_HW_FEATURE_END
+};
+
+static const enum base_hw_feature base_hw_features_tVAx[] = {
+ BASE_HW_FEATURE_JOBCHAIN_DISAMBIGUATION,
+ BASE_HW_FEATURE_PWRON_DURING_PWROFF_TRANS,
+ BASE_HW_FEATURE_XAFFINITY,
+ BASE_HW_FEATURE_WARPING,
+ BASE_HW_FEATURE_INTERPIPE_REG_ALIASING,
+ BASE_HW_FEATURE_32_BIT_UNIFORM_ADDRESS,
+ BASE_HW_FEATURE_ATTR_AUTO_TYPE_INFERRAL,
+ BASE_HW_FEATURE_BRNDOUT_CC,
+ BASE_HW_FEATURE_BRNDOUT_KILL,
+ BASE_HW_FEATURE_LD_ST_LEA_TEX,
+ BASE_HW_FEATURE_LD_ST_TILEBUFFER,
+ BASE_HW_FEATURE_LINEAR_FILTER_FLOAT,
+ BASE_HW_FEATURE_MRT,
+ BASE_HW_FEATURE_MSAA_16X,
+ BASE_HW_FEATURE_NEXT_INSTRUCTION_TYPE,
+ BASE_HW_FEATURE_OUT_OF_ORDER_EXEC,
+ BASE_HW_FEATURE_T7XX_PAIRING_RULES,
+ BASE_HW_FEATURE_TEST4_DATUM_MODE,
+ BASE_HW_FEATURE_FLUSH_REDUCTION,
+ BASE_HW_FEATURE_PROTECTED_DEBUG_MODE,
+ BASE_HW_FEATURE_COHERENCY_REG,
+ BASE_HW_FEATURE_L2_CONFIG,
+ BASE_HW_FEATURE_CLEAN_ONLY_SAFE,
+ BASE_HW_FEATURE_END
+};
+
#endif /* _BASE_HWCONFIG_FEATURES_H_ */
diff --git a/mali_kbase/mali_base_hwconfig_issues.h b/mali_kbase/mali_base_hwconfig_issues.h
index a61eeb2..8912002 100644
--- a/mali_kbase/mali_base_hwconfig_issues.h
+++ b/mali_kbase/mali_base_hwconfig_issues.h
@@ -607,5 +607,35 @@ static const enum base_hw_issue base_hw_issues_model_tODx[] = {
BASE_HW_ISSUE_END
};
+static const enum base_hw_issue base_hw_issues_tGRx_r0p0[] = {
+ BASE_HW_ISSUE_9435,
+ BASE_HW_ISSUE_TSIX_2033,
+ BASE_HW_ISSUE_TTRX_1337,
+ BASE_HW_ISSUE_END
+};
+
+static const enum base_hw_issue base_hw_issues_model_tGRx[] = {
+ BASE_HW_ISSUE_5736,
+ BASE_HW_ISSUE_9435,
+ BASE_HW_ISSUE_TSIX_2033,
+ BASE_HW_ISSUE_TTRX_1337,
+ BASE_HW_ISSUE_END
+};
+
+static const enum base_hw_issue base_hw_issues_tVAx_r0p0[] = {
+ BASE_HW_ISSUE_9435,
+ BASE_HW_ISSUE_TSIX_2033,
+ BASE_HW_ISSUE_TTRX_1337,
+ BASE_HW_ISSUE_END
+};
+
+static const enum base_hw_issue base_hw_issues_model_tVAx[] = {
+ BASE_HW_ISSUE_5736,
+ BASE_HW_ISSUE_9435,
+ BASE_HW_ISSUE_TSIX_2033,
+ BASE_HW_ISSUE_TTRX_1337,
+ BASE_HW_ISSUE_END
+};
+
#endif /* _BASE_HWCONFIG_ISSUES_H_ */
diff --git a/mali_kbase/mali_kbase.h b/mali_kbase/mali_kbase.h
index afa2018..ac05c90 100644
--- a/mali_kbase/mali_kbase.h
+++ b/mali_kbase/mali_kbase.h
@@ -79,7 +79,7 @@
#include "ipa/mali_kbase_ipa.h"
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
#include <trace/events/gpu.h>
#endif
@@ -201,7 +201,7 @@ void kbase_device_pm_term(struct kbase_device *kbdev);
int power_control_init(struct kbase_device *kbdev);
void power_control_term(struct kbase_device *kbdev);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
void kbase_device_debugfs_term(struct kbase_device *kbdev);
int kbase_device_debugfs_init(struct kbase_device *kbdev);
#else /* CONFIG_DEBUG_FS */
diff --git a/mali_kbase/mali_kbase_as_fault_debugfs.c b/mali_kbase/mali_kbase_as_fault_debugfs.c
index e6aaaf1..919af1d 100644
--- a/mali_kbase/mali_kbase_as_fault_debugfs.c
+++ b/mali_kbase/mali_kbase_as_fault_debugfs.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2016-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2016-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -25,7 +25,7 @@
#include <mali_kbase_as_fault_debugfs.h>
#include <device/mali_kbase_device.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#ifdef CONFIG_MALI_DEBUG
static int kbase_as_fault_read(struct seq_file *sfile, void *data)
@@ -79,7 +79,7 @@ static const struct file_operations as_fault_fops = {
*/
void kbase_as_fault_debugfs_init(struct kbase_device *kbdev)
{
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#ifdef CONFIG_MALI_DEBUG
uint i;
char as_name[64];
diff --git a/mali_kbase/mali_kbase_as_fault_debugfs.h b/mali_kbase/mali_kbase_as_fault_debugfs.h
index b03884b..80cf350 100644
--- a/mali_kbase/mali_kbase_as_fault_debugfs.h
+++ b/mali_kbase/mali_kbase_as_fault_debugfs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2016, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2016, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -38,7 +38,7 @@ void kbase_as_fault_debugfs_init(struct kbase_device *kbdev);
static inline void
kbase_as_fault_debugfs_new(struct kbase_device *kbdev, int as_no)
{
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#ifdef CONFIG_MALI_DEBUG
kbdev->debugfs_as_read_bitmap |= (1ULL << as_no);
#endif /* CONFIG_DEBUG_FS */
diff --git a/mali_kbase/mali_kbase_bits.h b/mali_kbase/mali_kbase_bits.h
index 6f6dba1..7dc1e25 100644
--- a/mali_kbase/mali_kbase_bits.h
+++ b/mali_kbase/mali_kbase_bits.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_cache_policy.c b/mali_kbase/mali_kbase_cache_policy.c
index 7f266aa..8261685 100644
--- a/mali_kbase/mali_kbase_cache_policy.c
+++ b/mali_kbase/mali_kbase_cache_policy.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2012-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_ccswe.c b/mali_kbase/mali_kbase_ccswe.c
index 624482a..b61ee06 100644
--- a/mali_kbase/mali_kbase_ccswe.c
+++ b/mali_kbase/mali_kbase_ccswe.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_ccswe.h b/mali_kbase/mali_kbase_ccswe.h
index 5c440b8..13ebe36 100644
--- a/mali_kbase/mali_kbase_ccswe.h
+++ b/mali_kbase/mali_kbase_ccswe.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_config.c b/mali_kbase/mali_kbase_config.c
index 98b6c35..ea841f7 100644
--- a/mali_kbase/mali_kbase_config.c
+++ b/mali_kbase/mali_kbase_config.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2011-2015, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2015, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -43,6 +43,27 @@ void kbasep_platform_device_term(struct kbase_device *kbdev)
platform_funcs_p->platform_term_func(kbdev);
}
+int kbasep_platform_device_late_init(struct kbase_device *kbdev)
+{
+ struct kbase_platform_funcs_conf *platform_funcs_p;
+
+ platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
+ if (platform_funcs_p && platform_funcs_p->platform_late_init_func)
+ platform_funcs_p->platform_late_init_func(kbdev);
+
+ return 0;
+}
+
+void kbasep_platform_device_late_term(struct kbase_device *kbdev)
+{
+ struct kbase_platform_funcs_conf *platform_funcs_p;
+
+ platform_funcs_p = (struct kbase_platform_funcs_conf *)PLATFORM_FUNCS;
+ if (platform_funcs_p && platform_funcs_p->platform_late_term_func)
+ platform_funcs_p->platform_late_term_func(kbdev);
+}
+
+#if !MALI_USE_CSF
int kbasep_platform_context_init(struct kbase_context *kctx)
{
struct kbase_platform_funcs_conf *platform_funcs_p;
@@ -80,3 +101,4 @@ void kbasep_platform_event_atom_complete(struct kbase_jd_atom *katom)
if (platform_funcs_p && platform_funcs_p->platform_handler_atom_complete_func)
platform_funcs_p->platform_handler_atom_complete_func(katom);
}
+#endif
diff --git a/mali_kbase/mali_kbase_config.h b/mali_kbase/mali_kbase_config.h
index 549df78..cb11ee2 100644
--- a/mali_kbase/mali_kbase_config.h
+++ b/mali_kbase/mali_kbase_config.h
@@ -28,20 +28,23 @@
#include <linux/mm.h>
#include <mali_malisw.h>
-#include <mali_kbase_backend_config.h>
+#include <backend/gpu/mali_kbase_backend_config.h>
#include <linux/rbtree.h>
/* Forward declaration of struct kbase_device */
struct kbase_device;
+#if !MALI_USE_CSF
/* Forward declaration of struct kbase_context */
struct kbase_context;
/* Forward declaration of struct kbase_atom */
struct kbase_jd_atom;
+#endif
/**
- * struct kbase_platform_funcs_conf - Specifies platform init/term function pointers
+ * struct kbase_platform_funcs_conf - Specifies platform integration function
+ * pointers for DDK events such as device init and term.
*
* Specifies the functions pointers for platform specific initialization and
* termination as well as other events. By default no functions are required.
@@ -75,8 +78,36 @@ struct kbase_platform_funcs_conf {
* can be accessed (and possibly terminated) in here.
*/
void (*platform_term_func)(struct kbase_device *kbdev);
+
/**
- * platform_handler_context_init_func - platform specific handler for
+ * @platform_late_init_func: platform specific late init function pointer
+ * @kbdev - kbase_device pointer
+ *
+ * Function pointer to inform that the kbase driver initialization completed
+ * or NULL if no such function is required. At this point the GPU driver will be
+ * fully initialized.
+ *
+ * The platform specific private pointer kbase_device::platform_context
+ * can be accessed (and possibly terminated) in here.
+ */
+ int (*platform_late_init_func)(struct kbase_device *kbdev);
+
+ /**
+ * @platform_late_term_func: platform specific late termination function pointer
+ * @kbdev - kbase_device pointer
+ *
+ * Function pointer for platform specific termination or NULL if no
+ * termination function is required. At this point the GPU driver will complete
+ * termination process
+ *
+ * The platform specific private pointer kbase_device::platform_context
+ * can be accessed (and possibly terminated) in here.
+ */
+ void (*platform_late_term_func)(struct kbase_device *kbdev);
+
+#if !MALI_USE_CSF
+ /**
+ * @platform_handler_context_init_func: platform specific handler for
* when a new kbase_context is created.
* @kctx - kbase_context pointer
*
@@ -88,7 +119,7 @@ struct kbase_platform_funcs_conf {
*/
int (*platform_handler_context_init_func)(struct kbase_context *kctx);
/**
- * platform_handler_context_term_func - platform specific handler for
+ * @platform_handler_context_term_func: platform specific handler for
* when a kbase_context is terminated.
* @kctx - kbase_context pointer
*
@@ -98,7 +129,7 @@ struct kbase_platform_funcs_conf {
*/
void (*platform_handler_context_term_func)(struct kbase_context *kctx);
/**
- * platform_handler_atom_submit_func - platform specific handler for
+ * @platform_handler_atom_submit_func: platform specific handler for
* when a kbase_jd_atom is submitted.
* @katom - kbase_jd_atom pointer
*
@@ -111,7 +142,7 @@ struct kbase_platform_funcs_conf {
*/
void (*platform_handler_atom_submit_func)(struct kbase_jd_atom *katom);
/**
- * platform_handler_atom_complete_func - platform specific handler for
+ * @platform_handler_atom_complete_func: platform specific handler for
* when a kbase_jd_atom completes.
* @katom - kbase_jd_atom pointer
*
@@ -122,7 +153,9 @@ struct kbase_platform_funcs_conf {
* Context: The caller must hold the hwaccess_lock. Function must be
* runnable in an interrupt context.
*/
- void (*platform_handler_atom_complete_func)(struct kbase_jd_atom *katom);
+ void (*platform_handler_atom_complete_func)(
+ struct kbase_jd_atom *katom);
+#endif
};
/*
@@ -266,8 +299,8 @@ struct kbase_pm_callback_conf {
* and such alignment should be maintained.
*
* @gpu_clk_handle: Handle of the GPU clock for which notifier was registered.
- * @old_rate: Previous rate of this GPU clock.
- * @new_rate: New rate of this GPU clock.
+ * @old_rate: Previous rate of this GPU clock in Hz.
+ * @new_rate: New rate of this GPU clock in Hz.
*/
struct kbase_gpu_clk_notifier_data {
void *gpu_clk_handle;
@@ -341,7 +374,7 @@ struct kbase_clk_rate_trace_op_conf {
void *gpu_clk_handle, struct notifier_block *nb);
};
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
struct kbase_platform_config {
};
#else
@@ -403,9 +436,37 @@ int kbasep_platform_device_init(struct kbase_device *kbdev);
void kbasep_platform_device_term(struct kbase_device *kbdev);
/**
+ * kbasep_platform_device_late_init: - Platform specific call to finish hardware
+ * initialization
+ * @kbdev: kbase device pointer
+ *
+ * Function calls a platform defined routine if specified in the configuration
+ * attributes. The routine can initialize any hardware and context state that
+ * is required for the GPU block to function.
+ *
+ * Return: 0 if no errors have been found in the config.
+ * Negative error code otherwise.
+ */
+int kbasep_platform_device_late_init(struct kbase_device *kbdev);
+
+/**
+ * kbasep_platform_device_late_term - Platform specific call to finish hardware
+ * termination
+ * @kbdev: Kbase device pointer
+ *
+ * Function calls a platform defined routine if specified in the configuration
+ * attributes. The routine can destroy any platform specific context state and
+ * shut down any hardware functionality that are outside of the Power Management
+ * callbacks.
+ *
+ */
+void kbasep_platform_device_late_term(struct kbase_device *kbdev);
+
+#if !MALI_USE_CSF
+/**
* kbasep_platform_context_init - Platform specific callback when a kernel
- * context is created
- * @kctx - kbase_context pointer
+ * context is created
+ * @kctx: kbase_context pointer
*
* Function calls a platform defined routine if specified in the configuration
* attributes. The routine can initialize any per kernel context structures
@@ -417,7 +478,8 @@ int kbasep_platform_context_init(struct kbase_context *kctx);
/**
* kbasep_platform_context_term - Platform specific callback when a kernel
- * context is terminated
+ * context is terminated
+ * @kctx: kbase_context pointer
*
* Function calls a platform defined routine if specified in the configuration
* attributes. The routine should terminate any per kernel context structures
@@ -427,9 +489,9 @@ int kbasep_platform_context_init(struct kbase_context *kctx);
void kbasep_platform_context_term(struct kbase_context *kctx);
/**
- * kbasep_platform_event_atom_submit - Platform specific callback when an atom is
- * submitted to the GPU
- * @katom - kbase_jd_atom pointer
+ * kbasep_platform_event_atom_submit - Platform specific callback when an atom
+ * is submitted to the GPU
+ * @katom: kbase_jd_atom pointer
*
* Function calls a platform defined routine if specified in the configuration
* attributes. The routine should not assume that it is in a process context.
@@ -440,14 +502,15 @@ void kbasep_platform_event_atom_submit(struct kbase_jd_atom *katom);
/**
* kbasep_platform_event_atom_complete - Platform specific callback when an atom
- * has stopped running on the GPU
- * @katom - kbase_jd_atom pointer
+ * has stopped running on the GPU
+ * @katom: kbase_jd_atom pointer
*
* Function calls a platform defined routine if specified in the configuration
* attributes. The routine should not assume that it is in a process context.
*
*/
void kbasep_platform_event_atom_complete(struct kbase_jd_atom *katom);
+#endif
#ifndef CONFIG_OF
/**
diff --git a/mali_kbase/mali_kbase_core_linux.c b/mali_kbase/mali_kbase_core_linux.c
index b2f8e28..a9a10fb 100644
--- a/mali_kbase/mali_kbase_core_linux.c
+++ b/mali_kbase/mali_kbase_core_linux.c
@@ -27,22 +27,15 @@
#ifdef CONFIG_MALI_DEVFREQ
#include <linux/devfreq.h>
#include <backend/gpu/mali_kbase_devfreq.h>
-#ifdef CONFIG_DEVFREQ_THERMAL
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
#include <ipa/mali_kbase_ipa_debugfs.h>
#endif /* CONFIG_DEVFREQ_THERMAL */
#endif /* CONFIG_MALI_DEVFREQ */
-#ifdef CONFIG_MALI_NO_MALI
-#include "mali_kbase_model_linux.h"
-#include <backend/gpu/mali_kbase_model_dummy.h>
-#endif /* CONFIG_MALI_NO_MALI */
#include "mali_kbase_mem_profile_debugfs_buf_size.h"
#include "mali_kbase_mem.h"
#include "mali_kbase_mem_pool_debugfs.h"
#include "mali_kbase_mem_pool_group.h"
#include "mali_kbase_debugfs_helper.h"
-#if !MALI_CUSTOMER_RELEASE
-#include "mali_kbase_regs_dump_debugfs.h"
-#endif /* !MALI_CUSTOMER_RELEASE */
#include "mali_kbase_regs_history_debugfs.h"
#include <mali_kbase_hwaccess_backend.h>
#include <mali_kbase_hwaccess_time.h>
@@ -76,8 +69,7 @@
#ifdef CONFIG_MALI_CINSTR_GWT
#include "mali_kbase_gwt.h"
#endif
-#include "mali_kbase_pm.h"
-#include "mali_kbase_pm_internal.h"
+#include "backend/gpu/mali_kbase_pm_internal.h"
#include "mali_kbase_dvfs_debugfs.h"
#include <linux/module.h>
@@ -109,7 +101,6 @@
#include <mali_kbase_config.h>
-
#include <linux/pm_opp.h>
#include <linux/pm_runtime.h>
@@ -375,7 +366,7 @@ static void kbase_file_delete(struct kbase_file *const kfile)
if (atomic_read(&kfile->setup_state) == KBASE_FILE_COMPLETE) {
struct kbase_context *kctx = kfile->kctx;
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
kbasep_mem_profile_debugfs_remove(kctx);
#endif
@@ -468,7 +459,7 @@ int assign_irqs(struct kbase_device *kbdev)
return -ENOENT;
}
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
if (!strncasecmp(irq_res->name, "JOB", 4)) {
irqtag = JOB_IRQ_TAG;
} else if (!strncasecmp(irq_res->name, "MMU", 4)) {
@@ -519,7 +510,7 @@ void kbase_release_device(struct kbase_device *kbdev)
}
EXPORT_SYMBOL(kbase_release_device);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#if KERNEL_VERSION(4, 6, 0) > LINUX_VERSION_CODE && \
!(KERNEL_VERSION(4, 4, 28) <= LINUX_VERSION_CODE && \
KERNEL_VERSION(4, 5, 0) > LINUX_VERSION_CODE)
@@ -636,7 +627,7 @@ static int kbase_file_create_kctx(struct kbase_file *const kfile,
{
struct kbase_device *kbdev = NULL;
struct kbase_context *kctx = NULL;
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
char kctx_name[64];
#endif
@@ -667,7 +658,7 @@ static int kbase_file_create_kctx(struct kbase_file *const kfile,
if (kbdev->infinite_cache_active_default)
kbase_ctx_flag_set(kctx, KCTX_INFINITE_CACHE);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
snprintf(kctx_name, 64, "%d_%d", kctx->tgid, kctx->id);
mutex_init(&kctx->mem_profile_lock);
@@ -715,6 +706,13 @@ static int kbase_open(struct inode *inode, struct file *filp)
if (!kbdev)
return -ENODEV;
+ /* Device-wide firmware load is moved here from probing to comply with
+ * Android GKI vendor guideline.
+ */
+ ret = kbase_device_firmware_init_once(kbdev);
+ if (ret)
+ goto out;
+
kfile = kbase_file_new(kbdev, filp);
if (!kfile) {
ret = -ENOMEM;
@@ -726,7 +724,7 @@ static int kbase_open(struct inode *inode, struct file *filp)
return 0;
- out:
+out:
kbase_release_device(kbdev);
return ret;
}
@@ -1014,17 +1012,6 @@ static int kbase_api_get_cpu_gpu_timeinfo(struct kbase_context *kctx,
return 0;
}
-#ifdef CONFIG_MALI_NO_MALI
-static int kbase_api_hwcnt_set(struct kbase_context *kctx,
- struct kbase_ioctl_hwcnt_values *values)
-{
- gpu_model_set_dummy_prfcnt_sample(
- (u32 __user *)(uintptr_t)values->data,
- values->size);
-
- return 0;
-}
-#endif
static int kbase_api_disjoint_query(struct kbase_context *kctx,
struct kbase_ioctl_disjoint_query *query)
@@ -1420,6 +1407,14 @@ static int kbasep_cs_queue_register(struct kbase_context *kctx,
return kbase_csf_queue_register(kctx, reg);
}
+static int kbasep_cs_queue_register_ex(struct kbase_context *kctx,
+ struct kbase_ioctl_cs_queue_register_ex *reg)
+{
+ kctx->jit_group_id = BASE_MEM_GROUP_DEFAULT;
+
+ return kbase_csf_queue_register_ex(kctx, reg);
+}
+
static int kbasep_cs_queue_terminate(struct kbase_context *kctx,
struct kbase_ioctl_cs_queue_terminate *term)
{
@@ -1913,14 +1908,6 @@ static long kbase_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
union kbase_ioctl_get_cpu_gpu_timeinfo,
kctx);
break;
-#ifdef CONFIG_MALI_NO_MALI
- case KBASE_IOCTL_HWCNT_SET:
- KBASE_HANDLE_IOCTL_IN(KBASE_IOCTL_HWCNT_SET,
- kbase_api_hwcnt_set,
- struct kbase_ioctl_hwcnt_values,
- kctx);
- break;
-#endif
#ifdef CONFIG_MALI_CINSTR_GWT
case KBASE_IOCTL_CINSTR_GWT_START:
KBASE_HANDLE_IOCTL(KBASE_IOCTL_CINSTR_GWT_START,
@@ -1951,6 +1938,12 @@ static long kbase_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
struct kbase_ioctl_cs_queue_register,
kctx);
break;
+ case KBASE_IOCTL_CS_QUEUE_REGISTER_EX:
+ KBASE_HANDLE_IOCTL_IN(KBASE_IOCTL_CS_QUEUE_REGISTER_EX,
+ kbasep_cs_queue_register_ex,
+ struct kbase_ioctl_cs_queue_register_ex,
+ kctx);
+ break;
case KBASE_IOCTL_CS_QUEUE_TERMINATE:
KBASE_HANDLE_IOCTL_IN(KBASE_IOCTL_CS_QUEUE_TERMINATE,
kbasep_cs_queue_terminate,
@@ -2507,6 +2500,11 @@ static ssize_t set_core_mask(struct device *dev, struct device_attribute *attr,
new_core_mask[i], i, group0_core_mask);
err = -EINVAL;
goto unlock;
+ } else if (!(new_core_mask[i] & kbdev->gpu_props.curr_config.shader_present)) {
+ dev_err(dev, "Invalid core mask 0x%llX for JS %d: No intersection with current core mask 0x%llX\n",
+ new_core_mask[i], i, kbdev->gpu_props.curr_config.shader_present);
+ err = -EINVAL;
+ goto unlock;
}
}
@@ -2984,7 +2982,7 @@ static DEVICE_ATTR(js_softstop_always, S_IRUGO | S_IWUSR, show_js_softstop_alway
#endif /* !MALI_USE_CSF */
#ifdef CONFIG_MALI_DEBUG
-typedef void (kbasep_debug_command_func) (struct kbase_device *);
+typedef void kbasep_debug_command_func(struct kbase_device *);
enum kbasep_debug_command_code {
KBASEP_DEBUG_COMMAND_DUMPTRACE,
@@ -3140,6 +3138,10 @@ static ssize_t kbase_show_gpuinfo(struct device *dev,
.name = "Mali-TODX" },
{ .id = GPU_ID2_PRODUCT_LODX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT,
.name = "Mali-LODX" },
+ { .id = GPU_ID2_PRODUCT_TGRX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT,
+ .name = "Mali-TGRX" },
+ { .id = GPU_ID2_PRODUCT_TVAX >> GPU_ID_VERSION_PRODUCT_ID_SHIFT,
+ .name = "Mali-TVAX" },
};
const char *product_name = "(Unknown Mali GPU)";
struct kbase_device *kbdev;
@@ -3975,7 +3977,7 @@ static ssize_t update_serialize_jobs_setting(struct kbase_device *kbdev,
return count;
}
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbasep_serialize_jobs_seq_debugfs_show - Show callback for the serialize_jobs
* debugfs file
@@ -4229,15 +4231,6 @@ void kbase_protected_mode_term(struct kbase_device *kbdev)
kfree(kbdev->protected_dev);
}
-#ifdef CONFIG_MALI_NO_MALI
-static int kbase_common_reg_map(struct kbase_device *kbdev)
-{
- return 0;
-}
-static void kbase_common_reg_unmap(struct kbase_device * const kbdev)
-{
-}
-#else /* CONFIG_MALI_NO_MALI */
static int kbase_common_reg_map(struct kbase_device *kbdev)
{
int err = 0;
@@ -4273,7 +4266,6 @@ static void kbase_common_reg_unmap(struct kbase_device * const kbdev)
kbdev->reg_size = 0;
}
}
-#endif /* CONFIG_MALI_NO_MALI */
int registers_map(struct kbase_device * const kbdev)
{
@@ -4428,7 +4420,7 @@ int kbase_device_pm_init(struct kbase_device *kbdev)
void kbase_device_pm_term(struct kbase_device *kbdev)
{
#ifdef CONFIG_MALI_ARBITER_SUPPORT
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
if (kbase_is_pv_enabled(kbdev->dev->of_node))
kbase_arbiter_pm_early_term(kbdev);
else
@@ -4592,7 +4584,7 @@ void power_control_term(struct kbase_device *kbdev)
}
#ifdef MALI_KBASE_BUILD
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
static void trigger_reset(struct kbase_device *kbdev)
{
@@ -4777,9 +4769,6 @@ int kbase_device_debugfs_init(struct kbase_device *kbdev)
goto out;
}
-#if !MALI_CUSTOMER_RELEASE
- kbasep_regs_dump_debugfs_init(kbdev);
-#endif /* !MALI_CUSTOMER_RELEASE */
kbasep_regs_history_debugfs_init(kbdev);
#if !MALI_USE_CSF
@@ -4833,20 +4822,18 @@ int kbase_device_debugfs_init(struct kbase_device *kbdev)
kbase_ktrace_debugfs_init(kbdev);
#ifdef CONFIG_MALI_DEVFREQ
-#ifdef CONFIG_DEVFREQ_THERMAL
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
if (kbdev->devfreq)
kbase_ipa_debugfs_init(kbdev);
#endif /* CONFIG_DEVFREQ_THERMAL */
#endif /* CONFIG_MALI_DEVFREQ */
-#if MALI_USE_CSF
- kbase_csf_debugfs_init(kbdev);
-#else
+#if !MALI_USE_CSF
debugfs_create_file("serialize_jobs", S_IRUGO | S_IWUSR,
kbdev->mali_debugfs_directory, kbdev,
&kbasep_serialize_jobs_debugfs_fops);
-#endif
+#endif
kbase_dvfs_status_debugfs_init(kbdev);
return 0;
@@ -4865,7 +4852,7 @@ void kbase_device_debugfs_term(struct kbase_device *kbdev)
int kbase_device_coherency_init(struct kbase_device *kbdev)
{
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
u32 supported_coherency_bitmap =
kbdev->gpu_props.props.raw_props.coherency_mode;
const void *coherency_override_dts;
@@ -4892,7 +4879,7 @@ int kbase_device_coherency_init(struct kbase_device *kbdev)
kbdev->system_coherency = COHERENCY_NONE;
/* device tree may override the coherency */
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
coherency_override_dts = of_get_property(kbdev->dev->of_node,
"system-coherency",
NULL);
@@ -4900,7 +4887,7 @@ int kbase_device_coherency_init(struct kbase_device *kbdev)
override_coherency = be32_to_cpup(coherency_override_dts);
-#if MALI_USE_CSF && !defined(CONFIG_MALI_NO_MALI)
+#if MALI_USE_CSF && !IS_ENABLED(CONFIG_MALI_NO_MALI)
/* ACE coherency mode is not supported by Driver on CSF GPUs.
* Return an error to signal the invalid device tree configuration.
*/
@@ -5456,7 +5443,7 @@ static const struct dev_pm_ops kbase_pm_ops = {
#endif /* KBASE_PM_RUNTIME */
};
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id kbase_dt_ids[] = {
{ .compatible = "arm,malit6xx" },
{ .compatible = "arm,mali-midgard" },
@@ -5473,6 +5460,7 @@ static struct platform_driver kbase_platform_driver = {
.name = kbase_drv_name,
.pm = &kbase_pm_ops,
.of_match_table = of_match_ptr(kbase_dt_ids),
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};
@@ -5480,7 +5468,7 @@ static struct platform_driver kbase_platform_driver = {
* The driver will not provide a shortcut to create the Mali platform device
* anymore when using Device Tree.
*/
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
module_platform_driver(kbase_platform_driver);
#else
diff --git a/mali_kbase/mali_kbase_cs_experimental.h b/mali_kbase/mali_kbase_cs_experimental.h
index 67cd5ee..73b776b 100644
--- a/mali_kbase/mali_kbase_cs_experimental.h
+++ b/mali_kbase/mali_kbase_cs_experimental.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_ctx_sched.c b/mali_kbase/mali_kbase_ctx_sched.c
index c63bc8d..3db214c 100644
--- a/mali_kbase/mali_kbase_ctx_sched.c
+++ b/mali_kbase/mali_kbase_ctx_sched.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2017-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_debug.c b/mali_kbase/mali_kbase_debug.c
index 6caf56c..d112000 100644
--- a/mali_kbase/mali_kbase_debug.c
+++ b/mali_kbase/mali_kbase_debug.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2012-2014, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2014, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_debug.h b/mali_kbase/mali_kbase_debug.h
index 9e1f73b..fcfc8ea 100644
--- a/mali_kbase/mali_kbase_debug.h
+++ b/mali_kbase/mali_kbase_debug.h
@@ -40,7 +40,7 @@
#endif /* KBASE_DEBUG_DISABLE_ASSERTS */
/** Function type that is called on an KBASE_DEBUG_ASSERT() or KBASE_DEBUG_ASSERT_MSG() */
-typedef void (kbase_debug_assert_hook) (void *);
+typedef void kbase_debug_assert_hook(void *);
struct kbasep_debug_assert_cb {
kbase_debug_assert_hook *func;
diff --git a/mali_kbase/mali_kbase_debug_job_fault.c b/mali_kbase/mali_kbase_debug_job_fault.c
index 7dfdff1..a544ffa 100644
--- a/mali_kbase/mali_kbase_debug_job_fault.c
+++ b/mali_kbase/mali_kbase_debug_job_fault.c
@@ -23,7 +23,7 @@
#include <linux/spinlock.h>
#include <mali_kbase_hwaccess_jm.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
static bool kbase_is_job_fault_event_pending(struct kbase_device *kbdev)
{
diff --git a/mali_kbase/mali_kbase_debug_job_fault.h b/mali_kbase/mali_kbase_debug_job_fault.h
index 63ccb3d..9d08aff 100644
--- a/mali_kbase/mali_kbase_debug_job_fault.h
+++ b/mali_kbase/mali_kbase_debug_job_fault.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2012-2016, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2016, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_debug_mem_view.c b/mali_kbase/mali_kbase_debug_mem_view.c
index 9bdb765..77b7432 100644
--- a/mali_kbase/mali_kbase_debug_mem_view.c
+++ b/mali_kbase/mali_kbase_debug_mem_view.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2013-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2013-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -29,7 +29,7 @@
#include <linux/list.h>
#include <linux/file.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
struct debug_mem_mapping {
struct list_head node;
diff --git a/mali_kbase/mali_kbase_debug_mem_view.h b/mali_kbase/mali_kbase_debug_mem_view.h
index c913d5c..cf15e68 100644
--- a/mali_kbase/mali_kbase_debug_mem_view.h
+++ b/mali_kbase/mali_kbase_debug_mem_view.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2013-2015, 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2013-2015, 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_debugfs_helper.c b/mali_kbase/mali_kbase_debugfs_helper.c
index 28df887..1a28495 100644
--- a/mali_kbase/mali_kbase_debugfs_helper.c
+++ b/mali_kbase/mali_kbase_debugfs_helper.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -45,10 +45,9 @@
*
* Return: 0 if success, negative error code otherwise.
*/
-static int set_attr_from_string(
- char *const buf,
- void *const array, size_t const nelems,
- kbase_debugfs_helper_set_attr_fn const set_attr_fn)
+static int
+set_attr_from_string(char *const buf, void *const array, size_t const nelems,
+ kbase_debugfs_helper_set_attr_fn *const set_attr_fn)
{
size_t index, err = 0;
char *ptr = buf;
@@ -144,7 +143,7 @@ int kbase_debugfs_string_validator(char *const buf)
int kbase_debugfs_helper_set_attr_from_string(
const char *const buf, void *const array, size_t const nelems,
- kbase_debugfs_helper_set_attr_fn const set_attr_fn)
+ kbase_debugfs_helper_set_attr_fn *const set_attr_fn)
{
char *const wbuf = kstrdup(buf, GFP_KERNEL);
int err = 0;
@@ -167,9 +166,9 @@ int kbase_debugfs_helper_set_attr_from_string(
}
ssize_t kbase_debugfs_helper_get_attr_to_string(
- char *const buf, size_t const size,
- void *const array, size_t const nelems,
- kbase_debugfs_helper_get_attr_fn const get_attr_fn)
+ char *const buf, size_t const size, void *const array,
+ size_t const nelems,
+ kbase_debugfs_helper_get_attr_fn *const get_attr_fn)
{
ssize_t total = 0;
size_t index;
@@ -187,10 +186,10 @@ ssize_t kbase_debugfs_helper_get_attr_to_string(
return total;
}
-int kbase_debugfs_helper_seq_write(struct file *const file,
- const char __user *const ubuf, size_t const count,
- size_t const nelems,
- kbase_debugfs_helper_set_attr_fn const set_attr_fn)
+int kbase_debugfs_helper_seq_write(
+ struct file *const file, const char __user *const ubuf,
+ size_t const count, size_t const nelems,
+ kbase_debugfs_helper_set_attr_fn *const set_attr_fn)
{
const struct seq_file *const sfile = file->private_data;
void *const array = sfile->private;
@@ -228,9 +227,9 @@ int kbase_debugfs_helper_seq_write(struct file *const file,
return err;
}
-int kbase_debugfs_helper_seq_read(struct seq_file *const sfile,
- size_t const nelems,
- kbase_debugfs_helper_get_attr_fn const get_attr_fn)
+int kbase_debugfs_helper_seq_read(
+ struct seq_file *const sfile, size_t const nelems,
+ kbase_debugfs_helper_get_attr_fn *const get_attr_fn)
{
void *const array = sfile->private;
size_t index;
diff --git a/mali_kbase/mali_kbase_debugfs_helper.h b/mali_kbase/mali_kbase_debugfs_helper.h
index 5fcbb15..8ed5c66 100644
--- a/mali_kbase/mali_kbase_debugfs_helper.h
+++ b/mali_kbase/mali_kbase_debugfs_helper.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -30,8 +30,8 @@
* @index: An element index. The valid range depends on the use-case.
* @value: Attribute value to be set.
*/
-typedef void (*kbase_debugfs_helper_set_attr_fn)(
- void *array, size_t index, size_t value);
+typedef void kbase_debugfs_helper_set_attr_fn(void *array, size_t index,
+ size_t value);
/**
* kbase_debugfs_helper_set_attr_from_string - Parse a string to reconfigure an
@@ -55,7 +55,7 @@ typedef void (*kbase_debugfs_helper_set_attr_fn)(
*/
int kbase_debugfs_helper_set_attr_from_string(
const char *buf, void *array, size_t nelems,
- kbase_debugfs_helper_set_attr_fn set_attr_fn);
+ kbase_debugfs_helper_set_attr_fn *set_attr_fn);
/**
* kbase_debugfs_string_validator - Validate a string to be written to a
@@ -89,8 +89,7 @@ int kbase_debugfs_string_validator(char *const buf);
*
* Return: Value of attribute.
*/
-typedef size_t (*kbase_debugfs_helper_get_attr_fn)(
- void *array, size_t index);
+typedef size_t kbase_debugfs_helper_get_attr_fn(void *array, size_t index);
/**
* kbase_debugfs_helper_get_attr_to_string - Construct a formatted string
@@ -111,7 +110,7 @@ typedef size_t (*kbase_debugfs_helper_get_attr_fn)(
*/
ssize_t kbase_debugfs_helper_get_attr_to_string(
char *buf, size_t size, void *array, size_t nelems,
- kbase_debugfs_helper_get_attr_fn get_attr_fn);
+ kbase_debugfs_helper_get_attr_fn *get_attr_fn);
/**
* kbase_debugfs_helper_seq_read - Implements reads from a virtual file for an
@@ -132,8 +131,8 @@ ssize_t kbase_debugfs_helper_get_attr_to_string(
* Return: 0 if success, negative error code otherwise.
*/
int kbase_debugfs_helper_seq_read(
- struct seq_file *const sfile, size_t const nelems,
- kbase_debugfs_helper_get_attr_fn const get_attr_fn);
+ struct seq_file *sfile, size_t nelems,
+ kbase_debugfs_helper_get_attr_fn *get_attr_fn);
/**
* kbase_debugfs_helper_seq_write - Implements writes to a virtual file for an
@@ -154,10 +153,10 @@ int kbase_debugfs_helper_seq_read(
*
* Return: 0 if success, negative error code otherwise.
*/
-int kbase_debugfs_helper_seq_write(struct file *const file,
- const char __user *const ubuf, size_t const count,
- size_t const nelems,
- kbase_debugfs_helper_set_attr_fn const set_attr_fn);
+int kbase_debugfs_helper_seq_write(struct file *file,
+ const char __user *ubuf, size_t count,
+ size_t nelems,
+ kbase_debugfs_helper_set_attr_fn *set_attr_fn);
#endif /*_KBASE_DEBUGFS_HELPER_H_ */
diff --git a/mali_kbase/mali_kbase_defs.h b/mali_kbase/mali_kbase_defs.h
index 06c8d4f..13bba29 100644
--- a/mali_kbase/mali_kbase_defs.h
+++ b/mali_kbase/mali_kbase_defs.h
@@ -32,7 +32,7 @@
#include <mali_base_hwconfig_issues.h>
#include <mali_kbase_mem_lowlevel.h>
#include <mmu/mali_kbase_mmu_hw.h>
-#include <mali_kbase_instr_defs.h>
+#include <backend/gpu/mali_kbase_instr_defs.h>
#include <mali_kbase_pm.h>
#include <mali_kbase_gpuprops_types.h>
#if MALI_USE_CSF
@@ -55,7 +55,7 @@
#include "mali_kbase_fence_defs.h"
#endif
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#include <linux/debugfs.h>
#endif /* CONFIG_DEBUG_FS */
@@ -341,10 +341,9 @@ struct kbase_clk_rate_listener;
* sleep. No clock rate manager functions must be called from here, as
* its lock is taken.
*/
-typedef void (*kbase_clk_rate_listener_on_change_t)(
- struct kbase_clk_rate_listener *listener,
- u32 clk_index,
- u32 clk_rate_hz);
+typedef void
+kbase_clk_rate_listener_on_change_t(struct kbase_clk_rate_listener *listener,
+ u32 clk_index, u32 clk_rate_hz);
/**
* struct kbase_clk_rate_listener - Clock frequency listener
@@ -354,7 +353,7 @@ typedef void (*kbase_clk_rate_listener_on_change_t)(
*/
struct kbase_clk_rate_listener {
struct list_head node;
- kbase_clk_rate_listener_on_change_t notify;
+ kbase_clk_rate_listener_on_change_t *notify;
};
/**
@@ -699,6 +698,7 @@ struct kbase_process {
* accesses made by the driver.
* @pm: Per device object for storing data for power management
* framework.
+ * @fw_load_lock: Mutex to protect firmware loading in @ref kbase_open.
* @csf: CSF object for the GPU device.
* @js_data: Per device object encapsulating the current context of
* Job Scheduler, which is global to the device and is not
@@ -949,8 +949,12 @@ struct kbase_process {
* @dummy_job_wa.jc: dummy job workaround job
* @dummy_job_wa.slot: dummy job workaround slot
* @dummy_job_wa.flags: dummy job workaround flags
+ * @dummy_job_wa_loaded: Flag for indicating that the workaround blob has
+ * been loaded. Protected by @fw_load_lock.
* @arb: Pointer to the arbiter device
* @pcm_dev: The priority control manager device.
+ * @oom_notifier_block: notifier_block containing kernel-registered out-of-
+ * memory handler.
*/
struct kbase_device {
u32 hw_quirks_sc;
@@ -972,7 +976,7 @@ struct kbase_device {
struct clk *clocks[BASE_MAX_NR_CLOCKS_REGULATORS];
unsigned int nr_clocks;
-#ifdef CONFIG_REGULATOR
+#if IS_ENABLED(CONFIG_REGULATOR)
struct regulator *regulators[BASE_MAX_NR_CLOCKS_REGULATORS];
unsigned int nr_regulators;
#if (KERNEL_VERSION(4, 10, 0) <= LINUX_VERSION_CODE)
@@ -982,16 +986,6 @@ struct kbase_device {
char devname[DEVNAME_SIZE];
u32 id;
-#ifdef CONFIG_MALI_NO_MALI
- void *model;
- struct kmem_cache *irq_slab;
- struct workqueue_struct *irq_workq;
- atomic_t serving_job_irq;
- atomic_t serving_gpu_irq;
- atomic_t serving_mmu_irq;
- spinlock_t reg_op_lock;
-#endif /* CONFIG_MALI_NO_MALI */
-
struct kbase_pm_device_data pm;
struct kbase_mem_pool_group mem_pools;
@@ -1068,7 +1062,7 @@ struct kbase_device {
struct kbasep_pm_metrics last_devfreq_metrics;
struct kbase_devfreq_queue_info devfreq_queue;
-#ifdef CONFIG_DEVFREQ_THERMAL
+#if IS_ENABLED(CONFIG_DEVFREQ_THERMAL)
struct thermal_cooling_device *devfreq_cooling;
bool ipa_protection_mode_switched;
struct {
@@ -1096,7 +1090,7 @@ struct kbase_device {
atomic_t job_fault_debug;
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
struct dentry *mali_debugfs_directory;
struct dentry *debugfs_ctx_directory;
struct dentry *debugfs_instr_directory;
@@ -1120,7 +1114,7 @@ struct kbase_device {
atomic_t ctx_num;
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
struct kbase_io_history io_history;
#endif /* CONFIG_DEBUG_FS */
@@ -1173,6 +1167,7 @@ struct kbase_device {
bool l2_hash_values_override;
u32 l2_hash_values[ASN_HASH_COUNT];
+ struct mutex fw_load_lock;
#if MALI_USE_CSF
/* CSF object for the GPU device. */
struct kbase_csf_device csf;
@@ -1220,12 +1215,15 @@ struct kbase_device {
int slot;
u64 flags;
} dummy_job_wa;
+ bool dummy_job_wa_loaded;
#ifdef CONFIG_MALI_ARBITER_SUPPORT
struct kbase_arbiter_device arb;
#endif
/* Priority Control Manager device */
struct priority_control_manager_device *pcm_dev;
+
+ struct notifier_block oom_notifier_block;
};
/**
@@ -1556,6 +1554,8 @@ struct kbase_reg_zone {
* evictable/reclaimable.
* @evict_list: List head for the list containing the allocations which
* can be evicted or freed up in the shrinker callback.
+ * @evict_nents: Total number of pages allocated by the allocations within
+ * @evict_list (atomic).
* @waiting_soft_jobs: List head for the list containing softjob atoms, which
* are either waiting for the event set operation, or waiting
* for the signaling of input fence or waiting for the GPU
@@ -1799,6 +1799,7 @@ struct kbase_context {
struct shrinker reclaim;
struct list_head evict_list;
+ atomic_t evict_nents;
struct list_head waiting_soft_jobs;
spinlock_t waiting_soft_jobs_lock;
@@ -1818,7 +1819,7 @@ struct kbase_context {
u64 gpu_va_end;
bool jit_va;
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
char *mem_profile_data;
size_t mem_profile_size;
struct mutex mem_profile_lock;
@@ -1873,7 +1874,9 @@ struct kbase_context {
u64 limited_core_mask;
- void* platform_data;
+#if !MALI_USE_CSF
+ void *platform_data;
+#endif
};
#ifdef CONFIG_MALI_CINSTR_GWT
diff --git a/mali_kbase/mali_kbase_disjoint_events.c b/mali_kbase/mali_kbase_disjoint_events.c
index 0b73f55..3381ccc 100644
--- a/mali_kbase/mali_kbase_disjoint_events.c
+++ b/mali_kbase/mali_kbase_disjoint_events.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_dma_fence.c b/mali_kbase/mali_kbase_dma_fence.c
index aa8a933..2b5de13 100644
--- a/mali_kbase/mali_kbase_dma_fence.c
+++ b/mali_kbase/mali_kbase_dma_fence.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2011-2016, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2016, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -27,7 +27,7 @@
#include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/mutex.h>
-#include <linux/reservation.h>
+#include <linux/version.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
@@ -247,7 +247,12 @@ kbase_dma_fence_add_reservation_callback(struct kbase_jd_atom *katom,
unsigned int shared_count = 0;
int err, i;
- err = reservation_object_get_fences_rcu(resv,
+#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
+ err = reservation_object_get_fences_rcu(
+#else
+ err = dma_resv_get_fences_rcu(
+#endif
+ resv,
&excl_fence,
&shared_count,
&shared_fences);
@@ -365,7 +370,11 @@ int kbase_dma_fence_wait(struct kbase_jd_atom *katom,
struct dma_resv *obj = info->resv_objs[i];
#endif
if (!test_bit(i, info->dma_fence_excl_bitmap)) {
+#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
err = reservation_object_reserve_shared(obj);
+#else
+ err = dma_resv_reserve_shared(obj, 0);
+#endif
if (err) {
dev_err(katom->kctx->kbdev->dev,
"Error %d reserving space for shared fence.\n", err);
@@ -379,7 +388,11 @@ int kbase_dma_fence_wait(struct kbase_jd_atom *katom,
goto end;
}
+#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
reservation_object_add_shared_fence(obj, fence);
+#else
+ dma_resv_add_shared_fence(obj, fence);
+#endif
} else {
err = kbase_dma_fence_add_reservation_callback(katom, obj, true);
if (err) {
@@ -388,7 +401,11 @@ int kbase_dma_fence_wait(struct kbase_jd_atom *katom,
goto end;
}
+#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
reservation_object_add_excl_fence(obj, fence);
+#else
+ dma_resv_add_excl_fence(obj, fence);
+#endif
}
}
diff --git a/mali_kbase/mali_kbase_dma_fence.h b/mali_kbase/mali_kbase_dma_fence.h
index 0dd3d92..00f7974 100644
--- a/mali_kbase/mali_kbase_dma_fence.h
+++ b/mali_kbase/mali_kbase_dma_fence.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2010-2016, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2016, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -25,7 +25,12 @@
#ifdef CONFIG_MALI_DMA_FENCE
#include <linux/list.h>
+#include <linux/version.h>
+#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
#include <linux/reservation.h>
+#else
+#include <linux/dma-resv.h>
+#endif
#include <mali_kbase_fence.h>
/* Forward declaration from mali_kbase_defs.h */
diff --git a/mali_kbase/mali_kbase_dummy_job_wa.c b/mali_kbase/mali_kbase_dummy_job_wa.c
index b37b60e..0450acd 100644
--- a/mali_kbase/mali_kbase_dummy_job_wa.c
+++ b/mali_kbase/mali_kbase_dummy_job_wa.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -283,6 +283,8 @@ int kbase_dummy_job_wa_load(struct kbase_device *kbdev)
int err;
struct kbase_context *kctx;
+ lockdep_assert_held(&kbdev->fw_load_lock);
+
if (!wa_blob_load_needed(kbdev))
return 0;
@@ -428,6 +430,10 @@ void kbase_dummy_job_wa_cleanup(struct kbase_device *kbdev)
{
struct kbase_context *wa_ctx;
+ /* return if the dummy job has not been loaded */
+ if (kbdev->dummy_job_wa_loaded == false)
+ return;
+
/* Can be safely called even if the file wasn't created on probe */
sysfs_remove_file(&kbdev->dev->kobj, &dev_attr_dummy_job_wa_info.attr);
diff --git a/mali_kbase/mali_kbase_dummy_job_wa.h b/mali_kbase/mali_kbase_dummy_job_wa.h
index 4f3c227..da779ea 100644
--- a/mali_kbase/mali_kbase_dummy_job_wa.h
+++ b/mali_kbase/mali_kbase_dummy_job_wa.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_dvfs_debugfs.c b/mali_kbase/mali_kbase_dvfs_debugfs.c
index ce23ede..2f79894 100644
--- a/mali_kbase/mali_kbase_dvfs_debugfs.c
+++ b/mali_kbase/mali_kbase_dvfs_debugfs.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -23,7 +23,7 @@
#include <mali_kbase.h>
#include <linux/seq_file.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbasep_dvfs_utilization_debugfs_show() - Print the DVFS utilization info
diff --git a/mali_kbase/mali_kbase_dvfs_debugfs.h b/mali_kbase/mali_kbase_dvfs_debugfs.h
index 080331f..accd074 100644
--- a/mali_kbase/mali_kbase_dvfs_debugfs.h
+++ b/mali_kbase/mali_kbase_dvfs_debugfs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_event.c b/mali_kbase/mali_kbase_event.c
index 7f72b95..9f59b3d 100644
--- a/mali_kbase/mali_kbase_event.c
+++ b/mali_kbase/mali_kbase_event.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2010-2016,2018-2021 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2016, 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_fence.c b/mali_kbase/mali_kbase_fence.c
index d65b4eb..e5edb70 100644
--- a/mali_kbase/mali_kbase_fence.c
+++ b/mali_kbase/mali_kbase_fence.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2011-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_fence.h b/mali_kbase/mali_kbase_fence.h
index a28aacc..62e0dbb 100644
--- a/mali_kbase/mali_kbase_fence.h
+++ b/mali_kbase/mali_kbase_fence.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2010-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_fence_defs.h b/mali_kbase/mali_kbase_fence_defs.h
index 006512d..1b226d4 100644
--- a/mali_kbase/mali_kbase_fence_defs.h
+++ b/mali_kbase/mali_kbase_fence_defs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2010-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_fence_ops.c b/mali_kbase/mali_kbase_fence_ops.c
index 4712ef4..49348ed 100644
--- a/mali_kbase/mali_kbase_fence_ops.c
+++ b/mali_kbase/mali_kbase_fence_ops.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_gator.h b/mali_kbase/mali_kbase_gator.h
index 9c722b6..e8d7d1d 100644
--- a/mali_kbase/mali_kbase_gator.h
+++ b/mali_kbase/mali_kbase_gator.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2011-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_gpu_memory_debugfs.c b/mali_kbase/mali_kbase_gpu_memory_debugfs.c
index a10b2bb..f7229a3 100644
--- a/mali_kbase/mali_kbase_gpu_memory_debugfs.c
+++ b/mali_kbase/mali_kbase_gpu_memory_debugfs.c
@@ -22,7 +22,7 @@
#include <mali_kbase.h>
#include <device/mali_kbase_device.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbasep_gpu_memory_seq_show - Show callback for the @c gpu_memory debugfs file
* @sfile: The debugfs entry
diff --git a/mali_kbase/mali_kbase_gpuprops.c b/mali_kbase/mali_kbase_gpuprops.c
index 49f96f6..225f9df 100644
--- a/mali_kbase/mali_kbase_gpuprops.c
+++ b/mali_kbase/mali_kbase_gpuprops.c
@@ -30,7 +30,7 @@
#include <mali_kbase_config_defaults.h>
#include <uapi/gpu/arm/midgard/mali_kbase_ioctl.h>
#include <linux/clk.h>
-#include <mali_kbase_pm_internal.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
#include <linux/of_platform.h>
#include <linux/moduleparam.h>
@@ -531,6 +531,14 @@ static int num_override_l2_hash_values;
module_param_array(l2_hash_values, uint, &num_override_l2_hash_values, 0000);
MODULE_PARM_DESC(l2_hash_values, "Override L2 hash values config for testing");
+/* Definitions for range of supported user defined hash functions for GPUs
+ * that support L2_CONFIG and not ASN_HASH features. Supported hash function
+ * range from 0b1000-0b1111 inclusive. Selection of any other values will
+ * lead to undefined behavior.
+ */
+#define USER_DEFINED_HASH_LO ((u8)0x08)
+#define USER_DEFINED_HASH_HI ((u8)0x0F)
+
enum l2_config_override_result {
L2_CONFIG_OVERRIDE_FAIL = -1,
L2_CONFIG_OVERRIDE_NONE,
@@ -562,7 +570,11 @@ kbase_read_l2_config_from_dt(struct kbase_device *const kbdev)
else if (of_property_read_u8(np, "l2-size", &kbdev->l2_size_override))
kbdev->l2_size_override = 0;
- if (override_l2_hash)
+ /* Check overriding value is supported, if not will result in
+ * undefined behavior.
+ */
+ if (override_l2_hash >= USER_DEFINED_HASH_LO &&
+ override_l2_hash <= USER_DEFINED_HASH_HI)
kbdev->l2_hash_override = override_l2_hash;
else if (of_property_read_u8(np, "l2-hash", &kbdev->l2_hash_override))
kbdev->l2_hash_override = 0;
diff --git a/mali_kbase/mali_kbase_gwt.c b/mali_kbase/mali_kbase_gwt.c
index 93acf8a..873b619 100644
--- a/mali_kbase/mali_kbase_gwt.c
+++ b/mali_kbase/mali_kbase_gwt.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2010-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hw.c b/mali_kbase/mali_kbase_hw.c
index b1758d7..c324b48 100644
--- a/mali_kbase/mali_kbase_hw.c
+++ b/mali_kbase/mali_kbase_hw.c
@@ -75,6 +75,12 @@ void kbase_hw_set_features_mask(struct kbase_device *kbdev)
case GPU_ID2_PRODUCT_LODX:
features = base_hw_features_tODx;
break;
+ case GPU_ID2_PRODUCT_TGRX:
+ features = base_hw_features_tGRx;
+ break;
+ case GPU_ID2_PRODUCT_TVAX:
+ features = base_hw_features_tVAx;
+ break;
default:
features = base_hw_features_generic;
break;
@@ -211,6 +217,14 @@ static const enum base_hw_issue *kbase_hw_get_issues_for_new_id(
{ GPU_ID2_PRODUCT_LODX,
{ { GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tODx_r0p0 },
{ U32_MAX, NULL } } },
+
+ { GPU_ID2_PRODUCT_TGRX,
+ { { GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tGRx_r0p0 },
+ { U32_MAX, NULL } } },
+
+ { GPU_ID2_PRODUCT_TVAX,
+ { { GPU_ID2_VERSION_MAKE(0, 0, 0), base_hw_issues_tVAx_r0p0 },
+ { U32_MAX, NULL } } },
};
u32 gpu_id = kbdev->gpu_props.props.raw_props.gpu_id;
@@ -360,6 +374,12 @@ int kbase_hw_set_issues_mask(struct kbase_device *kbdev)
case GPU_ID2_PRODUCT_LODX:
issues = base_hw_issues_model_tODx;
break;
+ case GPU_ID2_PRODUCT_TGRX:
+ issues = base_hw_issues_model_tGRx;
+ break;
+ case GPU_ID2_PRODUCT_TVAX:
+ issues = base_hw_issues_model_tVAx;
+ break;
default:
dev_err(kbdev->dev,
"Unknown GPU ID %x", gpu_id);
diff --git a/mali_kbase/mali_kbase_hwaccess_backend.h b/mali_kbase/mali_kbase_hwaccess_backend.h
index 90851e2..cc13b84 100644
--- a/mali_kbase/mali_kbase_hwaccess_backend.h
+++ b/mali_kbase/mali_kbase_hwaccess_backend.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2015, 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2015, 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwaccess_defs.h b/mali_kbase/mali_kbase_hwaccess_defs.h
index 97a593f..cf99659 100644
--- a/mali_kbase/mali_kbase_hwaccess_defs.h
+++ b/mali_kbase/mali_kbase_hwaccess_defs.h
@@ -26,7 +26,7 @@
#ifndef _KBASE_HWACCESS_DEFS_H_
#define _KBASE_HWACCESS_DEFS_H_
-#include <mali_kbase_jm_defs.h>
+#include <backend/gpu/mali_kbase_jm_defs.h>
/**
* struct kbase_hwaccess_data - object encapsulating the GPU backend specific
diff --git a/mali_kbase/mali_kbase_hwaccess_gpuprops.h b/mali_kbase/mali_kbase_hwaccess_gpuprops.h
index 0fca83e..4bef45b 100644
--- a/mali_kbase/mali_kbase_hwaccess_gpuprops.h
+++ b/mali_kbase/mali_kbase_hwaccess_gpuprops.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2015, 2018, 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2015, 2018, 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwaccess_instr.h b/mali_kbase/mali_kbase_hwaccess_instr.h
index 959bfeb..c71d5a2 100644
--- a/mali_kbase/mali_kbase_hwaccess_instr.h
+++ b/mali_kbase/mali_kbase_hwaccess_instr.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2015, 2017-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2015, 2017-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -26,7 +26,7 @@
#ifndef _KBASE_HWACCESS_INSTR_H_
#define _KBASE_HWACCESS_INSTR_H_
-#include <mali_kbase_instr_defs.h>
+#include <backend/gpu/mali_kbase_instr_defs.h>
/**
* struct kbase_instr_hwcnt_enable - Enable hardware counter collection.
diff --git a/mali_kbase/mali_kbase_hwaccess_pm.h b/mali_kbase/mali_kbase_hwaccess_pm.h
index 4b2a53e..31e7507 100644
--- a/mali_kbase/mali_kbase_hwaccess_pm.h
+++ b/mali_kbase/mali_kbase_hwaccess_pm.h
@@ -29,7 +29,7 @@
#include <gpu/mali_kbase_gpu_regmap.h>
#include <linux/atomic.h>
-#include <mali_kbase_pm_defs.h>
+#include <backend/gpu/mali_kbase_pm_defs.h>
/* Forward definition - see mali_kbase.h */
struct kbase_device;
diff --git a/mali_kbase/mali_kbase_hwcnt.c b/mali_kbase/mali_kbase_hwcnt.c
index 6bd7d5f..394b90d 100644
--- a/mali_kbase/mali_kbase_hwcnt.c
+++ b/mali_kbase/mali_kbase_hwcnt.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwcnt_accumulator.h b/mali_kbase/mali_kbase_hwcnt_accumulator.h
index fbd13a4..b332db3 100644
--- a/mali_kbase/mali_kbase_hwcnt_accumulator.h
+++ b/mali_kbase/mali_kbase_hwcnt_accumulator.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwcnt_backend.h b/mali_kbase/mali_kbase_hwcnt_backend.h
index a3013a6..5ad8e73 100644
--- a/mali_kbase/mali_kbase_hwcnt_backend.h
+++ b/mali_kbase/mali_kbase_hwcnt_backend.h
@@ -56,8 +56,8 @@ struct kbase_hwcnt_backend;
*
* Return: Non-NULL pointer to immutable hardware counter metadata.
*/
-typedef const struct kbase_hwcnt_metadata *(*kbase_hwcnt_backend_metadata_fn)(
- const struct kbase_hwcnt_backend_info *info);
+typedef const struct kbase_hwcnt_metadata *
+kbase_hwcnt_backend_metadata_fn(const struct kbase_hwcnt_backend_info *info);
/**
* typedef kbase_hwcnt_backend_init_fn - Initialise a counter backend.
@@ -69,16 +69,15 @@ typedef const struct kbase_hwcnt_metadata *(*kbase_hwcnt_backend_metadata_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_init_fn)(
- const struct kbase_hwcnt_backend_info *info,
- struct kbase_hwcnt_backend **out_backend);
+typedef int
+kbase_hwcnt_backend_init_fn(const struct kbase_hwcnt_backend_info *info,
+ struct kbase_hwcnt_backend **out_backend);
/**
* typedef kbase_hwcnt_backend_term_fn - Terminate a counter backend.
* @backend: Pointer to backend to be terminated.
*/
-typedef void (*kbase_hwcnt_backend_term_fn)(
- struct kbase_hwcnt_backend *backend);
+typedef void kbase_hwcnt_backend_term_fn(struct kbase_hwcnt_backend *backend);
/**
* typedef kbase_hwcnt_backend_timestamp_ns_fn - Get the current backend
@@ -87,8 +86,8 @@ typedef void (*kbase_hwcnt_backend_term_fn)(
*
* Return: Backend timestamp in nanoseconds.
*/
-typedef u64 (*kbase_hwcnt_backend_timestamp_ns_fn)(
- struct kbase_hwcnt_backend *backend);
+typedef u64
+kbase_hwcnt_backend_timestamp_ns_fn(struct kbase_hwcnt_backend *backend);
/**
* typedef kbase_hwcnt_backend_dump_enable_fn - Start counter dumping with the
@@ -103,7 +102,7 @@ typedef u64 (*kbase_hwcnt_backend_timestamp_ns_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_dump_enable_fn)(
+typedef int kbase_hwcnt_backend_dump_enable_fn(
struct kbase_hwcnt_backend *backend,
const struct kbase_hwcnt_enable_map *enable_map);
@@ -119,7 +118,7 @@ typedef int (*kbase_hwcnt_backend_dump_enable_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_dump_enable_nolock_fn)(
+typedef int kbase_hwcnt_backend_dump_enable_nolock_fn(
struct kbase_hwcnt_backend *backend,
const struct kbase_hwcnt_enable_map *enable_map);
@@ -131,8 +130,8 @@ typedef int (*kbase_hwcnt_backend_dump_enable_nolock_fn)(
* If the backend is already disabled, does nothing.
* Any undumped counter values since the last dump get will be lost.
*/
-typedef void (*kbase_hwcnt_backend_dump_disable_fn)(
- struct kbase_hwcnt_backend *backend);
+typedef void
+kbase_hwcnt_backend_dump_disable_fn(struct kbase_hwcnt_backend *backend);
/**
* typedef kbase_hwcnt_backend_dump_clear_fn - Reset all the current undumped
@@ -143,8 +142,8 @@ typedef void (*kbase_hwcnt_backend_dump_disable_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_dump_clear_fn)(
- struct kbase_hwcnt_backend *backend);
+typedef int
+kbase_hwcnt_backend_dump_clear_fn(struct kbase_hwcnt_backend *backend);
/**
* typedef kbase_hwcnt_backend_dump_request_fn - Request an asynchronous counter
@@ -158,9 +157,9 @@ typedef int (*kbase_hwcnt_backend_dump_clear_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_dump_request_fn)(
- struct kbase_hwcnt_backend *backend,
- u64 *dump_time_ns);
+typedef int
+kbase_hwcnt_backend_dump_request_fn(struct kbase_hwcnt_backend *backend,
+ u64 *dump_time_ns);
/**
* typedef kbase_hwcnt_backend_dump_wait_fn - Wait until the last requested
@@ -171,8 +170,8 @@ typedef int (*kbase_hwcnt_backend_dump_request_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_dump_wait_fn)(
- struct kbase_hwcnt_backend *backend);
+typedef int
+kbase_hwcnt_backend_dump_wait_fn(struct kbase_hwcnt_backend *backend);
/**
* typedef kbase_hwcnt_backend_dump_get_fn - Copy or accumulate enable the
@@ -190,11 +189,11 @@ typedef int (*kbase_hwcnt_backend_dump_wait_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_dump_get_fn)(
- struct kbase_hwcnt_backend *backend,
- struct kbase_hwcnt_dump_buffer *dump_buffer,
- const struct kbase_hwcnt_enable_map *enable_map,
- bool accumulate);
+typedef int
+kbase_hwcnt_backend_dump_get_fn(struct kbase_hwcnt_backend *backend,
+ struct kbase_hwcnt_dump_buffer *dump_buffer,
+ const struct kbase_hwcnt_enable_map *enable_map,
+ bool accumulate);
/**
* struct kbase_hwcnt_backend_interface - Hardware counter backend virtual
@@ -218,17 +217,17 @@ typedef int (*kbase_hwcnt_backend_dump_get_fn)(
*/
struct kbase_hwcnt_backend_interface {
const struct kbase_hwcnt_backend_info *info;
- kbase_hwcnt_backend_metadata_fn metadata;
- kbase_hwcnt_backend_init_fn init;
- kbase_hwcnt_backend_term_fn term;
- kbase_hwcnt_backend_timestamp_ns_fn timestamp_ns;
- kbase_hwcnt_backend_dump_enable_fn dump_enable;
- kbase_hwcnt_backend_dump_enable_nolock_fn dump_enable_nolock;
- kbase_hwcnt_backend_dump_disable_fn dump_disable;
- kbase_hwcnt_backend_dump_clear_fn dump_clear;
- kbase_hwcnt_backend_dump_request_fn dump_request;
- kbase_hwcnt_backend_dump_wait_fn dump_wait;
- kbase_hwcnt_backend_dump_get_fn dump_get;
+ kbase_hwcnt_backend_metadata_fn *metadata;
+ kbase_hwcnt_backend_init_fn *init;
+ kbase_hwcnt_backend_term_fn *term;
+ kbase_hwcnt_backend_timestamp_ns_fn *timestamp_ns;
+ kbase_hwcnt_backend_dump_enable_fn *dump_enable;
+ kbase_hwcnt_backend_dump_enable_nolock_fn *dump_enable_nolock;
+ kbase_hwcnt_backend_dump_disable_fn *dump_disable;
+ kbase_hwcnt_backend_dump_clear_fn *dump_clear;
+ kbase_hwcnt_backend_dump_request_fn *dump_request;
+ kbase_hwcnt_backend_dump_wait_fn *dump_wait;
+ kbase_hwcnt_backend_dump_get_fn *dump_get;
};
#endif /* _KBASE_HWCNT_BACKEND_H_ */
diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf.c b/mali_kbase/mali_kbase_hwcnt_backend_csf.c
index 4bc62c1..51c59df 100644
--- a/mali_kbase/mali_kbase_hwcnt_backend_csf.c
+++ b/mali_kbase/mali_kbase_hwcnt_backend_csf.c
@@ -228,7 +228,7 @@ struct kbase_hwcnt_backend_csf {
struct work_struct hwc_threshold_work;
};
-bool kbasep_hwcnt_backend_csf_backend_exists(
+static bool kbasep_hwcnt_backend_csf_backend_exists(
struct kbase_hwcnt_backend_csf_info *csf_info)
{
WARN_ON(!csf_info);
@@ -347,8 +347,10 @@ static void kbasep_hwcnt_backend_csf_init_layout(
phys_layout->shader_avail_mask = prfcnt_info->core_mask;
phys_layout->headers_per_block = KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
- phys_layout->counters_per_block = KBASE_HWCNT_V5_COUNTERS_PER_BLOCK;
- phys_layout->values_per_block = KBASE_HWCNT_V5_VALUES_PER_BLOCK;
+ phys_layout->values_per_block =
+ prfcnt_info->prfcnt_block_size / KBASE_HWCNT_VALUE_BYTES;
+ phys_layout->counters_per_block =
+ phys_layout->values_per_block - phys_layout->headers_per_block;
phys_layout->offset_enable_mask = KBASE_HWCNT_V5_PRFCNT_EN_HEADER;
}
@@ -1783,6 +1785,9 @@ int kbase_hwcnt_backend_csf_metadata_init(
gpu_info.l2_count = csf_info->prfcnt_info.l2_count;
gpu_info.core_mask = csf_info->prfcnt_info.core_mask;
gpu_info.clk_cnt = csf_info->prfcnt_info.clk_cnt;
+ gpu_info.prfcnt_values_per_block =
+ csf_info->prfcnt_info.prfcnt_block_size /
+ KBASE_HWCNT_VALUE_BYTES;
errcode = kbase_hwcnt_csf_metadata_create(
&gpu_info, csf_info->counter_set, &csf_info->metadata);
if (errcode)
diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h b/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h
index b4ddd31..c6c490a 100644
--- a/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h
+++ b/mali_kbase/mali_kbase_hwcnt_backend_csf_if.h
@@ -65,6 +65,7 @@ struct kbase_hwcnt_backend_csf_if_enable {
* information.
* @dump_bytes: Bytes of GPU memory required to perform a performance
* counter dump.
+ * @prfcnt_block_size Bytes of each performance counter block.
* @l2_count: The MMU L2 cache count.
* @core_mask: Shader core mask.
* @clk_cnt: Clock domain count in the system.
@@ -73,6 +74,7 @@ struct kbase_hwcnt_backend_csf_if_enable {
*/
struct kbase_hwcnt_backend_csf_if_prfcnt_info {
size_t dump_bytes;
+ size_t prfcnt_block_size;
size_t l2_count;
u64 core_mask;
u8 clk_cnt;
@@ -85,7 +87,7 @@ struct kbase_hwcnt_backend_csf_if_prfcnt_info {
* held.
* @ctx: Non-NULL pointer to a CSF context.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_assert_lock_held_fn)(
+typedef void kbase_hwcnt_backend_csf_if_assert_lock_held_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx);
/**
@@ -95,8 +97,9 @@ typedef void (*kbase_hwcnt_backend_csf_if_assert_lock_held_fn)(
* @flags: Pointer to the memory location that would store the previous
* interrupt state.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_lock_fn)(
- struct kbase_hwcnt_backend_csf_if_ctx *ctx, unsigned long *flags);
+typedef void
+kbase_hwcnt_backend_csf_if_lock_fn(struct kbase_hwcnt_backend_csf_if_ctx *ctx,
+ unsigned long *flags);
/**
* typedef kbase_hwcnt_backend_csf_if_unlock_fn - Release backend spinlock.
@@ -105,8 +108,9 @@ typedef void (*kbase_hwcnt_backend_csf_if_lock_fn)(
* @flags: Previously stored interrupt state when Scheduler interrupt
* spinlock was acquired.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_unlock_fn)(
- struct kbase_hwcnt_backend_csf_if_ctx *ctx, unsigned long flags);
+typedef void
+kbase_hwcnt_backend_csf_if_unlock_fn(struct kbase_hwcnt_backend_csf_if_ctx *ctx,
+ unsigned long flags);
/**
* typedef kbase_hwcnt_backend_csf_if_get_prfcnt_info_fn - Get performance
@@ -115,7 +119,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_unlock_fn)(
* @prfcnt_info: Non-NULL pointer to struct where performance counter
* information should be stored.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_get_prfcnt_info_fn)(
+typedef void kbase_hwcnt_backend_csf_if_get_prfcnt_info_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx,
struct kbase_hwcnt_backend_csf_if_prfcnt_info *prfcnt_info);
@@ -135,7 +139,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_get_prfcnt_info_fn)(
*
* Return: 0 on success, else error code.
*/
-typedef int (*kbase_hwcnt_backend_csf_if_ring_buf_alloc_fn)(
+typedef int kbase_hwcnt_backend_csf_if_ring_buf_alloc_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx, u32 buf_count,
void **cpu_dump_base,
struct kbase_hwcnt_backend_csf_if_ring_buf **ring_buf);
@@ -157,7 +161,7 @@ typedef int (*kbase_hwcnt_backend_csf_if_ring_buf_alloc_fn)(
* Flush cached HWC dump buffer data to ensure that all writes from GPU and CPU
* are correctly observed.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_ring_buf_sync_fn)(
+typedef void kbase_hwcnt_backend_csf_if_ring_buf_sync_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx,
struct kbase_hwcnt_backend_csf_if_ring_buf *ring_buf,
u32 buf_index_first, u32 buf_index_last, bool for_cpu);
@@ -169,7 +173,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_ring_buf_sync_fn)(
* @ctx: Non-NULL pointer to a CSF interface context.
* @ring_buf: Non-NULL pointer to the ring buffer which to be freed.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_ring_buf_free_fn)(
+typedef void kbase_hwcnt_backend_csf_if_ring_buf_free_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx,
struct kbase_hwcnt_backend_csf_if_ring_buf *ring_buf);
@@ -181,7 +185,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_ring_buf_free_fn)(
*
* Return: CSF interface timestamp in nanoseconds.
*/
-typedef u64 (*kbase_hwcnt_backend_csf_if_timestamp_ns_fn)(
+typedef u64 kbase_hwcnt_backend_csf_if_timestamp_ns_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx);
/**
@@ -193,7 +197,7 @@ typedef u64 (*kbase_hwcnt_backend_csf_if_timestamp_ns_fn)(
*
* Requires lock to be taken before calling.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_dump_enable_fn)(
+typedef void kbase_hwcnt_backend_csf_if_dump_enable_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx,
struct kbase_hwcnt_backend_csf_if_ring_buf *ring_buf,
struct kbase_hwcnt_backend_csf_if_enable *enable);
@@ -205,7 +209,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_dump_enable_fn)(
*
* Requires lock to be taken before calling.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_dump_disable_fn)(
+typedef void kbase_hwcnt_backend_csf_if_dump_disable_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx);
/**
@@ -215,7 +219,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_dump_disable_fn)(
*
* Requires lock to be taken before calling.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_dump_request_fn)(
+typedef void kbase_hwcnt_backend_csf_if_dump_request_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx);
/**
@@ -229,7 +233,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_dump_request_fn)(
*
* Requires lock to be taken before calling.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_get_indexes_fn)(
+typedef void kbase_hwcnt_backend_csf_if_get_indexes_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx, u32 *extract_index,
u32 *insert_index);
@@ -243,7 +247,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_get_indexes_fn)(
*
* Requires lock to be taken before calling.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_set_extract_index_fn)(
+typedef void kbase_hwcnt_backend_csf_if_set_extract_index_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx, u32 extract_index);
/**
@@ -258,7 +262,7 @@ typedef void (*kbase_hwcnt_backend_csf_if_set_extract_index_fn)(
*
* Requires lock to be taken before calling.
*/
-typedef void (*kbase_hwcnt_backend_csf_if_get_gpu_cycle_count_fn)(
+typedef void kbase_hwcnt_backend_csf_if_get_gpu_cycle_count_fn(
struct kbase_hwcnt_backend_csf_if_ctx *ctx, u64 *cycle_counts,
u64 clk_enable_map);
@@ -288,20 +292,20 @@ typedef void (*kbase_hwcnt_backend_csf_if_get_gpu_cycle_count_fn)(
*/
struct kbase_hwcnt_backend_csf_if {
struct kbase_hwcnt_backend_csf_if_ctx *ctx;
- kbase_hwcnt_backend_csf_if_assert_lock_held_fn assert_lock_held;
- kbase_hwcnt_backend_csf_if_lock_fn lock;
- kbase_hwcnt_backend_csf_if_unlock_fn unlock;
- kbase_hwcnt_backend_csf_if_get_prfcnt_info_fn get_prfcnt_info;
- kbase_hwcnt_backend_csf_if_ring_buf_alloc_fn ring_buf_alloc;
- kbase_hwcnt_backend_csf_if_ring_buf_sync_fn ring_buf_sync;
- kbase_hwcnt_backend_csf_if_ring_buf_free_fn ring_buf_free;
- kbase_hwcnt_backend_csf_if_timestamp_ns_fn timestamp_ns;
- kbase_hwcnt_backend_csf_if_dump_enable_fn dump_enable;
- kbase_hwcnt_backend_csf_if_dump_disable_fn dump_disable;
- kbase_hwcnt_backend_csf_if_dump_request_fn dump_request;
- kbase_hwcnt_backend_csf_if_get_indexes_fn get_indexes;
- kbase_hwcnt_backend_csf_if_set_extract_index_fn set_extract_index;
- kbase_hwcnt_backend_csf_if_get_gpu_cycle_count_fn get_gpu_cycle_count;
+ kbase_hwcnt_backend_csf_if_assert_lock_held_fn *assert_lock_held;
+ kbase_hwcnt_backend_csf_if_lock_fn *lock;
+ kbase_hwcnt_backend_csf_if_unlock_fn *unlock;
+ kbase_hwcnt_backend_csf_if_get_prfcnt_info_fn *get_prfcnt_info;
+ kbase_hwcnt_backend_csf_if_ring_buf_alloc_fn *ring_buf_alloc;
+ kbase_hwcnt_backend_csf_if_ring_buf_sync_fn *ring_buf_sync;
+ kbase_hwcnt_backend_csf_if_ring_buf_free_fn *ring_buf_free;
+ kbase_hwcnt_backend_csf_if_timestamp_ns_fn *timestamp_ns;
+ kbase_hwcnt_backend_csf_if_dump_enable_fn *dump_enable;
+ kbase_hwcnt_backend_csf_if_dump_disable_fn *dump_disable;
+ kbase_hwcnt_backend_csf_if_dump_request_fn *dump_request;
+ kbase_hwcnt_backend_csf_if_get_indexes_fn *get_indexes;
+ kbase_hwcnt_backend_csf_if_set_extract_index_fn *set_extract_index;
+ kbase_hwcnt_backend_csf_if_get_gpu_cycle_count_fn *get_gpu_cycle_count;
};
#endif /* #define _KBASE_HWCNT_BACKEND_CSF_IF_H_ */
diff --git a/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c
index 67ca4cb..a9d3298 100644
--- a/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c
+++ b/mali_kbase/mali_kbase_hwcnt_backend_csf_if_fw.c
@@ -37,9 +37,7 @@
#include <linux/log2.h>
#include "mali_kbase_ccswe.h"
-#ifdef CONFIG_MALI_NO_MALI
-#include <backend/gpu/mali_kbase_model_dummy.h>
-#endif
+
/** The number of nanoseconds in a second. */
#define NSECS_IN_SEC 1000000000ull /* ns */
@@ -76,6 +74,7 @@ struct kbase_hwcnt_backend_csf_if_fw_ring_buf {
* @buf_bytes: The size in bytes for each buffer in the ring buffer.
* @clk_cnt: The number of clock domains in the system.
* The maximum is 64.
+ * @clk_enable_map: Bitmask of enabled clocks
* @rate_listener: Clock rate listener callback state.
* @ccswe_shader_cores: Shader cores cycle count software estimator.
*/
@@ -160,8 +159,8 @@ static void kbasep_hwcnt_backend_csf_if_fw_on_freq_change(
/**
* kbasep_hwcnt_backend_csf_if_fw_cc_enable() - Enable cycle count tracking
*
- * @fw_ctx: Non-NULL pointer to CSF firmware interface context.
- * @enable_map: Non-NULL pointer to enable map specifying enabled counters.
+ * @fw_ctx: Non-NULL pointer to CSF firmware interface context.
+ * @clk_enable_map: Non-NULL pointer to enable map specifying enabled counters.
*/
static void kbasep_hwcnt_backend_csf_if_fw_cc_enable(
struct kbase_hwcnt_backend_csf_if_fw_ctx *fw_ctx, u64 clk_enable_map)
@@ -218,20 +217,13 @@ static void kbasep_hwcnt_backend_csf_if_fw_get_prfcnt_info(
struct kbase_hwcnt_backend_csf_if_ctx *ctx,
struct kbase_hwcnt_backend_csf_if_prfcnt_info *prfcnt_info)
{
-#ifdef CONFIG_MALI_NO_MALI
- prfcnt_info->l2_count = KBASE_DUMMY_MODEL_MAX_MEMSYS_BLOCKS;
- prfcnt_info->core_mask =
- (1ull << KBASE_DUMMY_MODEL_MAX_SHADER_CORES) - 1;
- prfcnt_info->dump_bytes = KBASE_DUMMY_MODEL_MAX_NUM_PERF_BLOCKS *
- KBASE_DUMMY_MODEL_BLOCK_SIZE;
- prfcnt_info->clk_cnt = 1;
- prfcnt_info->clearing_samples = false;
-#else
struct kbase_hwcnt_backend_csf_if_fw_ctx *fw_ctx;
struct kbase_device *kbdev;
u32 prfcnt_size;
u32 prfcnt_hw_size = 0;
u32 prfcnt_fw_size = 0;
+ u32 prfcnt_block_size = KBASE_HWCNT_V5_DEFAULT_VALUES_PER_BLOCK *
+ KBASE_HWCNT_VALUE_BYTES;
WARN_ON(!ctx);
WARN_ON(!prfcnt_info);
@@ -242,15 +234,23 @@ static void kbasep_hwcnt_backend_csf_if_fw_get_prfcnt_info(
prfcnt_hw_size = (prfcnt_size & 0xFF) << 8;
prfcnt_fw_size = (prfcnt_size >> 16) << 8;
fw_ctx->buf_bytes = prfcnt_hw_size + prfcnt_fw_size;
- prfcnt_info->dump_bytes = fw_ctx->buf_bytes;
+
+ prfcnt_info->dump_bytes = fw_ctx->buf_bytes;
+ prfcnt_info->prfcnt_block_size = prfcnt_block_size;
prfcnt_info->l2_count = kbdev->gpu_props.props.l2_props.num_l2_slices;
prfcnt_info->core_mask =
kbdev->gpu_props.props.coherency_info.group[0].core_mask;
prfcnt_info->clk_cnt = fw_ctx->clk_cnt;
prfcnt_info->clearing_samples = true;
-#endif
+
+ /* Block size must be multiple of counter size. */
+ WARN_ON((prfcnt_info->prfcnt_block_size % KBASE_HWCNT_VALUE_BYTES) !=
+ 0);
+ /* Total size must be multiple of block size. */
+ WARN_ON((prfcnt_info->dump_bytes % prfcnt_info->prfcnt_block_size) !=
+ 0);
}
static int kbasep_hwcnt_backend_csf_if_fw_ring_buf_alloc(
@@ -339,6 +339,7 @@ static int kbasep_hwcnt_backend_csf_if_fw_ring_buf_alloc(
*out_ring_buf =
(struct kbase_hwcnt_backend_csf_if_ring_buf *)fw_ring_buf;
+
return 0;
mmu_insert_failed:
@@ -682,9 +683,9 @@ static void kbasep_hwcnt_backend_csf_if_fw_get_gpu_cycle_count(
}
/**
- * @brief Destroy a CSF FW interface context.
+ * kbasep_hwcnt_backedn_csf_if_fw_cts_destroy() - Destroy a CSF FW interface context.
*
- * @param[in,out] fw_ctx Pointer to context to destroy.
+ * @fw_ctx: Pointer to context to destroy.
*/
static void kbasep_hwcnt_backend_csf_if_fw_ctx_destroy(
struct kbase_hwcnt_backend_csf_if_fw_ctx *fw_ctx)
diff --git a/mali_kbase/mali_kbase_hwcnt_backend_jm.c b/mali_kbase/mali_kbase_hwcnt_backend_jm.c
index 4168472..804af09 100644
--- a/mali_kbase/mali_kbase_hwcnt_backend_jm.c
+++ b/mali_kbase/mali_kbase_hwcnt_backend_jm.c
@@ -23,14 +23,11 @@
#include "mali_kbase_hwcnt_gpu.h"
#include "mali_kbase_hwcnt_types.h"
#include "mali_kbase.h"
-#include "mali_kbase_pm_ca.h"
+#include "backend/gpu/mali_kbase_pm_ca.h"
#include "mali_kbase_hwaccess_instr.h"
#include "mali_kbase_hwaccess_time.h"
#include "mali_kbase_ccswe.h"
-#ifdef CONFIG_MALI_NO_MALI
-#include "backend/gpu/mali_kbase_model_dummy.h"
-#endif
#include "backend/gpu/mali_kbase_clk_rate_trace_mgr.h"
#include "backend/gpu/mali_kbase_pm_internal.h"
@@ -108,10 +105,6 @@ kbasep_hwcnt_backend_jm_gpu_info_init(struct kbase_device *kbdev,
if (!kbdev || !info)
return -EINVAL;
-#ifdef CONFIG_MALI_NO_MALI
- info->l2_count = KBASE_DUMMY_MODEL_MAX_MEMSYS_BLOCKS;
- info->core_mask = (1ull << KBASE_DUMMY_MODEL_MAX_SHADER_CORES) - 1;
-#else /* CONFIG_MALI_NO_MALI */
{
const struct base_gpu_props *props = &kbdev->gpu_props.props;
const size_t l2_count = props->l2_props.num_l2_slices;
@@ -120,8 +113,9 @@ kbasep_hwcnt_backend_jm_gpu_info_init(struct kbase_device *kbdev,
info->l2_count = l2_count;
info->core_mask = core_mask;
+ info->prfcnt_values_per_block =
+ KBASE_HWCNT_V5_DEFAULT_VALUES_PER_BLOCK;
}
-#endif /* CONFIG_MALI_NO_MALI */
/* Determine the number of available clock domains. */
for (clk = 0; clk < BASE_MAX_NR_CLOCKS_REGULATORS; clk++) {
@@ -483,11 +477,6 @@ static int kbasep_hwcnt_backend_jm_dump_get(
struct kbase_hwcnt_backend_jm *backend_jm =
(struct kbase_hwcnt_backend_jm *)backend;
size_t clk;
-#ifdef CONFIG_MALI_NO_MALI
- struct kbase_device *kbdev;
- unsigned long flags;
- int errcode;
-#endif
if (!backend_jm || !dst || !dst_enable_map ||
(backend_jm->info->metadata != dst->metadata) ||
@@ -507,21 +496,6 @@ static int kbasep_hwcnt_backend_jm_dump_get(
dst->clk_cnt_buf[clk] = backend_jm->cycle_count_elapsed[clk];
}
-#ifdef CONFIG_MALI_NO_MALI
- kbdev = backend_jm->kctx->kbdev;
-
- spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
-
- /* Update the current configuration information. */
- errcode = kbasep_hwcnt_gpu_update_curr_config(kbdev,
- &backend_jm->curr_config);
-
- spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
-
- if (errcode)
- return errcode;
-#endif
-
return kbase_hwcnt_jm_dump_get(dst, backend_jm->cpu_dump_va,
dst_enable_map, backend_jm->pm_core_mask,
&backend_jm->curr_config, accumulate);
@@ -655,10 +629,6 @@ static int kbasep_hwcnt_backend_jm_create(
kbase_ccswe_init(&backend->ccswe_shader_cores);
backend->rate_listener.notify = kbasep_hwcnt_backend_jm_on_freq_change;
-#ifdef CONFIG_MALI_NO_MALI
- /* The dummy model needs the CPU mapping. */
- gpu_model_set_dummy_prfcnt_base_cpu(backend->cpu_dump_va);
-#endif
*out_backend = backend;
return 0;
diff --git a/mali_kbase/mali_kbase_hwcnt_backend_jm.h b/mali_kbase/mali_kbase_hwcnt_backend_jm.h
index 5d1947e..2bbd54c 100644
--- a/mali_kbase/mali_kbase_hwcnt_backend_jm.h
+++ b/mali_kbase/mali_kbase_hwcnt_backend_jm.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwcnt_context.h b/mali_kbase/mali_kbase_hwcnt_context.h
index 403b1c5..68e5916 100644
--- a/mali_kbase/mali_kbase_hwcnt_context.h
+++ b/mali_kbase/mali_kbase_hwcnt_context.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwcnt_gpu.c b/mali_kbase/mali_kbase_hwcnt_gpu.c
index 4fba6b6..908f92c 100644
--- a/mali_kbase/mali_kbase_hwcnt_gpu.c
+++ b/mali_kbase/mali_kbase_hwcnt_gpu.c
@@ -25,13 +25,6 @@
#include <linux/bug.h>
#include <linux/err.h>
-#define KBASE_HWCNT_V5_BLOCK_TYPE_COUNT 4
-#define KBASE_HWCNT_V5_HEADERS_PER_BLOCK 4
-#define KBASE_HWCNT_V5_COUNTERS_PER_BLOCK 60
-#define KBASE_HWCNT_V5_VALUES_PER_BLOCK \
- (KBASE_HWCNT_V5_HEADERS_PER_BLOCK + KBASE_HWCNT_V5_COUNTERS_PER_BLOCK)
-/* Index of the PRFCNT_EN header into a V5 counter block */
-#define KBASE_HWCNT_V5_PRFCNT_EN_HEADER 2
static void kbasep_get_fe_block_type(u64 *dst, enum kbase_hwcnt_set counter_set,
bool is_csf)
@@ -160,19 +153,22 @@ static int kbasep_hwcnt_backend_gpu_metadata_create(
kbasep_get_fe_block_type(&blks[0].type, counter_set, is_csf);
blks[0].inst_cnt = 1;
blks[0].hdr_cnt = KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
- blks[0].ctr_cnt = KBASE_HWCNT_V5_COUNTERS_PER_BLOCK;
+ blks[0].ctr_cnt = gpu_info->prfcnt_values_per_block -
+ KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
/* One Tiler block */
kbasep_get_tiler_block_type(&blks[1].type, counter_set);
blks[1].inst_cnt = 1;
blks[1].hdr_cnt = KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
- blks[1].ctr_cnt = KBASE_HWCNT_V5_COUNTERS_PER_BLOCK;
+ blks[1].ctr_cnt = gpu_info->prfcnt_values_per_block -
+ KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
/* l2_count memsys blks */
kbasep_get_memsys_block_type(&blks[2].type, counter_set);
blks[2].inst_cnt = gpu_info->l2_count;
blks[2].hdr_cnt = KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
- blks[2].ctr_cnt = KBASE_HWCNT_V5_COUNTERS_PER_BLOCK;
+ blks[2].ctr_cnt = gpu_info->prfcnt_values_per_block -
+ KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
/*
* There are as many shader cores in the system as there are bits set in
@@ -193,7 +189,8 @@ static int kbasep_hwcnt_backend_gpu_metadata_create(
kbasep_get_sc_block_type(&blks[3].type, counter_set, is_csf);
blks[3].inst_cnt = sc_block_count;
blks[3].hdr_cnt = KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
- blks[3].ctr_cnt = KBASE_HWCNT_V5_COUNTERS_PER_BLOCK;
+ blks[3].ctr_cnt = gpu_info->prfcnt_values_per_block -
+ KBASE_HWCNT_V5_HEADERS_PER_BLOCK;
WARN_ON(KBASE_HWCNT_V5_BLOCK_TYPE_COUNT != 4);
@@ -226,7 +223,7 @@ kbasep_hwcnt_backend_jm_dump_bytes(const struct kbase_hwcnt_gpu_info *gpu_info)
WARN_ON(!gpu_info);
return (2 + gpu_info->l2_count + fls64(gpu_info->core_mask)) *
- KBASE_HWCNT_V5_VALUES_PER_BLOCK * KBASE_HWCNT_VALUE_BYTES;
+ gpu_info->prfcnt_values_per_block * KBASE_HWCNT_VALUE_BYTES;
}
int kbase_hwcnt_jm_metadata_create(
@@ -305,6 +302,127 @@ void kbase_hwcnt_csf_metadata_destroy(
kbase_hwcnt_metadata_destroy(metadata);
}
+int kbase_hwcnt_gpu_metadata_create_truncate_64(
+ const struct kbase_hwcnt_metadata **dst_md,
+ const struct kbase_hwcnt_metadata *src_md)
+{
+ struct kbase_hwcnt_description desc;
+ struct kbase_hwcnt_group_description group;
+ struct kbase_hwcnt_block_description
+ blks[KBASE_HWCNT_V5_BLOCK_TYPE_COUNT];
+ size_t prfcnt_values_per_block;
+ size_t blk;
+
+ if (!dst_md || !src_md || !src_md->grp_metadata ||
+ !src_md->grp_metadata[0].blk_metadata)
+ return -EINVAL;
+
+ /* Only support 1 group count and KBASE_HWCNT_V5_BLOCK_TYPE_COUNT block
+ * count in the metadata.
+ */
+ if ((kbase_hwcnt_metadata_group_count(src_md) != 1) ||
+ (kbase_hwcnt_metadata_block_count(src_md, 0) !=
+ KBASE_HWCNT_V5_BLOCK_TYPE_COUNT))
+ return -EINVAL;
+
+ /* Get the values count in the first block. */
+ prfcnt_values_per_block =
+ kbase_hwcnt_metadata_block_values_count(src_md, 0, 0);
+
+ /* check all blocks should have same values count. */
+ for (blk = 0; blk < KBASE_HWCNT_V5_BLOCK_TYPE_COUNT; blk++) {
+ size_t val_cnt =
+ kbase_hwcnt_metadata_block_values_count(src_md, 0, blk);
+ if (val_cnt != prfcnt_values_per_block)
+ return -EINVAL;
+ }
+
+ /* Only support 64 and 128 entries per block. */
+ if ((prfcnt_values_per_block != 64) && (prfcnt_values_per_block != 128))
+ return -EINVAL;
+
+ if (prfcnt_values_per_block == 64) {
+ /* If the values per block is 64, no need to truncate. */
+ *dst_md = NULL;
+ return 0;
+ }
+
+ /* Truncate from 128 to 64 entries per block to keep API backward
+ * compatibility.
+ */
+ prfcnt_values_per_block = 64;
+
+ for (blk = 0; blk < KBASE_HWCNT_V5_BLOCK_TYPE_COUNT; blk++) {
+ blks[blk].type =
+ kbase_hwcnt_metadata_block_type(src_md, 0, blk);
+ blks[blk].inst_cnt = kbase_hwcnt_metadata_block_instance_count(
+ src_md, 0, blk);
+ blks[blk].hdr_cnt = kbase_hwcnt_metadata_block_headers_count(
+ src_md, 0, blk);
+ blks[blk].ctr_cnt = prfcnt_values_per_block - blks[blk].hdr_cnt;
+ }
+
+ group.type = kbase_hwcnt_metadata_group_type(src_md, 0);
+ group.blk_cnt = KBASE_HWCNT_V5_BLOCK_TYPE_COUNT;
+ group.blks = blks;
+
+ desc.grp_cnt = kbase_hwcnt_metadata_group_count(src_md);
+ desc.avail_mask = src_md->avail_mask;
+ desc.clk_cnt = src_md->clk_cnt;
+ desc.grps = &group;
+
+ return kbase_hwcnt_metadata_create(&desc, dst_md);
+}
+
+void kbase_hwcnt_dump_buffer_copy_strict_narrow(
+ struct kbase_hwcnt_dump_buffer *dst,
+ const struct kbase_hwcnt_dump_buffer *src,
+ const struct kbase_hwcnt_enable_map *dst_enable_map)
+{
+ const struct kbase_hwcnt_metadata *metadata;
+ size_t grp, blk, blk_inst;
+ size_t clk;
+
+ if (WARN_ON(!dst) || WARN_ON(!src) || WARN_ON(!dst_enable_map) ||
+ WARN_ON(dst == src) || WARN_ON(dst->metadata == src->metadata) ||
+ WARN_ON(dst->metadata->grp_cnt != src->metadata->grp_cnt) ||
+ WARN_ON(src->metadata->grp_cnt != 1) ||
+ WARN_ON(dst->metadata->grp_metadata[0].blk_cnt !=
+ src->metadata->grp_metadata[0].blk_cnt) ||
+ WARN_ON(dst->metadata->grp_metadata[0].blk_cnt != 4) ||
+ WARN_ON(dst->metadata->grp_metadata[0].blk_metadata[0].ctr_cnt >
+ src->metadata->grp_metadata[0].blk_metadata[0].ctr_cnt))
+ return;
+
+ /* Don't use src metadata since src buffer is bigger than dst buffer. */
+ metadata = dst->metadata;
+
+ kbase_hwcnt_metadata_for_each_block(metadata, grp, blk, blk_inst) {
+ u32 *dst_blk = kbase_hwcnt_dump_buffer_block_instance(
+ dst, grp, blk, blk_inst);
+ const u32 *src_blk = kbase_hwcnt_dump_buffer_block_instance(
+ src, grp, blk, blk_inst);
+ const u64 *blk_em = kbase_hwcnt_enable_map_block_instance(
+ dst_enable_map, grp, blk, blk_inst);
+ size_t val_cnt = kbase_hwcnt_metadata_block_values_count(
+ metadata, grp, blk);
+ /* Align upwards to include padding bytes */
+ val_cnt = KBASE_HWCNT_ALIGN_UPWARDS(
+ val_cnt, (KBASE_HWCNT_BLOCK_BYTE_ALIGNMENT /
+ KBASE_HWCNT_VALUE_BYTES));
+
+ kbase_hwcnt_dump_buffer_block_copy_strict(dst_blk, src_blk,
+ blk_em, val_cnt);
+ }
+
+ kbase_hwcnt_metadata_for_each_clock(metadata, clk) {
+ bool clk_enabled = kbase_hwcnt_clk_enable_map_enabled(
+ dst_enable_map->clk_enable_map, clk);
+
+ dst->clk_cnt_buf[clk] = clk_enabled ? src->clk_cnt_buf[clk] : 0;
+ }
+}
+
static bool is_block_type_shader(
const u64 grp_type,
const u64 blk_type,
@@ -594,15 +712,11 @@ void kbase_hwcnt_gpu_enable_map_to_physical(
metadata, grp);
const u64 blk_type = kbase_hwcnt_metadata_block_type(
metadata, grp, blk);
- const size_t blk_val_cnt =
- kbase_hwcnt_metadata_block_values_count(
- metadata, grp, blk);
const u64 *blk_map = kbase_hwcnt_enable_map_block_instance(
src, grp, blk, blk_inst);
if ((enum kbase_hwcnt_gpu_group_type)grp_type ==
KBASE_HWCNT_GPU_GROUP_TYPE_V5) {
- WARN_ON(blk_val_cnt != KBASE_HWCNT_V5_VALUES_PER_BLOCK);
switch ((enum kbase_hwcnt_gpu_v5_block_type)blk_type) {
case KBASE_HWCNT_GPU_V5_BLOCK_TYPE_PERF_UNDEFINED:
/* Nothing to do in this case. */
@@ -692,15 +806,11 @@ void kbase_hwcnt_gpu_enable_map_from_physical(
metadata, grp);
const u64 blk_type = kbase_hwcnt_metadata_block_type(
metadata, grp, blk);
- const size_t blk_val_cnt =
- kbase_hwcnt_metadata_block_values_count(
- metadata, grp, blk);
u64 *blk_map = kbase_hwcnt_enable_map_block_instance(
dst, grp, blk, blk_inst);
if ((enum kbase_hwcnt_gpu_group_type)grp_type ==
KBASE_HWCNT_GPU_GROUP_TYPE_V5) {
- WARN_ON(blk_val_cnt != KBASE_HWCNT_V5_VALUES_PER_BLOCK);
switch ((enum kbase_hwcnt_gpu_v5_block_type)blk_type) {
case KBASE_HWCNT_GPU_V5_BLOCK_TYPE_PERF_UNDEFINED:
/* Nothing to do in this case. */
diff --git a/mali_kbase/mali_kbase_hwcnt_gpu.h b/mali_kbase/mali_kbase_hwcnt_gpu.h
index 9b846a9..8f7b768 100644
--- a/mali_kbase/mali_kbase_hwcnt_gpu.h
+++ b/mali_kbase/mali_kbase_hwcnt_gpu.h
@@ -31,9 +31,10 @@ struct kbase_hwcnt_dump_buffer;
#define KBASE_HWCNT_V5_BLOCK_TYPE_COUNT 4
#define KBASE_HWCNT_V5_HEADERS_PER_BLOCK 4
-#define KBASE_HWCNT_V5_COUNTERS_PER_BLOCK 60
-#define KBASE_HWCNT_V5_VALUES_PER_BLOCK \
- (KBASE_HWCNT_V5_HEADERS_PER_BLOCK + KBASE_HWCNT_V5_COUNTERS_PER_BLOCK)
+#define KBASE_HWCNT_V5_DEFAULT_COUNTERS_PER_BLOCK 60
+#define KBASE_HWCNT_V5_DEFAULT_VALUES_PER_BLOCK \
+ (KBASE_HWCNT_V5_HEADERS_PER_BLOCK + \
+ KBASE_HWCNT_V5_DEFAULT_COUNTERS_PER_BLOCK)
/** Index of the PRFCNT_EN header into a V5 counter block */
#define KBASE_HWCNT_V5_PRFCNT_EN_HEADER 2
@@ -117,14 +118,17 @@ enum kbase_hwcnt_physical_set {
/**
* struct kbase_hwcnt_gpu_info - Information about hwcnt blocks on the GPUs.
- * @l2_count: L2 cache count.
- * @core_mask: Shader core mask. May be sparse.
- * @clk_cnt: Number of clock domains available.
+ * @l2_count: L2 cache count.
+ * @core_mask: Shader core mask. May be sparse.
+ * @clk_cnt: Number of clock domains available.
+ * @prfcnt_values_per_block: Total entries (header + counters) of performance
+ * counter per block.
*/
struct kbase_hwcnt_gpu_info {
size_t l2_count;
u64 core_mask;
u8 clk_cnt;
+ size_t prfcnt_values_per_block;
};
/**
@@ -221,6 +225,48 @@ void kbase_hwcnt_csf_metadata_destroy(
const struct kbase_hwcnt_metadata *metadata);
/**
+ * kbase_hwcnt_gpu_metadata_create_truncate_64() - Create HWC metadata with HWC
+ * block entries truncated
+ * to 64.
+ *
+ * @dst_md: Non-NULL pointer to where created metadata is stored on success.
+ * @src_md: Non-NULL pointer to the HWC metadata used as the source to create
+ * dst_md.
+ *
+ * If the total block entries in src_md is 64, metadata dst_md returns NULL
+ * since no need to truncate.
+ * if the total block entries in src_md is 128, then a new metadata with block
+ * entries truncated to 64 will be created for dst_md, which keeps the interface
+ * to user clients backward compatible.
+ * If the total block entries in src_md is other values, function returns error
+ * since it's not supported.
+ *
+ * Return: 0 on success, else error code.
+ */
+int kbase_hwcnt_gpu_metadata_create_truncate_64(
+ const struct kbase_hwcnt_metadata **dst_md,
+ const struct kbase_hwcnt_metadata *src_md);
+
+/**
+ * kbase_hwcnt_dump_buffer_copy_strict_narrow() - Copy all enabled values from
+ * src to dst.
+ *
+ * @dst: Non-NULL pointer to dst dump buffer.
+ * @src: Non-NULL pointer to src dump buffer.
+ * @dst_enable_map: Non-NULL pointer to enable map specifying enabled values.
+ *
+ * After the operation, all non-enabled values (including padding bytes) will be
+ * zero.
+ *
+ * The dst and src have different metadata, and the dst metadata is narrower
+ * than src metadata.
+ */
+void kbase_hwcnt_dump_buffer_copy_strict_narrow(
+ struct kbase_hwcnt_dump_buffer *dst,
+ const struct kbase_hwcnt_dump_buffer *src,
+ const struct kbase_hwcnt_enable_map *dst_enable_map);
+
+/**
* kbase_hwcnt_jm_dump_get() - Copy or accumulate enabled counters from the raw
* dump buffer in src into the dump buffer
* abstraction in dst.
diff --git a/mali_kbase/mali_kbase_hwcnt_legacy.h b/mali_kbase/mali_kbase_hwcnt_legacy.h
index deaf7eb..7ce480f 100644
--- a/mali_kbase/mali_kbase_hwcnt_legacy.h
+++ b/mali_kbase/mali_kbase_hwcnt_legacy.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwcnt_types.c b/mali_kbase/mali_kbase_hwcnt_types.c
index 931fbf3..0be0926 100644
--- a/mali_kbase/mali_kbase_hwcnt_types.c
+++ b/mali_kbase/mali_kbase_hwcnt_types.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -23,20 +23,6 @@
#include <linux/slab.h>
-/* Minimum alignment of each block of hardware counters */
-#define KBASE_HWCNT_BLOCK_BYTE_ALIGNMENT \
- (KBASE_HWCNT_BITFIELD_BITS * KBASE_HWCNT_VALUE_BYTES)
-
-/**
- * KBASE_HWCNT_ALIGN_UPWARDS() - Align a value to an alignment.
- * @value: The value to align upwards.
- * @alignment: The alignment.
- *
- * Return: A number greater than or equal to value that is aligned to alignment.
- */
-#define KBASE_HWCNT_ALIGN_UPWARDS(value, alignment) \
- (value + ((alignment - (value % alignment)) % alignment))
-
int kbase_hwcnt_metadata_create(
const struct kbase_hwcnt_description *desc,
const struct kbase_hwcnt_metadata **out_metadata)
diff --git a/mali_kbase/mali_kbase_hwcnt_types.h b/mali_kbase/mali_kbase_hwcnt_types.h
index e775393..3f3808e 100644
--- a/mali_kbase/mali_kbase_hwcnt_types.h
+++ b/mali_kbase/mali_kbase_hwcnt_types.h
@@ -99,6 +99,21 @@
*/
#define KBASE_HWCNT_AVAIL_MASK_BITS (sizeof(u64) * BITS_PER_BYTE)
+/* Minimum alignment of each block of hardware counters */
+#define KBASE_HWCNT_BLOCK_BYTE_ALIGNMENT \
+ (KBASE_HWCNT_BITFIELD_BITS * KBASE_HWCNT_VALUE_BYTES)
+
+/**
+ * KBASE_HWCNT_ALIGN_UPWARDS() - Calculate next aligned value.
+ * @value: The value to align upwards.
+ * @alignment: The alignment boundary.
+ *
+ * Return: Input value if already aligned to the specified boundary, or next
+ * (incrementing upwards) aligned value.
+ */
+#define KBASE_HWCNT_ALIGN_UPWARDS(value, alignment) \
+ (value + ((alignment - (value % alignment)) % alignment))
+
/**
* struct kbase_hwcnt_block_description - Description of one or more identical,
* contiguous, Hardware Counter Blocks.
@@ -357,8 +372,7 @@ void kbase_hwcnt_metadata_destroy(const struct kbase_hwcnt_metadata *metadata);
* @grp: Index of the group in the metadata.
* @blk: Index of the block in the group.
*
- * Return: Number of u32 counter headers in each instance of block blk in
- * group grp.
+ * Return: Number of counter headers in each instance of block blk in group grp.
*/
#define kbase_hwcnt_metadata_block_headers_count(metadata, grp, blk) \
((metadata)->grp_metadata[(grp)].blk_metadata[(blk)].hdr_cnt)
@@ -369,19 +383,29 @@ void kbase_hwcnt_metadata_destroy(const struct kbase_hwcnt_metadata *metadata);
* @grp: Index of the group in the metadata.
* @blk: Index of the block in the group.
*
- * Return: Number of u32 counters in each instance of block blk in group
- * grp.
+ * Return: Number of counters in each instance of block blk in group grp.
*/
#define kbase_hwcnt_metadata_block_counters_count(metadata, grp, blk) \
((metadata)->grp_metadata[(grp)].blk_metadata[(blk)].ctr_cnt)
/**
+ * kbase_hwcnt_metadata_block_enable_map_stride() - Get the enable map stride.
+ * @metadata: Non-NULL pointer to metadata.
+ * @grp: Index of the group in the metadata.
+ * @blk: Index of the block in the group.
+ *
+ * Return: enable map stride in each instance of block blk in group grp.
+ */
+#define kbase_hwcnt_metadata_block_enable_map_stride(metadata, grp, blk) \
+ ((metadata)->grp_metadata[(grp)].blk_metadata[(blk)].enable_map_stride)
+
+/**
* kbase_hwcnt_metadata_block_values_count() - Get the number of values.
* @metadata: Non-NULL pointer to metadata.
* @grp: Index of the group in the metadata.
* @blk: Index of the block in the group.
*
- * Return: Number of u32 headers plus counters in each instance of block blk
+ * Return: Number of headers plus counters in each instance of block blk
* in group grp.
*/
#define kbase_hwcnt_metadata_block_values_count(metadata, grp, blk) \
@@ -777,9 +801,7 @@ void kbase_hwcnt_dump_buffer_free(struct kbase_hwcnt_dump_buffer *dump_buf);
* kbase_hwcnt_dump_buffer_array_alloc() - Allocate an array of dump buffers.
* @metadata: Non-NULL pointer to metadata describing the system.
* @n: Number of dump buffers to allocate
- * @dump_bufs: Non-NULL pointer to dump buffer array to be initialised. Each
- * dump buffer in the array will be initialised to undefined values,
- * so must be used as a copy dest, or cleared before use.
+ * @dump_bufs: Non-NULL pointer to dump buffer array to be initialised.
*
* A single zeroed contiguous page allocation will be used for all of the
* buffers inside the array, where:
diff --git a/mali_kbase/mali_kbase_hwcnt_virtualizer.c b/mali_kbase/mali_kbase_hwcnt_virtualizer.c
index 4bb8489..279464a 100644
--- a/mali_kbase/mali_kbase_hwcnt_virtualizer.c
+++ b/mali_kbase/mali_kbase_hwcnt_virtualizer.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_hwcnt_virtualizer.h b/mali_kbase/mali_kbase_hwcnt_virtualizer.h
index 1bce691..6e2297c 100644
--- a/mali_kbase/mali_kbase_hwcnt_virtualizer.h
+++ b/mali_kbase/mali_kbase_hwcnt_virtualizer.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_jd.c b/mali_kbase/mali_kbase_jd.c
index 54032c2..c9fd7ef 100644
--- a/mali_kbase/mali_kbase_jd.c
+++ b/mali_kbase/mali_kbase_jd.c
@@ -20,7 +20,7 @@
*/
#include <linux/dma-buf.h>
-#ifdef CONFIG_COMPAT
+#if IS_ENABLED(CONFIG_COMPAT)
#include <linux/compat.h>
#endif
#include <mali_kbase.h>
@@ -62,7 +62,7 @@
static void __user *
get_compat_pointer(struct kbase_context *kctx, const u64 p)
{
-#ifdef CONFIG_COMPAT
+#if IS_ENABLED(CONFIG_COMPAT)
if (kbase_ctx_flag(kctx, KCTX_COMPAT))
return compat_ptr(p);
#endif
@@ -924,7 +924,7 @@ bool jd_done_nolock(struct kbase_jd_atom *katom,
KBASE_EXPORT_TEST_API(jd_done_nolock);
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
enum {
CORE_REQ_DEP_ONLY,
CORE_REQ_SOFT,
@@ -1281,7 +1281,7 @@ static bool jd_submit_atom(struct kbase_context *const kctx,
jd_mark_simple_gfx_frame_atoms(katom);
-#ifdef CONFIG_GPU_TRACEPOINTS
+#if IS_ENABLED(CONFIG_GPU_TRACEPOINTS)
katom->work_id = atomic_inc_return(&jctx->work_id);
trace_gpu_job_enqueue(kctx->id, katom->work_id,
kbasep_map_core_reqs_to_string(katom->core_req));
@@ -1784,7 +1784,7 @@ void kbase_jd_done(struct kbase_jd_atom *katom, int slot_nr,
atomic_inc(&kctx->work_count);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/* a failed job happened and is waiting for dumping*/
if (!katom->will_fail_event_code &&
kbase_debug_job_fault_process(katom, katom->event_code))
@@ -1864,7 +1864,7 @@ void kbase_jd_zap_context(struct kbase_context *kctx)
flush_workqueue(kctx->dma_fence.wq);
#endif
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
kbase_debug_job_fault_kctx_unblock(kctx);
#endif
diff --git a/mali_kbase/mali_kbase_jd_debugfs.c b/mali_kbase/mali_kbase_jd_debugfs.c
index f423758..f097880 100644
--- a/mali_kbase/mali_kbase_jd_debugfs.c
+++ b/mali_kbase/mali_kbase_jd_debugfs.c
@@ -19,7 +19,7 @@
*
*/
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
#include <linux/seq_file.h>
#include <mali_kbase.h>
diff --git a/mali_kbase/mali_kbase_jm.h b/mali_kbase/mali_kbase_jm.h
index 47202b9..41f105b 100644
--- a/mali_kbase/mali_kbase_jm.h
+++ b/mali_kbase/mali_kbase_jm.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2013-2014, 2016, 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2013-2014, 2016, 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_js.c b/mali_kbase/mali_kbase_js.c
index 804505f..e22d856 100644
--- a/mali_kbase/mali_kbase_js.c
+++ b/mali_kbase/mali_kbase_js.c
@@ -81,7 +81,7 @@ static int kbase_js_get_slot(struct kbase_device *kbdev,
struct kbase_jd_atom *katom);
static void kbase_js_foreach_ctx_job(struct kbase_context *kctx,
- kbasep_js_ctx_job_cb callback);
+ kbasep_js_ctx_job_cb *callback);
/* Helper for ktrace */
#if KBASE_KTRACE_ENABLE
@@ -212,9 +212,8 @@ jsctx_rb_none_to_pull(struct kbase_context *kctx, int js)
*
* The HW access lock must always be held when calling this function.
*/
-static void
-jsctx_queue_foreach_prio(struct kbase_context *kctx, int js, int prio,
- kbasep_js_ctx_job_cb callback)
+static void jsctx_queue_foreach_prio(struct kbase_context *kctx, int js,
+ int prio, kbasep_js_ctx_job_cb *callback)
{
struct jsctx_queue *queue = &kctx->jsctx_queue[prio][js];
@@ -273,9 +272,8 @@ jsctx_queue_foreach_prio(struct kbase_context *kctx, int js, int prio,
* jsctx_queue_foreach_prio() to iterate over the queue and invoke @callback
* for each entry, and remove the entry from the queue.
*/
-static inline void
-jsctx_queue_foreach(struct kbase_context *kctx, int js,
- kbasep_js_ctx_job_cb callback)
+static inline void jsctx_queue_foreach(struct kbase_context *kctx, int js,
+ kbasep_js_ctx_job_cb *callback)
{
int prio;
@@ -3879,7 +3877,7 @@ static inline int trace_get_refcnt(struct kbase_device *kbdev,
* - it will be holding kbasep_js_kctx_info::ctx::jsctx_mutex.
*/
static void kbase_js_foreach_ctx_job(struct kbase_context *kctx,
- kbasep_js_ctx_job_cb callback)
+ kbasep_js_ctx_job_cb *callback)
{
struct kbase_device *kbdev;
unsigned long flags;
diff --git a/mali_kbase/mali_kbase_kinstr_jm.c b/mali_kbase/mali_kbase_kinstr_jm.c
index cc8dd86..4cdd722 100644
--- a/mali_kbase/mali_kbase_kinstr_jm.c
+++ b/mali_kbase/mali_kbase_kinstr_jm.c
@@ -30,7 +30,7 @@
#include "mali_kbase.h"
#include "mali_kbase_linux.h"
-#include <mali_kbase_jm_rb.h>
+#include <backend/gpu/mali_kbase_jm_rb.h>
#include <asm/barrier.h>
#include <linux/anon_inodes.h>
diff --git a/mali_kbase/mali_kbase_mem.c b/mali_kbase/mali_kbase_mem.c
index 326917c..6c0002f 100644
--- a/mali_kbase/mali_kbase_mem.c
+++ b/mali_kbase/mali_kbase_mem.c
@@ -28,7 +28,7 @@
#include <linux/compat.h>
#include <linux/version.h>
#include <linux/log2.h>
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
#include <linux/of_platform.h>
#endif
@@ -89,7 +89,7 @@ static size_t kbase_get_num_cpu_va_bits(struct kbase_context *kctx)
#error "Unknown CPU VA width for this architecture"
#endif
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (kbase_ctx_flag(kctx, KCTX_COMPAT))
cpu_va_bits = 32;
#endif
@@ -115,11 +115,11 @@ static struct rb_root *kbase_gpu_va_to_rbtree(struct kbase_context *kctx,
else {
u64 same_va_end;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (kbase_ctx_flag(kctx, KCTX_COMPAT)) {
#endif /* CONFIG_64BIT */
same_va_end = KBASE_REG_ZONE_CUSTOM_VA_BASE;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
} else {
struct kbase_reg_zone *same_va_zone =
kbase_ctx_reg_zone_get(kctx,
@@ -755,7 +755,7 @@ int kbase_region_tracker_init(struct kbase_context *kctx)
kbase_ctx_reg_zone_init(kctx, KBASE_REG_ZONE_SAME_VA, same_va_base,
same_va_pages);
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
/* 32-bit clients have custom VA zones */
if (kbase_ctx_flag(kctx, KCTX_COMPAT)) {
#endif
@@ -782,7 +782,7 @@ int kbase_region_tracker_init(struct kbase_context *kctx)
kbase_ctx_reg_zone_init(kctx, KBASE_REG_ZONE_CUSTOM_VA,
KBASE_REG_ZONE_CUSTOM_VA_BASE,
custom_va_size);
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
} else {
custom_va_size = 0;
}
@@ -901,7 +901,7 @@ static bool kbase_region_tracker_has_allocs(struct kbase_context *kctx)
return false;
}
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
static int kbase_region_tracker_init_jit_64(struct kbase_context *kctx,
u64 jit_va_pages)
{
@@ -1010,7 +1010,7 @@ int kbase_region_tracker_init_jit(struct kbase_context *kctx, u64 jit_va_pages,
goto exit_unlock;
}
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (!kbase_ctx_flag(kctx, KCTX_COMPAT))
err = kbase_region_tracker_init_jit_64(kctx, jit_va_pages);
#endif
@@ -1081,12 +1081,12 @@ int kbase_region_tracker_init_exec(struct kbase_context *kctx, u64 exec_va_pages
goto exit_unlock;
}
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (kbase_ctx_flag(kctx, KCTX_COMPAT)) {
#endif
/* 32-bit client: take from CUSTOM_VA zone */
target_zone_bits = KBASE_REG_ZONE_CUSTOM_VA;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
} else {
/* 64-bit client: take from SAME_VA zone */
target_zone_bits = KBASE_REG_ZONE_SAME_VA;
@@ -1180,7 +1180,7 @@ int kbase_mem_init(struct kbase_device *kbdev)
{
int err = 0;
struct kbasep_mem_device *memdev;
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
struct device_node *mgm_node = NULL;
#endif
@@ -1208,7 +1208,7 @@ int kbase_mem_init(struct kbase_device *kbdev)
kbdev->mgm_dev = &kbase_native_mgm_dev;
-#ifdef CONFIG_OF
+#if IS_ENABLED(CONFIG_OF)
/* Check to see whether or not a platform-specific memory group manager
* is configured and available.
*/
@@ -3163,7 +3163,7 @@ void kbase_gpu_vm_unlock(struct kbase_context *kctx)
KBASE_EXPORT_TEST_API(kbase_gpu_vm_unlock);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
struct kbase_jit_debugfs_data {
int (*func)(struct kbase_jit_debugfs_data *);
struct mutex lock;
@@ -4269,6 +4269,7 @@ void kbase_jit_free(struct kbase_context *kctx, struct kbase_va_region *reg)
/* This allocation can't already be on a list. */
WARN_ON(!list_empty(&reg->gpu_alloc->evict_node));
list_add(&reg->gpu_alloc->evict_node, &kctx->evict_list);
+ atomic_add(reg->gpu_alloc->nents, &kctx->evict_nents);
list_move(&reg->jit_node, &kctx->jit_pool_head);
diff --git a/mali_kbase/mali_kbase_mem.h b/mali_kbase/mali_kbase_mem.h
index d12ec31..6a6f0d0 100644
--- a/mali_kbase/mali_kbase_mem.h
+++ b/mali_kbase/mali_kbase_mem.h
@@ -1517,7 +1517,7 @@ void kbase_sync_single_for_device(struct kbase_device *kbdev, dma_addr_t handle,
void kbase_sync_single_for_cpu(struct kbase_device *kbdev, dma_addr_t handle,
size_t size, enum dma_data_direction dir);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* kbase_jit_debugfs_init - Add per context debugfs entry for JIT.
* @kctx: kbase context
diff --git a/mali_kbase/mali_kbase_mem_linux.c b/mali_kbase/mali_kbase_mem_linux.c
index 2dabd8a..50effa9 100644
--- a/mali_kbase/mali_kbase_mem_linux.c
+++ b/mali_kbase/mali_kbase_mem_linux.c
@@ -325,7 +325,7 @@ struct kbase_va_region *kbase_mem_alloc(struct kbase_context *kctx,
goto bad_flags;
}
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
if (unlikely(kbase_ctx_flag(kctx, KCTX_INFINITE_CACHE))) {
/* Mask coherency flags if infinite cache is enabled to prevent
* the skipping of syncs from BASE side.
@@ -634,8 +634,6 @@ unsigned long kbase_mem_evictable_reclaim_count_objects(struct shrinker *s,
struct shrink_control *sc)
{
struct kbase_context *kctx;
- struct kbase_mem_phy_alloc *alloc;
- unsigned long pages = 0;
kctx = container_of(s, struct kbase_context, reclaim);
@@ -646,13 +644,7 @@ unsigned long kbase_mem_evictable_reclaim_count_objects(struct shrinker *s,
"Shrinker called whilst in atomic context. The caller must switch to using GFP_ATOMIC or similar. gfp_mask==%x\n",
sc->gfp_mask);
- mutex_lock(&kctx->jit_evict_lock);
-
- list_for_each_entry(alloc, &kctx->evict_list, evict_node)
- pages += alloc->nents;
-
- mutex_unlock(&kctx->jit_evict_lock);
- return pages;
+ return atomic_read(&kctx->evict_nents);
}
/**
@@ -684,6 +676,7 @@ unsigned long kbase_mem_evictable_reclaim_scan_objects(struct shrinker *s,
unsigned long freed = 0;
kctx = container_of(s, struct kbase_context, reclaim);
+
mutex_lock(&kctx->jit_evict_lock);
list_for_each_entry_safe(alloc, tmp, &kctx->evict_list, evict_node) {
@@ -710,6 +703,7 @@ unsigned long kbase_mem_evictable_reclaim_scan_objects(struct shrinker *s,
kbase_free_phy_pages_helper(alloc, alloc->evicted);
freed += alloc->evicted;
+ WARN_ON(atomic_sub_return(alloc->evicted, &kctx->evict_nents) < 0);
list_del_init(&alloc->evict_node);
/*
@@ -733,6 +727,8 @@ int kbase_mem_evictable_init(struct kbase_context *kctx)
INIT_LIST_HEAD(&kctx->evict_list);
mutex_init(&kctx->jit_evict_lock);
+ atomic_set(&kctx->evict_nents, 0);
+
kctx->reclaim.count_objects = kbase_mem_evictable_reclaim_count_objects;
kctx->reclaim.scan_objects = kbase_mem_evictable_reclaim_scan_objects;
kctx->reclaim.seeks = DEFAULT_SEEKS;
@@ -816,6 +812,7 @@ int kbase_mem_evictable_make(struct kbase_mem_phy_alloc *gpu_alloc)
* can reclaim it.
*/
list_add(&gpu_alloc->evict_node, &kctx->evict_list);
+ atomic_add(gpu_alloc->nents, &kctx->evict_nents);
mutex_unlock(&kctx->jit_evict_lock);
kbase_mem_evictable_mark_reclaim(gpu_alloc);
@@ -835,6 +832,7 @@ bool kbase_mem_evictable_unmake(struct kbase_mem_phy_alloc *gpu_alloc)
* First remove the allocation from the eviction list as it's no
* longer eligible for eviction.
*/
+ WARN_ON(atomic_sub_return(gpu_alloc->nents, &kctx->evict_nents) < 0);
list_del_init(&gpu_alloc->evict_node);
mutex_unlock(&kctx->jit_evict_lock);
@@ -1403,7 +1401,7 @@ static struct kbase_va_region *kbase_mem_from_umm(struct kbase_context *kctx,
if (*flags & BASE_MEM_IMPORT_SYNC_ON_MAP_UNMAP)
need_sync = true;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) {
/*
* 64-bit tasks require us to reserve VA on the CPU that we use
@@ -1556,7 +1554,7 @@ static struct kbase_va_region *kbase_mem_from_user_buffer(
if (*flags & BASE_MEM_IMPORT_SHARED)
shared_zone = true;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) {
/*
* 64-bit tasks require us to reserve VA on the CPU that we use
@@ -1750,7 +1748,7 @@ u64 kbase_mem_alias(struct kbase_context *kctx, u64 *flags, u64 stride,
/* calculate the number of pages this alias will cover */
*num_pages = nents * stride;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) {
/* 64-bit tasks must MMAP anyway, but not expose this address to
* clients
@@ -1871,7 +1869,7 @@ u64 kbase_mem_alias(struct kbase_context *kctx, u64 *flags, u64 stride,
}
}
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
if (!kbase_ctx_flag(kctx, KCTX_COMPAT)) {
/* Bind to a cookie */
if (bitmap_empty(kctx->cookies, BITS_PER_LONG)) {
@@ -1906,7 +1904,7 @@ u64 kbase_mem_alias(struct kbase_context *kctx, u64 *flags, u64 stride,
return gpu_va;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
no_cookie:
#endif
no_mmap:
@@ -1994,7 +1992,7 @@ int kbase_mem_import(struct kbase_context *kctx, enum base_mem_import_type type,
sizeof(user_buffer))) {
reg = NULL;
} else {
-#ifdef CONFIG_COMPAT
+#if IS_ENABLED(CONFIG_COMPAT)
if (kbase_ctx_flag(kctx, KCTX_COMPAT))
uptr = compat_ptr(user_buffer.ptr);
else
@@ -3215,10 +3213,8 @@ static unsigned long get_queue_doorbell_pfn(struct kbase_device *kbdev,
* assigned one, otherwise a dummy page. Always return the
* dummy page in no mali builds.
*/
- if ((queue->doorbell_nr == KBASEP_USER_DB_NR_INVALID) ||
- IS_ENABLED(CONFIG_MALI_NO_MALI))
+ if (queue->doorbell_nr == KBASEP_USER_DB_NR_INVALID)
return PFN_DOWN(as_phys_addr_t(kbdev->csf.dummy_db_page));
-
return (PFN_DOWN(kbdev->reg_start + CSF_HW_DOORBELL_PAGE_OFFSET +
(u64)queue->doorbell_nr * CSF_HW_DOORBELL_PAGE_SIZE));
}
@@ -3464,7 +3460,7 @@ static vm_fault_t kbase_csf_user_reg_vm_fault(struct vm_fault *vmf)
/* Don't map in the actual register page if GPU is powered down.
* Always map in the dummy page in no mali builds.
*/
- if (!kbdev->pm.backend.gpu_powered || IS_ENABLED(CONFIG_MALI_NO_MALI))
+ if (!kbdev->pm.backend.gpu_powered)
pfn = PFN_DOWN(as_phys_addr_t(kbdev->csf.dummy_user_reg_page));
ret = mgm_dev->ops.mgm_vmf_insert_pfn_prot(mgm_dev,
diff --git a/mali_kbase/mali_kbase_mem_pool_debugfs.c b/mali_kbase/mali_kbase_mem_pool_debugfs.c
index e7d8fdc..17831d8 100644
--- a/mali_kbase/mali_kbase_mem_pool_debugfs.c
+++ b/mali_kbase/mali_kbase_mem_pool_debugfs.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_mem_pool_debugfs.h b/mali_kbase/mali_kbase_mem_pool_debugfs.h
index b2a94d7..9d27108 100644
--- a/mali_kbase/mali_kbase_mem_pool_debugfs.h
+++ b/mali_kbase/mali_kbase_mem_pool_debugfs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_mem_pool_group.c b/mali_kbase/mali_kbase_mem_pool_group.c
index 72a17b2..e551274 100644
--- a/mali_kbase/mali_kbase_mem_pool_group.c
+++ b/mali_kbase/mali_kbase_mem_pool_group.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_mem_pool_group.h b/mali_kbase/mali_kbase_mem_pool_group.h
index 35333e9..47e4213 100644
--- a/mali_kbase/mali_kbase_mem_pool_group.h
+++ b/mali_kbase/mali_kbase_mem_pool_group.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_mem_profile_debugfs.c b/mali_kbase/mali_kbase_mem_profile_debugfs.c
index 113b69e..346aeeb 100644
--- a/mali_kbase/mali_kbase_mem_profile_debugfs.c
+++ b/mali_kbase/mali_kbase_mem_profile_debugfs.c
@@ -21,7 +21,7 @@
#include <mali_kbase.h>
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* Show callback for the @c mem_profile debugfs file.
diff --git a/mali_kbase/mali_kbase_native_mgm.c b/mali_kbase/mali_kbase_native_mgm.c
index 957d884..082bc23 100644
--- a/mali_kbase/mali_kbase_native_mgm.c
+++ b/mali_kbase/mali_kbase_native_mgm.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_platform_fake.c b/mali_kbase/mali_kbase_platform_fake.c
index 02bfb25..bf79317 100644
--- a/mali_kbase/mali_kbase_platform_fake.c
+++ b/mali_kbase/mali_kbase_platform_fake.c
@@ -25,7 +25,6 @@
#include <linux/platform_device.h>
#include <linux/string.h>
-
/*
* This file is included only for type definitions and functions belonging to
* specific platform folders. Do not add dependencies with symbols that are
diff --git a/mali_kbase/mali_kbase_pm.c b/mali_kbase/mali_kbase_pm.c
index 6ceda01..cc618bf 100644
--- a/mali_kbase/mali_kbase_pm.c
+++ b/mali_kbase/mali_kbase_pm.c
@@ -29,13 +29,13 @@
#include <mali_kbase_hwcnt_context.h>
#include <mali_kbase_pm.h>
-#include <mali_kbase_pm_internal.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
#ifdef CONFIG_MALI_ARBITER_SUPPORT
#include <arbiter/mali_kbase_arbiter_pm.h>
#endif /* CONFIG_MALI_ARBITER_SUPPORT */
-#include <mali_kbase_clk_rate_trace_mgr.h>
+#include <backend/gpu/mali_kbase_clk_rate_trace_mgr.h>
int kbase_pm_powerup(struct kbase_device *kbdev, unsigned int flags)
{
diff --git a/mali_kbase/mali_kbase_regs_history_debugfs.c b/mali_kbase/mali_kbase_regs_history_debugfs.c
index ede4996..3353eaa 100644
--- a/mali_kbase/mali_kbase_regs_history_debugfs.c
+++ b/mali_kbase/mali_kbase_regs_history_debugfs.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014, 2016, 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2016, 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -22,7 +22,7 @@
#include "mali_kbase.h"
#include "mali_kbase_regs_history_debugfs.h"
-#if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_MALI_NO_MALI)
+#if defined(CONFIG_DEBUG_FS) && !IS_ENABLED(CONFIG_MALI_NO_MALI)
#include <linux/debugfs.h>
@@ -241,4 +241,4 @@ void kbasep_regs_history_debugfs_init(struct kbase_device *kbdev)
kbdev->mali_debugfs_directory, &kbdev->io_history,
&regs_history_fops);
}
-#endif /* defined(CONFIG_DEBUG_FS) && !defined(CONFIG_MALI_NO_MALI) */
+#endif /* defined(CONFIG_DEBUG_FS) && !IS_ENABLED(CONFIG_MALI_NO_MALI) */
diff --git a/mali_kbase/mali_kbase_regs_history_debugfs.h b/mali_kbase/mali_kbase_regs_history_debugfs.h
index 9af8d05..f8ff281 100644
--- a/mali_kbase/mali_kbase_regs_history_debugfs.h
+++ b/mali_kbase/mali_kbase_regs_history_debugfs.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2016, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2016, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -36,7 +36,7 @@
struct kbase_device;
-#if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_MALI_NO_MALI)
+#if defined(CONFIG_DEBUG_FS) && !IS_ENABLED(CONFIG_MALI_NO_MALI)
/**
* kbase_io_history_init - initialize data struct for register access history
@@ -69,16 +69,7 @@ void kbase_io_history_dump(struct kbase_device *kbdev);
*/
void kbasep_regs_history_debugfs_init(struct kbase_device *kbdev);
-#else /* defined(CONFIG_DEBUG_FS) && !defined(CONFIG_MALI_NO_MALI) */
-
-#define kbase_io_history_init(...) ((int)0)
-
-#define kbase_io_history_term CSTD_NOP
-
-#define kbase_io_history_dump CSTD_NOP
-
-#define kbasep_regs_history_debugfs_init CSTD_NOP
-
-#endif /* defined(CONFIG_DEBUG_FS) && !defined(CONFIG_MALI_NO_MALI) */
+#else /* defined(CONFIG_DEBUG_FS) && !IS_ENABLED(CONFIG_MALI_NO_MALI) */
+#endif /* defined(CONFIG_DEBUG_FS) && !IS_ENABLED(CONFIG_MALI_NO_MALI) */
#endif /*_KBASE_REGS_HISTORY_DEBUGFS_H*/
diff --git a/mali_kbase/mali_kbase_smc.c b/mali_kbase/mali_kbase_smc.c
index 82c5a10..149ba8c 100644
--- a/mali_kbase/mali_kbase_smc.c
+++ b/mali_kbase/mali_kbase_smc.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2015, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2015, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -19,7 +19,7 @@
*
*/
-#ifdef CONFIG_ARM64
+#if IS_ENABLED(CONFIG_ARM64)
#include <mali_kbase.h>
#include <mali_kbase_smc.h>
diff --git a/mali_kbase/mali_kbase_smc.h b/mali_kbase/mali_kbase_smc.h
index 9b89c32..9c018ad 100644
--- a/mali_kbase/mali_kbase_smc.h
+++ b/mali_kbase/mali_kbase_smc.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2015, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2015, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -22,7 +22,7 @@
#ifndef _KBASE_SMC_H_
#define _KBASE_SMC_H_
-#ifdef CONFIG_ARM64
+#if IS_ENABLED(CONFIG_ARM64)
#include <mali_kbase.h>
diff --git a/mali_kbase/mali_kbase_strings.c b/mali_kbase/mali_kbase_strings.c
index f380930..e176be5 100644
--- a/mali_kbase/mali_kbase_strings.c
+++ b/mali_kbase/mali_kbase_strings.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2010-2016, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2016, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_strings.h b/mali_kbase/mali_kbase_strings.h
index e6ec7f3..8e69ce6 100644
--- a/mali_kbase/mali_kbase_strings.h
+++ b/mali_kbase/mali_kbase_strings.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2010-2016, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2016, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_sync.h b/mali_kbase/mali_kbase_sync.h
index bad8b54..475ff0b 100644
--- a/mali_kbase/mali_kbase_sync.h
+++ b/mali_kbase/mali_kbase_sync.h
@@ -30,10 +30,10 @@
#include <linux/fdtable.h>
#include <linux/syscalls.h>
-#ifdef CONFIG_SYNC
+#if IS_ENABLED(CONFIG_SYNC)
#include <sync.h>
#endif
-#ifdef CONFIG_SYNC_FILE
+#if IS_ENABLED(CONFIG_SYNC_FILE)
#include "mali_kbase_fence_defs.h"
#include <linux/sync_file.h>
#endif
diff --git a/mali_kbase/mali_kbase_sync_android.c b/mali_kbase/mali_kbase_sync_android.c
index 2bd1f5d..0553159 100644
--- a/mali_kbase/mali_kbase_sync_android.c
+++ b/mali_kbase/mali_kbase_sync_android.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2012-2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_sync_file.c b/mali_kbase/mali_kbase_sync_file.c
index d426640..0b54fe6 100644
--- a/mali_kbase/mali_kbase_sync_file.c
+++ b/mali_kbase/mali_kbase_sync_file.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2012-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_trace_gpu_mem.c b/mali_kbase/mali_kbase_trace_gpu_mem.c
index 0458e17..ee3aa1b 100644
--- a/mali_kbase/mali_kbase_trace_gpu_mem.c
+++ b/mali_kbase/mali_kbase_trace_gpu_mem.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_trace_gpu_mem.h b/mali_kbase/mali_kbase_trace_gpu_mem.h
index b78b553..dbab354 100644
--- a/mali_kbase/mali_kbase_trace_gpu_mem.h
+++ b/mali_kbase/mali_kbase_trace_gpu_mem.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -22,7 +22,7 @@
#ifndef _KBASE_TRACE_GPU_MEM_H_
#define _KBASE_TRACE_GPU_MEM_H_
-#ifdef CONFIG_TRACE_GPU_MEM
+#if IS_ENABLED(CONFIG_TRACE_GPU_MEM)
#include <trace/events/gpu_mem.h>
#endif
@@ -31,7 +31,7 @@
static void kbase_trace_gpu_mem_usage(struct kbase_device *kbdev,
struct kbase_context *kctx)
{
-#ifdef CONFIG_TRACE_GPU_MEM
+#if IS_ENABLED(CONFIG_TRACE_GPU_MEM)
lockdep_assert_held(&kbdev->gpu_mem_usage_lock);
trace_gpu_mem_total(kbdev->id, DEVICE_TGID,
diff --git a/mali_kbase/mali_kbase_utility.h b/mali_kbase/mali_kbase_utility.h
index 5911969..6147251 100644
--- a/mali_kbase/mali_kbase_utility.h
+++ b/mali_kbase/mali_kbase_utility.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2012-2013, 2015, 2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2012-2013, 2015, 2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_kbase_vinstr.c b/mali_kbase/mali_kbase_vinstr.c
index 4ac0d0e..6d7272f 100644
--- a/mali_kbase/mali_kbase_vinstr.c
+++ b/mali_kbase/mali_kbase_vinstr.c
@@ -53,6 +53,10 @@
* counters.
* @hvirt: Hardware counter virtualizer used by vinstr.
* @metadata: Hardware counter metadata provided by virtualizer.
+ * @metadata_user: API compatible hardware counter metadata provided by vinstr.
+ * For compatibility with the user driver interface, this
+ * contains a "truncated" version of the HWCNT metadata limited
+ * to 64 entries per block. NULL when not required.
* @lock: Lock protecting all vinstr state.
* @suspend_count: Suspend reference count. If non-zero, timer and worker are
* prevented from being re-scheduled.
@@ -64,6 +68,7 @@
struct kbase_vinstr_context {
struct kbase_hwcnt_virtualizer *hvirt;
const struct kbase_hwcnt_metadata *metadata;
+ const struct kbase_hwcnt_metadata *metadata_user;
struct mutex lock;
size_t suspend_count;
size_t client_count;
@@ -217,9 +222,18 @@ static int kbasep_vinstr_client_dump(
/* Copy the temp buffer to the userspace visible buffer. The strict
* variant will explicitly zero any non-enabled counters to ensure
* nothing except exactly what the user asked for is made visible.
+ *
+ * If the metadata in vinstr (vctx->metadata_user) is not NULL, it means
+ * vinstr has the truncated metadata, so do a narrow copy since
+ * virtualizer has a bigger buffer but user only needs part of it.
+ * otherwise we do a full copy.
*/
- kbase_hwcnt_dump_buffer_copy_strict(
- dump_buf, tmp_buf, &vcli->enable_map);
+ if (vcli->vctx->metadata_user)
+ kbase_hwcnt_dump_buffer_copy_strict_narrow(dump_buf, tmp_buf,
+ &vcli->enable_map);
+ else
+ kbase_hwcnt_dump_buffer_copy_strict(dump_buf, tmp_buf,
+ &vcli->enable_map);
clk_cnt = vcli->vctx->metadata->clk_cnt;
@@ -422,6 +436,9 @@ static int kbasep_vinstr_client_create(
phys_em.mmu_l2_bm = setup->mmu_l2_bm;
kbase_hwcnt_gpu_enable_map_from_physical(&vcli->enable_map, &phys_em);
+ /* Use virtualizer's metadata to alloc tmp buffer which interacts with
+ * the HWC virtualizer.
+ */
errcode = kbase_hwcnt_dump_buffer_alloc(vctx->metadata, &vcli->tmp_buf);
if (errcode)
goto error;
@@ -429,8 +446,20 @@ static int kbasep_vinstr_client_create(
/* Enable all the available clk_enable_map. */
vcli->enable_map.clk_enable_map = (1ull << vctx->metadata->clk_cnt) - 1;
- errcode = kbase_hwcnt_dump_buffer_array_alloc(
- vctx->metadata, setup->buffer_count, &vcli->dump_bufs);
+ if (vctx->metadata_user)
+ /* Use vinstr's truncated metadata to alloc dump buffers which
+ * interact with clients.
+ */
+ errcode =
+ kbase_hwcnt_dump_buffer_array_alloc(vctx->metadata_user,
+ setup->buffer_count,
+ &vcli->dump_bufs);
+ else
+ /* Use metadata from virtualizer to allocate dump buffers if
+ * vinstr doesn't have the truncated metadata.
+ */
+ errcode = kbase_hwcnt_dump_buffer_array_alloc(
+ vctx->metadata, setup->buffer_count, &vcli->dump_bufs);
if (errcode)
goto error;
@@ -458,6 +487,7 @@ int kbase_vinstr_init(
struct kbase_hwcnt_virtualizer *hvirt,
struct kbase_vinstr_context **out_vctx)
{
+ int errcode;
struct kbase_vinstr_context *vctx;
const struct kbase_hwcnt_metadata *metadata;
@@ -474,6 +504,11 @@ int kbase_vinstr_init(
vctx->hvirt = hvirt;
vctx->metadata = metadata;
+ vctx->metadata_user = NULL;
+ errcode = kbase_hwcnt_gpu_metadata_create_truncate_64(
+ &vctx->metadata_user, metadata);
+ if (errcode)
+ goto err_metadata_create;
mutex_init(&vctx->lock);
INIT_LIST_HEAD(&vctx->clients);
@@ -483,6 +518,11 @@ int kbase_vinstr_init(
*out_vctx = vctx;
return 0;
+
+err_metadata_create:
+ kfree(vctx);
+
+ return errcode;
}
void kbase_vinstr_term(struct kbase_vinstr_context *vctx)
@@ -503,6 +543,9 @@ void kbase_vinstr_term(struct kbase_vinstr_context *vctx)
}
}
+ if (vctx->metadata_user)
+ kbase_hwcnt_metadata_destroy(vctx->metadata_user);
+
WARN_ON(vctx->client_count != 0);
kfree(vctx);
}
@@ -963,9 +1006,14 @@ static long kbasep_vinstr_hwcnt_reader_ioctl(
cli, (u32 __user *)arg);
break;
case _IOC_NR(KBASE_HWCNT_READER_GET_BUFFER_SIZE):
- rcode = put_user(
- (u32)cli->vctx->metadata->dump_buf_bytes,
- (u32 __user *)arg);
+ if (cli->vctx->metadata_user)
+ rcode = put_user(
+ (u32)cli->vctx->metadata_user->dump_buf_bytes,
+ (u32 __user *)arg);
+ else
+ rcode = put_user(
+ (u32)cli->vctx->metadata->dump_buf_bytes,
+ (u32 __user *)arg);
break;
case _IOC_NR(KBASE_HWCNT_READER_DUMP):
rcode = kbasep_vinstr_hwcnt_reader_ioctl_dump(cli);
diff --git a/mali_kbase/mali_kbase_vinstr.h b/mali_kbase/mali_kbase_vinstr.h
index a20f31a..97475e1 100644
--- a/mali_kbase/mali_kbase_vinstr.h
+++ b/mali_kbase/mali_kbase_vinstr.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2015-2018, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2015-2018, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_power_gpu_frequency_trace.c b/mali_kbase/mali_power_gpu_frequency_trace.c
index f548b04..ab57733 100644
--- a/mali_kbase/mali_power_gpu_frequency_trace.c
+++ b/mali_kbase/mali_power_gpu_frequency_trace.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mali_power_gpu_frequency_trace.h b/mali_kbase/mali_power_gpu_frequency_trace.h
index d6909a4..7346089 100644
--- a/mali_kbase/mali_power_gpu_frequency_trace.h
+++ b/mali_kbase/mali_power_gpu_frequency_trace.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mmu/Kbuild b/mali_kbase/mmu/Kbuild
new file mode 100644
index 0000000..cc00c45
--- /dev/null
+++ b/mali_kbase/mmu/Kbuild
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
+#
+# This program is free software and is provided to you under the terms of the
+# GNU General Public License version 2 as published by the Free Software
+# Foundation, and any use by you of this program is subject to the terms
+# of such GNU license.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, you can access it online at
+# http://www.gnu.org/licenses/gpl-2.0.html.
+#
+#
+
+mali_kbase-y += \
+ mmu/mali_kbase_mmu.o \
+ mmu/mali_kbase_mmu_hw_direct.o \
+ mmu/mali_kbase_mmu_mode_aarch64.o
+
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ mali_kbase-y += mmu/backend/mali_kbase_mmu_csf.o
+else
+ mali_kbase-y += mmu/backend/mali_kbase_mmu_jm.o
+endif
diff --git a/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c b/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c
index 8240817..a884fa3 100644
--- a/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c
+++ b/mali_kbase/mmu/backend/mali_kbase_mmu_csf.c
@@ -28,7 +28,7 @@
#include <mali_kbase_ctx_sched.h>
#include <mali_kbase_reset_gpu.h>
#include <mali_kbase_as_fault_debugfs.h>
-#include "../mali_kbase_mmu_internal.h"
+#include <mmu/mali_kbase_mmu_internal.h>
void kbase_mmu_get_as_setup(struct kbase_mmu_table *mmut,
struct kbase_mmu_setup * const setup)
diff --git a/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c b/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c
index ae334c1..84a04bd 100644
--- a/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c
+++ b/mali_kbase/mmu/backend/mali_kbase_mmu_jm.c
@@ -28,7 +28,7 @@
#include <mali_kbase_hwaccess_jm.h>
#include <device/mali_kbase_device.h>
#include <mali_kbase_as_fault_debugfs.h>
-#include "../mali_kbase_mmu_internal.h"
+#include <mmu/mali_kbase_mmu_internal.h>
void kbase_mmu_get_as_setup(struct kbase_mmu_table *mmut,
struct kbase_mmu_setup * const setup)
diff --git a/mali_kbase/mmu/mali_kbase_mmu.c b/mali_kbase/mmu/mali_kbase_mmu.c
index 0761f68..d2ad9a8 100644
--- a/mali_kbase/mmu/mali_kbase_mmu.c
+++ b/mali_kbase/mmu/mali_kbase_mmu.c
@@ -29,7 +29,7 @@
#include <gpu/mali_kbase_gpu_fault.h>
#include <gpu/mali_kbase_gpu_regmap.h>
#include <tl/mali_kbase_tracepoints.h>
-#include <mali_kbase_instr_defs.h>
+#include <backend/gpu/mali_kbase_instr_defs.h>
#include <mali_kbase_ctx_sched.h>
#include <mali_kbase_debug.h>
#include <mali_kbase_defs.h>
@@ -982,7 +982,11 @@ static phys_addr_t kbase_mmu_alloc_pgd(struct kbase_device *kbdev,
int i;
struct page *p;
+#ifdef CONFIG_MALI_2MB_ALLOC
+ p = kbase_mem_pool_alloc(&kbdev->mem_pools.large[mmut->group_id]);
+#else /* CONFIG_MALI_2MB_ALLOC */
p = kbase_mem_pool_alloc(&kbdev->mem_pools.small[mmut->group_id]);
+#endif /* CONFIG_MALI_2MB_ALLOC */
if (!p)
return 0;
@@ -1019,8 +1023,12 @@ static phys_addr_t kbase_mmu_alloc_pgd(struct kbase_device *kbdev,
return page_to_phys(p);
alloc_free:
- kbase_mem_pool_free(&kbdev->mem_pools.small[mmut->group_id], p,
- false);
+
+#ifdef CONFIG_MALI_2MB_ALLOC
+ kbase_mem_pool_free(&kbdev->mem_pools.large[mmut->group_id], p, false);
+#else /* CONFIG_MALI_2MB_ALLOC */
+ kbase_mem_pool_free(&kbdev->mem_pools.small[mmut->group_id], p, false);
+#endif /* CONFIG_MALI_2MB_ALLOC */
return 0;
}
@@ -1246,7 +1254,11 @@ int kbase_mmu_insert_single_page(struct kbase_context *kctx, u64 vpfn,
*/
mutex_unlock(&kctx->mmu.mmu_lock);
err = kbase_mem_pool_grow(
+#ifdef CONFIG_MALI_2MB_ALLOC
+ &kbdev->mem_pools.large[
+#else
&kbdev->mem_pools.small[
+#endif
kctx->mmu.group_id],
MIDGARD_MMU_BOTTOMLEVEL);
mutex_lock(&kctx->mmu.mmu_lock);
@@ -1325,7 +1337,11 @@ static inline void cleanup_empty_pte(struct kbase_device *kbdev,
tmp_pgd = kbdev->mmu_mode->pte_to_phy_addr(*pte);
tmp_p = phys_to_page(tmp_pgd);
+#ifdef CONFIG_MALI_2MB_ALLOC
+ kbase_mem_pool_free(&kbdev->mem_pools.large[mmut->group_id],
+#else
kbase_mem_pool_free(&kbdev->mem_pools.small[mmut->group_id],
+#endif
tmp_p, false);
/* If the MMU tables belong to a context then we accounted the memory
@@ -1409,7 +1425,11 @@ int kbase_mmu_insert_pages_no_flush(struct kbase_device *kbdev,
*/
mutex_unlock(&mmut->mmu_lock);
err = kbase_mem_pool_grow(
+#ifdef CONFIG_MALI_2MB_ALLOC
+ &kbdev->mem_pools.large[mmut->group_id],
+#else
&kbdev->mem_pools.small[mmut->group_id],
+#endif
cur_level);
mutex_lock(&mmut->mmu_lock);
} while (!err);
@@ -1897,7 +1917,11 @@ static int kbase_mmu_update_pages_no_flush(struct kbase_context *kctx, u64 vpfn,
*/
mutex_unlock(&kctx->mmu.mmu_lock);
err = kbase_mem_pool_grow(
+#ifdef CONFIG_MALI_2MB_ALLOC
+ &kbdev->mem_pools.large[
+#else
&kbdev->mem_pools.small[
+#endif
kctx->mmu.group_id],
MIDGARD_MMU_BOTTOMLEVEL);
mutex_lock(&kctx->mmu.mmu_lock);
@@ -1992,8 +2016,11 @@ static void mmu_teardown_level(struct kbase_device *kbdev,
}
p = pfn_to_page(PFN_DOWN(pgd));
-
+#ifdef CONFIG_MALI_2MB_ALLOC
+ kbase_mem_pool_free(&kbdev->mem_pools.large[mmut->group_id],
+#else
kbase_mem_pool_free(&kbdev->mem_pools.small[mmut->group_id],
+#endif
p, true);
atomic_sub(1, &kbdev->memdev.used_pages);
@@ -2036,7 +2063,11 @@ int kbase_mmu_init(struct kbase_device *const kbdev,
int err;
err = kbase_mem_pool_grow(
+#ifdef CONFIG_MALI_2MB_ALLOC
+ &kbdev->mem_pools.large[mmut->group_id],
+#else
&kbdev->mem_pools.small[mmut->group_id],
+#endif
MIDGARD_MMU_BOTTOMLEVEL);
if (err) {
kbase_mmu_term(kbdev, mmut);
diff --git a/mali_kbase/mmu/mali_kbase_mmu.h b/mali_kbase/mmu/mali_kbase_mmu.h
index bf4fd91..a641e7a 100644
--- a/mali_kbase/mmu/mali_kbase_mmu.h
+++ b/mali_kbase/mmu/mali_kbase_mmu.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mmu/mali_kbase_mmu_internal.h b/mali_kbase/mmu/mali_kbase_mmu_internal.h
index d3fcd39..622ae6d 100644
--- a/mali_kbase/mmu/mali_kbase_mmu_internal.h
+++ b/mali_kbase/mmu/mali_kbase_mmu_internal.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c b/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c
index fac515c..024374a 100644
--- a/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c
+++ b/mali_kbase/mmu/mali_kbase_mmu_mode_aarch64.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2010-2014, 2016-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2014, 2016-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/platform/Kconfig b/mali_kbase/platform/Kconfig
index ffb9aa7..67cdfa4 100644
--- a/mali_kbase/platform/Kconfig
+++ b/mali_kbase/platform/Kconfig
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2012-2013, 2017 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2012-2013, 2017, 2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/platform/devicetree/Kbuild b/mali_kbase/platform/devicetree/Kbuild
index 4068e28..fea7aa2 100644
--- a/mali_kbase/platform/devicetree/Kbuild
+++ b/mali_kbase/platform/devicetree/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2012-2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2012-2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,6 +19,7 @@
#
mali_kbase-y += \
- $(MALI_PLATFORM_DIR)/mali_kbase_config_devicetree.o \
- $(MALI_PLATFORM_DIR)/mali_kbase_runtime_pm.o \
- $(MALI_PLATFORM_DIR)/mali_kbase_clk_rate_trace.o
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_config_devicetree.o \
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_config_platform.o \
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_runtime_pm.o \
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_clk_rate_trace.o
diff --git a/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c b/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c
index f149554..658f0d7 100644
--- a/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c
+++ b/mali_kbase/platform/devicetree/mali_kbase_clk_rate_trace.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2015, 2017-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2015, 2017-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c b/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c
index 5f300b1..cb73e6d 100644
--- a/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c
+++ b/mali_kbase/platform/devicetree/mali_kbase_config_devicetree.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2015, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2015, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -19,7 +19,9 @@
*
*/
+#include <mali_kbase.h>
#include <mali_kbase_config.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
static struct kbase_platform_config dummy_platform_config;
@@ -38,3 +40,14 @@ void kbase_platform_unregister(void)
{
}
#endif
+
+#ifdef CONFIG_MALI_MIDGARD_DVFS
+#if MALI_USE_CSF
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation)
+#else
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation, u32 util_gl_share, u32 util_cl_share[2])
+#endif
+{
+ return 1;
+}
+#endif /* CONFIG_MALI_MIDGARD_DVFS */
diff --git a/mali_kbase/platform/devicetree/mali_kbase_config_platform.c b/mali_kbase/platform/devicetree/mali_kbase_config_platform.c
new file mode 100644
index 0000000..44dfa2f
--- /dev/null
+++ b/mali_kbase/platform/devicetree/mali_kbase_config_platform.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *
+ * (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
+ */
+
+#include <mali_kbase.h>
+#include <mali_kbase_defs.h>
+#include <mali_kbase_config.h>
+#include "mali_kbase_config_platform.h"
+#include <device/mali_kbase_device.h>
+#include <mali_kbase_hwaccess_time.h>
+#include <gpu/mali_kbase_gpu_regmap.h>
+
+#include <linux/kthread.h>
+#include <linux/timer.h>
+#include <linux/jiffies.h>
+#include <linux/wait.h>
+#include <linux/delay.h>
+#include <linux/gcd.h>
+#include <asm/arch_timer.h>
+
+struct kbase_platform_funcs_conf platform_funcs = {
+ .platform_init_func = NULL,
+ .platform_term_func = NULL,
+ .platform_late_init_func = NULL,
+ .platform_late_term_func = NULL,
+};
diff --git a/mali_kbase/platform/devicetree/mali_kbase_config_platform.h b/mali_kbase/platform/devicetree/mali_kbase_config_platform.h
index ee9ae52..a2d815b 100644
--- a/mali_kbase/platform/devicetree/mali_kbase_config_platform.h
+++ b/mali_kbase/platform/devicetree/mali_kbase_config_platform.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -33,13 +33,13 @@
* Attached value: pointer to @ref kbase_platform_funcs_conf
* Default value: See @ref kbase_platform_funcs_conf
*/
-#define PLATFORM_FUNCS (NULL)
+#define PLATFORM_FUNCS (&platform_funcs)
#define CLK_RATE_TRACE_OPS (&clk_rate_trace_ops)
extern struct kbase_pm_callback_conf pm_callbacks;
extern struct kbase_clk_rate_trace_op_conf clk_rate_trace_ops;
-
+extern struct kbase_platform_funcs_conf platform_funcs;
/**
* Autosuspend delay
*
diff --git a/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c b/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c
index 008f8a4..7e7dc67 100644
--- a/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c
+++ b/mali_kbase/platform/devicetree/mali_kbase_runtime_pm.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2015-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2015-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -25,6 +25,7 @@
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/regulator/consumer.h>
+
#include "mali_kbase_config_platform.h"
static void enable_gpu_power_control(struct kbase_device *kbdev)
diff --git a/mali_kbase/platform/pixel/Kbuild b/mali_kbase/platform/pixel/Kbuild
index 250780d..1d368c9 100644
--- a/mali_kbase/platform/pixel/Kbuild
+++ b/mali_kbase/platform/pixel/Kbuild
@@ -20,17 +20,17 @@
#
mali_kbase-y += \
- $(MALI_PLATFORM_DIR)/pixel_gpu.o \
- $(MALI_PLATFORM_DIR)/pixel_gpu_power.o
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu.o \
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu_power.o
mali_kbase-$(CONFIG_MALI_MIDGARD_DVFS) += \
- $(MALI_PLATFORM_DIR)/pixel_gpu_dvfs.o \
- $(MALI_PLATFORM_DIR)/pixel_gpu_dvfs_governor.o \
- $(MALI_PLATFORM_DIR)/pixel_gpu_dvfs_metrics.o \
- $(MALI_PLATFORM_DIR)/pixel_gpu_sysfs.o
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu_dvfs.o \
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu_dvfs_governor.o \
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu_dvfs_metrics.o \
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu_sysfs.o
mali_kbase-$(CONFIG_MALI_PIXEL_GPU_QOS) += \
- $(MALI_PLATFORM_DIR)/pixel_gpu_dvfs_qos.o
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu_dvfs_qos.o
mali_kbase-$(CONFIG_MALI_PIXEL_GPU_THERMAL) += \
- $(MALI_PLATFORM_DIR)/pixel_gpu_tmu.o
+ platform/$(MALI_PLATFORM_DIR)/pixel_gpu_tmu.o
diff --git a/mali_kbase/platform/vexpress/Kbuild b/mali_kbase/platform/vexpress/Kbuild
index c184180..cf9c3cb 100644
--- a/mali_kbase/platform/vexpress/Kbuild
+++ b/mali_kbase/platform/vexpress/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2012-2013, 2016-2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2012-2013, 2016-2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,5 +19,5 @@
#
mali_kbase-y += \
- $(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \
- mali_kbase_platform_fake.o
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \
+ mali_kbase_platform_fake.o
diff --git a/mali_kbase/platform/vexpress/mali_kbase_config_platform.h b/mali_kbase/platform/vexpress/mali_kbase_config_platform.h
index 97fdd13..e3433ae 100644
--- a/mali_kbase/platform/vexpress/mali_kbase_config_platform.h
+++ b/mali_kbase/platform/vexpress/mali_kbase_config_platform.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c b/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c
index 1816817..051d530 100644
--- a/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c
+++ b/mali_kbase/platform/vexpress/mali_kbase_config_vexpress.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2011-2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -25,6 +25,8 @@
#include <mali_kbase_config.h>
#include "mali_kbase_config_platform.h"
+#include <backend/gpu/mali_kbase_pm_internal.h>
+
#ifndef CONFIG_OF
static struct kbase_io_resources io_resources = {
.job_irq_number = 68,
@@ -64,3 +66,14 @@ struct kbase_platform_config *kbase_get_platform_config(void)
{
return &versatile_platform_config;
}
+
+#ifdef CONFIG_MALI_MIDGARD_DVFS
+#if MALI_USE_CSF
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation)
+#else
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation, u32 util_gl_share, u32 util_cl_share[2])
+#endif
+{
+ return 1;
+}
+#endif /* CONFIG_MALI_MIDGARD_DVFS */
diff --git a/mali_kbase/platform/vexpress_1xv7_a57/Kbuild b/mali_kbase/platform/vexpress_1xv7_a57/Kbuild
index 777a4ce..cf9c3cb 100644
--- a/mali_kbase/platform/vexpress_1xv7_a57/Kbuild
+++ b/mali_kbase/platform/vexpress_1xv7_a57/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2013-2014, 2016-2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2012-2013, 2016-2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,5 +19,5 @@
#
mali_kbase-y += \
- $(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \
- mali_kbase_platform_fake.o
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \
+ mali_kbase_platform_fake.o
diff --git a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h
index 97fdd13..e3433ae 100644
--- a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h
+++ b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_platform.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c
index 3bb5caf..5e67a0c 100644
--- a/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c
+++ b/mali_kbase/platform/vexpress_1xv7_a57/mali_kbase_config_vexpress.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2011-2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -24,6 +24,8 @@
#include <mali_kbase_defs.h>
#include <mali_kbase_config.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
+
#ifndef CONFIG_OF
static struct kbase_io_resources io_resources = {
.job_irq_number = 68,
@@ -62,3 +64,14 @@ struct kbase_platform_config *kbase_get_platform_config(void)
{
return &versatile_platform_config;
}
+
+#ifdef CONFIG_MALI_MIDGARD_DVFS
+#if MALI_USE_CSF
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation)
+#else
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation, u32 util_gl_share, u32 util_cl_share[2])
+#endif
+{
+ return 1;
+}
+#endif /* CONFIG_MALI_MIDGARD_DVFS */
diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild
index edda36c..af896b0 100644
--- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild
+++ b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2012-2013, 2016-2017 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2012-2013, 2016-2017, 2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -19,6 +19,6 @@
#
mali_kbase-y += \
- $(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \
- $(MALI_PLATFORM_DIR)/mali_kbase_cpu_vexpress.o \
- mali_kbase_platform_fake.o
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_config_vexpress.o \
+ platform/$(MALI_PLATFORM_DIR)/mali_kbase_cpu_vexpress.o \
+ mali_kbase_platform_fake.o
diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h
index 97fdd13..e3433ae 100644
--- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h
+++ b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_platform.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014-2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c
index a7a842a..b711c29 100644
--- a/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c
+++ b/mali_kbase/platform/vexpress_6xvirtex7_10mhz/mali_kbase_config_vexpress.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2011-2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2011-2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -24,6 +24,8 @@
#include <mali_kbase_defs.h>
#include <mali_kbase_config.h>
+#include <backend/gpu/mali_kbase_pm_internal.h>
+
#ifndef CONFIG_OF
static struct kbase_io_resources io_resources = {
.job_irq_number = 75,
@@ -62,3 +64,14 @@ struct kbase_platform_config *kbase_get_platform_config(void)
{
return &versatile_platform_config;
}
+
+#ifdef CONFIG_MALI_MIDGARD_DVFS
+#if MALI_USE_CSF
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation)
+#else
+int kbase_platform_dvfs_event(struct kbase_device *kbdev, u32 utilisation, u32 util_gl_share, u32 util_cl_share[2])
+#endif
+{
+ return 1;
+}
+#endif /* CONFIG_MALI_MIDGARD_DVFS */
diff --git a/mali_kbase/tests/Kbuild b/mali_kbase/tests/Kbuild
index cf9d7fd..eaa88f4 100644
--- a/mali_kbase/tests/Kbuild
+++ b/mali_kbase/tests/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,13 @@
#
#
+ccflags-y += -I$(src)/include \
+ -I$(src)
+
+subdir-ccflags-y += -I$(src)/include \
+ -I$(src)
+
obj-$(CONFIG_MALI_KUTF) += kutf/
-obj-$(CONFIG_MALI_IRQ_LATENCY) += mali_kutf_irq_test/
-obj-$(CONFIG_MALI_CLK_RATE_TRACE_PORTAL) += mali_kutf_clk_rate_trace/kernel/
+obj-$(CONFIG_MALI_KUTF_IRQ_TEST) += mali_kutf_irq_test/
+obj-$(CONFIG_MALI_KUTF_CLK_RATE_TRACE) += mali_kutf_clk_rate_trace/kernel/
+
diff --git a/mali_kbase/tests/Kconfig b/mali_kbase/tests/Kconfig
index cf2a23a..2468361 100644
--- a/mali_kbase/tests/Kconfig
+++ b/mali_kbase/tests/Kconfig
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,6 +18,40 @@
#
#
-source "drivers/gpu/arm/midgard/tests/kutf/Kconfig"
-source "drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/Kconfig"
-source "drivers/gpu/arm/midgard/tests/mali_kutf_clk_rate_trace/kernel/Kconfig"
+menuconfig MALI_KUTF
+ bool "Build Mali Kernel Unit Test Framework modules"
+ depends on MALI_MIDGARD && MALI_DEBUG
+ default y if MALI_DEBUG
+ help
+ This option will build the Mali testing framework modules.
+
+ Modules:
+ - kutf.ko
+ - kutf_test.ko
+
+config MALI_KUTF_IRQ_TEST
+ bool "Build Mali KUTF IRQ test module"
+ depends on MALI_KUTF
+ default y
+ help
+ This option will build the IRQ latency measurement test module.
+ It can determine the latency of the Mali GPU IRQ on your system.
+
+ Modules:
+ - mali_kutf_irq_test.ko
+
+config MALI_KUTF_CLK_RATE_TRACE
+ bool "Build Mali KUTF Clock rate trace test module"
+ depends on MALI_KUTF
+ default y
+ help
+ This option will build the clock rate trace portal test module.
+ It can test the clocks integration into the platform and exercise some
+ basic trace test in the system.
+
+ Modules:
+ - mali_kutf_clk_rate_trace_test_portal.ko
+
+
+comment "Enable MALI_DEBUG for KUTF modules support"
+ depends on MALI_MIDGARD && !MALI_DEBUG && MALI_KUTF
diff --git a/mali_kbase/tests/Mconfig b/mali_kbase/tests/Mconfig
index a21810b..167facd 100644
--- a/mali_kbase/tests/Mconfig
+++ b/mali_kbase/tests/Mconfig
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0
+# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
#
# (C) COPYRIGHT 2018-2021 ARM Limited. All rights reserved.
#
@@ -18,32 +18,44 @@
#
#
+menuconfig MALI_KUTF
+ bool "Build Mali Kernel Unit Test Framework modules"
+ depends on MALI_MIDGARD && MALI_DEBUG
+ default y if BACKEND_KERNEL && MALI_DEBUG
+ help
+ This option will build the Mali testing framework modules.
+
+ Modules:
+ - kutf.ko
+ - kutf_test.ko
+
+config MALI_KUTF_IRQ_TEST
+ bool "Build Mali KUTF IRQ test module"
+ depends on MALI_KUTF
+ default y
+ help
+ This option will build the IRQ latency measurement test module.
+ It can determine the latency of the Mali GPU IRQ on your system.
+
+ Modules:
+ - mali_kutf_irq_test.ko
+
+config MALI_KUTF_CLK_RATE_TRACE
+ bool "Build Mali KUTF Clock rate trace test module"
+ depends on MALI_KUTF
+ default y
+ help
+ This option will build the clock rate trace portal test module.
+ It can test the clocks integration into the platform and exercise some
+ basic trace test in the system.
+
+ Modules:
+ - mali_kutf_clk_rate_trace_test_portal.ko
+
+
+# Enable MALI_DEBUG for KUTF modules support
+
config UNIT_TEST_KERNEL_MODULES
- bool
- default y if UNIT_TEST_CODE && BACKEND_KERNEL
- default n
-
-config BUILD_IPA_TESTS
- bool
- default y if UNIT_TEST_KERNEL_MODULES && MALI_DEVFREQ
- default n
-
-config BUILD_IPA_UNIT_TESTS
- bool
- default y if NO_MALI && BUILD_IPA_TESTS
- default n
-
-config BUILD_CSF_TESTS
- bool
- default y if UNIT_TEST_KERNEL_MODULES && GPU_HAS_CSF
- default n
-
-config BUILD_ARBIF_TESTS
- bool
- default y if UNIT_TEST_CODE && MALI_ARBITER_SUPPORT
- default n
-
-config BUILD_ARBIF_KERNEL_TESTS
- bool
- default y if BUILD_KERNEL_MODULES && BUILD_ARBIF_TESTS
- default n
+ bool
+ default y if UNIT_TEST_CODE && BACKEND_KERNEL
+ default n
diff --git a/mali_kbase/tests/build.bp b/mali_kbase/tests/build.bp
new file mode 100644
index 0000000..9d6137d
--- /dev/null
+++ b/mali_kbase/tests/build.bp
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+/*
+ *
+ * (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
+ */
+
+bob_defaults {
+ name: "kernel_test_includes",
+ local_include_dirs: [
+ "include",
+ "./../../",
+ "./../",
+ "./"
+ ],
+}
+
+bob_defaults {
+ name: "kernel_test_configs",
+ mali_kutf: {
+ kbuild_options: ["CONFIG_MALI_KUTF=y"],
+ },
+ unit_test_kernel_modules: {
+ kbuild_options: ["CONFIG_UNIT_TEST_KERNEL_MODULES=y"],
+ },
+}
diff --git a/mali_kbase/tests/include/kutf/kutf_helpers.h b/mali_kbase/tests/include/kutf/kutf_helpers.h
index 3b8613a..5cd1498 100644
--- a/mali_kbase/tests/include/kutf/kutf_helpers.h
+++ b/mali_kbase/tests/include/kutf/kutf_helpers.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/include/kutf/kutf_helpers_user.h b/mali_kbase/tests/include/kutf/kutf_helpers_user.h
index 49aad29..10cce4f 100644
--- a/mali_kbase/tests/include/kutf/kutf_helpers_user.h
+++ b/mali_kbase/tests/include/kutf/kutf_helpers_user.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/include/kutf/kutf_mem.h b/mali_kbase/tests/include/kutf/kutf_mem.h
index 47c4bea..e729e72 100644
--- a/mali_kbase/tests/include/kutf/kutf_mem.h
+++ b/mali_kbase/tests/include/kutf/kutf_mem.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/include/kutf/kutf_resultset.h b/mali_kbase/tests/include/kutf/kutf_resultset.h
index 1f2dcfa..e869c5e 100644
--- a/mali_kbase/tests/include/kutf/kutf_resultset.h
+++ b/mali_kbase/tests/include/kutf/kutf_resultset.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/include/kutf/kutf_suite.h b/mali_kbase/tests/include/kutf/kutf_suite.h
index 426e435..910717e 100644
--- a/mali_kbase/tests/include/kutf/kutf_suite.h
+++ b/mali_kbase/tests/include/kutf/kutf_suite.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/include/kutf/kutf_utils.h b/mali_kbase/tests/include/kutf/kutf_utils.h
index e5e2f02..c72a2cf 100644
--- a/mali_kbase/tests/include/kutf/kutf_utils.h
+++ b/mali_kbase/tests/include/kutf/kutf_utils.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/kutf/Kbuild b/mali_kbase/tests/kutf/Kbuild
index bd6540c..61f6385 100644
--- a/mali_kbase/tests/kutf/Kbuild
+++ b/mali_kbase/tests/kutf/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,8 +18,14 @@
#
#
-ccflags-y += -I$(src)/../include
+ifeq ($(CONFIG_MALI_KUTF),y)
+obj-m += kutf.o
-obj-$(CONFIG_MALI_KUTF) += kutf.o
-
-kutf-y := kutf_mem.o kutf_resultset.o kutf_suite.o kutf_utils.o kutf_helpers.o kutf_helpers_user.o
+kutf-y := \
+ kutf_mem.o \
+ kutf_resultset.o \
+ kutf_suite.o \
+ kutf_utils.o \
+ kutf_helpers.o \
+ kutf_helpers_user.o
+endif
diff --git a/mali_kbase/tests/kutf/build.bp b/mali_kbase/tests/kutf/build.bp
index 707a053..89edae9 100644
--- a/mali_kbase/tests/kutf/build.bp
+++ b/mali_kbase/tests/kutf/build.bp
@@ -1,7 +1,7 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
*
- * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -22,8 +22,9 @@
bob_kernel_module {
name: "kutf",
defaults: [
- "kernel_defaults",
- "kutf_includes",
+ "mali_kbase_shared_config_defaults",
+ "kernel_test_configs",
+ "kernel_test_includes",
],
srcs: [
"Kbuild",
@@ -34,9 +35,8 @@ bob_kernel_module {
"kutf_suite.c",
"kutf_utils.c",
],
- kbuild_options: ["CONFIG_MALI_KUTF=m"],
enabled: false,
- base_build_kutf: {
+ mali_kutf: {
enabled: true,
},
}
diff --git a/mali_kbase/tests/kutf/kutf_helpers.c b/mali_kbase/tests/kutf/kutf_helpers.c
index 13923fa..b5614e7 100644
--- a/mali_kbase/tests/kutf/kutf_helpers.c
+++ b/mali_kbase/tests/kutf/kutf_helpers.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/kutf/kutf_helpers_user.c b/mali_kbase/tests/kutf/kutf_helpers_user.c
index 84c63be..fa76e62 100644
--- a/mali_kbase/tests/kutf/kutf_helpers_user.c
+++ b/mali_kbase/tests/kutf/kutf_helpers_user.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/kutf/kutf_mem.c b/mali_kbase/tests/kutf/kutf_mem.c
index b005b68..e8f148a 100644
--- a/mali_kbase/tests/kutf/kutf_mem.c
+++ b/mali_kbase/tests/kutf/kutf_mem.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/kutf/kutf_resultset.c b/mali_kbase/tests/kutf/kutf_resultset.c
index 1eea08c..dd1ffe7 100644
--- a/mali_kbase/tests/kutf/kutf_resultset.c
+++ b/mali_kbase/tests/kutf/kutf_resultset.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/kutf/kutf_suite.c b/mali_kbase/tests/kutf/kutf_suite.c
index 4b1dde4..215bfab 100644
--- a/mali_kbase/tests/kutf/kutf_suite.c
+++ b/mali_kbase/tests/kutf/kutf_suite.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014, 2017-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -1158,7 +1158,7 @@ void kutf_test_abort(struct kutf_context *context)
}
EXPORT_SYMBOL(kutf_test_abort);
-#ifdef CONFIG_DEBUG_FS
+#if IS_ENABLED(CONFIG_DEBUG_FS)
/**
* init_kutf_core() - Module entry point.
diff --git a/mali_kbase/tests/kutf/kutf_utils.c b/mali_kbase/tests/kutf/kutf_utils.c
index f0dad1f..00381eb 100644
--- a/mali_kbase/tests/kutf/kutf_utils.c
+++ b/mali_kbase/tests/kutf/kutf_utils.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2014, 2017, 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2014, 2017, 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild
index 00b2a41..c340525 100644
--- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild
+++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,8 +18,8 @@
#
#
-ccflags-y += -I$(src)/../include -I$(src)/../../../ -I$(src)/../../ -I$(src)/../../backend/gpu -I$(srctree)/drivers/staging/android
-
-obj-$(CONFIG_MALI_CLK_RATE_TRACE_PORTAL) += mali_kutf_clk_rate_trace_test_portal.o
+ifeq ($(CONFIG_MALI_KUTF_CLK_RATE_TRACE),y)
+obj-m += mali_kutf_clk_rate_trace_test_portal.o
mali_kutf_clk_rate_trace_test_portal-y := mali_kutf_clk_rate_trace_test.o
+endif
diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kconfig b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kconfig
deleted file mode 100644
index 51c2d27..0000000
--- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Kconfig
+++ /dev/null
@@ -1,29 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
-#
-# This program is free software and is provided to you under the terms of the
-# GNU General Public License version 2 as published by the Free Software
-# Foundation, and any use by you of this program is subject to the terms
-# of such GNU license.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, you can access it online at
-# http://www.gnu.org/licenses/gpl-2.0.html.
-#
-#
-
-config CONFIG_MALI_CLK_RATE_TRACE_PORTAL
- tristate "Mali GPU Clock Trace Test portal"
- depends on MALI_MIDGARD && MALI_DEBUG && MALI_KUTF
- default m
- help
- This option will build a test module mali_kutf_clk_rate_trace_test_portal
- that can test the clocks integration into the platform and exercise some
- basic trace test in the system. Choosing M here will generate a single
- module called mali_kutf_clk_rate_trace_test_portal.
diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile
deleted file mode 100644
index 950acd8..0000000
--- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/Makefile
+++ /dev/null
@@ -1,56 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
-#
-# This program is free software and is provided to you under the terms of the
-# GNU General Public License version 2 as published by the Free Software
-# Foundation, and any use by you of this program is subject to the terms
-# of such GNU license.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, you can access it online at
-# http://www.gnu.org/licenses/gpl-2.0.html.
-#
-#
-
-ifneq ($(KERNELRELEASE),)
-
-ccflags-y := \
- -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
- -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
- -I$(src)/../../include \
- -I$(src)/../../../../../../../include \
- -I$(src)/../../../../ \
- -I$(src)/../../../ \
- -I$(src)/../../../backend/gpu \
- -I$(src)/../../../debug \
- -I$(src)/../../../debug/backend \
- -I$(src)/ \
- -I$(srctree)/drivers/staging/android \
- -I$(srctree)/include/linux
-
-obj-m := mali_kutf_clk_rate_trace_test_portal.o
-mali_kutf_clk_rate_trace_test_portal-y := mali_kutf_clk_rate_trace_test.o
-
-else
-# linux build system bootstrap for out-of-tree module
-
-# default to building for the host
-ARCH ?= $(shell uname -m)
-
-ifeq ($(KDIR),)
-$(error Must specify KDIR to point to the kernel to target))
-endif
-
-all:
- $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) KBUILD_EXTRA_SYMBOLS="$(CURDIR)/../../kutf/Module.symvers $(CURDIR)/../../../Module.symvers" modules
-
-clean:
- $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
-
-endif
diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/build.bp b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/build.bp
index c16b3de..225ad69 100644
--- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/build.bp
+++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/build.bp
@@ -1,7 +1,7 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -23,20 +23,21 @@ bob_kernel_module {
name: "mali_kutf_clk_rate_trace_test_portal",
defaults: [
"mali_kbase_shared_config_defaults",
+ "kernel_test_configs",
"kernel_test_includes",
],
srcs: [
- "../mali_kutf_clk_rate_trace_test.h",
- "Makefile",
+ "Kbuild",
"mali_kutf_clk_rate_trace_test.c",
+ "../mali_kutf_clk_rate_trace_test.h",
],
extra_symbols: [
"mali_kbase",
"kutf",
],
enabled: false,
- base_build_kutf: {
+ mali_kutf_clk_rate_trace: {
+ kbuild_options: ["CONFIG_MALI_KUTF_CLK_RATE_TRACE=y"],
enabled: true,
- kbuild_options: ["CONFIG_MALI_CLK_RATE_TRACE_PORTAL=m"],
},
}
diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c
index bd091fa..a0dca7e 100644
--- a/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c
+++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/kernel/mali_kutf_clk_rate_trace_test.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -32,9 +32,9 @@
#include <linux/sched.h>
#endif
#include "mali_kbase.h"
-#include "mali_kbase_irq_internal.h"
-#include "mali_kbase_pm_internal.h"
-#include "mali_kbase_clk_rate_trace_mgr.h"
+#include "backend/gpu/mali_kbase_irq_internal.h"
+#include "backend/gpu/mali_kbase_pm_internal.h"
+#include "backend/gpu/mali_kbase_clk_rate_trace_mgr.h"
#include <kutf/kutf_suite.h>
#include <kutf/kutf_utils.h>
@@ -114,14 +114,15 @@ struct kbasep_cmd_name_pair {
};
struct kbasep_cmd_name_pair kbasep_portal_cmd_name_map[] = {
- {PORTAL_CMD_GET_CLK_RATE_MGR, GET_CLK_RATE_MGR},
- {PORTAL_CMD_GET_CLK_RATE_TRACE, GET_CLK_RATE_TRACE},
- {PORTAL_CMD_GET_TRACE_SNAPSHOT, GET_TRACE_SNAPSHOT},
- {PORTAL_CMD_INC_PM_CTX_CNT, INC_PM_CTX_CNT},
- {PORTAL_CMD_DEC_PM_CTX_CNT, DEC_PM_CTX_CNT},
- {PORTAL_CMD_CLOSE_PORTAL, CLOSE_PORTAL},
- {PORTAL_CMD_INVOKE_NOTIFY_42KHZ, INVOKE_NOTIFY_42KHZ},
- };
+ { PORTAL_CMD_GET_PLATFORM, GET_PLATFORM },
+ { PORTAL_CMD_GET_CLK_RATE_MGR, GET_CLK_RATE_MGR },
+ { PORTAL_CMD_GET_CLK_RATE_TRACE, GET_CLK_RATE_TRACE },
+ { PORTAL_CMD_GET_TRACE_SNAPSHOT, GET_TRACE_SNAPSHOT },
+ { PORTAL_CMD_INC_PM_CTX_CNT, INC_PM_CTX_CNT },
+ { PORTAL_CMD_DEC_PM_CTX_CNT, DEC_PM_CTX_CNT },
+ { PORTAL_CMD_CLOSE_PORTAL, CLOSE_PORTAL },
+ { PORTAL_CMD_INVOKE_NOTIFY_42KHZ, INVOKE_NOTIFY_42KHZ },
+};
/* Global pointer for the kutf_portal_trace_write() to use. When
* this pointer is engaged, new requests for create fixture will fail
@@ -137,8 +138,16 @@ static void kutf_portal_trace_write(
u32 index, u32 new_rate)
{
struct clk_trace_snapshot *snapshot;
- struct kutf_clk_rate_trace_fixture_data *data = container_of(
- listener, struct kutf_clk_rate_trace_fixture_data, listener);
+ struct kutf_clk_rate_trace_fixture_data *data;
+
+ if (listener == NULL) {
+ pr_err("%s - index: %u, new_rate: %u, listener is NULL\n",
+ __func__, index, new_rate);
+ return;
+ }
+
+ data = container_of(listener, struct kutf_clk_rate_trace_fixture_data,
+ listener);
lockdep_assert_held(&data->kbdev->pm.clk_rtm.lock);
@@ -180,11 +189,10 @@ static void kutf_set_pm_ctx_idle(struct kutf_context *context)
if (WARN_ON(data->pm_ctx_cnt > 0))
return;
-
- kbase_pm_context_idle(data->kbdev);
#if !MALI_USE_CSF
kbase_pm_release_gpu_cycle_counter(data->kbdev);
#endif
+ kbase_pm_context_idle(data->kbdev);
}
static char const *kutf_clk_trace_do_change_pm_ctx(struct kutf_context *context,
@@ -408,6 +416,63 @@ static char const *kutf_clk_trace_do_close_portal(struct kutf_context *context,
return errmsg;
}
+/**
+ * kutf_clk_trace_do_get_platform() - Gets platform information
+ * @context: KUTF context
+ * @cmd: The decoded portal input request
+ *
+ * Checks the gpu node in the device tree to see if arbitration is enabled
+ * If so determines device tree whether platform is PV or PTM
+ *
+ * Return: A string to indicate the platform (PV/PTM/GPU/UNKNOWN)
+ */
+static char const *kutf_clk_trace_do_get_platform(
+ struct kutf_context *context,
+ struct clk_trace_portal_input *cmd)
+{
+ int seq = cmd->cmd_input.u.val_u64 & 0xFF;
+ char const *errmsg = NULL;
+ const void *arbiter_if_node = NULL;
+ const void *power_node = NULL;
+ const char *platform = "GPU";
+#if defined(CONFIG_MALI_ARBITER_SUPPORT) && defined(CONFIG_OF)
+ struct kutf_clk_rate_trace_fixture_data *data = context->fixture;
+
+ arbiter_if_node =
+ of_get_property(data->kbdev->dev->of_node, "arbiter_if", NULL);
+#endif
+ if (arbiter_if_node) {
+ power_node = of_find_compatible_node(NULL, NULL,
+ "arm,mali-gpu-power");
+ if (power_node) {
+ platform = "PV";
+ } else {
+ power_node = of_find_compatible_node(NULL, NULL,
+ "arm,mali-ptm");
+ if (power_node)
+ platform = "PTM";
+ else
+ platform = "UNKNOWN";
+ }
+ } else {
+ platform = "GPU";
+ }
+
+ pr_debug("%s - platform is %s\n", __func__, platform);
+ snprintf(portal_msg_buf, PORTAL_MSG_LEN,
+ "{SEQ:%d, PLATFORM:%s}", seq, platform);
+
+ WARN_ON(cmd->portal_cmd != PORTAL_CMD_GET_PLATFORM);
+
+ if (kutf_helper_send_named_str(context, "ACK", portal_msg_buf)) {
+ pr_warn("Error in sending ack for " CLOSE_PORTAL "reuquest\n");
+ errmsg = kutf_dsprintf(&context->fixture_pool,
+ "Error in sending ack for " GET_PLATFORM "request");
+ }
+
+ return errmsg;
+}
+
static bool kutf_clk_trace_dequeue_portal_cmd(struct kutf_context *context,
struct clk_trace_portal_input *cmd)
{
@@ -461,6 +526,9 @@ static bool kutf_clk_trace_process_portal_cmd(struct kutf_context *context,
WARN_ON(cmd->portal_cmd == PORTAL_CMD_INVALID);
switch (cmd->portal_cmd) {
+ case PORTAL_CMD_GET_PLATFORM:
+ errmsg = kutf_clk_trace_do_get_platform(context, cmd);
+ break;
case PORTAL_CMD_GET_CLK_RATE_MGR:
/* Fall through */
case PORTAL_CMD_GET_CLK_RATE_TRACE:
@@ -613,7 +681,7 @@ void kutf_clk_trace_barebone_check(struct kutf_context *context)
kutf_clk_trace_flag_result(context, KUTF_RESULT_FAIL, msg);
else if (!data->total_update_cnt) {
msg = kutf_dsprintf(&context->fixture_pool,
- "No trace update seen during the test!");
+ "No trace update seen during the test!");
kutf_clk_trace_flag_result(context, KUTF_RESULT_WARN, msg);
}
}
diff --git a/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h b/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h
index 600b025..878eddc 100644
--- a/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h
+++ b/mali_kbase/tests/mali_kutf_clk_rate_trace/mali_kutf_clk_rate_trace_test.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2020-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -30,6 +30,8 @@
* enum kbasep_clk_rate_trace_req - request command to the clock rate trace
* service portal.
*
+ * @PORTAL_CMD_GET_PLATFORM: Request the platform that the tests are
+ * to be run on.
* @PORTAL_CMD_GET_CLK_RATE_MGR: Request the clock trace manager internal
* data record. On a positive acknowledgement
* the prevailing clock rates and the GPU idle
@@ -73,6 +75,7 @@
*/
/* PORTAL_CMD_INVALID must be the last one, serving the size */
enum kbasep_clk_rate_trace_req {
+ PORTAL_CMD_GET_PLATFORM,
PORTAL_CMD_GET_CLK_RATE_MGR,
PORTAL_CMD_GET_CLK_RATE_TRACE,
PORTAL_CMD_GET_TRACE_SNAPSHOT,
@@ -121,6 +124,7 @@ enum kbasep_clk_rate_trace_req {
* Note, at the close, PM_CTX_CNT is 1. The PM_CTX_CNT will internally be
* dropped down to 0 as part of the portal close clean up.
*/
+#define GET_PLATFORM "GET_PLATFORM"
#define GET_CLK_RATE_MGR "GET_CLK_RATE_MGR"
#define GET_CLK_RATE_TRACE "GET_CLK_RATE_TRACE"
#define GET_TRACE_SNAPSHOT "GET_TRACE_SNAPSHOT"
diff --git a/mali_kbase/tests/mali_kutf_irq_test/Kbuild b/mali_kbase/tests/mali_kutf_irq_test/Kbuild
index cc38cb8..6f4a536 100644
--- a/mali_kbase/tests/mali_kutf_irq_test/Kbuild
+++ b/mali_kbase/tests/mali_kutf_irq_test/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2017, 2020-2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,8 +18,8 @@
#
#
-ccflags-y += -I$(src)/../include -I$(src)/../../../ -I$(src)/../../ -I$(src)/../../backend/gpu -I$(srctree)/drivers/staging/android
-
-obj-$(CONFIG_MALI_IRQ_LATENCY) += mali_kutf_irq_test.o
+ifeq ($(CONFIG_MALI_KUTF_IRQ_TEST),y)
+obj-m += mali_kutf_irq_test.o
mali_kutf_irq_test-y := mali_kutf_irq_test_main.o
+endif
diff --git a/mali_kbase/tests/mali_kutf_irq_test/Makefile b/mali_kbase/tests/mali_kutf_irq_test/Makefile
deleted file mode 100644
index cbec0d3..0000000
--- a/mali_kbase/tests/mali_kutf_irq_test/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-#
-# (C) COPYRIGHT 2015, 2017-2018, 2020 ARM Limited. All rights reserved.
-#
-# This program is free software and is provided to you under the terms of the
-# GNU General Public License version 2 as published by the Free Software
-# Foundation, and any use by you of this program is subject to the terms
-# of such GNU license.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, you can access it online at
-# http://www.gnu.org/licenses/gpl-2.0.html.
-#
-#
-
-# linux build system bootstrap for out-of-tree module
-
-# default to building for the host
-ARCH ?= $(shell uname -m)
-
-ifeq ($(KDIR),)
-$(error Must specify KDIR to point to the kernel to target))
-endif
-
-TEST_CCFLAGS := \
- -DMALI_UNIT_TEST=$(MALI_UNIT_TEST) \
- -DMALI_CUSTOMER_RELEASE=$(MALI_CUSTOMER_RELEASE) \
- -DMALI_USE_CSF=$(MALI_USE_CSF) \
- $(SCONS_CFLAGS) \
- -I$(CURDIR)/../include \
- -I$(CURDIR)/../../../../../../include \
- -I$(CURDIR)/../../../ \
- -I$(CURDIR)/../../ \
- -I$(CURDIR)/../../backend/gpu \
- -I$(CURDIR)/../../debug \
- -I$(CURDIR)/../../debug/backend \
- -I$(CURDIR)/ \
- -I$(srctree)/drivers/staging/android \
- -I$(srctree)/include/linux
-
-all:
- $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) $(SCONS_CONFIGS) EXTRA_CFLAGS="$(TEST_CCFLAGS)" KBUILD_EXTRA_SYMBOLS="$(CURDIR)/../kutf/Module.symvers $(CURDIR)/../../Module.symvers" modules
-
-clean:
- $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
diff --git a/mali_kbase/tests/mali_kutf_irq_test/build.bp b/mali_kbase/tests/mali_kutf_irq_test/build.bp
index 58021c8..155875b 100644
--- a/mali_kbase/tests/mali_kutf_irq_test/build.bp
+++ b/mali_kbase/tests/mali_kutf_irq_test/build.bp
@@ -1,7 +1,7 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/*
*
- * (C) COPYRIGHT 2018-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2018-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -23,6 +23,7 @@ bob_kernel_module {
name: "mali_kutf_irq_test",
defaults: [
"mali_kbase_shared_config_defaults",
+ "kernel_test_configs",
"kernel_test_includes",
],
srcs: [
@@ -34,8 +35,8 @@ bob_kernel_module {
"kutf",
],
enabled: false,
- base_build_kutf: {
+ mali_kutf_irq_test: {
+ kbuild_options: ["CONFIG_MALI_KUTF_IRQ_TEST=y"],
enabled: true,
- kbuild_options: ["CONFIG_MALI_IRQ_LATENCY=m"],
},
}
diff --git a/mali_kbase/Makefile.kbase b/mali_kbase/thirdparty/Kbuild
index 6d97f19..c723f3a 100644
--- a/mali_kbase/Makefile.kbase
+++ b/mali_kbase/thirdparty/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2010, 2013, 2018-2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,4 +18,4 @@
#
#
-EXTRA_CFLAGS += -I$(ROOT) -I$(KBASE_PATH) -I$(KBASE_PATH)/platform_$(PLATFORM)
+mali_kbase-y += thirdparty/mali_kbase_mmap.o
diff --git a/mali_kbase/thirdparty/mali_kbase_mmap.c b/mali_kbase/thirdparty/mali_kbase_mmap.c
index a3b4a74..de1199a 100644
--- a/mali_kbase/thirdparty/mali_kbase_mmap.c
+++ b/mali_kbase/thirdparty/mali_kbase_mmap.c
@@ -10,7 +10,7 @@
*/
#include "linux/mman.h"
-#include "../mali_kbase.h"
+#include <mali_kbase.h>
/* mali_kbase_mmap.c
*
@@ -275,7 +275,7 @@ unsigned long kbase_context_get_unmapped_area(struct kbase_context *const kctx,
if ((flags & MAP_FIXED) || addr)
return -EINVAL;
-#ifdef CONFIG_64BIT
+#if IS_ENABLED(CONFIG_64BIT)
/* too big? */
if (len > TASK_SIZE - SZ_2M)
return -ENOMEM;
diff --git a/mali_kbase/tests/kutf/Makefile b/mali_kbase/tl/Kbuild
index 041f539..6929cf8 100644
--- a/mali_kbase/tests/kutf/Makefile
+++ b/mali_kbase/tl/Kbuild
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
#
-# (C) COPYRIGHT 2014-2017, 2020 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2021 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -18,17 +18,15 @@
#
#
-# linux build system bootstrap for out-of-tree module
+mali_kbase-y += \
+ tl/mali_kbase_timeline.o \
+ tl/mali_kbase_timeline_io.o \
+ tl/mali_kbase_tlstream.o \
+ tl/mali_kbase_tracepoints.o
-# default to building for the host
-ARCH ?= $(shell uname -m)
-ifeq ($(KDIR),)
-$(error Must specify KDIR to point to the kernel to target))
+ifeq ($(CONFIG_MALI_CSF_SUPPORT),y)
+ mali_kbase-y += tl/backend/mali_kbase_timeline_csf.o
+else
+ mali_kbase-y += tl/backend/mali_kbase_timeline_jm.o
endif
-
-all:
- $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) $(SCONS_CONFIGS) EXTRA_CFLAGS=-I$(CURDIR)/../include modules
-
-clean:
- $(MAKE) ARCH=$(ARCH) -C $(KDIR) M=$(CURDIR) clean
diff --git a/mali_kbase/tl/backend/mali_kbase_timeline_csf.c b/mali_kbase/tl/backend/mali_kbase_timeline_csf.c
index 7455ce2..6bb507f 100644
--- a/mali_kbase/tl/backend/mali_kbase_timeline_csf.c
+++ b/mali_kbase/tl/backend/mali_kbase_timeline_csf.c
@@ -19,9 +19,9 @@
*
*/
-#include "../mali_kbase_tracepoints.h"
-#include "../mali_kbase_timeline.h"
-#include "../mali_kbase_timeline_priv.h"
+#include <tl/mali_kbase_tracepoints.h>
+#include <tl/mali_kbase_timeline.h>
+#include <tl/mali_kbase_timeline_priv.h>
#include <mali_kbase.h>
diff --git a/mali_kbase/tl/backend/mali_kbase_timeline_jm.c b/mali_kbase/tl/backend/mali_kbase_timeline_jm.c
index 6659d2d..2a783c2 100644
--- a/mali_kbase/tl/backend/mali_kbase_timeline_jm.c
+++ b/mali_kbase/tl/backend/mali_kbase_timeline_jm.c
@@ -19,9 +19,9 @@
*
*/
-#include "../mali_kbase_tracepoints.h"
-#include "../mali_kbase_timeline.h"
-#include "../mali_kbase_timeline_priv.h"
+#include <tl/mali_kbase_tracepoints.h>
+#include <tl/mali_kbase_timeline.h>
+#include <tl/mali_kbase_timeline_priv.h>
#include <mali_kbase.h>
diff --git a/mali_kbase/tl/mali_kbase_tl_serialize.h b/mali_kbase/tl/mali_kbase_tl_serialize.h
index f8cad4a..d100336 100644
--- a/mali_kbase/tl/mali_kbase_tl_serialize.h
+++ b/mali_kbase/tl/mali_kbase_tl_serialize.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
*
- * (C) COPYRIGHT 2019-2020 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
diff --git a/mali_kbase/tl/mali_kbase_tracepoints.h b/mali_kbase/tl/mali_kbase_tracepoints.h
index f3f554a..15284c6 100644
--- a/mali_kbase/tl/mali_kbase_tracepoints.h
+++ b/mali_kbase/tl/mali_kbase_tracepoints.h
@@ -1932,7 +1932,7 @@ struct kbase_tlstream;
*
* @kbdev: Kbase device
* @kcpu_queue: KCPU queue
- * @cqs_obj_gpu_addr: CQS Object GPU ptr
+ * @cqs_obj_gpu_addr: CQS Object GPU pointer
* @cqs_obj_compare_value: Semaphore value that should be exceeded
* for the WAIT to pass
* @cqs_obj_inherit_error: Indicates the error state should be inherited into the queue or not
@@ -1969,7 +1969,7 @@ struct kbase_tlstream;
*
* @kbdev: Kbase device
* @kcpu_queue: KCPU queue
- * @cqs_obj_gpu_addr: CQS Object GPU ptr
+ * @cqs_obj_gpu_addr: CQS Object GPU pointer
*/
#if MALI_USE_CSF
#define KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_ENQUEUE_CQS_SET( \
@@ -1999,7 +1999,7 @@ struct kbase_tlstream;
*
* @kbdev: Kbase device
* @kcpu_queue: KCPU queue
- * @map_import_buf_gpu_addr: Map import buffer GPU ptr
+ * @map_import_buf_gpu_addr: Map import buffer GPU pointer
*/
#if MALI_USE_CSF
#define KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_ENQUEUE_MAP_IMPORT( \
@@ -2029,7 +2029,7 @@ struct kbase_tlstream;
*
* @kbdev: Kbase device
* @kcpu_queue: KCPU queue
- * @map_import_buf_gpu_addr: Map import buffer GPU ptr
+ * @map_import_buf_gpu_addr: Map import buffer GPU pointer
*/
#if MALI_USE_CSF
#define KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_ENQUEUE_UNMAP_IMPORT( \
@@ -2059,7 +2059,7 @@ struct kbase_tlstream;
*
* @kbdev: Kbase device
* @kcpu_queue: KCPU queue
- * @map_import_buf_gpu_addr: Map import buffer GPU ptr
+ * @map_import_buf_gpu_addr: Map import buffer GPU pointer
*/
#if MALI_USE_CSF
#define KBASE_TLSTREAM_TL_KBASE_KCPUQUEUE_ENQUEUE_UNMAP_IMPORT_FORCE( \