mem-buf-gh.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #ifndef MEM_BUF_GH_H
  7. #define MEM_BUF_GH_H
  8. #include <linux/dma-buf.h>
  9. #include <linux/mem-buf.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/scatterlist.h>
  12. #include <linux/slab.h>
  13. #include <linux/types.h>
  14. #include <linux/uaccess.h>
  15. #include <linux/mem-buf-exporter.h>
  16. #include <soc/qcom/secure_buffer.h>
  17. #include <uapi/linux/mem-buf.h>
  18. #include "mem-buf-dev.h"
  19. int mem_buf_acl_to_vmid_perms_list(unsigned int nr_acl_entries, const void __user *acl_entries,
  20. int **dst_vmids, int **dst_perms);
  21. #if IS_ENABLED(CONFIG_QCOM_MEM_BUF_GH)
  22. #include <linux/gunyah/gh_rm_drv.h>
  23. int mem_buf_alloc_fd(struct mem_buf_alloc_ioctl_arg *allocation_args);
  24. int mem_buf_retrieve_user(struct mem_buf_retrieve_ioctl_arg *uarg);
  25. int mem_buf_msgq_alloc(struct device *dev);
  26. void mem_buf_msgq_free(struct device *dev);
  27. #else
  28. static inline int mem_buf_alloc_fd(struct mem_buf_alloc_ioctl_arg *allocation_args)
  29. {
  30. return -EOPNOTSUPP;
  31. }
  32. static inline int mem_buf_retrieve_user(struct mem_buf_retrieve_ioctl_arg *uarg)
  33. {
  34. return -EOPNOTSUPP;
  35. }
  36. static inline int mem_buf_msgq_alloc(struct device *dev)
  37. {
  38. return 0;
  39. }
  40. static inline void mem_buf_msgq_free(struct device *dev)
  41. {
  42. }
  43. #endif
  44. #endif