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

Commit 3bfdd36d authored by Neeti Desai's avatar Neeti Desai Committed by Liam Mark
Browse files

msm: secure_buffer: Update the hyp_assign_phys() api



The hyp_assign_phys() api can be called by different
usecases where it is not guaranteed that the source vm is
always VMID_HLOS.

Pass the responsibility of setting the source_vm to
caller of the function.

Change-Id: I3851a6681f49d4bb6fa5b7a889a16a158497e9e6
Signed-off-by: default avatarNeeti Desai <neetid@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 5cd08085
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -319,12 +319,11 @@ int hyp_assign_table(struct sg_table *table,
	return ret;
}

int hyp_assign_phys(phys_addr_t addr, u64 size,
			int *dest_vmids, int *dest_perms,
			int dest_nelems)
int hyp_assign_phys(phys_addr_t addr, u64 size, u32 *source_vm_list,
			int source_nelems, int *dest_vmids,
			int *dest_perms, int dest_nelems)
{
	struct sg_table *table;
	u32 source_vm;
	int ret;

	table = kzalloc(sizeof(struct sg_table), GFP_KERNEL);
@@ -336,9 +335,7 @@ int hyp_assign_phys(phys_addr_t addr, u64 size,

	sg_set_page(table->sgl, phys_to_page(addr), size, 0);

	source_vm = VMID_HLOS;

	ret = hyp_assign_table(table, &source_vm, 1, dest_vmids,
	ret = hyp_assign_table(table, source_vm_list, source_nelems, dest_vmids,
						dest_perms, dest_nelems);
	if (ret)
		goto err2;
+7 −5
Original line number Diff line number Diff line
@@ -40,8 +40,8 @@ int hyp_assign_table(struct sg_table *table,
			int *dest_vmids, int *dest_perms,
			int dest_nelems);
int hyp_assign_phys(phys_addr_t addr, u64 size,
			int *dest_vmids, int *dest_perms,
			int dest_nelems);
			u32 *source_vmlist, int source_nelems,
			int *dest_vmids, int *dest_perms, int dest_nelems);
bool msm_secure_v2_is_supported(void);
#else
static inline int msm_secure_table(struct sg_table *table)
@@ -59,12 +59,14 @@ int hyp_assign_table(struct sg_table *table,
{
	return -EINVAL;
}
int hyp_assign_phys(phys_addr_t addr, u64 size,
			int *dest_vmids, int *dest_perms,
			int dest_nelems)

static inline int hyp_assign_phys(phys_addr_t addr, u64 size,
			u32 *source_vmlist, int source_nelems,
			int *dest_vmids, int *dest_perms, int dest_nelems)
{
	return -EINVAL;
}

static inline bool msm_secure_v2_is_supported(void)
{
	return false;