qcedev_smmu.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Qti (or) Qualcomm Technologies Inc CE device driver.
  4. *
  5. * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
  6. */
  7. #ifndef _DRIVERS_CRYPTO_PARSE_H_
  8. #define _DRIVERS_CRYPTO_PARSE_H_
  9. #include <linux/dma-buf.h>
  10. #include <linux/dma-direction.h>
  11. #include <linux/iommu.h>
  12. #include <linux/msm_dma_iommu_mapping.h>
  13. #include <linux/msm_ion.h>
  14. #include <linux/of.h>
  15. #include <linux/of_platform.h>
  16. #include <linux/slab.h>
  17. #include <linux/types.h>
  18. struct context_bank_info {
  19. struct list_head list;
  20. const char *name;
  21. u32 buffer_type;
  22. u32 start_addr;
  23. u32 size;
  24. bool is_secure;
  25. struct device *dev;
  26. struct dma_iommu_mapping *mapping;
  27. };
  28. enum qcedev_mem_type {
  29. MEM_ION,
  30. };
  31. struct qcedev_mem_client {
  32. enum qcedev_mem_type mtype;
  33. };
  34. struct dma_mapping_info {
  35. struct device *dev;
  36. struct dma_iommu_mapping *mapping;
  37. struct sg_table *table;
  38. struct dma_buf_attachment *attach;
  39. struct dma_buf *buf;
  40. };
  41. struct qcedev_ion_buf_info {
  42. struct dma_mapping_info mapping_info;
  43. dma_addr_t iova;
  44. unsigned long mapped_buf_size;
  45. int ion_fd;
  46. };
  47. struct qcedev_reg_buf_info {
  48. struct list_head list;
  49. union {
  50. struct qcedev_ion_buf_info ion_buf;
  51. };
  52. atomic_t ref_count;
  53. };
  54. struct qcedev_buffer_list {
  55. struct list_head list;
  56. struct mutex lock;
  57. };
  58. int qcedev_parse_context_bank(struct platform_device *pdev);
  59. struct qcedev_mem_client *qcedev_mem_new_client(enum qcedev_mem_type mtype);
  60. void qcedev_mem_delete_client(struct qcedev_mem_client *mem_client);
  61. int qcedev_check_and_map_buffer(void *qce_hndl,
  62. int fd, unsigned int offset, unsigned int fd_size,
  63. unsigned long long *vaddr);
  64. int qcedev_check_and_unmap_buffer(void *handle, int fd);
  65. int qcedev_unmap_all_buffers(void *handle);
  66. extern struct qcedev_reg_buf_info *global_binfo_in;
  67. extern struct qcedev_reg_buf_info *global_binfo_out;
  68. extern struct qcedev_reg_buf_info *global_binfo_res;
  69. #endif