Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding missing folders & Fixing Errors #4087

Open
wants to merge 11 commits into
base: ingres-s-oss
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-Werror=implicit-function-declaration -Werror=implicit-int \
-Werror=return-type -Wno-format-security \
-std=gnu89
KBUILD_CFLAGS += $(call cc-disable-warning, implicit-function-declaration)
KBUILD_CFLAGS += $(call cc-disable-warning, inline-asm)
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
Expand Down
67 changes: 67 additions & 0 deletions drivers/mihw/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
config MILLET_CGROUP
tristate "frozen framework cgroup"
depends on MIHW
default n
help
Mi frozen function

config MILLET_SIG
tristate "frozen framework signal"
depends on MIHW
default n
help
Mi frozen function

config MILLET_BINDER
tristate "frozen framework binder"
depends on MIHW
default n
help
Mi frozen function

config MILLET_PKG
tristate "frozen framework pkg"
depends on MIHW
default n
help
Mi frozen function

config MILLET_BINDER_GKI
tristate "frozen framework binder gki"
depends on MIHW
default n
help
Mi frozen function

config MILLET_CORE
tristate "frozen framework core"
depends on MIHW
default n
help
Mi frozen function

config MILLET_HS
tristate "frozen framework hs"
depends on MIHW
default n
help
Mi frozen function

config MI_SCHED
tristate "schedule policy defined by xiaomi"
depends on MIHW && MI_SCHED_WALT
default n
help
This option can show package runtime info in sup/big/little core.

config MIGT
tristate "mi game turbo"
depends on MI_SCHED && SCHED_WALT && MIGT_WALT
help
Improve game peformance and power.

config TURBO_SCHED
tristate "mi turbo sched"
depends on MIHW && MI_SCHED
help
Tuning mi-scheduler policy
4 changes: 4 additions & 0 deletions drivers/mihw/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
obj-y += millet/
obj-y += mi_sched/
obj-y += game/
obj-y += turbo_sched/
4 changes: 4 additions & 0 deletions drivers/mihw/game/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
obj-$(CONFIG_MIGT) += migt.o
migt-$(CONFIG_MIGT) += migt_main.o
migt-$(CONFIG_MIGT) += migt_ca.o
migt-$(CONFIG_MIGT) += glk.o
52 changes: 52 additions & 0 deletions drivers/mihw/game/glk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) Xiaomi Technologies Co., Ltd. 2019. All rights reserved.
* Copyright (C) 2021 XiaoMi, Inc.
*
* File name: glk.c
* Descrviption: Game load tracking
* Author: [email protected]
* Version: 1.0
* Date: 2019/12/03
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#define pr_fmt(fmt) "glk: " fmt

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/cpu.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/miscdevice.h>
#include <linux/security.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/uaccess.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include <linux/syscore_ops.h>
#include <linux/irq_work.h>
#include <trace/hooks/sched.h>

static void set_next_freq(void *nouse, unsigned long util, unsigned long freq, unsigned long max,
unsigned long *next_freq, struct cpufreq_policy *policy, bool *need_freq_update)
{
return;
}

int game_load_init(void)
{
register_trace_android_vh_map_util_freq(set_next_freq, NULL);
pr_err("game load init success\n");
return 0;
}
EXPORT_SYMBOL_GPL(game_load_init);
//late_initcall(game_load_init);

21 changes: 21 additions & 0 deletions drivers/mihw/game/migt_ca.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

#define pr_fmt(fmt) "migt-gtc: " fmt
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/uaccess.h>
#include <linux/sched/signal.h>
#include <linux/kthread.h>
#include <linux/sort.h>
#include <linux/cred.h>
#include <linux/jiffies.h>
#include <linux/hrtimer.h>






MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("vip-task detected by David");

48 changes: 48 additions & 0 deletions drivers/mihw/game/migt_main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#define pr_fmt(fmt) "migt: " fmt

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/cpufreq.h>
#include <linux/cpu.h>
#include <linux/sched.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/miscdevice.h>
#include <linux/security.h>
#include <linux/mm.h>
#include <linux/mman.h>
#include <linux/uaccess.h>
#include <linux/hrtimer.h>
#include <linux/pm_qos.h>
#include <linux/cred.h>
#include <linux/mi_sched.h>
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include <linux/sched/signal.h>
#include <linux/list.h>
#include <trace/hooks/sched.h>


static unsigned int migt_debug;
module_param(migt_debug, uint, 0644);



static int migt_init(void)
{
return 0;
}

static void __exit migt_exit()
{
return;
}

late_initcall(migt_init);
module_exit(migt_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("migt-driver by David");
46 changes: 46 additions & 0 deletions drivers/mihw/include/mi_module.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef MI_MODULE_H
#define MI_MODULE_H

#include <linux/mi_sched.h>

typedef void (*mi_walt_get_indicies)(struct task_struct *, int *, int *, int, bool *);
typedef void (*mi_find_energy_efficient_cpu) (struct task_struct *, bool *);

typedef void (*update_task_load_hook)(struct task_struct *tsk, int cpu, int flag,
u64 wallclock, u64 delta);
typedef void (*mi_enqueue_task_fair) (struct rq *, struct task_struct *);
typedef void (*mi_dequeue_task_fair) (struct rq *, struct task_struct *);

enum MI_SCHED_MOD{
GT_TASK,
SCHED_TYPES,
};

struct sched_load_update_hooks {
update_task_load_hook f;
};

static inline void init_gt_task(struct mi_task_struct *tsk)
{
int i;
struct gt_task *gt_tsk = &tsk->migt;

gt_tsk->migt_count = 0;
gt_tsk->prev_sum = 0;
gt_tsk->max_exec = 0;
gt_tsk->fps_exec = 0;
gt_tsk->fps_mexec = 0;
gt_tsk->flag = MIGT_NORMAL_TASK;
gt_tsk->run_times = 0;
gt_tsk->wake_render = 0;
gt_tsk->boost_end = 0;

for (i = 0; i < NUM_MIGT_BUCKETS; i++) {
gt_tsk->bucket[i] = 0;
#ifdef VTASK_BOOST_DEBUG
gt_tsk->boostat[i] = 0;
#endif
}
}

#endif
2 changes: 2 additions & 0 deletions drivers/mihw/mi_sched/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obj-$(CONFIG_MI_SCHED) += mi_schedule.o
mi_schedule-$(CONFIG_MI_SCHED) += mi_sched.o
56 changes: 56 additions & 0 deletions drivers/mihw/mi_sched/mi_sched.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#define pr_fmt(fmt) "mi-sched: " fmt

#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/uaccess.h>
#include <linux/sched/signal.h>
#include <linux/mi_sched.h>
#include <linux/slab.h>
#include <linux/ktime.h>
#include <linux/hrtimer.h>
#include <linux/compat.h>
#include <trace/hooks/sched.h>
#include "../include/mi_module.h"
#include "../../../kernel/sched/sched.h"

static int mi_sched_debug = 0;


void mi_sched_tick(void *nouse, struct rq *rq)/*should run in timer interrupt*/
{
if (!mi_sched_debug)
return;

printk("mi_sched_tick: %d", rq->nr_running);
}
EXPORT_SYMBOL(mi_sched_tick);


void free_mi_task_struct(void *nouse, struct task_struct *tsk)
{
if (!mi_sched_debug)
return;

printk("free mi_task_struct: %s,%d\n", tsk->comm, tsk->pid);
}
EXPORT_SYMBOL(free_mi_task_struct);

static int __init mi_sched_init(void)
{
register_trace_android_vh_free_task(free_mi_task_struct, NULL);
register_trace_android_vh_scheduler_tick(mi_sched_tick, NULL);
return 0;

}

static void __exit mi_sched_exit(void)
{
printk(KERN_ERR "in %s\n", __func__);
}

module_init(mi_sched_init);
module_exit(mi_sched_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("pkg runtime info calc by David");
8 changes: 8 additions & 0 deletions drivers/mihw/millet/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
obj-$(CONFIG_MILLET_BINDER_GKI) += binder_gki.o
obj-$(CONFIG_MILLET_CORE) += millet_core.o
obj-$(CONFIG_MILLET_PKG) += millet_pkg.o
obj-$(CONFIG_MILLET_HS) += millet_hs.o
obj-$(CONFIG_MILLET_BINDER) += millet_binder.o
obj-$(CONFIG_MILLET_SIG) += millet_sig.o
obj-$(CONFIG_MILLET_CGROUP) += millet_oem_cgroup.o
millet_oem_cgroup-$(CONFIG_MILLET_CGROUP) += oem_cgroup.o
29 changes: 29 additions & 0 deletions drivers/mihw/millet/binder_gki.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) Xiaomi Technologies Co., Ltd. 2020. All rights reserved.
* Copyright (C) 2021 XiaoMi, Inc.
*
* File name: oem_binder.c
* Description: millet-binder-driver
* Author: [email protected]
* Version: 1.0
* Date: 2020/9/9
*/
#define pr_fmt(fmt) "millet-binder_gki: " fmt

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/freezer.h>
#include <linux/ktime.h>
#include <linux/hrtimer.h>
#include <linux/proc_fs.h>

static int __init init_binder_gki(void)
{
pr_err("enter init_binder_gki func!\n");
return 0;
}

module_init(init_binder_gki);

MODULE_LICENSE("GPL");

31 changes: 31 additions & 0 deletions drivers/mihw/millet/millet_binder.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) Xiaomi Technologies Co., Ltd. 2020. All rights reserved.
* Copyright (C) 2021 XiaoMi, Inc.
*
* File name: oem_binder.c
* Description: millet-binder-driver
* Author: [email protected]
* Version: 1.0
* Date: 2020/9/9
*/
#define pr_fmt(fmt) "millet_millet-binder: " fmt

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/freezer.h>
#include <linux/ktime.h>
#include <linux/hrtimer.h>
#include <linux/proc_fs.h>

static int __init init_millet_binder_drv(void)
{

pr_err("enter init_millet_binder_drv func!\n");

return 0;
}

module_init(init_millet_binder_drv);

MODULE_LICENSE("GPL");

Loading