/* The current core where Secure OS is on */ static ssize_t current_core_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { current_core = mc_active_core(); return sprintf(buf, "Secure OS is on core [%c%d]\n", (current_core < 4) ? 'L' : 'b', (current_core & 3)); }
int secos_booster_start(enum secos_boost_policy policy) { int ret = 0; int freq; current_core = mc_active_core(); /* migrate to big Core */ if ((policy != MAX_PERFORMANCE) && (policy != MID_PERFORMANCE) && (policy != MIN_PERFORMANCE)) { pr_err("%s: wrong secos boost policy:%d\n", __func__, policy); ret = -EINVAL; goto error; } /* cpufreq configuration */ if (policy == MAX_PERFORMANCE) freq = max_cpu_freq; else if (policy == MID_PERFORMANCE) freq = MID_CPUFREQ; else freq = 0; pm_qos_update_request(&secos_booster_qos, freq); /* KHz */ if (!cpu_online(DEFAULT_BIG_CORE)) { pr_debug("%s: %d core is offline\n", __func__, DEFAULT_BIG_CORE); udelay(100); if (!cpu_online(DEFAULT_BIG_CORE)) { pr_debug("%s: %d core is offline\n", __func__, DEFAULT_BIG_CORE); pm_qos_update_request(&secos_booster_qos, 0); ret = -EPERM; goto error; } pr_debug("%s: %d core is online\n", __func__, DEFAULT_BIG_CORE); } ret = mc_switch_core(DEFAULT_BIG_CORE); if (ret) { pr_err("%s: mc switch failed : err:%d\n", __func__, ret); pm_qos_update_request(&secos_booster_qos, 0); goto error; } /* Change schedule policy */ mc_set_schedule_policy(DEFAULT_BIG_CORE); /* Restore origin performance policy after default boost time */ hrtimer_cancel(&timer); hrtimer_start(&timer, ns_to_ktime((u64)DEFAULT_SECOS_BOOST_TIME * NSEC_PER_MSEC), HRTIMER_MODE_REL); error: return ret; }