Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 143af9e3 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 3dd11fd4 on remote branch

Change-Id: I136987ce6072420b3479ab119bf12bea5006b83c
parents 6c9b53fe 3dd11fd4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -808,6 +808,12 @@ static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl)
	pm_wakeup_hard_event(&mhi_cntrl->mhi_dev->dev);
}

static inline bool is_valid_ring_ptr(struct mhi_ring *ring, dma_addr_t addr)
{
	return ((addr >= ring->iommu_base &&
		addr < ring->iommu_base + ring->len) && (addr % 16 == 0));
}

/* queue transfer buffer */
int mhi_gen_tre(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,
		void *buf, void *cb, size_t buf_len, enum MHI_FLAGS flags);
+15 −1
Original line number Diff line number Diff line
@@ -1385,6 +1385,13 @@ int mhi_process_tsync_ev_ring(struct mhi_controller *mhi_cntrl,
	int ret = 0;

	spin_lock_bh(&mhi_event->lock);
	if (!is_valid_ring_ptr(ev_ring, er_ctxt->rp)) {
		MHI_ERR(
			"Event ring rp points outside of the event ring or unalign rp %llx\n",
			er_ctxt->rp);
		spin_unlock_bh(&mhi_event->lock);
		return 0;
	}
	dev_rp = mhi_to_virtual(ev_ring, er_ctxt->rp);
	if (ev_ring->rp == dev_rp) {
		spin_unlock_bh(&mhi_event->lock);
@@ -1477,8 +1484,15 @@ int mhi_process_bw_scale_ev_ring(struct mhi_controller *mhi_cntrl,
	int result, ret = 0;

	spin_lock_bh(&mhi_event->lock);
	dev_rp = mhi_to_virtual(ev_ring, er_ctxt->rp);
	if (!is_valid_ring_ptr(ev_ring, er_ctxt->rp)) {
		MHI_ERR(
			"Event ring rp points outside of the event ring or unalign rp %llx\n",
			er_ctxt->rp);
		spin_unlock_bh(&mhi_event->lock);
		return 0;
	}

	dev_rp = mhi_to_virtual(ev_ring, er_ctxt->rp);
	if (ev_ring->rp == dev_rp) {
		spin_unlock_bh(&mhi_event->lock);
		goto exit_bw_scale_process;
+20 −11
Original line number Diff line number Diff line
@@ -144,6 +144,13 @@
#define INIT_MEMLEN_MAX  (8*1024*1024)
#define MAX_CACHE_BUF_SIZE (8*1024*1024)

/* FastRPC remote subsystem state*/
enum fastrpc_remote_subsys_state {
	SUBSYSTEM_RESTARTING = 0,
	SUBSYSTEM_DOWN,
	SUBSYSTEM_UP,
};

#define PERF_END (void)0

#define PERF(enb, cnt, ff) \
@@ -349,7 +356,7 @@ struct fastrpc_channel_ctx {
	uint64_t ssrcount;
	void *handle;
	uint64_t prevssrcount;
	int issubsystemup;
	int subsystemstate;
	int vmid;
	struct secure_vm rhvm;
	int ramdumpenabled;
@@ -2936,7 +2943,7 @@ static int fastrpc_get_info_from_dsp(struct fastrpc_file *fl,
	case ADSP_DOMAIN_ID:
	case SDSP_DOMAIN_ID:
	case CDSP_DOMAIN_ID:
		if (me->channel[domain].issubsystemup)
		if (me->channel[domain].subsystemstate == SUBSYSTEM_UP)
			dsp_support = 1;
		break;
	case MDSP_DOMAIN_ID:
@@ -3060,7 +3067,8 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl)
	VERIFY(err, fl->apps->channel[cid].rpdev != NULL);
	if (err)
		goto bail;
	VERIFY(err, fl->apps->channel[cid].issubsystemup == 1);
	VERIFY(err, fl->apps->channel[cid].subsystemstate !=
			SUBSYSTEM_RESTARTING);
	if (err) {
		wait_for_completion(&fl->shutdown);
		goto bail;
@@ -3926,8 +3934,8 @@ static ssize_t fastrpc_debugfs_read(struct file *filp, char __user *buffer,
		len += scnprintf(fileinfo + len, DEBUGFS_SIZE - len,
			"\n%s %s %s\n", title, " CHANNEL INFO ", title);
		len += scnprintf(fileinfo + len, DEBUGFS_SIZE - len,
			"%-7s|%-10s|%-14s|%-9s|%-13s\n",
			"subsys", "sesscount", "issubsystemup",
			"%-7s|%-10s|%-15s|%-9s|%-13s\n",
			"subsys", "sesscount", "subsystemstate",
			"ssrcount", "session_used");
		len += scnprintf(fileinfo + len, DEBUGFS_SIZE - len,
			"-%s%s%s%s-\n", single_line, single_line,
@@ -3941,8 +3949,8 @@ static ssize_t fastrpc_debugfs_read(struct file *filp, char __user *buffer,
				DEBUGFS_SIZE - len, "|%-10u",
				chan->sesscount);
			len += scnprintf(fileinfo + len,
				DEBUGFS_SIZE - len, "|%-14d",
				chan->issubsystemup);
				DEBUGFS_SIZE - len, "|%-15d",
				chan->subsystemstate);
			len += scnprintf(fileinfo + len,
				DEBUGFS_SIZE - len, "|%-9u",
				chan->ssrcount);
@@ -4163,7 +4171,7 @@ static int fastrpc_channel_open(struct fastrpc_file *fl)
	mutex_lock(&me->channel[cid].smd_mutex);
	if (me->channel[cid].ssrcount !=
				 me->channel[cid].prevssrcount) {
		if (!me->channel[cid].issubsystemup) {
		if (me->channel[cid].subsystemstate != SUBSYSTEM_UP) {
			err = -ENOTCONN;
			mutex_unlock(&me->channel[cid].smd_mutex);
			goto bail;
@@ -4778,7 +4786,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
			__func__, gcinfo[cid].subsys);
		mutex_lock(&me->channel[cid].smd_mutex);
		ctx->ssrcount++;
		ctx->issubsystemup = 0;
		ctx->subsystemstate = SUBSYSTEM_RESTARTING;
		mutex_unlock(&me->channel[cid].smd_mutex);
	} else if (code == SUBSYS_AFTER_SHUTDOWN) {
		pr_info("adsprpc: %s: %s subsystem is down\n",
@@ -4790,6 +4798,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
			complete(&fl->shutdown);
		}
		spin_unlock(&me->hlock);
		ctx->subsystemstate = SUBSYSTEM_DOWN;
	} else if (code == SUBSYS_RAMDUMP_NOTIFICATION) {
		if (cid == RH_CID) {
			if (me->ramdump_handle)
@@ -4808,7 +4817,7 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
	} else if (code == SUBSYS_AFTER_POWERUP) {
		pr_info("adsprpc: %s: %s subsystem is up\n",
			__func__, gcinfo[cid].subsys);
		ctx->issubsystemup = 1;
		ctx->subsystemstate = SUBSYSTEM_UP;
	}
	return NOTIFY_DONE;
}
@@ -5481,7 +5490,7 @@ static int __init fastrpc_device_init(void)
			me->channel[i].dev = dev;
		me->channel[i].ssrcount = 0;
		me->channel[i].prevssrcount = 0;
		me->channel[i].issubsystemup = 1;
		me->channel[i].subsystemstate = SUBSYSTEM_UP;
		me->channel[i].ramdumpenabled = 0;
		me->channel[i].rh_dump_dev = NULL;
		me->channel[i].nb.notifier_call = fastrpc_restart_notifier_cb;
+10 −17
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/msm-bus.h>
@@ -502,28 +503,15 @@ struct mem_entry {
	unsigned int type;
} __packed;

static int _save_mem_entries(int id, void *ptr, void *data)
{
	struct kgsl_mem_entry *entry = ptr;
	struct mem_entry *m = (struct mem_entry *) data;
	unsigned int index = id - 1;

	m[index].gpuaddr = entry->memdesc.gpuaddr;
	m[index].size = entry->memdesc.size;
	m[index].type = kgsl_memdesc_get_memtype(&entry->memdesc);

	return 0;
}

static size_t snapshot_capture_mem_list(struct kgsl_device *device,
		u8 *buf, size_t remain, void *priv)
{
	struct kgsl_snapshot_mem_list_v2 *header =
		(struct kgsl_snapshot_mem_list_v2 *)buf;
	int num_mem = 0;
	int ret = 0;
	unsigned int *data = (unsigned int *)(buf + sizeof(*header));
	int id, index = 0, ret = 0, num_mem = 0;
	struct kgsl_process_private *process = priv;
	struct mem_entry *m = (struct mem_entry *)(buf + sizeof(*header));
	struct kgsl_mem_entry *entry;

	/* we need a process to search! */
	if (process == NULL)
@@ -550,7 +538,12 @@ static size_t snapshot_capture_mem_list(struct kgsl_device *device,
	 * Walk through the memory list and store the
	 * tuples(gpuaddr, size, memtype) in snapshot
	 */
	idr_for_each(&process->mem_idr, _save_mem_entries, data);
	idr_for_each_entry(&process->mem_idr, entry, id) {
		m[index].gpuaddr = entry->memdesc.gpuaddr;
		m[index].size = entry->memdesc.size;
		m[index].type = kgsl_memdesc_get_memtype(&entry->memdesc);
		index++;
	}

	ret = sizeof(*header) + (num_mem * sizeof(struct mem_entry));
out:
+4 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-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.
 */

/*
@@ -283,7 +283,7 @@ static void drawobj_destroy_sparse(struct kgsl_drawobj *drawobj)
	}
}

static void drawobj_sync_timeline_fence_work(struct irq_work *work)
static void drawobj_sync_timeline_fence_work(struct work_struct *work)
{
	struct kgsl_drawobj_sync_event *event = container_of(work,
		struct kgsl_drawobj_sync_event, work);
@@ -303,7 +303,7 @@ static void drawobj_sync_timeline_fence_callback(struct dma_fence *f,
	 * removing the fence
	 */
	if (drawobj_sync_expire(event->device, event))
		irq_work_queue(&event->work);
		queue_work(kgsl_driver.mem_workqueue, &event->work);
}

static void syncobj_destroy(struct kgsl_drawobj *drawobj)
@@ -497,7 +497,7 @@ static int drawobj_add_sync_timeline(struct kgsl_device *device,
	event->device = device;
	event->context = NULL;
	event->fence = fence;
	init_irq_work(&event->work, drawobj_sync_timeline_fence_work);
	INIT_WORK(&event->work, drawobj_sync_timeline_fence_work);

	INIT_LIST_HEAD(&event->cb.node);

Loading