Merge tag 'lsk-v3.10-15.10-android'
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / rogue / include / devicemem_typedefs.h
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        Dual MIT/GPLv2
10
11 The contents of this file are subject to the MIT license as set out below.
12
13 Permission is hereby granted, free of charge, to any person obtaining a copy
14 of this software and associated documentation files (the "Software"), to deal
15 in the Software without restriction, including without limitation the rights
16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the Software is
18 furnished to do so, subject to the following conditions:
19
20 The above copyright notice and this permission notice shall be included in
21 all copies or substantial portions of the Software.
22
23 Alternatively, the contents of this file may be used under the terms of
24 the GNU General Public License Version 2 ("GPL") in which case the provisions
25 of GPL are applicable instead of those above.
26
27 If you wish to allow use of your version of this file only under the terms of
28 GPL, and not to allow others to use your version of this file under the terms
29 of the MIT license, indicate your decision by deleting the provisions above
30 and replace them with the notice and other provisions required by GPL as set
31 out in the file called "GPL-COPYING" included in this distribution. If you do
32 not delete the provisions above, a recipient may use your version of this file
33 under the terms of either the MIT license or GPL.
34
35 This License is also included in this distribution in the file called
36 "MIT-COPYING".
37
38 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
39 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
40 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
41 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
42 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
43 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
44 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 */ /**************************************************************************/
46
47 #ifndef DEVICEMEM_TYPEDEFS_H
48 #define DEVICEMEM_TYPEDEFS_H
49
50 #include "img_types.h"
51 #include "pvrsrv_memallocflags.h"
52
53 typedef struct _DEVMEM_CONTEXT_ DEVMEM_CONTEXT;     /*!< Convenience typedef for struct _DEVMEM_CONTEXT_ */
54 typedef struct _DEVMEM_HEAP_ DEVMEM_HEAP;           /*!< Convenience typedef for struct _DEVMEM_HEAP_ */
55 typedef struct _DEVMEM_MEMDESC_ DEVMEM_MEMDESC;     /*!< Convenience typedef for struct _DEVMEM_MEMDESC_ */
56 typedef struct _DEVMEM_PAGELIST_ DEVMEM_PAGELIST;       /*!< Convenience typedef for struct _DEVMEM_PAGELIST_ */
57 typedef PVRSRV_MEMALLOCFLAGS_T DEVMEM_FLAGS_T;      /*!< Conveneince typedef for PVRSRV_MEMALLOCFLAGS_T */
58
59 typedef IMG_HANDLE /* */ DEVMEM_EXPORTHANDLE; /*!< Typedef for DeviceMem Export Handle */
60 typedef IMG_UINT64 DEVMEM_EXPORTKEY;                                /*!< Typedef for DeviceMem Export Key */
61 typedef IMG_DEVMEM_SIZE_T DEVMEM_SIZE_T;                            /*!< Typedef for DeviceMem SIZE_T */
62 typedef IMG_DEVMEM_LOG2ALIGN_T DEVMEM_LOG2ALIGN_T;                  /*!< Typdef for DeviceMem LOG2 Alignment */
63
64 /*! calling code needs all the info in this struct, to be able to pass it around */
65 typedef struct
66 {
67     /*! A handle to the PMR.  Should be a SID.  
68 */
69     IMG_HANDLE hPMRExportHandle;
70     /*! The "key" to prove we have authorization to use this PMR */
71     IMG_UINT64 uiPMRExportPassword;
72     /*! Size and alignment properties for this PMR.  Note, these
73        numbers are not trusted in kernel, but we need to cache them
74        client-side in order to allocate from the VM arena.  The kernel
75        will know the actual alignment and size of the PMR and thus
76        would prevent client code from breaching security here.  Ditto
77        for physmem granularity (aka page size) if this is different
78        from alignment */
79     IMG_DEVMEM_SIZE_T uiSize;
80     /*! We call this "contiguity guarantee" to be more precise than
81        calling it "alignment" or "page size", terms which may seem
82        similar but have different emphasis.  The number reported here
83        is the minimum contiguity guarantee from the creator of the
84        PMR.  Now, there is no requirement to allocate that coarsely
85        from the RA.  The alignment given to the RA simply needs to be
86        at least as coarse as the device page size for the heap we
87        ultimately intend to map into.  What is important is that the
88        device MMU data page size is not greater than the minimum
89        contiguity guarantee from the PMR.  This value is reported to
90        the client in order that it can choose to make early checks and
91        perhaps decide which heap (in a variable page size scenario) it
92        would be safe to map this PMR into.  For convenience, the
93        client may choose to use this argument as the alignment of the
94        virtual range he chooses to allocate, but this is _not_
95        necessary and in many cases would be able to get away with a
96        finer alignment, should the heap into which this PMR will be
97        mapped support it. */
98     IMG_DEVMEM_LOG2ALIGN_T uiLog2ContiguityGuarantee;
99 } DEVMEM_EXPORTCOOKIE;
100
101 typedef IMG_HANDLE DEVMEM_SERVER_EXPORTCOOKIE; /*!< typedef for DeviceMem Server Export Cookie */
102
103 #endif /* #ifndef SRVCLIENT_NEW_DEVMEM_ALLOCATION_TYPEDEFS_H */
104