From 12058013a7d15ec5a19648e0d50a2517614713ff Mon Sep 17 00:00:00 2001 From: Patrick Daly Date: Wed, 8 Jun 2022 19:41:33 -0700 Subject: [PATCH] mem-buf: Add accessor for current_vmid Allow other modules to access this variable. Change-Id: I4eb92e6ea7bed0fb854a7aafe355f33a09120389 Signed-off-by: Patrick Daly --- drivers/soc/qcom/mem_buf/mem-buf-ids.c | 6 ++++++ include/linux/mem-buf.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/drivers/soc/qcom/mem_buf/mem-buf-ids.c b/drivers/soc/qcom/mem_buf/mem-buf-ids.c index a81f7f7bf347..846c7fb038ff 100644 --- a/drivers/soc/qcom/mem_buf/mem-buf-ids.c +++ b/drivers/soc/qcom/mem_buf/mem-buf-ids.c @@ -82,6 +82,12 @@ struct mem_buf_vm *pdata_array[] = { NULL, }; +int mem_buf_current_vmid(void) +{ + return current_vmid; +} +EXPORT_SYMBOL(mem_buf_current_vmid); + /* * Opening this file acquires a refcount on vm->dev's kobject - see * chrdev_open(). So private data won't be free'd out from diff --git a/include/linux/mem-buf.h b/include/linux/mem-buf.h index 8c08679abd52..43823d1304ae 100644 --- a/include/linux/mem-buf.h +++ b/include/linux/mem-buf.h @@ -104,6 +104,7 @@ int mem_buf_reclaim(struct dma_buf *dmabuf); void *mem_buf_alloc(struct mem_buf_allocation_data *alloc_data); void mem_buf_free(void *membuf); struct gh_sgl_desc *mem_buf_get_sgl(void *membuf); +int mem_buf_current_vmid(void); #else static inline void *mem_buf_alloc(struct mem_buf_allocation_data *alloc_data) @@ -117,6 +118,10 @@ static inline struct gh_sgl_desc *mem_buf_get_sgl(void *membuf) { return ERR_PTR(-EINVAL); } +static inline int mem_buf_current_vmid(void) +{ + return ERR_PTR(-EINVAL); +} #endif /* CONFIG_QCOM_MEM_BUF */