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

Commit 5ab7307c authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "adsprpc: Map dynamic loading memory persistent"

parents e3e00bfb 834ac339
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -568,8 +568,8 @@ struct fastrpc_mmap {
	uintptr_t raddr;
	int uncached;
	int secure;
	/* Minidump unique index */
	int frpc_md_index;
	bool is_persistent;                     //the map is persistenet across sessions
	int frpc_md_index;                      //Minidump unique index
	uintptr_t attr;
	struct timespec64 map_start_time;
	struct timespec64 map_end_time;
@@ -1199,7 +1199,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 ((fd < 0 || map->fd == fd) && map->raddr == va &&
			map->raddr + map->len == va + len &&
			map->refs == 1) {
			map->refs == 1 && !map->is_persistent) {
			match = map;
			hlist_del_init(&map->hn);
			break;
@@ -1251,7 +1251,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)
		if (!map->refs && !map->is_persistent)
			hlist_del_init(&map->hn);
		spin_unlock(&me->hlock);
		if (map->refs > 0) {
@@ -3864,7 +3864,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
		 * If remote-heap VMIDs are defined in DTSI, then do
		 * hyp_assign from HLOS to those VMs (LPASS, ADSP).
		 */
		if (rhvm->vmid) {
		if (rhvm->vmid && mem && !mem->is_persistent) {
			err = hyp_assign_phys(phys, (uint64_t)size,
				hlosvm, 1,
				rhvm->vmid, rhvm->vmperm, rhvm->vmcount);
@@ -3878,6 +3878,7 @@ static int fastrpc_init_create_static_process(struct fastrpc_file *fl,
			rh_hyp_done = 1;
		}
		me->staticpd_flags = 1;
		mem->is_persistent = true;
	}

	/*
@@ -4517,6 +4518,10 @@ static int fastrpc_mmap_remove_ssr(struct fastrpc_file *fl)
		spin_lock(&me->hlock);
		hlist_for_each_entry_safe(map, n, &me->maps, hn) {
			match = map;
			if (map->is_persistent) {
				match = NULL;
				continue;
			}
			hlist_del_init(&map->hn);
			break;
		}
@@ -4656,8 +4661,11 @@ static int fastrpc_internal_munmap(struct fastrpc_file *fl,
		err = -EINVAL;
		goto bail;
	}
	if (!map->is_persistent) {
		VERIFY(err, !(err = fastrpc_munmap_on_dsp(fl, map->raddr,
					map->phys, map->size, map->flags)));
	}

	if (err)
		goto bail;
	mutex_lock(&fl->map_mutex);