1*4882a593Smuzhiyun /************************************************************************** 2*4882a593Smuzhiyun * 3*4882a593Smuzhiyun * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 4*4882a593Smuzhiyun * All Rights Reserved. 5*4882a593Smuzhiyun * 6*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 7*4882a593Smuzhiyun * copy of this software and associated documentation files (the 8*4882a593Smuzhiyun * "Software"), to deal in the Software without restriction, including 9*4882a593Smuzhiyun * without limitation the rights to use, copy, modify, merge, publish, 10*4882a593Smuzhiyun * distribute, sub license, and/or sell copies of the Software, and to 11*4882a593Smuzhiyun * permit persons to whom the Software is furnished to do so, subject to 12*4882a593Smuzhiyun * the following conditions: 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * The above copyright notice and this permission notice (including the 15*4882a593Smuzhiyun * next paragraph) shall be included in all copies or substantial portions 16*4882a593Smuzhiyun * of the Software. 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21*4882a593Smuzhiyun * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 22*4882a593Smuzhiyun * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 23*4882a593Smuzhiyun * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 24*4882a593Smuzhiyun * USE OR OTHER DEALINGS IN THE SOFTWARE. 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun **************************************************************************/ 27*4882a593Smuzhiyun /* 28*4882a593Smuzhiyun * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> 29*4882a593Smuzhiyun */ 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun #ifndef _TTM_PLACEMENT_H_ 32*4882a593Smuzhiyun #define _TTM_PLACEMENT_H_ 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun #include <linux/types.h> 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun /* 37*4882a593Smuzhiyun * Memory regions for data placement. 38*4882a593Smuzhiyun */ 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun #define TTM_PL_SYSTEM 0 41*4882a593Smuzhiyun #define TTM_PL_TT 1 42*4882a593Smuzhiyun #define TTM_PL_VRAM 2 43*4882a593Smuzhiyun #define TTM_PL_PRIV 3 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun /* 46*4882a593Smuzhiyun * Other flags that affects data placement. 47*4882a593Smuzhiyun * TTM_PL_FLAG_CACHED indicates cache-coherent mappings 48*4882a593Smuzhiyun * if available. 49*4882a593Smuzhiyun * TTM_PL_FLAG_SHARED means that another application may 50*4882a593Smuzhiyun * reference the buffer. 51*4882a593Smuzhiyun * TTM_PL_FLAG_NO_EVICT means that the buffer may never 52*4882a593Smuzhiyun * be evicted to make room for other buffers. 53*4882a593Smuzhiyun * TTM_PL_FLAG_TOPDOWN requests to be placed from the 54*4882a593Smuzhiyun * top of the memory area, instead of the bottom. 55*4882a593Smuzhiyun */ 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun #define TTM_PL_FLAG_CACHED (1 << 16) 58*4882a593Smuzhiyun #define TTM_PL_FLAG_UNCACHED (1 << 17) 59*4882a593Smuzhiyun #define TTM_PL_FLAG_WC (1 << 18) 60*4882a593Smuzhiyun #define TTM_PL_FLAG_CONTIGUOUS (1 << 19) 61*4882a593Smuzhiyun #define TTM_PL_FLAG_NO_EVICT (1 << 21) 62*4882a593Smuzhiyun #define TTM_PL_FLAG_TOPDOWN (1 << 22) 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun #define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ 65*4882a593Smuzhiyun TTM_PL_FLAG_UNCACHED | \ 66*4882a593Smuzhiyun TTM_PL_FLAG_WC) 67*4882a593Smuzhiyun 68*4882a593Smuzhiyun /** 69*4882a593Smuzhiyun * struct ttm_place 70*4882a593Smuzhiyun * 71*4882a593Smuzhiyun * @fpfn: first valid page frame number to put the object 72*4882a593Smuzhiyun * @lpfn: last valid page frame number to put the object 73*4882a593Smuzhiyun * @flags: memory domain and caching flags for the object 74*4882a593Smuzhiyun * 75*4882a593Smuzhiyun * Structure indicating a possible place to put an object. 76*4882a593Smuzhiyun */ 77*4882a593Smuzhiyun struct ttm_place { 78*4882a593Smuzhiyun unsigned fpfn; 79*4882a593Smuzhiyun unsigned lpfn; 80*4882a593Smuzhiyun uint32_t mem_type; 81*4882a593Smuzhiyun uint32_t flags; 82*4882a593Smuzhiyun }; 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun /** 85*4882a593Smuzhiyun * struct ttm_placement 86*4882a593Smuzhiyun * 87*4882a593Smuzhiyun * @num_placement: number of preferred placements 88*4882a593Smuzhiyun * @placement: preferred placements 89*4882a593Smuzhiyun * @num_busy_placement: number of preferred placements when need to evict buffer 90*4882a593Smuzhiyun * @busy_placement: preferred placements when need to evict buffer 91*4882a593Smuzhiyun * 92*4882a593Smuzhiyun * Structure indicating the placement you request for an object. 93*4882a593Smuzhiyun */ 94*4882a593Smuzhiyun struct ttm_placement { 95*4882a593Smuzhiyun unsigned num_placement; 96*4882a593Smuzhiyun const struct ttm_place *placement; 97*4882a593Smuzhiyun unsigned num_busy_placement; 98*4882a593Smuzhiyun const struct ttm_place *busy_placement; 99*4882a593Smuzhiyun }; 100*4882a593Smuzhiyun 101*4882a593Smuzhiyun #endif 102