diff --git a/drivers/soc/qcom/secure_buffer.c b/drivers/soc/qcom/secure_buffer.c index 6697fca0c3f2..cb7c130c97db 100644 --- a/drivers/soc/qcom/secure_buffer.c +++ b/drivers/soc/qcom/secure_buffer.c @@ -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. diff --git a/include/soc/qcom/secure_buffer.h b/include/soc/qcom/secure_buffer.h index 3c8b3c7146ee..2d28674a3cb9 100644 --- a/include/soc/qcom/secure_buffer.h +++ b/include/soc/qcom/secure_buffer.h @@ -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