Merge ab395d7782 on remote branch

Change-Id: I3d48f999c9d5d981487e8e8ae1d91c3aa7bf7ce1
This commit is contained in:
Linux Build Service Account
2023-03-12 12:30:19 -07:00
9 changed files with 234 additions and 12 deletions

View File

@@ -623,7 +623,6 @@ CONFIG_MSM_PIL=y
CONFIG_MSM_SYSMON_QMI_COMM=y
CONFIG_MSM_PIL_SSR_GENERIC=y
CONFIG_MSM_BOOT_STATS=y
CONFIG_QCOM_DCC_V2=y
CONFIG_QCOM_EUD=y
CONFIG_QCOM_MINIDUMP=y
CONFIG_MSM_CORE_HANG_DETECT=y
@@ -644,6 +643,7 @@ CONFIG_QCOM_SMCINVOKE=y
CONFIG_MSM_EVENT_TIMER=y
CONFIG_MSM_PM=y
CONFIG_QTI_L2_REUSE=y
CONFIG_QCOM_DCC=y
CONFIG_QTI_RPM_STATS_LOG=y
CONFIG_QTEE_SHM_BRIDGE=y
CONFIG_MEM_SHARE_QMI_SERVICE=y

View File

@@ -472,6 +472,7 @@ struct fastrpc_file {
struct mutex perf_mutex;
struct pm_qos_request pm_qos_req;
int qos_request;
struct mutex pm_qos_mutex;
struct mutex map_mutex;
struct mutex internal_map_mutex;
/* Identifies the device (MINOR_NUM_DEV / MINOR_NUM_SECURE_DEV) */
@@ -3859,6 +3860,7 @@ static int fastrpc_file_free(struct fastrpc_file *fl)
mutex_destroy(&fl->perf_mutex);
mutex_destroy(&fl->map_mutex);
mutex_destroy(&fl->internal_map_mutex);
mutex_destroy(&fl->pm_qos_mutex);
kfree(fl);
return 0;
}
@@ -4232,6 +4234,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
hlist_add_head(&fl->hn, &me->drivers);
spin_unlock(&me->hlock);
mutex_init(&fl->perf_mutex);
mutex_init(&fl->pm_qos_mutex);
init_completion(&fl->shutdown);
return 0;
}
@@ -4359,12 +4362,14 @@ static int fastrpc_internal_control(struct fastrpc_file *fl,
fl->pm_qos_req.type = PM_QOS_REQ_AFFINE_CORES;
cpumask_copy(&fl->pm_qos_req.cpus_affine, &mask);
mutex_lock(&fl->pm_qos_mutex);
if (!fl->qos_request) {
pm_qos_add_request(&fl->pm_qos_req,
PM_QOS_CPU_DMA_LATENCY, latency);
fl->qos_request = 1;
} else
pm_qos_update_request(&fl->pm_qos_req, latency);
mutex_unlock(&fl->pm_qos_mutex);
/* Ensure CPU feature map updated to DSP for early WakeUp */
fastrpc_send_cpuinfo_to_dsp(fl);

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2016, 2019-2021 The Linux Foundation. All rights reserved. */
/* Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. */
#include <linux/clk.h>
#include <linux/export.h>
@@ -11,6 +12,10 @@
#include <linux/bitops.h>
#include <linux/mfd/syscon.h>
#include <linux/msm-bus.h>
#include <trace/events/power.h>
#define CREATE_TRACE_POINTS
#include "trace.h"
#include "clk-regmap.h"
#include "clk-debug.h"
@@ -273,6 +278,8 @@ static int clk_debug_measure_get(void *data, u64 *val)
/* recursively calculate actual freq */
*val *= get_mux_divs(measure);
/* enable ftrace support */
trace_clk_measure(clk_hw_get_name(hw), *val);
disable_debug_clks(measure);
exit:
if (meas->bus_cl_id)

51
drivers/clk/qcom/trace.h Normal file
View File

@@ -0,0 +1,51 @@
/* SPDX-License-Identifier: GPL-2.0-only
*
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#undef TRACE_SYSTEM
#define TRACE_SYSTEM clk_qcom
#if !defined(_TRACE_CLOCK_QCOM_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_CLOCK_QCOM
#include <linux/tracepoint.h>
DECLARE_EVENT_CLASS(clk_measure_support,
TP_PROTO(const char *name, unsigned long rate),
TP_ARGS(name, rate),
TP_STRUCT__entry(
__string(name, name)
__field(unsigned long, rate)
),
TP_fast_assign(
__assign_str(name, name);
__entry->rate = rate;
),
TP_printk("%s rate: %lu",
__get_str(name), (unsigned long)__entry->rate)
);
DEFINE_EVENT(clk_measure_support, clk_measure,
TP_PROTO(const char *name, unsigned long rate),
TP_ARGS(name, rate)
);
#endif /* _TRACE_CLOCK_QCOM */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace
#include <trace/define_trace.h>

View File

@@ -5,7 +5,9 @@
#include <linux/kthread.h>
#include <linux/notifier.h>
#include <linux/pagevec.h>
#include <linux/shmem_fs.h>
#include <linux/swap.h>
#include "kgsl_reclaim.h"
#include "kgsl_sharedmem.h"
@@ -193,6 +195,12 @@ ssize_t kgsl_proc_max_reclaim_limit_show(struct device *dev,
return scnprintf(buf, PAGE_SIZE, "%d\n", kgsl_reclaim_max_page_limit);
}
static void kgsl_release_page_vec(struct pagevec *pvec)
{
check_move_unevictable_pages(pvec->pages, pvec->nr);
__pagevec_release(pvec);
}
static int kgsl_reclaim_callback(struct notifier_block *nb,
unsigned long pid, void *data)
{
@@ -266,20 +274,39 @@ static int kgsl_reclaim_callback(struct notifier_block *nb,
if (!kgsl_mmu_unmap(memdesc->pagetable, memdesc)) {
int i;
struct pagevec pvec;
/*
* Pages that are first allocated are by default added
* to unevictable list. To reclaim them, we first clear
* the AS_UNEVICTABLE flag of the shmem file address
* space thus check_move_unevictable_pages() places
* them on the evictable list.
*
* Once reclaim is done, hint that further shmem
* allocations will have to be on the unevictable list.
*/
mapping_clear_unevictable(
memdesc->shmem_filp->f_mapping);
pagevec_init(&pvec);
for (i = 0; i < memdesc->page_count; i++) {
set_page_dirty_lock(memdesc->pages[i]);
spin_lock(&memdesc->lock);
put_page(memdesc->pages[i]);
pagevec_add(&pvec, memdesc->pages[i]);
memdesc->pages[i] = NULL;
spin_unlock(&memdesc->lock);
if (pagevec_count(&pvec) == PAGEVEC_SIZE)
kgsl_release_page_vec(&pvec);
}
if (pagevec_count(&pvec))
kgsl_release_page_vec(&pvec);
memdesc->priv |= KGSL_MEMDESC_RECLAIMED;
ret = reclaim_address_space
(memdesc->shmem_filp->f_mapping, data);
mapping_set_unevictable(memdesc->shmem_filp->f_mapping);
memdesc->reclaimed_page_count += memdesc->page_count;
atomic_add(memdesc->page_count,
&process->reclaimed_page_count);

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
*/
@@ -974,6 +975,7 @@ static int kgsl_memdesc_file_setup(struct kgsl_memdesc *memdesc, uint64_t size)
memdesc->shmem_filp = NULL;
return ret;
}
mapping_set_unevictable(memdesc->shmem_filp->f_mapping);
}
return 0;

View File

@@ -6,7 +6,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include "aphost.h"
@@ -226,6 +226,10 @@ static ssize_t jsrequest_show(struct device *dev,
} else {
size = scnprintf(buf, PAGE_SIZE, "no need to ack\n");
}
pinctrl_select_state(
gspi_client->pinctrl_info.pinctrl,
gspi_client->pinctrl_info.active);
gspi_client->js_ledl_state = 0;
mutex_unlock(&gspi_client->js_mutex);
return size;
@@ -238,12 +242,36 @@ static ssize_t jsrequest_store(struct device *dev,
request_t request;
int vibState = 0;
int err = 0;
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
unsigned int getNorVersion = 0;
#endif
if (gspi_client == NULL) {
pr_err("invalid gspi_client\n");
return size;
}
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
getNorVersion = (unsigned int)
atomic_read(&gspi_client->probeGetNordicVersion);
if (getNorVersion <= 0x81000101 && getNorVersion > 0) {
pr_debug("%s DFU not supported version number:%d.%d\n",
__func__, (getNorVersion >> 8) & 0xff,
getNorVersion & 0xff);
} else {
pinctrl_select_state(
gspi_client->pinctrl_info.pinctrl,
gspi_client->pinctrl_info.suspend);
gspi_client->js_ledl_state = 1;
pr_debug("%s DFU supported version number:%d.%d\n",
__func__, (getNorVersion >> 8) & 0xff,
getNorVersion & 0xff);
}
#else
pinctrl_select_state(
gspi_client->pinctrl_info.pinctrl,
gspi_client->pinctrl_info.suspend);
gspi_client->js_ledl_state = 1;
#endif
mutex_lock(&gspi_client->js_mutex);
err = kstrtouint(buf, 16, &input);
if (err) {
@@ -252,9 +280,21 @@ static ssize_t jsrequest_store(struct device *dev,
memset(&request, 0, sizeof(request_t));
request.requestHead.requestType =
((input & 0x7f000000) >> 24);
request.requestData[0] = (input & 0x000000ff);
request.requestData[1] = (input & 0x0000ff00);
request.requestData[2] = (input & 0x00ff0000);
if (request.requestHead.requestType == 0xc) {
request.requestData[0] =
(input & 0x000000ff);
request.requestData[1] =
((input & 0x0000ff00) >> 8);
request.requestData[2] =
((input & 0x00ff0000) >> 16);
} else {
request.requestData[0] =
(input & 0x000000ff);
request.requestData[1] =
(input & 0x0000ff00);
request.requestData[2] =
(input & 0x00ff0000);
}
switch (request.requestHead.requestType) {
case setVibStateRequest:
@@ -285,6 +325,7 @@ static ssize_t jsrequest_store(struct device *dev,
case getRightJoyStickProductNameRequest:
case getLeftJoyStickFwVersionRequest:
case getRightJoyStickFwVersionRequest:
case setControllerSleepMode:
atomic_set(&gspi_client->userRequest,
input);
atomic_inc(&gspi_client->dataflag);
@@ -466,6 +507,12 @@ static int js_thread(void *data)
spi_client->txbuffer[2] =
(currentRequest.requestData[0]&0x01);
break;
case setControllerSleepMode:
spi_client->txbuffer[2] =
currentRequest.requestData[0];
spi_client->txbuffer[3] =
currentRequest.requestData[1];
break;
default:
break;
}
@@ -501,6 +548,18 @@ static int js_thread(void *data)
| spi_client->rxbuffer[1]);
atomic_set(&spi_client->nordicAcknowledge,
input);
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
if ((unsigned int)
atomic_read(
&gspi_client->probeGetNordicVersionFlag)) {
atomic_set(
&spi_client->probeGetNordicVersion,
input);
atomic_set(
&spi_client->probeGetNordicVersionFlag,
0);
}
#endif
}
memset(&lastRequest, 0, sizeof(lastRequest));
}
@@ -714,6 +773,59 @@ static int js_io_init(struct js_spi_client *spi_client)
return ret;
}
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
static int probe_get_nordic_version(void)
{
unsigned int getNorVersion = 0;
atomic_set(&gspi_client->probeGetNordicVersionFlag, 1);
atomic_set(&gspi_client->userRequest, 0x81000000);
atomic_inc(&gspi_client->dataflag);
wake_up_interruptible(&gspi_client->wait_queue);
pinctrl_select_state(
gspi_client->pinctrl_info.pinctrl,
gspi_client->pinctrl_info.suspend);
gspi_client->js_ledl_state = 1;
while (1) {
if (!((unsigned int)
atomic_read(&gspi_client->probeGetNordicVersionFlag))) {
pr_debug("nordic version flag %d userRequest 0x%x\n",
(unsigned int)atomic_read(
&gspi_client->probeGetNordicVersionFlag),
(unsigned int)atomic_read(
&gspi_client->userRequest));
getNorVersion = (unsigned int)atomic_read(
&gspi_client->probeGetNordicVersion);
pr_debug("nordic version %d.%d getNorVersion 0x%x\n",
(getNorVersion >> 8) & 0xff,
getNorVersion & 0xff, getNorVersion);
pinctrl_select_state(
gspi_client->pinctrl_info.pinctrl,
gspi_client->pinctrl_info.suspend);
gspi_client->js_ledl_state = 0;
} else {
atomic_set(&gspi_client->probeGetNordicVersionFlag, 1);
atomic_set(&gspi_client->userRequest, 0x81000000);
atomic_inc(&gspi_client->dataflag);
wake_up_interruptible(&gspi_client->wait_queue);
pinctrl_select_state(
gspi_client->pinctrl_info.pinctrl,
gspi_client->pinctrl_info.suspend);
gspi_client->js_ledl_state = 1;
pr_err("Failed to get version flag %d userRequest 0x%x\n",
(unsigned int)atomic_read(
&gspi_client->probeGetNordicVersionFlag),
(unsigned int)atomic_read(
&gspi_client->userRequest));
}
break;
}
return 0;
}
#endif
static int js_spi_setup(struct spi_device *spi)
{
struct js_spi_client *spi_client;
@@ -777,6 +889,10 @@ static int js_spi_setup(struct spi_device *spi)
js_io_init(spi_client);
js_set_power(1);
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
msleep(5000);
probe_get_nordic_version();
#endif
return rc;
spi_free:

View File

@@ -6,7 +6,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __APHOST_H__
@@ -70,12 +70,13 @@
#include <linux/string.h>
#include <linux/time.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <uapi/linux/sched/types.h>
#define MAX_PACK_SIZE 100
#define MAX_DATA_SIZE 32
//#define MANUL_CONTROL_JOYSTICK_RLED
#define COMPATIBLE_NOT_SUPPORT_DFU
#define XFR_SIZE 190
/* Protocol commands to interact with firmware */
@@ -109,6 +110,7 @@ typedef enum _requestType_t
getRightJoyStickProductNameRequest,
getLeftJoyStickFwVersionRequest,
getRightJoyStickFwVersionRequest,
setControllerSleepMode = 12,
invalidRequest,
} requestType_t;
@@ -153,6 +155,12 @@ struct js_spi_client {
atomic_t dataflag;
atomic_t userRequest; /* request from userspace */
atomic_t nordicAcknowledge; /* ack from nordic52832 master */
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
atomic_t probeGetNordicVersion; /* ack from nordic52832 master */
atomic_t probeGetNordicVersionFlag;
#endif
unsigned char JoyStickBondState; /* 1:left JoyStick 2:right JoyStick */
bool suspend;
wait_queue_head_t wait_queue;

View File

@@ -626,12 +626,13 @@ EXPORT_SYMBOL(fscrypt_has_permitted_context);
#define SDHCI "sdhci"
static int fscrypt_update_context(union fscrypt_context *ctx)
static int fscrypt_update_context(union fscrypt_context *ctx,
const char *file_system_type)
{
char *boot = "ufs";
if (!fscrypt_find_storage_type(&boot)) {
if (!strcmp(boot, SDHCI))
if (!strcmp(boot, SDHCI) && !strcmp(file_system_type, "f2fs"))
ctx->v1.flags |= FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32;
return 0;
}
@@ -654,6 +655,7 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child,
int ctxsize;
struct fscrypt_info *ci;
int res;
const char *file_system_type;
res = fscrypt_get_encryption_info(parent);
if (res < 0)
@@ -663,10 +665,14 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child,
if (ci == NULL)
return -ENOKEY;
file_system_type = ci->ci_inode->i_sb->s_type->name;
if (!file_system_type)
return -EINVAL;
ctxsize = fscrypt_new_context_from_policy(&ctx, &ci->ci_policy);
if (fscrypt_policy_contents_mode(&ci->ci_policy) ==
FSCRYPT_MODE_PRIVATE) {
res = fscrypt_update_context(&ctx);
res = fscrypt_update_context(&ctx, file_system_type);
if (res)
return res;
}