msm_ion.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _UAPI_LINUX_MSM_ION_H
  6. #define _UAPI_LINUX_MSM_ION_H
  7. #include <linux/types.h>
  8. #include <linux/msm_ion_ids.h>
  9. /**
  10. * TARGET_ION_ABI_VERSION can be used by user space clients to ensure that at
  11. * compile time only their code which uses the appropriate ION APIs for
  12. * this kernel is included.
  13. */
  14. #define TARGET_ION_ABI_VERSION 3
  15. enum msm_ion_heap_types {
  16. ION_HEAP_TYPE_MSM_START = 16,
  17. ION_HEAP_TYPE_SECURE_DMA = ION_HEAP_TYPE_MSM_START,
  18. ION_HEAP_TYPE_SYSTEM_SECURE,
  19. ION_HEAP_TYPE_HYP_CMA,
  20. ION_HEAP_TYPE_MSM_CARVEOUT,
  21. ION_HEAP_TYPE_SECURE_CARVEOUT,
  22. ION_HEAP_TYPE_MSM_SYSTEM,
  23. };
  24. /**
  25. * Flags to be used when allocating from the secure heap for
  26. * content protection
  27. */
  28. #define ION_FLAG_CP_TRUSTED_VM ION_BIT(15)
  29. /* ION_FLAG_POOL_FORCE_ALLOC uses ION_BIT(16) */
  30. #define ION_FLAG_CP_TOUCH ION_BIT(17)
  31. #define ION_FLAG_CP_BITSTREAM ION_BIT(18)
  32. #define ION_FLAG_CP_PIXEL ION_BIT(19)
  33. #define ION_FLAG_CP_NON_PIXEL ION_BIT(20)
  34. #define ION_FLAG_CP_CAMERA ION_BIT(21)
  35. #define ION_FLAG_CP_HLOS ION_BIT(22)
  36. #define ION_FLAG_CP_SPSS_SP ION_BIT(23)
  37. #define ION_FLAG_CP_SPSS_SP_SHARED ION_BIT(24)
  38. #define ION_FLAG_CP_SEC_DISPLAY ION_BIT(25)
  39. #define ION_FLAG_CP_APP ION_BIT(26)
  40. #define ION_FLAG_CP_CAMERA_PREVIEW ION_BIT(27)
  41. /* ION_FLAG_ALLOW_NON_CONTIG uses ION_BIT(28) */
  42. #define ION_FLAG_CP_CDSP ION_BIT(29)
  43. #define ION_FLAG_CP_SPSS_HLOS_SHARED ION_BIT(30)
  44. #define ION_FLAGS_CP_MASK 0x6FFE8000
  45. /**
  46. * Flag to allow non continguous allocation of memory from secure
  47. * heap
  48. */
  49. #define ION_FLAG_ALLOW_NON_CONTIG ION_BIT(28)
  50. /**
  51. * Flag to use when allocating to indicate that a heap is secure.
  52. * Do NOT use BIT macro since it is defined in #ifdef __KERNEL__
  53. */
  54. #define ION_FLAG_SECURE ION_BIT(31)
  55. /*
  56. * Used in conjunction with heap which pool memory to force an allocation
  57. * to come from the page allocator directly instead of from the pool allocation
  58. */
  59. #define ION_FLAG_POOL_FORCE_ALLOC ION_BIT(16)
  60. /**
  61. * Macro should be used with ion_heap_ids defined above.
  62. */
  63. #define ION_HEAP(bit) bit
  64. #define ION_IOC_MSM_MAGIC 'M'
  65. struct ion_prefetch_regions {
  66. __u64 sizes;
  67. __u32 vmid;
  68. __u32 nr_sizes;
  69. };
  70. struct ion_prefetch_data {
  71. __u64 len;
  72. __u64 regions;
  73. __u32 heap_id;
  74. __u32 nr_regions;
  75. };
  76. #define ION_IOC_PREFETCH _IOWR(ION_IOC_MSM_MAGIC, 3, \
  77. struct ion_prefetch_data)
  78. #define ION_IOC_DRAIN _IOWR(ION_IOC_MSM_MAGIC, 4, \
  79. struct ion_prefetch_data)
  80. #endif /* _UAPI_LINUX_MSM_ION_H */