diff options
author | JohnnLee <johnnlee@google.com> | 2023-04-26 12:01:28 +0800 |
---|---|---|
committer | JohnnLee <johnnlee@google.com> | 2023-04-26 12:01:36 +0800 |
commit | 7f8f8839da525ecc25ec82b5257add41a64e3c20 (patch) | |
tree | 0f3a4f08c142c82ae33f6072e79bafeb22196688 | |
parent | 1943df47c54db949465b8ce05aba3fb47f4ff905 (diff) | |
parent | d50df144aab374e653776c17a9adfcb94503bbd4 (diff) | |
download | msm-7f8f8839da525ecc25ec82b5257add41a64e3c20.tar.gz |
Merge branch 'LA.UM.9.12.C10.11.00.00.840.553' via branch 'qcom-msm-4.19-7250' into android-msm-pixel-4.19
Conflicts:
drivers/gpu/msm/kgsl_sharedmem.c
fs/crypto/policy.c
Bug: 272199761
Change-Id: I34703ee229f7de787f07a9c08b1af7fc0fab9386
Signed-off-by: JohnnLee <johnnlee@google.com>
-rw-r--r-- | drivers/gpu/msm/kgsl_reclaim.c | 31 | ||||
-rw-r--r-- | drivers/gpu/msm/kgsl_sharedmem.c | 2 | ||||
-rw-r--r-- | drivers/mfd/qcom-spmi-pmic.c | 4 | ||||
-rw-r--r-- | drivers/misc/kxrctrl/aphost.c | 94 | ||||
-rw-r--r-- | drivers/misc/kxrctrl/aphost.h | 11 |
5 files changed, 135 insertions, 7 deletions
diff --git a/drivers/gpu/msm/kgsl_reclaim.c b/drivers/gpu/msm/kgsl_reclaim.c index 8f78c8a458d2..2c1796e514ac 100644 --- a/drivers/gpu/msm/kgsl_reclaim.c +++ b/drivers/gpu/msm/kgsl_reclaim.c @@ -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" @@ -182,6 +184,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) { @@ -255,20 +263,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); diff --git a/drivers/gpu/msm/kgsl_sharedmem.c b/drivers/gpu/msm/kgsl_sharedmem.c index c246bedfc945..222bb6cbb8f6 100644 --- a/drivers/gpu/msm/kgsl_sharedmem.c +++ b/drivers/gpu/msm/kgsl_sharedmem.c @@ -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. */ @@ -981,6 +982,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; } diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c index 43af70a8a81b..49891ff3bf34 100644 --- a/drivers/mfd/qcom-spmi-pmic.c +++ b/drivers/mfd/qcom-spmi-pmic.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2014-2015, 2017-2019, The Linux Foundation. All rights reserved. */ +/* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/kernel.h> #include <linux/module.h> @@ -143,8 +144,11 @@ static int pmic_spmi_probe(struct spmi_device *sdev) MODULE_DEVICE_TABLE(of, pmic_spmi_id_table); +static void pmic_spmi_remove(struct spmi_device *sdev) {} + static struct spmi_driver pmic_spmi_driver = { .probe = pmic_spmi_probe, + .remove = pmic_spmi_remove, .driver = { .name = "pmic-spmi", .of_match_table = pmic_spmi_id_table, diff --git a/drivers/misc/kxrctrl/aphost.c b/drivers/misc/kxrctrl/aphost.c index 92cd21a7c2b6..ce8254139d91 100644 --- a/drivers/misc/kxrctrl/aphost.c +++ b/drivers/misc/kxrctrl/aphost.c @@ -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" @@ -242,17 +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) { @@ -529,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)); } @@ -742,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; @@ -805,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: diff --git a/drivers/misc/kxrctrl/aphost.h b/drivers/misc/kxrctrl/aphost.h index cce7927ec512..e9812a4cc2ad 100644 --- a/drivers/misc/kxrctrl/aphost.h +++ b/drivers/misc/kxrctrl/aphost.h @@ -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 */ @@ -154,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; |