Merge tag 'LA.UM.9.12.r1-15300-SMxx50.QSSI12.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.19 into android13-4.19-kona

"LA.UM.9.12.r1-15300-SMxx50.QSSI12.0"

* tag 'LA.UM.9.12.r1-15300-SMxx50.QSSI12.0' of https://git.codelinaro.org/clo/la/kernel/msm-4.19:
  Revert "Revert "msm: kgsl: Make sure that pool pages don't have any extra references""
  Revert "msm: kgsl: Make sure that pool pages don't have any extra references"
  msm: kgsl: Make sure that pool pages don't have any extra references
  msm: kgsl: Use dma_buf_get() to get dma_buf structure
  msm: kgsl: move kgsl shmem pages to unevictable list
  misc: update nordic DFU function check
  fs: crypto: Setting IV_INO_LBLK_32 flag only to F2FS
  msm: kgsl: Use dma_buf_get() to get dma_buf structure
  msm: kgsl: Make sure that pool pages don't have any extra references
  msm: adsprpc: Fix race condition in internal_control
  defconfig: msm: Enable dcc in sdm660 config
  clk: qcom: clk-debug: Cleanup the tracing code
  misc: Add Nordic driver sleep mode support
  clk: qcom: Enable ftrace for clock frequency measurement

Change-Id: Ib1cd799bec72fd258dd1035299d7e826013056d2
This commit is contained in:
Michael Bestas 2023-04-01 00:50:56 +03:00
commit fb386fd636
No known key found for this signature in database
GPG key ID: CC95044519BE6669
11 changed files with 273 additions and 21 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

@ -3859,8 +3859,8 @@ static int fastrpc_file_free(struct fastrpc_file *fl)
mutex_unlock(&fl->perf_mutex);
mutex_destroy(&fl->perf_mutex);
mutex_destroy(&fl->map_mutex);
mutex_destroy(&fl->pm_qos_mutex);
mutex_destroy(&fl->internal_map_mutex);
mutex_destroy(&fl->pm_qos_mutex);
kfree(fl);
return 0;
}

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

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2008-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <uapi/linux/sched/types.h>
@ -2677,6 +2677,15 @@ static int kgsl_setup_anon_useraddr(struct kgsl_pagetable *pagetable,
}
#ifdef CONFIG_DMA_SHARED_BUFFER
static int match_file(const void *p, struct file *file, unsigned int fd)
{
/*
* We must return fd + 1 because iterate_fd stops searching on
* non-zero return, but 0 is a valid fd.
*/
return (p == file) ? (fd + 1) : 0;
}
static void _setup_cache_mode(struct kgsl_mem_entry *entry,
struct vm_area_struct *vma)
{
@ -2714,6 +2723,8 @@ static int kgsl_setup_dmabuf_useraddr(struct kgsl_device *device,
vma = find_vma(current->mm, hostptr);
if (vma && vma->vm_file) {
int fd;
ret = check_vma_flags(vma, entry->memdesc.flags);
if (ret) {
up_read(&current->mm->mmap_sem);
@ -2729,13 +2740,27 @@ static int kgsl_setup_dmabuf_useraddr(struct kgsl_device *device,
return -EFAULT;
}
/*
* Take a refcount because dma_buf_put() decrements the
* refcount
*/
get_file(vma->vm_file);
dmabuf = vma->vm_file->private_data;
/* Look for the fd that matches this vma file */
fd = iterate_fd(current->files, 0, match_file, vma->vm_file);
if (fd) {
dmabuf = dma_buf_get(fd - 1);
if (IS_ERR(dmabuf)) {
up_read(&current->mm->mmap_sem);
return PTR_ERR(dmabuf);
}
/*
* It is possible that the fd obtained from iterate_fd
* was closed before passing the fd to dma_buf_get().
* Hence dmabuf returned by dma_buf_get() could be
* different from vma->vm_file->private_data. Return
* failure if this happens.
*/
if (dmabuf != vma->vm_file->private_data) {
dma_buf_put(dmabuf);
up_read(&current->mm->mmap_sem);
return -EBADF;
}
}
}
if (IS_ERR_OR_NULL(dmabuf)) {

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <asm/cacheflush.h>
@ -61,6 +62,15 @@ _kgsl_get_pool_from_order(unsigned int order)
static void
_kgsl_pool_add_page(struct kgsl_page_pool *pool, struct page *p)
{
/*
* Sanity check to make sure we don't re-pool a page that
* somebody else has a reference to.
*/
if (WARN_ON_ONCE(unlikely(page_count(p) > 1))) {
__free_pages(p, pool->pool_order);
return;
}
kgsl_zero_page(p, pool->pool_order);
spin_lock(&pool->list_lock);

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 @@ failed:
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

@ -645,12 +645,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;
}
@ -673,6 +674,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)
@ -682,10 +684,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;
}