devicemem_typedefs.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*************************************************************************/ /*!
  2. @File
  3. @Title Device Memory Management
  4. @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
  5. @Description Client side part of device memory management -- this file
  6. is forked from new_devmem_allocation.h as this one has to
  7. reside in the top level include so that client code is able
  8. to make use of the typedefs.
  9. @License Strictly Confidential.
  10. */ /**************************************************************************/
  11. #ifndef DEVICEMEM_TYPEDEFS_H
  12. #define DEVICEMEM_TYPEDEFS_H
  13. #include <powervr/mem_types.h>
  14. #include "img_types.h"
  15. #include "pvrsrv_memallocflags.h"
  16. typedef struct DEVMEM_CONTEXT_TAG DEVMEM_CONTEXT; /*!< Convenience typedef for struct DEVMEM_CONTEXT_TAG */
  17. typedef struct DEVMEM_HEAP_TAG DEVMEM_HEAP; /*!< Convenience typedef for struct DEVMEM_HEAP_TAG */
  18. typedef struct DEVMEM_MEMDESC_TAG DEVMEM_MEMDESC; /*!< Convenience typedef for struct DEVMEM_MEMDESC_TAG */
  19. typedef struct DEVMEM_PAGELIST_TAG DEVMEM_PAGELIST; /*!< Convenience typedef for struct DEVMEM_PAGELIST_TAG */
  20. typedef IMG_HANDLE DEVMEM_EXPORTHANDLE; /*!< Typedef for DeviceMem Export Handle */
  21. typedef IMG_UINT64 DEVMEM_EXPORTKEY; /*!< Typedef for DeviceMem Export Key */
  22. typedef IMG_DEVMEM_SIZE_T DEVMEM_SIZE_T; /*!< Typedef for DeviceMem SIZE_T */
  23. typedef IMG_DEVMEM_LOG2ALIGN_T DEVMEM_LOG2ALIGN_T; /*!< Typedef for DeviceMem LOG2 Alignment */
  24. typedef struct DEVMEMX_PHYS_MEMDESC_TAG DEVMEMX_PHYSDESC; /*!< Convenience typedef for DevmemX physical */
  25. typedef struct DEVMEMX_VIRT_MEMDESC_TAG DEVMEMX_VIRTDESC; /*!< Convenience typedef for DevmemX virtual */
  26. /*! calling code needs all the info in this struct, to be able to pass it around */
  27. typedef struct
  28. {
  29. /*! A handle to the PMR. */
  30. IMG_HANDLE hPMRExportHandle;
  31. /*! The "key" to prove we have authorisation to use this PMR */
  32. IMG_UINT64 uiPMRExportPassword;
  33. /*! Size and alignment properties for this PMR. Note, these
  34. numbers are not trusted in kernel, but we need to cache them
  35. client-side in order to allocate from the VM arena. The kernel
  36. will know the actual alignment and size of the PMR and thus
  37. would prevent client code from breaching security here. Ditto
  38. for physmem granularity (aka page size) if this is different
  39. from alignment */
  40. IMG_DEVMEM_SIZE_T uiSize;
  41. /*! We call this "contiguity guarantee" to be more precise than
  42. calling it "alignment" or "page size", terms which may seem
  43. similar but have different emphasis. The number reported here
  44. is the minimum contiguity guarantee from the creator of the
  45. PMR. Now, there is no requirement to allocate that coarsely
  46. from the RA. The alignment given to the RA simply needs to be
  47. at least as coarse as the device page size for the heap we
  48. ultimately intend to map into. What is important is that the
  49. device MMU data page size is not greater than the minimum
  50. contiguity guarantee from the PMR. This value is reported to
  51. the client in order that it can choose to make early checks and
  52. perhaps decide which heap (in a variable page size scenario) it
  53. would be safe to map this PMR into. For convenience, the
  54. client may choose to use this argument as the alignment of the
  55. virtual range he chooses to allocate, but this is _not_
  56. necessary and in many cases would be able to get away with a
  57. finer alignment, should the heap into which this PMR will be
  58. mapped support it. */
  59. IMG_DEVMEM_LOG2ALIGN_T uiLog2ContiguityGuarantee;
  60. } DEVMEM_EXPORTCOOKIE;
  61. /* Enum that describes the operation associated with changing sparse memory */
  62. typedef IMG_UINT32 SPARSE_MEM_RESIZE_FLAGS;
  63. #define SPARSE_RESIZE_NONE 0U
  64. /* This should be set to indicate the change needs allocation */
  65. #define SPARSE_RESIZE_ALLOC 1U
  66. /* This should be set to indicate the change needs free */
  67. #define SPARSE_RESIZE_FREE 2U
  68. #define SPARSE_RESIZE_BOTH (SPARSE_RESIZE_ALLOC | SPARSE_RESIZE_FREE)
  69. /* This should be set to silently swap underlying physical memory
  70. * without disturbing its device or cpu virtual maps.
  71. * This flag is not supported in the case of PDUMP and could lead to
  72. * PDUMP panic when used.
  73. */
  74. #define SPARSE_REMAP_MEM 4U
  75. /* Should be set to get the sparse changes appear in cpu virtual map */
  76. #define SPARSE_MAP_CPU_ADDR 8U
  77. /* To be used with all the sparse allocations that gets mapped to CPU Virtual
  78. * space. The sparse allocation CPU mapping is torn down and re-mapped every
  79. * time the sparse allocation layout changes.
  80. */
  81. #define PVRSRV_UNMAP_ON_SPARSE_CHANGE 1
  82. /* To use with DevmemSubAllocate() as the default factor if no over-allocation
  83. * is desired.
  84. */
  85. #define DEVMEM_NO_PRE_ALLOCATE_MULTIPLIER (1U)
  86. /* Defines the max length for PMR, MemDesc, Device memory History and RI debug
  87. * annotations stored in memory, including the null terminator.
  88. */
  89. #define DEVMEM_ANNOTATION_MAX_LEN ((IMG_UINT32)PVR_ANNOTATION_MAX_LEN + 1U)
  90. #endif /* #ifndef DEVICEMEM_TYPEDEFS_H */