18c2ecf20Sopenharmony_ci/************************************************************************** 28c2ecf20Sopenharmony_ci * 38c2ecf20Sopenharmony_ci * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA 48c2ecf20Sopenharmony_ci * All Rights Reserved. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 78c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the 88c2ecf20Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 98c2ecf20Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 108c2ecf20Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to 118c2ecf20Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 128c2ecf20Sopenharmony_ci * the following conditions: 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the 158c2ecf20Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions 168c2ecf20Sopenharmony_ci * of the Software. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 198c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 208c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 218c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, 228c2ecf20Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 238c2ecf20Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 248c2ecf20Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci **************************************************************************/ 278c2ecf20Sopenharmony_ci/* 288c2ecf20Sopenharmony_ci * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> 298c2ecf20Sopenharmony_ci */ 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#ifndef _TTM_PLACEMENT_H_ 328c2ecf20Sopenharmony_ci#define _TTM_PLACEMENT_H_ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#include <linux/types.h> 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* 378c2ecf20Sopenharmony_ci * Memory regions for data placement. 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define TTM_PL_SYSTEM 0 418c2ecf20Sopenharmony_ci#define TTM_PL_TT 1 428c2ecf20Sopenharmony_ci#define TTM_PL_VRAM 2 438c2ecf20Sopenharmony_ci#define TTM_PL_PRIV 3 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* 468c2ecf20Sopenharmony_ci * Other flags that affects data placement. 478c2ecf20Sopenharmony_ci * TTM_PL_FLAG_CACHED indicates cache-coherent mappings 488c2ecf20Sopenharmony_ci * if available. 498c2ecf20Sopenharmony_ci * TTM_PL_FLAG_SHARED means that another application may 508c2ecf20Sopenharmony_ci * reference the buffer. 518c2ecf20Sopenharmony_ci * TTM_PL_FLAG_NO_EVICT means that the buffer may never 528c2ecf20Sopenharmony_ci * be evicted to make room for other buffers. 538c2ecf20Sopenharmony_ci * TTM_PL_FLAG_TOPDOWN requests to be placed from the 548c2ecf20Sopenharmony_ci * top of the memory area, instead of the bottom. 558c2ecf20Sopenharmony_ci */ 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define TTM_PL_FLAG_CACHED (1 << 16) 588c2ecf20Sopenharmony_ci#define TTM_PL_FLAG_UNCACHED (1 << 17) 598c2ecf20Sopenharmony_ci#define TTM_PL_FLAG_WC (1 << 18) 608c2ecf20Sopenharmony_ci#define TTM_PL_FLAG_CONTIGUOUS (1 << 19) 618c2ecf20Sopenharmony_ci#define TTM_PL_FLAG_NO_EVICT (1 << 21) 628c2ecf20Sopenharmony_ci#define TTM_PL_FLAG_TOPDOWN (1 << 22) 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \ 658c2ecf20Sopenharmony_ci TTM_PL_FLAG_UNCACHED | \ 668c2ecf20Sopenharmony_ci TTM_PL_FLAG_WC) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci/** 698c2ecf20Sopenharmony_ci * struct ttm_place 708c2ecf20Sopenharmony_ci * 718c2ecf20Sopenharmony_ci * @fpfn: first valid page frame number to put the object 728c2ecf20Sopenharmony_ci * @lpfn: last valid page frame number to put the object 738c2ecf20Sopenharmony_ci * @flags: memory domain and caching flags for the object 748c2ecf20Sopenharmony_ci * 758c2ecf20Sopenharmony_ci * Structure indicating a possible place to put an object. 768c2ecf20Sopenharmony_ci */ 778c2ecf20Sopenharmony_cistruct ttm_place { 788c2ecf20Sopenharmony_ci unsigned fpfn; 798c2ecf20Sopenharmony_ci unsigned lpfn; 808c2ecf20Sopenharmony_ci uint32_t mem_type; 818c2ecf20Sopenharmony_ci uint32_t flags; 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci/** 858c2ecf20Sopenharmony_ci * struct ttm_placement 868c2ecf20Sopenharmony_ci * 878c2ecf20Sopenharmony_ci * @num_placement: number of preferred placements 888c2ecf20Sopenharmony_ci * @placement: preferred placements 898c2ecf20Sopenharmony_ci * @num_busy_placement: number of preferred placements when need to evict buffer 908c2ecf20Sopenharmony_ci * @busy_placement: preferred placements when need to evict buffer 918c2ecf20Sopenharmony_ci * 928c2ecf20Sopenharmony_ci * Structure indicating the placement you request for an object. 938c2ecf20Sopenharmony_ci */ 948c2ecf20Sopenharmony_cistruct ttm_placement { 958c2ecf20Sopenharmony_ci unsigned num_placement; 968c2ecf20Sopenharmony_ci const struct ttm_place *placement; 978c2ecf20Sopenharmony_ci unsigned num_busy_placement; 988c2ecf20Sopenharmony_ci const struct ttm_place *busy_placement; 998c2ecf20Sopenharmony_ci}; 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci#endif 102