Skip to content

Commit

Permalink
HEADER: MALI: rockchip: upgrade midgard DDK to r9p0-05rel0
Browse files Browse the repository at this point in the history
Change-Id: Ie46489734268edac2db7508ed6976fc8b72c2f06
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
  • Loading branch information
wzyy2 committed Oct 15, 2016
1 parent f27d1ca commit 028bc40
Show file tree
Hide file tree
Showing 98 changed files with 4,126 additions and 8,988 deletions.
25 changes: 15 additions & 10 deletions drivers/gpu/arm/midgard/Kbuild
Expand Up @@ -15,7 +15,7 @@


# Driver version string which is returned to userspace via an ioctl
MALI_RELEASE_NAME ?= "r13p0-00rel0"
MALI_RELEASE_NAME ?= "r9p0-05rel0"

# Paths required for build
KBASE_PATH = $(src)
Expand Down Expand Up @@ -88,6 +88,7 @@ SRC := \
mali_kbase_context.c \
mali_kbase_pm.c \
mali_kbase_config.c \
mali_kbase_instr.c \
mali_kbase_vinstr.c \
mali_kbase_softjobs.c \
mali_kbase_10969_workaround.c \
Expand All @@ -103,27 +104,25 @@ SRC := \
mali_kbase_replay.c \
mali_kbase_mem_profile_debugfs.c \
mali_kbase_mmu_mode_lpae.c \
mali_kbase_mmu_mode_aarch64.c \
mali_kbase_disjoint_events.c \
mali_kbase_gator_api.c \
mali_kbase_debug_mem_view.c \
mali_kbase_debug_job_fault.c \
mali_kbase_smc.c \
mali_kbase_mem_pool.c \
mali_kbase_mem_pool_debugfs.c \
mali_kbase_tlstream.c \
mali_kbase_strings.c \
mali_kbase_as_fault_debugfs.c
mali_kbase_mem_pool_debugfs.c

ifeq ($(MALI_UNIT_TEST),1)
SRC += mali_kbase_tlstream_test.c
ifeq ($(CONFIG_MALI_MIPE_ENABLED),y)
SRC += mali_kbase_tlstream.c
ifeq ($(MALI_UNIT_TEST),1)
SRC += mali_kbase_tlstream_test.c
endif
endif

ifeq ($(MALI_CUSTOMER_RELEASE),0)
SRC += mali_kbase_regs_dump_debugfs.c
endif


# Job Scheduler Policy: Completely Fair Scheduler
SRC += mali_kbase_js_policy_cfs.c

Expand Down Expand Up @@ -201,7 +200,13 @@ obj-$(CONFIG_MALI_MIDGARD) += mali_kbase.o
# Tell the Linux build system to enable building of our .c files
mali_kbase-y := $(SRC:.c=.o)

mali_kbase-$(CONFIG_MALI_DMA_FENCE) += mali_kbase_dma_fence.o
ifneq ($(wildcard $(src)/internal/Kbuild),)
ifeq ($(MALI_CUSTOMER_RELEASE),0)
# This include may set MALI_BACKEND_PATH and CONFIG_MALI_BACKEND_REAL
include $(src)/internal/Kbuild
mali_kbase-y += $(INTERNAL:.c=.o)
endif
endif

MALI_BACKEND_PATH ?= backend
CONFIG_MALI_BACKEND ?= gpu
Expand Down
87 changes: 35 additions & 52 deletions drivers/gpu/arm/midgard/Kconfig
Expand Up @@ -16,23 +16,45 @@

menuconfig MALI_MIDGARD
tristate "Mali Midgard series support"
select GPU_TRACEPOINTS if ANDROID
default n
help
Enable this option to build support for a ARM Mali Midgard GPU.

To compile this driver as a module, choose M here:
this will generate a single module, called mali_kbase.

choice
prompt "Streamline support"
depends on MALI_MIDGARD
default MALI_TIMELINE_DISABLED
help
Select streamline support configuration.

config MALI_TIMELINE_DISABLED
bool "Streamline support disabled"
help
Disable support for ARM Streamline Performance Analyzer.

Timeline support will not be included in
kernel code.
Debug stream will not be generated.

config MALI_GATOR_SUPPORT
bool "Streamline support via Gator"
depends on MALI_MIDGARD
default n
help
Adds diagnostic support for use with the ARM Streamline Performance Analyzer.
You will need the Gator device driver already loaded before loading this driver when enabling
Streamline debug support.
This is a legacy interface required by older versions of Streamline.

config MALI_MIPE_ENABLED
bool "Streamline support via MIPE"
help
Adds diagnostic support for use with the ARM Streamline Performance Analyzer.

Stream will be transmitted directly to Mali GPU library.
Compatible version of the library is required to read debug stream generated by kernel.

endchoice

config MALI_MIDGARD_DVFS
bool "Enable legacy DVFS"
Expand All @@ -59,15 +81,6 @@ config MALI_DEVFREQ
governor, the frequency of Mali will be dynamically selected from the
available OPPs.

config MALI_DMA_FENCE
bool "DMA_BUF fence support for Mali"
depends on MALI_MIDGARD && !KDS
default n
help
Support DMA_BUF fences for Mali.

This option should only be enabled if KDS is not present and
the Linux Kernel has built in support for DMA_BUF fences.

# MALI_EXPERT configuration options

Expand All @@ -79,18 +92,13 @@ menuconfig MALI_EXPERT
Enabling this option and modifying the default settings may produce a driver with performance or
other limitations.

config MALI_PRFCNT_SET_SECONDARY
bool "Use secondary set of performance counters"
config MALI_DEBUG_SHADER_SPLIT_FS
bool "Allow mapping of shader cores via sysfs"
depends on MALI_MIDGARD && MALI_EXPERT
default n
help
Select this option to use secondary set of performance counters. Kernel
features that depend on an access to the primary set of counters may
become unavailable. Enabling this option will prevent power management
from working optimally and may cause instrumentation tools to return
bogus results.

If unsure, say N.
Select this option to provide a sysfs entry for runtime configuration of shader
core affinity masks.

config MALI_PLATFORM_FAKE
bool "Enable fake platform device support"
Expand Down Expand Up @@ -154,23 +162,6 @@ config MALI_DEBUG
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
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_NO_MALI
bool "No Mali"
depends on MALI_MIDGARD && MALI_EXPERT
Expand Down Expand Up @@ -207,19 +198,11 @@ config MALI_SYSTEM_TRACE
minimal overhead when not in use. Enable only if you know what
you are doing.

config MALI_GPU_MMU_AARCH64
bool "Use AArch64 page tables"
depends on MALI_MIDGARD && MALI_EXPERT
default n
config MALI_GPU_TRACEPOINTS
bool "Enable GPU tracepoints"
depends on MALI_MIDGARD && ANDROID
select GPU_TRACEPOINTS
help
Use AArch64 format page tables for the GPU instead of LPAE-style.
The two formats have the same functionality and performance but a
future GPU may deprecate or remove the legacy LPAE-style format.

The LPAE-style format is supported on all Midgard and current Bifrost
GPUs. Enabling AArch64 format restricts the driver to only supporting
Bifrost GPUs.

If in doubt, say N.
Enables GPU tracepoints using Android trace event definitions.

source "drivers/gpu/arm/midgard/platform/Kconfig"
6 changes: 5 additions & 1 deletion drivers/gpu/arm/midgard/Makefile
@@ -1,5 +1,5 @@
#
# (C) COPYRIGHT 2010-2016 ARM Limited. All rights reserved.
# (C) COPYRIGHT 2010-2015 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
Expand All @@ -26,6 +26,10 @@ ifeq ($(MALI_UNIT_TEST), 1)
EXTRA_SYMBOLS += $(KBASE_PATH_RELATIVE)/tests/internal/src/kernel_assert_module/linux/Module.symvers
endif

ifneq ($(wildcard $(CURDIR)/internal/Makefile.in),)
include $(CURDIR)/internal/Makefile.in
endif

ifeq ($(MALI_BUS_LOG), 1)
#Add bus logger symbols
EXTRA_SYMBOLS += $(BUSLOG_PATH_RELATIVE)/drivers/base/bus_logger/Module.symvers
Expand Down
@@ -1,6 +1,6 @@
/*
*
* (C) COPYRIGHT 2015-2016 ARM Limited. All rights reserved.
* (C) COPYRIGHT 2015 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
Expand All @@ -16,12 +16,7 @@


#include "backend/gpu/mali_kbase_cache_policy_backend.h"
#include <backend/gpu/mali_kbase_pm_internal.h>
#include <backend/gpu/mali_kbase_device_internal.h>

void kbase_cache_set_coherency_mode(struct kbase_device *kbdev,
u32 mode)
{
if (kbase_hw_has_feature(kbdev, BASE_HW_FEATURE_COHERENCY_REG))
kbase_reg_write(kbdev, COHERENCY_ENABLE, mode, NULL);
}

@@ -1,6 +1,6 @@
/*
*
* (C) COPYRIGHT 2015-2016 ARM Limited. All rights reserved.
* (C) COPYRIGHT 2015 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
Expand All @@ -22,13 +22,5 @@
#include "mali_kbase.h"
#include "mali_base_kernel.h"

/**
* kbase_cache_set_coherency_mode() - Sets the system coherency mode
* in the GPU.
* @kbdev: Device pointer
* @mode: Coherency mode. COHERENCY_ACE/ACE_LITE
*/
void kbase_cache_set_coherency_mode(struct kbase_device *kbdev,
u32 mode);

#endif /* _KBASE_CACHE_POLICY_H_ */
13 changes: 2 additions & 11 deletions drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
@@ -1,6 +1,6 @@
/*
*
* (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved.
* (C) COPYRIGHT 2014-2015 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
Expand Down Expand Up @@ -135,14 +135,6 @@ kbase_devfreq_status(struct device *dev, struct devfreq_dev_status *stat)

stat->private_data = NULL;

#ifdef CONFIG_DEVFREQ_THERMAL
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
if (kbdev->devfreq_cooling)
memcpy(&kbdev->devfreq_cooling->last_status, stat,
sizeof(*stat));
#endif
#endif

return 0;
}

Expand Down Expand Up @@ -213,8 +205,7 @@ int kbase_devfreq_init(struct kbase_device *kbdev)
dp = &kbdev->devfreq_profile;

dp->initial_freq = kbdev->current_freq;
/* .KP : set devfreq_dvfs_interval_in_ms */
dp->polling_ms = 20;
dp->polling_ms = 100;
dp->target = kbase_devfreq_target;
dp->get_dev_status = kbase_devfreq_status;
dp->get_cur_freq = kbase_devfreq_cur_freq;
Expand Down
6 changes: 1 addition & 5 deletions drivers/gpu/arm/midgard/backend/gpu/mali_kbase_device_hw.c
@@ -1,6 +1,6 @@
/*
*
* (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved.
* (C) COPYRIGHT 2014-2015 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
Expand Down Expand Up @@ -33,9 +33,7 @@ void kbase_reg_write(struct kbase_device *kbdev, u16 offset, u32 value,
KBASE_DEBUG_ASSERT(kctx == NULL || kctx->as_nr != KBASEP_AS_NR_INVALID);
KBASE_DEBUG_ASSERT(kbdev->dev != NULL);
dev_dbg(kbdev->dev, "w: reg %04x val %08x", offset, value);

writel(value, kbdev->reg + offset);

if (kctx && kctx->jctx.tb)
kbase_device_trace_register_access(kctx, REG_WRITE, offset,
value);
Expand All @@ -50,9 +48,7 @@ u32 kbase_reg_read(struct kbase_device *kbdev, u16 offset,
KBASE_DEBUG_ASSERT(kbdev->pm.backend.gpu_powered);
KBASE_DEBUG_ASSERT(kctx == NULL || kctx->as_nr != KBASEP_AS_NR_INVALID);
KBASE_DEBUG_ASSERT(kbdev->dev != NULL);

val = readl(kbdev->reg + offset);

dev_dbg(kbdev->dev, "r: reg %04x val %08x", offset, val);
if (kctx && kctx->jctx.tb)
kbase_device_trace_register_access(kctx, REG_READ, offset, val);
Expand Down
7 changes: 4 additions & 3 deletions drivers/gpu/arm/midgard/backend/gpu/mali_kbase_gpu.c
@@ -1,6 +1,6 @@
/*
*
* (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved.
* (C) COPYRIGHT 2014-2015 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
Expand All @@ -20,6 +20,7 @@
* Register-based HW access backend APIs
*/
#include <mali_kbase.h>
#include <mali_kbase_hwaccess_jm.h>
#include <mali_kbase_hwaccess_backend.h>
#include <backend/gpu/mali_kbase_irq_internal.h>
#include <backend/gpu/mali_kbase_jm_internal.h>
Expand Down Expand Up @@ -80,6 +81,7 @@ int kbase_backend_late_init(struct kbase_device *kbdev)
if (err)
goto fail_timer;

/* Currently disabled on the prototype */
#ifdef CONFIG_MALI_DEBUG
#ifndef CONFIG_MALI_NO_MALI
if (kbasep_common_test_interrupt_handlers(kbdev) != 0) {
Expand All @@ -99,13 +101,12 @@ int kbase_backend_late_init(struct kbase_device *kbdev)
return 0;

fail_job_slot:

/* Currently disabled on the prototype */
#ifdef CONFIG_MALI_DEBUG
#ifndef CONFIG_MALI_NO_MALI
fail_interrupt_test:
#endif /* !CONFIG_MALI_NO_MALI */
#endif /* CONFIG_MALI_DEBUG */

kbase_backend_timer_term(kbdev);
fail_timer:
kbase_hwaccess_pm_halt(kbdev);
Expand Down
@@ -1,6 +1,6 @@
/*
*
* (C) COPYRIGHT 2014-2016 ARM Limited. All rights reserved.
* (C) COPYRIGHT 2014-2015 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
Expand Down Expand Up @@ -86,20 +86,8 @@ void kbase_backend_gpuprops_get(struct kbase_device *kbdev,
void kbase_backend_gpuprops_get_features(struct kbase_device *kbdev,
struct kbase_gpuprops_regdump *regdump)
{
if (kbase_hw_has_feature(kbdev, BASE_HW_FEATURE_COHERENCY_REG)) {
/* Ensure we can access the GPU registers */
kbase_pm_register_access_enable(kbdev);

regdump->coherency_features = kbase_reg_read(kbdev,
GPU_CONTROL_REG(COHERENCY_FEATURES), NULL);

/* We're done accessing the GPU registers for now. */
kbase_pm_register_access_disable(kbdev);
} else {
/* Pre COHERENCY_FEATURES we only supported ACE_LITE */
regdump->coherency_features =
COHERENCY_FEATURE_BIT(COHERENCY_NONE) |
COHERENCY_FEATURE_BIT(COHERENCY_ACE_LITE);
}
}

0 comments on commit 028bc40

Please sign in to comment.