mem-buf: Allow selective usage of *memory_subsection functions

add_memory_subsection() and remove_memory_subsection() are only needed
on the TVM and OEM VMs. These are downstream functions as well. Thus,
selectively allow them to be enabled so that we only compile them on
downstream kernels.

Change-Id: I8416cd8eb8db74cf8a3cfbc8e3d7ea2fff112353
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
This commit is contained in:
Chris Goldsworthy 2022-08-31 19:07:19 -07:00
parent 6d0045aaf5
commit 5c3224adf4
3 changed files with 30 additions and 0 deletions

View File

@ -27,6 +27,20 @@ config QCOM_MEM_BUF_DEV
config QCOM_MEM_BUF_DEV_GH
bool
config QCOM_MEM_BUF_UPDATE_S1
tristate "Map imported memory into the S1 logical kernel mapping for cache maintenance"
depends on QCOM_MEM_BUF_DEV_GH
help
When mapping memory into a VM, we must add it to the logical mapping in Linux in
order to perform cache maintenance on the memory. The default functions used for
adding memory, add_memory(), only maps memory at 128 MB chunks and has a 256 KB
overhead in the page table space it consumes (assuming the logical mapping is not
using block mappings). We accordingly use a downstream functions instead -
add_memory_subsection() - that adds memory on a section-size granularity
(currently 4 MB). Select this config option to enable the usage of these functions
on VMs, where these functions will be available using our downstream kernels.
If unsure, say N.
config QCOM_MEM_BUF_MSGQ
tristate "Qualcomm Technologies, Inc. Memory Buffer Message Queue Support"
depends on GH_MSGQ && QCOM_MEM_BUF_DEV_GH

View File

@ -252,6 +252,7 @@ int mem_buf_unmap_mem_s2(gh_memparcel_handle_t memparcel_hdl)
}
EXPORT_SYMBOL(mem_buf_unmap_mem_s2);
#ifdef CONFIG_QCOM_MEM_BUF_UPDATE_S1
int mem_buf_map_mem_s1(struct gh_sgl_desc *sgl_desc)
{
u64 base, size;
@ -300,6 +301,7 @@ int mem_buf_unmap_mem_s1(struct gh_sgl_desc *sgl_desc)
return ret;
}
EXPORT_SYMBOL(mem_buf_unmap_mem_s1);
#endif /* CONFIG_QCOM_MEM_BUF_UPDATE_S1 */
static int mem_buf_hyp_assign_table_gh(struct gh_sgl_desc *sgl_desc, int src_vmid,
struct gh_acl_desc *acl_desc)

View File

@ -31,8 +31,22 @@ int mem_buf_hyp_assign_table(struct sg_table *sgt, u32 *src_vmid, int source_nel
int *dest_vmids, int *dest_perms, int dest_nelems);
#ifdef CONFIG_QCOM_MEM_BUF_DEV_GH
#ifdef CONFIG_QCOM_MEM_BUF_UPDATE_S1
int mem_buf_map_mem_s1(struct gh_sgl_desc *sgl_desc);
int mem_buf_unmap_mem_s1(struct gh_sgl_desc *sgl_desc);
#else
static inline int mem_buf_map_mem_s1(struct gh_sgl_desc *sgl_desc)
{
return -EINVAL;
}
static inline int mem_buf_unmap_mem_s1(struct gh_sgl_desc *sgl_desc)
{
return -EINVAL;
}
#endif /* CONFIG_QCOM_MEM_BUF_UPDATE_S1 */
struct gh_acl_desc *mem_buf_vmid_perm_list_to_gh_acl(int *vmids, int *perms,
unsigned int nr_acl_entries);
struct gh_sgl_desc *mem_buf_sgt_to_gh_sgl_desc(struct sg_table *sgt);