Merge 0821b24a81 on remote branch

Change-Id: Iab96906a9028dc1b70bbd9200628846b791786cc
This commit is contained in:
Linux Build Service Account
2023-02-17 05:37:56 -08:00
bovenliggende 30ce347fc9 0821b24a81
commit e0450aef71
5 gewijzigde bestanden met toevoegingen van 77 en 13 verwijderingen

15
Kbuild.am Normal file
Bestand weergeven

@@ -0,0 +1,15 @@
# ported from Android.mk
$(info within KBUILD file KBUILD_EXTRA_SYMBOLS = $(KBUILD_EXTRA_SYMBOLS))
ifeq ($(CONFIG_ARCH_PINEAPPLE), y)
$(info within KBUILD file CONFIG_ARCH_PINEAPPLE = $(CONFIG_ARCH_PINEAPPLE))
KBUILD_CPPFLAGS += -DCONFIG_DSP_PINEAPPLE=1
ccflags-y += -DCONFIG_DSP_PINEAPPLE=1
ccflags-y += -DCONFIG_MSM_ADSPRPC_TRUSTED=1
endif
frpc-trusted-adsprpc-y := dsp/adsprpc.o \
dsp/adsprpc_compat.o \
dsp/adsprpc_socket.o \
obj-m := frpc-trusted-adsprpc.o

19
Makefile.am Normal file
Bestand weergeven

@@ -0,0 +1,19 @@
DSP_KERNEL_ROOT=$(ROOTDIR)vendor/qcom/opensource/dsp-kernel
KBUILD_OPTIONS := DSP_KERNEL_ROOT=$(DSP_KERNEL_ROOT) CONFIG_MSM_ADSPRPC_TRUSTED=m
ifeq ($(TARGET_SUPPORT),genericarmv8)
KBUILD_OPTIONS += CONFIG_ARCH_PINEAPPLE=y
endif
all:
$(MAKE) -C $(KERNEL_SRC) M=$(M) modules $(KBUILD_OPTIONS)
modules_install:
$(MAKE) INSTALL_MOD_STRIP=1 -C $(KERNEL_SRC) M=$(M) modules_install
%:
$(MAKE) -C $(KERNEL_SRC) M=$(M) $@ $(KBUILD_OPTIONS)
clean:
rm -f *.o *.ko *.mod.c *.mod.o *~ .*.cmd Module.symvers
rm -rf .tmp_versions

40
dsp/adsprpc.c Normal file → Executable file
Bestand weergeven

@@ -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 */
@@ -40,7 +40,6 @@
#include <linux/msm_dma_iommu_mapping.h>
#include "adsprpc_compat.h"
#include "adsprpc_shared.h"
#include "fastrpc.h"
#include <soc/qcom/qcom_ramdump.h>
#include <soc/qcom/minidump.h>
#include <linux/delay.h>
@@ -64,6 +63,12 @@
#define CREATE_TRACE_POINTS
#include "fastrpc_trace.h"
#ifdef CONFIG_MSM_ADSPRPC_TRUSTED
#include "../include/linux/fastrpc.h"
#else
#include "fastrpc.h"
#endif
#define TZ_PIL_PROTECT_MEM_SUBSYS_ID 0x0C
#define TZ_PIL_CLEAR_PROTECT_MEM_SUBSYS_ID 0x0D
#define TZ_PIL_AUTH_QDSP6_PROC 1
@@ -137,7 +142,7 @@
#endif
/*
* ctxid of every message is OR-ed with fl->pd (0/1/2) before
* ctxid of every message is OR-ed with fastrpc_remote_pd_type before
* it is sent to DSP. So mask 2 LSBs to retrieve actual context
*/
#define CONTEXT_PD_CHECK (3)
@@ -1044,6 +1049,12 @@ static inline bool fastrpc_get_persistent_map(size_t len, struct fastrpc_mmap **
map->is_persistent && !map->in_use) {
*pers_map = map;
map->in_use = true;
/*
* Incrementing map reference count when getting
* the map to avoid negative reference count when
* freeing the map.
*/
map->refs++;
found = true;
break;
}
@@ -3593,10 +3604,10 @@ static int fastrpc_init_attach_process(struct fastrpc_file *fl,
ioctl.job = NULL;
if (init->flags == FASTRPC_INIT_ATTACH)
fl->pd = 0;
fl->pd = FASTRPC_ROOT_PD;
else if (init->flags == FASTRPC_INIT_ATTACH_SENSORS)
/* Setting to 2 will route the message to sensorsPD */
fl->pd = 2;
fl->pd = FASTRPC_SENSORS_PD;
err = fastrpc_internal_invoke(fl, FASTRPC_MODE_PARALLEL, KERNEL_MSG_WITH_ZERO_PID, &ioctl);
if (err)
@@ -3650,6 +3661,7 @@ static int fastrpc_init_create_dynamic_process(struct fastrpc_file *fl,
"init memory for process %d should be between %d and %d\n",
init->memlen, INIT_MEMLEN_MIN_DYNAMIC, INIT_MEMLEN_MAX_DYNAMIC);
err = -EINVAL;
spin_unlock(&fl->hlock);
goto bail;
}
dsp_userpd_memlen = init->memlen;
@@ -3662,7 +3674,7 @@ static int fastrpc_init_create_dynamic_process(struct fastrpc_file *fl,
inbuf.pgid = fl->tgid;
inbuf.namelen = strlen(current->comm) + 1;
inbuf.filelen = init->filelen;
fl->pd = 1;
fl->pd = FASTRPC_USER_PD;
if (uproc->attrs & FASTRPC_MODE_UNSIGNED_MODULE)
fl->is_unsigned_pd = true;
@@ -3899,7 +3911,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
goto bail;
}
fl->pd = 1;
fl->pd = FASTRPC_USER_PD;
inbuf.pgid = fl->tgid;
inbuf.namelen = init->filelen;
inbuf.pageslen = 0;
@@ -4708,7 +4720,7 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
match = NULL;
spin_lock_irqsave(&me->hlock, irq_flags);
hlist_for_each_entry_safe(map, n, &me->maps, hn) {
if (map->servloc_name &&
if (map->servloc_name && fl &&
fl->servloc_name && !strcmp(map->servloc_name, fl->servloc_name)) {
match = map;
if (map->is_persistent && map->in_use) {
@@ -4736,6 +4748,11 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl, int locked)
}
spin_lock_irqsave(&me->hlock, irq_flags);
map->in_use = false;
/*
* decrementing refcount for persistent mappings
* as incrementing it in fastrpc_get_persistent_map
*/
map->refs--;
}
if (map->is_persistent) {
match = NULL;
@@ -7440,7 +7457,7 @@ static int fastrpc_cb_probe(struct device *dev)
buf->virt = NULL;
buf->phys = 0;
buf->size = frpc_gen_addr_pool[1];
buf->dma_attr = DMA_ATTR_DELAYED_UNMAP | DMA_ATTR_NO_KERNEL_MAPPING;
buf->dma_attr = DMA_ATTR_DELAYED_UNMAP;
/* Allocate memory for adding to genpool */
buf->virt = dma_alloc_attrs(sess->smmu.dev, buf->size,
(dma_addr_t *)&buf->phys,
@@ -7465,7 +7482,7 @@ static int fastrpc_cb_probe(struct device *dev)
}
/* Map the allocated memory with fixed IOVA and is shared to remote subsystem */
err = iommu_map_sg(domain, frpc_gen_addr_pool[0], sgt.sgl,
sgt.nents, IOMMU_READ | IOMMU_WRITE);
sgt.nents, IOMMU_READ | IOMMU_WRITE | IOMMU_CACHE);
if (err < 0) {
ADSPRPC_ERR("iommu_map_sg failed with err %d", err);
goto iommu_map_bail;
@@ -8282,8 +8299,9 @@ static int __init fastrpc_device_init(void)
VERIFY(err, NULL != (buf = kzalloc(sizeof(*buf), GFP_KERNEL)));
if (err) {
err = -ENOMEM;
ADSPRPC_WARN("%s: CMA alloc failed err 0x%x\n",
ADSPRPC_ERR("%s: CMA alloc failed err 0x%x\n",
__func__, err);
goto device_create_bail;
}
INIT_HLIST_NODE(&buf->hn);
buf->virt = region_vaddr;

Bestand weergeven

@@ -772,11 +772,16 @@ static int compat_fastrpc_get_dsp_info(struct fastrpc_file *fl,
struct fastrpc_ioctl_capability *info = NULL;
compat_uint_t u;
int err = 0;
size_t info_size = 0;
info32 = compat_ptr(arg);
VERIFY(err, NULL != (info = kmalloc(
sizeof(*info), GFP_KERNEL)));
info_size = sizeof(*info);
if (err) {
ADSPRPC_ERR("allocation failed for size 0x%zx\n", info_size);
return err;
}
err = get_user(u, &info32->domain);
if (err)
return err;

Bestand weergeven

@@ -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.
*/
#ifndef ADSPRPC_SHARED_H
#define ADSPRPC_SHARED_H
@@ -678,6 +678,13 @@ enum fastrpc_msg_type {
KERNEL_MSG_WITH_NONZERO_PID,
};
/* Fastrpc remote pd type */
enum fastrpc_remote_pd_type {
FASTRPC_ROOT_PD = 0,
FASTRPC_USER_PD,
FASTRPC_SENSORS_PD,
};
#define DSPSIGNAL_TIMEOUT_NONE 0xffffffff
#define DSPSIGNAL_NUM_SIGNALS 1024