Skip to content

Commit

Permalink
Merge 7d6b043 on remote branch
Browse files Browse the repository at this point in the history
Change-Id: Iac8955208a82b7035df6753cd790705eb9deec4d
  • Loading branch information
Linux Build Service Account committed May 16, 2022
2 parents 2dd74a8 + 7d6b043 commit fb6c355
Show file tree
Hide file tree
Showing 57 changed files with 3,406 additions and 186 deletions.
1 change: 1 addition & 0 deletions arch/arm/configs/vendor/bengal-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_FLASH=y
CONFIG_LEDS_QTI_FLASH=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_PWM=y
CONFIG_LEDS_QTI_TRI_LED=y
CONFIG_LEDS_QPNP_FLASH_V2=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/vendor/bengal_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
CONFIG_LEDS_CLASS_FLASH=y
CONFIG_LEDS_QTI_FLASH=y
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_PWM=y
CONFIG_LEDS_QTI_TRI_LED=y
CONFIG_LEDS_QPNP_FLASH_V2=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/vendor/msm8937-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_QCOM_QFPROM=y
CONFIG_NVMEM_SPMI_SDAM=y
CONFIG_SLIMBUS_MSM_NGD=y
CONFIG_SENSORS_SSC=y
CONFIG_QCOM_KGSL=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/vendor/msm8937_32go-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_QCOM_QFPROM=y
CONFIG_NVMEM_SPMI_SDAM=y
CONFIG_SLIMBUS_MSM_NGD=y
CONFIG_SENSORS_SSC=y
CONFIG_QCOM_KGSL=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/vendor/msm8937_32go_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_QCOM_QFPROM=y
CONFIG_NVMEM_SPMI_SDAM=y
CONFIG_SLIMBUS_MSM_NGD=y
CONFIG_SENSORS_SSC=y
CONFIG_QCOM_KGSL=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/vendor/msm8937_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_QCOM_QFPROM=y
CONFIG_NVMEM_SPMI_SDAM=y
CONFIG_SLIMBUS_MSM_NGD=y
CONFIG_SENSORS_SSC=y
CONFIG_QCOM_KGSL=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/vendor/kona-iot-perf_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
Expand Down
1 change: 1 addition & 0 deletions arch/arm64/configs/vendor/kona-iot_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ CONFIG_USB_CONFIGFS_MASS_STORAGE=y
CONFIG_USB_CONFIGFS_F_FS=y
CONFIG_USB_CONFIGFS_F_ACC=y
CONFIG_USB_CONFIGFS_F_AUDIO_SRC=y
CONFIG_USB_CONFIGFS_F_UAC1=y
CONFIG_USB_CONFIGFS_F_UAC2=y
CONFIG_USB_CONFIGFS_F_MIDI=y
CONFIG_USB_CONFIGFS_F_HID=y
Expand Down
44 changes: 43 additions & 1 deletion drivers/char/adsprpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@ struct fastrpc_file {
int debug_buf_alloced_attempted;
/* Flag to indicate dynamic process creation status*/
bool in_process_create;
struct completion shutdown;
};

static struct fastrpc_apps gfa;
Expand Down Expand Up @@ -2972,8 +2973,10 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl)
if (err)
goto bail;
VERIFY(err, fl->apps->channel[fl->cid].issubsystemup == 1);
if (err)
if (err) {
wait_for_completion(&fl->shutdown);
goto bail;
}
tgid = fl->tgid;
ra[0].buf.pv = (void *)&tgid;
ra[0].buf.len = sizeof(tgid);
Expand Down Expand Up @@ -4130,6 +4133,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);
init_completion(&fl->shutdown);
return 0;
}

Expand Down Expand Up @@ -4433,6 +4437,27 @@ static int fastrpc_get_dsp_info(struct fastrpc_ioctl_dsp_capabilities *dsp_cap,
return err;
}

static int fastrpc_update_cdsp_support(struct fastrpc_file *fl)
{
struct fastrpc_ioctl_dsp_capabilities *dsp_query;
struct fastrpc_apps *me = &gfa;
int err = 0;

VERIFY(err, NULL != (dsp_query = kzalloc(sizeof(*dsp_query),
GFP_KERNEL)));
if (err)
goto bail;
dsp_query->domain = CDSP_DOMAIN_ID;
err = fastrpc_get_info_from_kernel(dsp_query, fl);
if (err)
goto bail;
if (!(dsp_query->dsp_attributes[1]))
me->channel[CDSP_DOMAIN_ID].unsigned_support = false;
bail:
kfree(dsp_query);
return err;
}

static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
unsigned long ioctl_param)
{
Expand All @@ -4456,6 +4481,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
struct fastrpc_file *fl = (struct fastrpc_file *)file->private_data;
int size = 0, err = 0;
uint32_t info;
static bool isquerydone;

p.inv.fds = NULL;
p.inv.attrs = NULL;
Expand Down Expand Up @@ -4597,6 +4623,10 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
VERIFY(err, 0 == (err = fastrpc_init_process(fl, &p.init)));
if (err)
goto bail;
if ((fl->cid == CDSP_DOMAIN_ID) && !isquerydone) {
if (!fastrpc_update_cdsp_support(fl))
isquerydone = true;
}
break;
case FASTRPC_IOCTL_GET_DSP_INFO:
err = fastrpc_get_dsp_info(&p.dsp_cap, param, fl);
Expand All @@ -4615,6 +4645,8 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
{
struct fastrpc_apps *me = &gfa;
struct fastrpc_channel_ctx *ctx;
struct fastrpc_file *fl;
struct hlist_node *n;
struct notif_data *notifdata = (struct notif_data *)data;
int cid = -1;

Expand All @@ -4627,6 +4659,16 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
ctx->ssrcount++;
ctx->issubsystemup = 0;
mutex_unlock(&me->channel[cid].smd_mutex);
} else if (code == SUBSYS_AFTER_SHUTDOWN) {
pr_info("adsprpc: %s: %s subsystem is down\n",
__func__, gcinfo[cid].subsys);
spin_lock(&me->hlock);
hlist_for_each_entry_safe(fl, n, &me->drivers, hn) {
if (fl->cid != cid)
continue;
complete(&fl->shutdown);
}
spin_unlock(&me->hlock);
} else if (code == SUBSYS_RAMDUMP_NOTIFICATION) {
if (cid == RH_CID) {
if (me->ramdump_handle)
Expand Down
19 changes: 10 additions & 9 deletions drivers/char/diag/diagfwd_peripheral.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2019, 2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/slab.h>
#include <linux/err.h>
Expand Down Expand Up @@ -179,7 +180,7 @@ static int diag_add_hdlc_encoding(unsigned char *dest_buf, int *dest_len,
static int check_bufsize_for_encoding(struct diagfwd_buf_t *buf, uint32_t len)
{
int i, ctx = 0, flag_64k = 0;
uint32_t max_size = 0;
uint32_t max_size = 0, realloc_len = 0;
unsigned long flags;
unsigned char *temp_buf = NULL;
struct diag_md_info *ch = NULL;
Expand Down Expand Up @@ -223,20 +224,20 @@ static int check_bufsize_for_encoding(struct diagfwd_buf_t *buf, uint32_t len)
}
spin_unlock_irqrestore(&ch->lock, flags);
}
temp_buf = krealloc(buf->data, max_size +
APF_DIAG_PADDING,

if (flag_64k)
realloc_len = MAX_PERIPHERAL_HDLC_BUF_SZ;
else
realloc_len = MAX_PERIPHERAL_BUF_SZ;

temp_buf = krealloc(buf->data, realloc_len,
GFP_KERNEL);
if (!temp_buf) {
mutex_unlock(&driver->md_session_lock);
return -ENOMEM;
}
buf->data = temp_buf;

if (flag_64k)
buf->len = MAX_PERIPHERAL_HDLC_BUF_SZ;
else
buf->len = MAX_PERIPHERAL_BUF_SZ;

buf->len = realloc_len;
DIAG_LOG(DIAG_DEBUG_PERIPHERALS,
"diag: Reallocated data buffer: %pK with size: %d, max_buf_len: %d, p: %d, t: %d, n: %d\n",
temp_buf, max_size, buf->len,
Expand Down
21 changes: 17 additions & 4 deletions drivers/dma-buf/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ static void dma_buf_release(struct dentry *dentry)
*/
BUG_ON(dmabuf->cb_shared.active || dmabuf->cb_excl.active);

mutex_lock(&db_list.lock);
list_del(&dmabuf->list_node);
mutex_unlock(&db_list.lock);

if (dmabuf->dtor)
dtor_ret = dmabuf->dtor(dmabuf, dmabuf->dtor_data);

Expand All @@ -146,6 +142,22 @@ static void dma_buf_release(struct dentry *dentry)
dmabuf_dent_put(dmabuf);
}

static int dma_buf_file_release(struct inode *inode, struct file *file)
{
struct dma_buf *dmabuf;

if (!is_dma_buf_file(file))
return -EINVAL;

dmabuf = file->private_data;

mutex_lock(&db_list.lock);
list_del(&dmabuf->list_node);
mutex_unlock(&db_list.lock);

return 0;
}

static const struct dentry_operations dma_buf_dentry_ops = {
.d_dname = dmabuffs_dname,
.d_release = dma_buf_release,
Expand Down Expand Up @@ -484,6 +496,7 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
}

static const struct file_operations dma_buf_fops = {
.release = dma_buf_file_release,
.mmap = dma_buf_mmap_internal,
.llseek = dma_buf_llseek,
.poll = dma_buf_poll,
Expand Down
3 changes: 1 addition & 2 deletions drivers/gpu/msm/adreno_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ static void sync_event_print(struct seq_file *s,
break;
}
case KGSL_CMD_SYNCPOINT_TYPE_FENCE: {
struct event_fence_info *info = sync_event ?
sync_event->priv : NULL;
struct event_fence_info *info = sync_event->priv;
int i;

for (i = 0; info && i < info->num_fences; i++)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/msm/kgsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2188,7 +2188,7 @@ long kgsl_ioctl_gpu_aux_command(struct kgsl_device_private *dev_priv,
cmdlist = u64_to_user_ptr(param->cmdlist);

/* Create a draw object for KGSL_GPU_AUX_COMMAND_TIMELINE */
if (kgsl_copy_struct_from_user(&generic, sizeof(generic),
if (copy_struct_from_user(&generic, sizeof(generic),
cmdlist, param->cmdsize)) {
ret = -EFAULT;
goto err;
Expand Down
68 changes: 1 addition & 67 deletions drivers/gpu/msm/kgsl_device.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __KGSL_DEVICE_H
#define __KGSL_DEVICE_H
Expand All @@ -16,73 +17,6 @@
[_IOC_NR((_cmd))] = \
{ .cmd = (_cmd), .func = (_func) }

/**
* kgsl_copy_struct_from_user: copy a struct from userspace
* @dst: Destination address, in kernel space. This buffer must be @ksize
* bytes long.
* @ksize: Size of @dst struct.
* @src: Source address, in userspace.
* @usize: (Alleged) size of @src struct.
*
* Copies a struct from userspace to kernel space, in a way that guarantees
* backwards-compatibility for struct syscall arguments (as long as future
* struct extensions are made such that all new fields are *appended* to the
* old struct, and zeroed-out new fields have the same meaning as the old
* struct).
*
* @ksize is just sizeof(*dst), and @usize should've been passed by userspace.
* The recommended usage is something like the following:
*
* SYSCALL_DEFINE2(foobar, const struct foo __user *, uarg, size_t, usize)
* {
* int err;
* struct foo karg = {};
*
* if (usize > PAGE_SIZE)
* return -E2BIG;
* if (usize < FOO_SIZE_VER0)
* return -EINVAL;
*
* err = kgsl_copy_struct_from_user(&karg, sizeof(karg), uarg, usize);
* if (err)
* return err;
*
* // ...
* }
*
* There are three cases to consider:
* * If @usize == @ksize, then it's copied verbatim.
* * If @usize < @ksize, then the userspace has passed an old struct to a
* newer kernel. The rest of the trailing bytes in @dst (@ksize - @usize)
* are to be zero-filled.
* * If @usize > @ksize, then the userspace has passed a new struct to an
* older kernel. The trailing bytes unknown to the kernel (@usize - @ksize)
* are checked to ensure they are zeroed, otherwise -E2BIG is returned.
*
* Returns (in all cases, some data may have been copied):
* * -E2BIG: (@usize > @ksize) and there are non-zero trailing bytes in @src.
* * -EFAULT: access to userspace failed.
*/
static __always_inline __must_check int
kgsl_copy_struct_from_user(void *dst, size_t ksize, const void __user *src,
size_t usize)
{
size_t size = min(ksize, usize);
size_t rest = max(ksize, usize) - size;

/* Deal with trailing bytes. */
if (usize < ksize) {
memset(dst + size, 0, rest);
} else if (usize > ksize) {
if (memchr_inv(src + size, 0, rest))
return -E2BIG;
}
/* Copy the interoperable parts of the struct. */
if (copy_from_user(dst, src, size))
return -EFAULT;
return 0;
}

/*
* KGSL device state is initialized to INIT when platform_probe *
* successfully initialized the device. Once a device has been opened *
Expand Down
Loading

0 comments on commit fb6c355

Please sign in to comment.