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

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

Merge "ARM: dts: msm: Add vm-nav-path support for rmtfs on trinket"

parents cd46ff3e f7033126
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ Optional properties:
			This is needed to overcome the XPU limitation on few MSM HW,
			so as to make this memory not contiguous with other allocations
			that may possibly happen from other clients.
- qcom,vm-nav-path:     If this dtsi property is set, then the shared memory region
			will be given access to vm-nav-path also.

Example:
	qcom,msm_sharedmem@0dc80000 {
@@ -23,4 +25,5 @@ Example:
		reg-names = "rmtfs";
		qcom,client-id = <0x00000001>;
		qcom,guard-memory;
		qcom,vm-nav-path;
	};
+1 −0
Original line number Diff line number Diff line
@@ -2039,6 +2039,7 @@
		reg-names = "rmtfs";
		qcom,client-id = <0x00000001>;
		qcom,guard-memory;
		qcom,vm-nav-path;
	};

	qcom_cedev: qcedev@1b20000 {
+30 −9
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -73,21 +73,33 @@ static int sharedmem_mmap(struct uio_info *info, struct vm_area_struct *vma)
}

/* Setup the shared ram permissions.
 * This function currently supports the mpss client only.
 * This function currently supports the mpss and nav clients only.
 */
static void setup_shared_ram_perms(u32 client_id, phys_addr_t addr, u32 size)
static void setup_shared_ram_perms(u32 client_id, phys_addr_t addr, u32 size,
				   bool vm_nav_path)
{
	int ret;
	u32 source_vmlist[1] = {VMID_HLOS};
	int dest_vmids[2] = {VMID_HLOS, VMID_MSS_MSA};
	int dest_perms[2] = {PERM_READ|PERM_WRITE,
			     PERM_READ|PERM_WRITE};

	if (client_id != MPSS_RMTS_CLIENT_ID)
		return;

	if (vm_nav_path) {
		int dest_vmids[3] = {VMID_HLOS, VMID_MSS_MSA, VMID_NAV};
		int dest_perms[3] = {PERM_READ|PERM_WRITE,
				     PERM_READ|PERM_WRITE,
				     PERM_READ|PERM_WRITE};

		ret = hyp_assign_phys(addr, size, source_vmlist, 1, dest_vmids,
					dest_perms, 3);
	} else {
		int dest_vmids[2] = {VMID_HLOS, VMID_MSS_MSA};
		int dest_perms[2] = {PERM_READ|PERM_WRITE,
				     PERM_READ|PERM_WRITE};

		ret = hyp_assign_phys(addr, size, source_vmlist, 1, dest_vmids,
					dest_perms, 2);
	}
	if (ret != 0) {
		if (ret == -EINVAL)
			pr_warn("hyp_assign_phys is not supported!");
@@ -109,6 +121,7 @@ static int msm_sharedmem_probe(struct platform_device *pdev)
	phys_addr_t shared_mem_pyhsical = 0;
	bool is_addr_dynamic = false;
	bool guard_memory = false;
	bool vm_nav_path = false;

	/* Get the addresses from platform-data */
	if (!pdev->dev.of_node) {
@@ -169,8 +182,16 @@ static int msm_sharedmem_probe(struct platform_device *pdev)
			shared_mem_pyhsical += SZ_4K;
	}

	/*
	 * If this dtsi property is set, then the shared memory region
	 * will be given access to vm-nav-path also.
	 */
	vm_nav_path = of_property_read_bool(pdev->dev.of_node,
			"qcom,vm-nav-path");

	/* Set up the permissions for the shared ram that was allocated. */
	setup_shared_ram_perms(client_id, shared_mem_pyhsical, shared_mem_size);
	setup_shared_ram_perms(client_id, shared_mem_pyhsical, shared_mem_size,
				vm_nav_path);

	/* Setup device */
	info->mmap = sharedmem_mmap; /* Custom mmap function. */