~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/ttm/ttm_pool.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
  2 /*
  3  * Copyright 2020 Advanced Micro Devices, Inc.
  4  *
  5  * Permission is hereby granted, free of charge, to any person obtaining a
  6  * copy of this software and associated documentation files (the "Software"),
  7  * to deal in the Software without restriction, including without limitation
  8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9  * and/or sell copies of the Software, and to permit persons to whom the
 10  * Software is furnished to do so, subject to the following conditions:
 11  *
 12  * The above copyright notice and this permission notice shall be included in
 13  * all copies or substantial portions of the Software.
 14  *
 15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 18  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 19  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 21  * OTHER DEALINGS IN THE SOFTWARE.
 22  *
 23  * Authors: Christian König
 24  */
 25 
 26 #ifndef _TTM_PAGE_POOL_H_
 27 #define _TTM_PAGE_POOL_H_
 28 
 29 #include <linux/mmzone.h>
 30 #include <linux/llist.h>
 31 #include <linux/spinlock.h>
 32 #include <drm/ttm/ttm_caching.h>
 33 
 34 struct device;
 35 struct seq_file;
 36 struct ttm_operation_ctx;
 37 struct ttm_pool;
 38 struct ttm_tt;
 39 
 40 /**
 41  * struct ttm_pool_type - Pool for a certain memory type
 42  *
 43  * @pool: the pool we belong to, might be NULL for the global ones
 44  * @order: the allocation order our pages have
 45  * @caching: the caching type our pages have
 46  * @shrinker_list: our place on the global shrinker list
 47  * @lock: protection of the page list
 48  * @pages: the list of pages in the pool
 49  */
 50 struct ttm_pool_type {
 51         struct ttm_pool *pool;
 52         unsigned int order;
 53         enum ttm_caching caching;
 54 
 55         struct list_head shrinker_list;
 56 
 57         spinlock_t lock;
 58         struct list_head pages;
 59 };
 60 
 61 /**
 62  * struct ttm_pool - Pool for all caching and orders
 63  *
 64  * @dev: the device we allocate pages for
 65  * @nid: which numa node to use
 66  * @use_dma_alloc: if coherent DMA allocations should be used
 67  * @use_dma32: if GFP_DMA32 should be used
 68  * @caching: pools for each caching/order
 69  */
 70 struct ttm_pool {
 71         struct device *dev;
 72         int nid;
 73 
 74         bool use_dma_alloc;
 75         bool use_dma32;
 76 
 77         struct {
 78                 struct ttm_pool_type orders[NR_PAGE_ORDERS];
 79         } caching[TTM_NUM_CACHING_TYPES];
 80 };
 81 
 82 int ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt,
 83                    struct ttm_operation_ctx *ctx);
 84 void ttm_pool_free(struct ttm_pool *pool, struct ttm_tt *tt);
 85 
 86 void ttm_pool_init(struct ttm_pool *pool, struct device *dev,
 87                    int nid, bool use_dma_alloc, bool use_dma32);
 88 void ttm_pool_fini(struct ttm_pool *pool);
 89 
 90 int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m);
 91 
 92 int ttm_pool_mgr_init(unsigned long num_pages);
 93 void ttm_pool_mgr_fini(void);
 94 
 95 #endif
 96 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php