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

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

Merge "mm: cma: add new cma api wrapper for hyp_assign"

parents 396c2088 4543a7e5
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/dma-mapping.h>
#include <linux/cma.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/secure_buffer.h>

@@ -413,6 +414,33 @@ int hyp_assign_phys(phys_addr_t addr, u64 size, u32 *source_vm_list,
}
EXPORT_SYMBOL(hyp_assign_phys);

int cma_hyp_assign_phys(struct device *dev, u32 *source_vm_list,
				int source_nelems, int *dest_vmids,
					int *dest_perms, int dest_nelems)
{
	phys_addr_t addr;
	u64 size;
	struct cma *cma = NULL;
	int ret;

	if (dev && dev->cma_area)
		cma = dev->cma_area;

	if (cma) {
		addr = cma_get_base(cma);
		size = (size_t)cma_get_size(cma);
	} else {
		return -ENOMEM;
	}

	ret = hyp_assign_phys(addr, size, source_vm_list,
				source_nelems, dest_vmids,
					dest_perms, dest_nelems);

	return ret;
}
EXPORT_SYMBOL(cma_hyp_assign_phys);

const char *msm_secure_vmid_to_string(int secure_vmid)
{
	switch (secure_vmid) {
+13 −0
Original line number Diff line number Diff line
@@ -66,6 +66,12 @@ int try_hyp_assign_table(struct sg_table *table,
extern 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);


extern int cma_hyp_assign_phys(struct device *dev, u32 *source_vm_list,
				int source_nelems, int *dest_vmids,
					int *dest_perms, int dest_nelems);

bool msm_secure_v2_is_supported(void);
const char *msm_secure_vmid_to_string(int secure_vmid);
#else
@@ -102,6 +108,13 @@ static inline int hyp_assign_phys(phys_addr_t addr, u64 size,
	return -EINVAL;
}

static inline int cma_hyp_assign_phys(struct device *dev, u32 *source_vm_list,
				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;