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

Commit 724d27be authored by Zhenhua Huang's avatar Zhenhua Huang Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: secure_buffer: add API page_accessible



Add page_accessible to check if page is secure or not. It is used
to avoid EL2 fault for dumping memory region.

Change-Id: If71a810997fc97722722339a25839249bd05d9e2
Signed-off-by: default avatarZhenhua Huang <zhenhuah@codeaurora.org>
parent 532b5fec
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -161,6 +161,16 @@ static inline void set_each_page_of_sg(struct sg_table *table, u64 flag)
}

#define SECURE_PAGE_MAGIC 0xEEEEEEEE
int page_accessible(unsigned long pfn)
{
	struct page *page = pfn_to_page(pfn);

	if (page->private == SECURE_PAGE_MAGIC)
		return 0;
	else
		return 1;
}

/*
 *  When -EADDRNOTAVAIL is returned the memory may no longer be in
 *  a usable state and should no longer be accessed by the HLOS.
+6 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ int hyp_assign_phys(phys_addr_t addr, u64 size,
			int *dest_vmids, int *dest_perms, int dest_nelems);
const char *msm_secure_vmid_to_string(int secure_vmid);
u32 msm_secure_get_vmid_perms(u32 vmid);
int page_accessible(unsigned long pfn);
#else
static inline int hyp_assign_table(struct sg_table *table,
			u32 *source_vm_list, int source_nelems,
@@ -79,5 +80,10 @@ static inline u32 msm_secure_get_vmid_perms(u32 vmid)
{
	return 0;
}

static inline int page_accessible(unsigned long pfn)
{
	return 1;
}
#endif
#endif