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