Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 /*
0003  * Copyright © 2021 Intel Corporation
0004  */
0005 #ifndef __TTM_KMAP_ITER_H__
0006 #define __TTM_KMAP_ITER_H__
0007 
0008 #include <linux/types.h>
0009 
0010 struct ttm_kmap_iter;
0011 struct iosys_map;
0012 
0013 /**
0014  * struct ttm_kmap_iter_ops - Ops structure for a struct
0015  * ttm_kmap_iter.
0016  * @maps_tt: Whether the iterator maps TT memory directly, as opposed
0017  * mapping a TT through an aperture. Both these modes have
0018  * struct ttm_resource_manager::use_tt set, but the latter typically
0019  * returns is_iomem == true from ttm_mem_io_reserve.
0020  */
0021 struct ttm_kmap_iter_ops {
0022     /**
0023      * kmap_local() - Map a PAGE_SIZE part of the resource using
0024      * kmap_local semantics.
0025      * @res_iter: Pointer to the struct ttm_kmap_iter representing
0026      * the resource.
0027      * @dmap: The struct iosys_map holding the virtual address after
0028      * the operation.
0029      * @i: The location within the resource to map. PAGE_SIZE granularity.
0030      */
0031     void (*map_local)(struct ttm_kmap_iter *res_iter,
0032               struct iosys_map *dmap, pgoff_t i);
0033     /**
0034      * unmap_local() - Unmap a PAGE_SIZE part of the resource previously
0035      * mapped using kmap_local.
0036      * @res_iter: Pointer to the struct ttm_kmap_iter representing
0037      * the resource.
0038      * @dmap: The struct iosys_map holding the virtual address after
0039      * the operation.
0040      */
0041     void (*unmap_local)(struct ttm_kmap_iter *res_iter,
0042                 struct iosys_map *dmap);
0043     bool maps_tt;
0044 };
0045 
0046 /**
0047  * struct ttm_kmap_iter - Iterator for kmap_local type operations on a
0048  * resource.
0049  * @ops: Pointer to the operations struct.
0050  *
0051  * This struct is intended to be embedded in a resource-specific specialization
0052  * implementing operations for the resource.
0053  *
0054  * Nothing stops us from extending the operations to vmap, vmap_pfn etc,
0055  * replacing some or parts of the ttm_bo_util. cpu-map functionality.
0056  */
0057 struct ttm_kmap_iter {
0058     const struct ttm_kmap_iter_ops *ops;
0059 };
0060 
0061 #endif /* __TTM_KMAP_ITER_H__ */