Back to home page

OSCL-LXR

 
 

    


0001 /**************************************************************************
0002  *
0003  * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
0004  * All Rights Reserved.
0005  *
0006  * Permission is hereby granted, free of charge, to any person obtaining a
0007  * copy of this software and associated documentation files (the
0008  * "Software"), to deal in the Software without restriction, including
0009  * without limitation the rights to use, copy, modify, merge, publish,
0010  * distribute, sub license, and/or sell copies of the Software, and to
0011  * permit persons to whom the Software is furnished to do so, subject to
0012  * the following conditions:
0013  *
0014  * The above copyright notice and this permission notice (including the
0015  * next paragraph) shall be included in all copies or substantial portions
0016  * of the Software.
0017  *
0018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0019  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0020  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
0021  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
0022  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
0023  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
0024  * USE OR OTHER DEALINGS IN THE SOFTWARE.
0025  *
0026  **************************************************************************/
0027 /*
0028  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
0029  */
0030 
0031 #ifndef _TTM_PLACEMENT_H_
0032 #define _TTM_PLACEMENT_H_
0033 
0034 #include <linux/types.h>
0035 
0036 /*
0037  * Memory regions for data placement.
0038  *
0039  * Buffers placed in TTM_PL_SYSTEM are considered under TTMs control and can
0040  * be swapped out whenever TTMs thinks it is a good idea.
0041  * In cases where drivers would like to use TTM_PL_SYSTEM as a valid
0042  * placement they need to be able to handle the issues that arise due to the
0043  * above manually.
0044  *
0045  * For BO's which reside in system memory but for which the accelerator
0046  * requires direct access (i.e. their usage needs to be synchronized
0047  * between the CPU and accelerator via fences) a new, driver private
0048  * placement that can handle such scenarios is a good idea.
0049  */
0050 
0051 #define TTM_PL_SYSTEM           0
0052 #define TTM_PL_TT               1
0053 #define TTM_PL_VRAM             2
0054 #define TTM_PL_PRIV             3
0055 
0056 /*
0057  * TTM_PL_FLAG_TOPDOWN requests to be placed from the
0058  * top of the memory area, instead of the bottom.
0059  */
0060 
0061 #define TTM_PL_FLAG_CONTIGUOUS  (1 << 0)
0062 #define TTM_PL_FLAG_TOPDOWN     (1 << 1)
0063 
0064 /* For multihop handling */
0065 #define TTM_PL_FLAG_TEMPORARY   (1 << 2)
0066 
0067 /**
0068  * struct ttm_place
0069  *
0070  * @fpfn:   first valid page frame number to put the object
0071  * @lpfn:   last valid page frame number to put the object
0072  * @mem_type:   One of TTM_PL_* where the resource should be allocated from.
0073  * @flags:  memory domain and caching flags for the object
0074  *
0075  * Structure indicating a possible place to put an object.
0076  */
0077 struct ttm_place {
0078     unsigned    fpfn;
0079     unsigned    lpfn;
0080     uint32_t    mem_type;
0081     uint32_t    flags;
0082 };
0083 
0084 /**
0085  * struct ttm_placement
0086  *
0087  * @num_placement:  number of preferred placements
0088  * @placement:      preferred placements
0089  * @num_busy_placement: number of preferred placements when need to evict buffer
0090  * @busy_placement: preferred placements when need to evict buffer
0091  *
0092  * Structure indicating the placement you request for an object.
0093  */
0094 struct ttm_placement {
0095     unsigned        num_placement;
0096     const struct ttm_place  *placement;
0097     unsigned        num_busy_placement;
0098     const struct ttm_place  *busy_placement;
0099 };
0100 
0101 #endif