diff --git a/arch/arm/configs/vendor/sdxlemur.config b/arch/arm/configs/vendor/sdxlemur.config index f9323a93463e..6f909a87bf87 100644 --- a/arch/arm/configs/vendor/sdxlemur.config +++ b/arch/arm/configs/vendor/sdxlemur.config @@ -363,6 +363,7 @@ CONFIG_IOSS=m CONFIG_AQFWD_IOSS=m CONFIG_R8125=y CONFIG_R8125_IOSS=m +CONFIG_R8168=y CONFIG_QCOM_SHOW_RESUME_IRQ=y CONFIG_HARDENED_USERCOPY=y # CONFIG_HARDENED_USERCOPY_FALLBACK is not set diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 56d93e1ccb27..3e9e9589b155 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2012-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. */ /* Uncomment this block to log an error on every VERIFY failure */ @@ -579,10 +579,11 @@ struct fastrpc_mmap { bool is_persistent; /* Indicates whether map is persistent */ int frpc_md_index; /* Minidump unique index */ uintptr_t attr; - bool in_use; /* Indicates if persistent map is in use*/ + bool in_use; /* Indicates if persistent map is in use */ struct timespec64 map_start_time; struct timespec64 map_end_time; - bool is_filemap; /*flag to indicate map used in process init*/ + bool is_filemap; /* flag to indicate map used in process init */ + unsigned int ctx_refs; /* Indicates reference count for context map */ }; enum fastrpc_perfkeys { @@ -1220,7 +1221,7 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, int fd, uintptr_t va, hlist_for_each_entry_safe(map, n, &me->maps, hn) { if (map->refs == 1 && map->raddr == va && map->raddr + map->len == va + len && - /*Remove map if not used in process initialization*/ + /* Remove map if not used in process initialization */ !map->is_filemap) { match = map; hlist_del_init(&map->hn); @@ -1233,9 +1234,10 @@ static int fastrpc_mmap_remove(struct fastrpc_file *fl, int fd, uintptr_t va, return 0; } hlist_for_each_entry_safe(map, n, &fl->maps, hn) { - if (map->refs == 1 && map->raddr == va && - map->raddr + map->len == va + len && - /*Remove map if not used in process initialization*/ + /* Remove if only one reference map and no context map */ + if (map->refs == 1 && !map->ctx_refs && + map->raddr == va && map->raddr + map->len == va + len && + /* Remove map if not used in process initialization */ !map->is_filemap) { match = map; hlist_del_init(&map->hn); @@ -1274,7 +1276,7 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags) map->flags == ADSP_MMAP_REMOTE_HEAP_ADDR) { spin_lock(&me->hlock); map->refs--; - if (!map->refs && !map->is_persistent) + if (!map->refs && !map->is_persistent && !map->ctx_refs) hlist_del_init(&map->hn); spin_unlock(&me->hlock); if (map->refs > 0) { @@ -1290,7 +1292,7 @@ static void fastrpc_mmap_free(struct fastrpc_mmap *map, uint32_t flags) } } else { map->refs--; - if (!map->refs) + if (!map->refs && !map->ctx_refs) hlist_del_init(&map->hn); if (map->refs > 0 && !flags) return; @@ -1426,6 +1428,7 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd, map->attr = attr; map->frpc_md_index = -1; map->is_filemap = false; + map->ctx_refs = 0; ktime_get_real_ts64(&map->map_start_time); if (mflags == ADSP_MMAP_HEAP_ADDR || mflags == ADSP_MMAP_REMOTE_HEAP_ADDR) { @@ -2177,8 +2180,11 @@ static void context_free(struct smq_invoke_ctx *ctx) spin_unlock(&ctx->fl->hlock); mutex_lock(&ctx->fl->map_mutex); - for (i = 0; i < nbufs; ++i) + for (i = 0; i < nbufs; ++i) { + if (ctx->maps[i] && ctx->maps[i]->ctx_refs) + ctx->maps[i]->ctx_refs--; fastrpc_mmap_free(ctx->maps[i], 0); + } mutex_unlock(&ctx->fl->map_mutex); fastrpc_buf_free(ctx->buf, 1); @@ -2485,6 +2491,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) err = fastrpc_mmap_create(ctx->fl, ctx->fds[i], ctx->attrs[i], buf, len, mflags, &ctx->maps[i]); + if (ctx->maps[i]) + ctx->maps[i]->ctx_refs++; mutex_unlock(&ctx->fl->map_mutex); if (err) goto bail; @@ -2502,9 +2510,14 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx) err = fastrpc_mmap_create(ctx->fl, ctx->fds[i], FASTRPC_ATTR_NOVA, 0, 0, dmaflags, &ctx->maps[i]); + if (!err && ctx->maps[i]) + ctx->maps[i]->ctx_refs++; if (err) { - for (j = bufs; j < i; j++) + for (j = bufs; j < i; j++) { + if (ctx->maps[j] && ctx->maps[j]->ctx_refs) + ctx->maps[j]->ctx_refs--; fastrpc_mmap_free(ctx->maps[j], 0); + } mutex_unlock(&ctx->fl->map_mutex); goto bail; } @@ -2835,6 +2848,8 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, } } else { mutex_lock(&ctx->fl->map_mutex); + if (ctx->maps[i]->ctx_refs) + ctx->maps[i]->ctx_refs--; fastrpc_mmap_free(ctx->maps[i], 0); mutex_unlock(&ctx->fl->map_mutex); ctx->maps[i] = NULL; @@ -2845,8 +2860,11 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx, if (!fdlist[i]) break; if (!fastrpc_mmap_find(ctx->fl, (int)fdlist[i], 0, 0, - 0, 0, &mmap)) + 0, 0, &mmap)) { + if (mmap && mmap->ctx_refs) + mmap->ctx_refs--; fastrpc_mmap_free(mmap, 0); + } } mutex_unlock(&ctx->fl->map_mutex); if (ctx->crc && crclist && rpra) diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index 86987252862f..552e202e7226 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -1129,9 +1129,11 @@ tmc_etr_setup_sysfs_buf(struct tmc_drvdata *drvdata) && drvdata->byte_cntr->sw_usb) new_buf = tmc_alloc_etr_buf(drvdata, TMC_ETR_SW_USB_BUF_SIZE, 0, cpu_to_node(0), NULL); - else if (drvdata->out_mode == TMC_ETR_OUT_MODE_PCIE) + else if (drvdata->out_mode == TMC_ETR_OUT_MODE_PCIE) { new_buf = tmc_alloc_etr_buf(drvdata, TMC_ETR_PCIE_MEM_SIZE, 0, cpu_to_node(0), NULL); + drvdata->size = TMC_ETR_PCIE_MEM_SIZE; + } else new_buf = tmc_alloc_etr_buf(drvdata, drvdata->size, 0, cpu_to_node(0), NULL); diff --git a/drivers/hwtracing/coresight/coresight-tmc.h b/drivers/hwtracing/coresight/coresight-tmc.h index 0c70b54863bb..e911342ddf31 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.h +++ b/drivers/hwtracing/coresight/coresight-tmc.h @@ -104,7 +104,7 @@ #define TMC_ETR_BAM_PIPE_INDEX 0 #define TMC_ETR_BAM_NR_PIPES 2 -#define TMC_ETR_PCIE_MEM_SIZE 0x400000 +#define TMC_ETR_PCIE_MEM_SIZE 0x2000000 #define TMC_AUTH_NSID_MASK GENMASK(1, 0) diff --git a/drivers/interconnect/qcom/holi.c b/drivers/interconnect/qcom/holi.c index a6a92e8719c8..8503687a1cd5 100644 --- a/drivers/interconnect/qcom/holi.c +++ b/drivers/interconnect/qcom/holi.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. * */ @@ -1868,11 +1869,5 @@ static int __init qnoc_driver_init(void) } core_initcall(qnoc_driver_init); -static void __exit qnoc_driver_exit(void) -{ - platform_driver_unregister(&qnoc_driver); -} -module_exit(qnoc_driver_exit); - MODULE_DESCRIPTION("Holi NoC driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/interconnect/qcom/lahaina.c b/drivers/interconnect/qcom/lahaina.c index 4f4847dfd65b..114fa54f250b 100644 --- a/drivers/interconnect/qcom/lahaina.c +++ b/drivers/interconnect/qcom/lahaina.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. * */ @@ -2903,11 +2904,5 @@ static int __init qnoc_driver_init(void) } core_initcall(qnoc_driver_init); -static void __exit qnoc_driver_exit(void) -{ - platform_driver_unregister(&qnoc_driver); -} -module_exit(qnoc_driver_exit); - MODULE_DESCRIPTION("Lahaina NoC driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/interconnect/qcom/monaco.c b/drivers/interconnect/qcom/monaco.c index f839bc69cef4..841554a7c1c5 100644 --- a/drivers/interconnect/qcom/monaco.c +++ b/drivers/interconnect/qcom/monaco.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. * */ @@ -1389,11 +1390,5 @@ static int __init qnoc_driver_init(void) } core_initcall(qnoc_driver_init); -static void __exit qnoc_driver_exit(void) -{ - platform_driver_unregister(&qnoc_driver); -} -module_exit(qnoc_driver_exit); - MODULE_DESCRIPTION("Monaco NoC driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/interconnect/qcom/shima.c b/drivers/interconnect/qcom/shima.c index f372f4515d28..967386d1f80a 100644 --- a/drivers/interconnect/qcom/shima.c +++ b/drivers/interconnect/qcom/shima.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved. * */ @@ -2708,11 +2709,5 @@ static int __init qnoc_driver_init(void) } core_initcall(qnoc_driver_init); -static void __exit qnoc_driver_exit(void) -{ - platform_driver_unregister(&qnoc_driver); -} -module_exit(qnoc_driver_exit); - MODULE_DESCRIPTION("Shima NoC driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/mtd/devices/msm_qpic_nand.c b/drivers/mtd/devices/msm_qpic_nand.c index 78517b27c309..19fdb76fb697 100644 --- a/drivers/mtd/devices/msm_qpic_nand.c +++ b/drivers/mtd/devices/msm_qpic_nand.c @@ -2,6 +2,7 @@ /* * Copyright (C) 2007 Google, Inc. * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "msm_qpic_nand.h" @@ -797,9 +798,15 @@ static int msm_nand_flash_onfi_probe(struct msm_nand_info *info) memset(&data, 0, sizeof(struct msm_nand_flash_onfi_data)); - /* Lookup the partition to which apps has access to */ + /* + * Lookup the partition to which apps has access to + * As a part of FR53657, add support for boot_a + * and boot_b partitions. + */ for (i = 0; i < FLASH_PTABLE_MAX_PARTS_V4; i++) { - if (mtd_part[i].name && !strcmp("boot", mtd_part[i].name)) { + if (mtd_part[i].name && (!strcmp("boot", mtd_part[i].name) || + !strcmp("boot_a", mtd_part[i].name) || + !strcmp("boot_b", mtd_part[i].name))) { page_address = mtd_part[i].offset << 6; break; } diff --git a/drivers/virt/haven/hh_rm_core.c b/drivers/virt/haven/hh_rm_core.c index 02fcfcb8ef82..cb45cd65aad4 100644 --- a/drivers/virt/haven/hh_rm_core.c +++ b/drivers/virt/haven/hh_rm_core.c @@ -525,7 +525,7 @@ static int hh_rm_send_request(u32 message_id, return -E2BIG; } - msg = kzalloc(HH_RM_MAX_MSG_SIZE_BYTES, GFP_KERNEL); + msg = kzalloc(HH_MSGQ_MAX_MSG_SIZE_BYTES, GFP_KERNEL); if (!msg) return -ENOMEM; @@ -542,7 +542,7 @@ static int hh_rm_send_request(u32 message_id, payload_size = buff_size_remaining; } - memset(msg, 0, HH_RM_MAX_MSG_SIZE_BYTES); + memset(msg, 0, HH_MSGQ_MAX_MSG_SIZE_BYTES); /* Fill header */ hdr = msg; diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index 569e95262be1..5467eb4f1701 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -939,13 +939,6 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) return -ENODEV; } - if (sock_queue_rcv_skb(&ipc->sk, skb)) - goto err; - - /* Force wakeup for all packets except for sensors */ - if (node->nid != 9 && node->nid != 5) - pm_wakeup_ws_event(node->ws, qrtr_wakeup_ms, true); - if (node->nid == 5) { svc_id = qrtr_get_service_id(cb->src_node, cb->src_port); if (svc_id > 0) { @@ -956,9 +949,19 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) } } } - if (wake) - pm_wakeup_ws_event(node->ws, qrtr_wakeup_ms, true); } + + if (sock_queue_rcv_skb(&ipc->sk, skb)) + goto err; + + /** + * Force wakeup for all packets except for sensors and blacklisted services + * from adsp side + */ + if ((node->nid != 9 && node->nid != 5) || + (node->nid == 5 && wake)) + pm_wakeup_ws_event(node->ws, qrtr_wakeup_ms, true); + qrtr_port_put(ipc); }