Skip to content

Commit

Permalink
drivers: gud: Exynos7870 MobiCore Driver
Browse files Browse the repository at this point in the history
* Experimental
* Minor changes , mainly secure_os booster

Signed-off-by: Anan Jaser <[email protected]>
  • Loading branch information
ananjaser1211 committed Aug 13, 2020
1 parent adae6dc commit 8937a29
Show file tree
Hide file tree
Showing 82 changed files with 399 additions and 13,469 deletions.
13 changes: 1 addition & 12 deletions drivers/gud/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
# Mobicore Configuration
#

config SOC_EXYNOS8890_KINIBI311
bool "Enable kinibi311"
default n


if SOC_EXYNOS8890 && SOC_EXYNOS8890_KINIBI311
source "drivers/gud/gud-exynos8890_kinibi311/Kconfig"
source "drivers/gud/TlcTui/Kconfig"
endif

if SOC_EXYNOS8890 && !SOC_EXYNOS8890_KINIBI311
if SOC_EXYNOS8890
source "drivers/gud/gud-exynos8890/Kconfig"
source "drivers/gud/TlcTui/Kconfig"
endif
7 changes: 1 addition & 6 deletions drivers/gud/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
ifeq ($(CONFIG_SOC_EXYNOS8890_KINIBI311), y)
obj-$(CONFIG_SOC_EXYNOS8890_KINIBI311) += gud-exynos8890_kinibi311/
obj-$(CONFIG_TRUSTONIC_TRUSTED_UI) += TlcTui/
else ifeq ($(CONFIG_SOC_EXYNOS8890), y)
obj-$(CONFIG_SOC_EXYNOS8890) += gud-exynos8890/
obj-$(CONFIG_TRUSTONIC_TRUSTED_UI) += TlcTui/
endif

51 changes: 0 additions & 51 deletions drivers/gud/TlcTui/Makefile

This file was deleted.

15 changes: 0 additions & 15 deletions drivers/gud/TlcTui/build_tag.h

This file was deleted.

6 changes: 6 additions & 0 deletions drivers/gud/gud-exynos8890/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ config TRUSTONIC_TRUSTED_UI

config TRUSTONIC_TRUSTED_UI_FB_BLANK
bool "Trustonic Trusted UI with fb_blank"
default y
depends on TRUSTONIC_TRUSTED_UI
---help---
Blank the framebuffer before starting a TUI session

config TRUSTED_UI_TOUCH_ENABLE
bool "TBase Trusted UI use touch related code"
default y
depends on TRUSTONIC_TRUSTED_UI

source "drivers/gud/gud-exynos8890/sec-os-ctrl/Kconfig"
source "drivers/gud/gud-exynos8890/sec-os-booster/Kconfig"
2 changes: 1 addition & 1 deletion drivers/gud/gud-exynos8890/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

obj-$(CONFIG_TRUSTONIC_TEE) := MobiCoreDriver/
#obj-$(CONFIG_TRUSTONIC_TRUSTED_UI) += TlcTui/
obj-$(CONFIG_TRUSTONIC_TRUSTED_UI) += TlcTui/

obj-$(CONFIG_SECURE_OS_CONTROL) += sec-os-ctrl/
obj-$(CONFIG_SECURE_OS_BOOSTER_API) += sec-os-booster/
4 changes: 4 additions & 0 deletions drivers/gud/gud-exynos8890/MobiCoreDriver/admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ static void mc_admin_sendcrashdump(void)
{
int ret = 0;

/* ExySp: to be updated in official release */
/* Prevent daemon reconnection */
admin_ctx.last_start_ret = -EHOSTUNREACH;

/* Lock communication channel */
channel_lock();

Expand Down
2 changes: 1 addition & 1 deletion drivers/gud/gud-exynos8890/MobiCoreDriver/client.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015 TRUSTONIC LIMITED
* Copyright (c) 2013-2017 TRUSTONIC LIMITED
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
Expand Down
45 changes: 14 additions & 31 deletions drivers/gud/gud-exynos8890/MobiCoreDriver/fastcall.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015 TRUSTONIC LIMITED
* Copyright (c) 2013-2017 TRUSTONIC LIMITED
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -37,10 +37,6 @@
#include "clock.h" /* mc_clock_enable, mc_clock_disable */
#include "fastcall.h"

#ifdef CONFIG_RKP_CFP_FIX_SMC_BUG
#include <linux/rkp_cfp.h>
#endif

/* ExySp: Lock for core switch processing */
#ifdef CONFIG_SECURE_OS_BOOSTER_API
struct mutex core_switch_lock;
Expand All @@ -52,7 +48,7 @@ int __mc_switch_core(int cpu);
#endif

#if KERNEL_VERSION(3, 15, 0) > LINUX_VERSION_CODE
#define MIN_NICE -20
#define MIN_NICE -20
#endif

struct fastcall_work {
Expand Down Expand Up @@ -178,13 +174,7 @@ static inline int _smc(union mc_fc_generic *mc_fc_generic)
* the asm code might clobber them.
*/
__asm__ volatile (
#ifdef CONFIG_RKP_CFP_FIX_SMC_BUG
PRE_SMC_INLINE
#endif
"smc #0\n"
#ifdef CONFIG_RKP_CFP_FIX_SMC_BUG
POST_SMC_INLINE
#endif
: "+r"(reg0), "+r"(reg1), "+r"(reg2), "+r"(reg3)
:
: "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11",
Expand All @@ -205,13 +195,7 @@ static inline int _smc(union mc_fc_generic *mc_fc_generic)
*/
".arch_extension sec\n"
#endif /* MC_ARCH_EXTENSION_SEC */
#ifdef CONFIG_RKP_CFP_FIX_SMC_BUG
PRE_SMC_INLINE
#endif
"smc #0\n"
#ifdef CONFIG_RKP_CFP_FIX_SMC_BUG
POST_SMC_INLINE
#endif
: "+r"(reg0), "+r"(reg1), "+r"(reg2), "+r"(reg3)
);

Expand Down Expand Up @@ -323,7 +307,7 @@ static int mobicore_cpu_callback(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
int cpu = (int)(uintptr_t)hcpu;

switch (action) {
#ifdef CONFIG_SECURE_OS_BOOSTER_API
/* ExySp: for sos performance */
Expand Down Expand Up @@ -444,7 +428,6 @@ static void fastcall_work_func(struct work_struct *work)
}
#endif
_smc(mc_fc_generic);

/* ExySp: for sos performance */
#ifdef CONFIG_SECURE_OS_BOOSTER_API
if (irq_check_cnt) {
Expand Down Expand Up @@ -509,7 +492,7 @@ int mc_fastcall_init(void)
mc_dev_err("cannot create fastcall wq: %d\n", ret);
return ret;
}

set_user_nice(fastcall_thread, MIN_NICE);

/* this thread MUST run on CPU 0 at startup */
Expand Down Expand Up @@ -749,16 +732,16 @@ int mc_switch_core(int cpu)
#ifdef CONFIG_SECURE_OS_BOOSTER_API
int mc_switch_core(int cpu)
{
int ret;
mutex_lock(&core_switch_lock);
if (!(core_status & (0x1 << cpu))){
mc_dev_devel("Core status... core #%d is off line\n", cpu);
mutex_unlock(&core_switch_lock);
return 1;
}
ret = __mc_switch_core(cpu);
mutex_unlock(&core_switch_lock);
return ret;
int ret;
mutex_lock(&core_switch_lock);
if (!(core_status & (0x1 << cpu))){
mc_dev_devel("Core status... core #%d is off line\n", cpu);
mutex_unlock(&core_switch_lock);
return 1;
}
ret = __mc_switch_core(cpu);
mutex_unlock(&core_switch_lock);
return ret;
}
#endif
#endif
18 changes: 9 additions & 9 deletions drivers/gud/gud-exynos8890/MobiCoreDriver/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ static inline void kasnprintf_buf_reset(struct kasnprintf_buf *buf)
}

ssize_t debug_generic_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos,
int (*function)(struct kasnprintf_buf *buf))
size_t count, loff_t *ppos,
int (*function)(struct kasnprintf_buf *buf))
{
struct kasnprintf_buf *buf = file->private_data;
int ret = 0;
Expand All @@ -132,19 +132,19 @@ ssize_t debug_generic_read(struct file *file, char __user *user_buf,
if (!*ppos) {
kasnprintf_buf_reset(buf);
ret = function(buf);
if (ret < 0) {
if (ret < 0) {
kasnprintf_buf_reset(buf);
goto end;
}
}
}

ret = simple_read_from_buffer(user_buf, count, ppos, buf->buf,
buf->off);

end:
mutex_unlock(&buf->mutex);
return ret;
}
}

int debug_generic_open(struct inode *inode, struct file *file)
{
Expand Down Expand Up @@ -655,9 +655,9 @@ static int mobicore_probe(struct platform_device *pdev)
}

/*
* Create admin dev so that daemon can already communicate with
* the driver
*/
* Create admin dev so that daemon can already communicate with
* the driver
*/
err = device_admin_init();
if (err)
goto fail_creat_dev_admin;
Expand All @@ -674,7 +674,7 @@ static int mobicore_probe(struct platform_device *pdev)
*/
mc_switch_core(NONBOOT_LITTLE_CORE);

return 0;
return 0;

fail_start:
device_admin_exit();
Expand Down
Loading

0 comments on commit 8937a29

Please sign in to comment.