From: Jiyu Yang Date: Thu, 4 Jan 2018 06:32:28 +0000 (+0800) Subject: PD#133451 add l2_max_reads for custom X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8247b6ea2a68a5e93ad3ccbf90d94aac01f028ef;p=GitHub%2FLineageOS%2FG12%2Fandroid_hardware_amlogic_kernel-modules_mali-driver.git PD#133451 add l2_max_reads for custom /sys/class/mpgpu/l2_max_reads AX_READ Register bit assignments Bits Name Function [31:5] - Reserved, read as zero [4:0] Max_Reads Limit the number of outstanding read transactions to this amount Change-Id: Idae8fa0a8e85f90749a62f6972b5bbe176008cd2 --- diff --git a/mali/linux/mali_kernel_linux.c b/mali/linux/mali_kernel_linux.c index 2c95146..4a0b9e8 100644 --- a/mali/linux/mali_kernel_linux.c +++ b/mali/linux/mali_kernel_linux.c @@ -112,7 +112,7 @@ module_param(mali_max_job_runtime, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | MODULE_PARM_DESC(mali_max_job_runtime, "Maximum allowed job runtime in msecs.\nJobs will be killed after this no matter what"); extern int mali_l2_max_reads; -module_param(mali_l2_max_reads, int, S_IRUSR | S_IRGRP | S_IROTH); +module_param(mali_l2_max_reads, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH); /* rw-rw-r-- */ MODULE_PARM_DESC(mali_l2_max_reads, "Maximum reads for Mali L2 cache"); extern unsigned int mali_dedicated_mem_start; diff --git a/utgard/platform/meson_bu/mpgpu.c b/utgard/platform/meson_bu/mpgpu.c index b480109..c4e2a26 100644 --- a/utgard/platform/meson_bu/mpgpu.c +++ b/utgard/platform/meson_bu/mpgpu.c @@ -32,6 +32,8 @@ //#include "mali_pp_scheduler.h" #include "meson_main.h" +extern int mali_l2_max_reads; + #if MESON_CPU_TYPE >= MESON_CPU_TYPE_MESON8 static ssize_t domain_stat_read(struct class *class, struct class_attribute *attr, char *buf) @@ -313,6 +315,29 @@ static ssize_t current_pp_write(struct class *class, return count; } +static ssize_t l2_max_reads_read(struct class *class, + struct class_attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", mali_l2_max_reads); +} + +static ssize_t l2_max_reads_write(struct class *class, + struct class_attribute *attr, const char *buf, size_t count) +{ + int ret; + unsigned int val; + + ret = kstrtouint(buf, 10, &val); + if (0 != ret) + { + return -EINVAL; + } + mali_l2_max_reads = val; + + return 0; +} + + static struct class_attribute mali_class_attrs[] = { __ATTR(domain_stat, 0644, domain_stat_read, NULL), __ATTR(mpgpucmd, 0644, NULL, mpgpu_write), @@ -323,6 +348,7 @@ static struct class_attribute mali_class_attrs[] = { __ATTR(max_pp, 0644, max_pp_read, max_pp_write), __ATTR(cur_freq, 0644, freq_read, freq_write), __ATTR(cur_pp, 0644, current_pp_read, current_pp_write), + __ATTR(l2_max_reads, 0644, l2_max_reads_read,l2_max_reads_write), }; static struct class mpgpu_class = {