Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2022 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  */
0023 #ifndef __AMDGPU_CS_H__
0024 #define __AMDGPU_CS_H__
0025 
0026 #include "amdgpu_job.h"
0027 #include "amdgpu_bo_list.h"
0028 #include "amdgpu_ring.h"
0029 
0030 struct amdgpu_bo_va_mapping;
0031 
0032 struct amdgpu_cs_chunk {
0033     uint32_t        chunk_id;
0034     uint32_t        length_dw;
0035     void            *kdata;
0036 };
0037 
0038 struct amdgpu_cs_post_dep {
0039     struct drm_syncobj *syncobj;
0040     struct dma_fence_chain *chain;
0041     u64 point;
0042 };
0043 
0044 struct amdgpu_cs_parser {
0045     struct amdgpu_device    *adev;
0046     struct drm_file     *filp;
0047     struct amdgpu_ctx   *ctx;
0048 
0049     /* chunks */
0050     unsigned        nchunks;
0051     struct amdgpu_cs_chunk  *chunks;
0052 
0053     /* scheduler job object */
0054     struct amdgpu_job   *job;
0055     struct drm_sched_entity *entity;
0056 
0057     /* buffer objects */
0058     struct ww_acquire_ctx       ticket;
0059     struct amdgpu_bo_list       *bo_list;
0060     struct amdgpu_mn        *mn;
0061     struct amdgpu_bo_list_entry vm_pd;
0062     struct list_head        validated;
0063     struct dma_fence        *fence;
0064     uint64_t            bytes_moved_threshold;
0065     uint64_t            bytes_moved_vis_threshold;
0066     uint64_t            bytes_moved;
0067     uint64_t            bytes_moved_vis;
0068 
0069     /* user fence */
0070     struct amdgpu_bo_list_entry uf_entry;
0071 
0072     unsigned            num_post_deps;
0073     struct amdgpu_cs_post_dep   *post_deps;
0074 };
0075 
0076 int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
0077                uint64_t addr, struct amdgpu_bo **bo,
0078                struct amdgpu_bo_va_mapping **mapping);
0079 
0080 #endif