Path: blob/master/drivers/gpu/drm/amd/amdkfd/kfd_kernel_queue.h
26516 views
/* SPDX-License-Identifier: GPL-2.0 OR MIT */1/*2* Copyright 2014-2022 Advanced Micro Devices, Inc.3*4* Permission is hereby granted, free of charge, to any person obtaining a5* copy of this software and associated documentation files (the "Software"),6* to deal in the Software without restriction, including without limitation7* the rights to use, copy, modify, merge, publish, distribute, sublicense,8* and/or sell copies of the Software, and to permit persons to whom the9* Software is furnished to do so, subject to the following conditions:10*11* The above copyright notice and this permission notice shall be included in12* all copies or substantial portions of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR18* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,19* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR20* OTHER DEALINGS IN THE SOFTWARE.21*22*/2324#ifndef KFD_KERNEL_QUEUE_H_25#define KFD_KERNEL_QUEUE_H_2627#include <linux/list.h>28#include <linux/types.h>29#include "kfd_priv.h"3031/**32* kq_acquire_packet_buffer: Returns a pointer to the location in the kernel33* queue ring buffer where the calling function can write its packet. It is34* Guaranteed that there is enough space for that packet. It also updates the35* pending write pointer to that location so subsequent calls to36* acquire_packet_buffer will get a correct write pointer37*38* kq_submit_packet: Update the write pointer and doorbell of a kernel queue.39*40* kq_rollback_packet: This routine is called if we failed to build an acquired41* packet for some reason. It just overwrites the pending wptr with the current42* one43*44*/4546int kq_acquire_packet_buffer(struct kernel_queue *kq,47size_t packet_size_in_dwords,48unsigned int **buffer_ptr);49int kq_submit_packet(struct kernel_queue *kq);50void kq_rollback_packet(struct kernel_queue *kq);515253struct kernel_queue {54/* data */55struct kfd_node *dev;56struct mqd_manager *mqd_mgr;57struct queue *queue;58uint64_t pending_wptr64;59uint32_t pending_wptr;60unsigned int nop_packet;6162struct kfd_mem_obj *rptr_mem;63uint32_t *rptr_kernel;64uint64_t rptr_gpu_addr;65struct kfd_mem_obj *wptr_mem;66union {67uint64_t *wptr64_kernel;68uint32_t *wptr_kernel;69};70uint64_t wptr_gpu_addr;71struct kfd_mem_obj *pq;72uint64_t pq_gpu_addr;73uint32_t *pq_kernel_addr;74struct kfd_mem_obj *eop_mem;75uint64_t eop_gpu_addr;76uint32_t *eop_kernel_addr;7778struct kfd_mem_obj *fence_mem_obj;79uint64_t fence_gpu_addr;80void *fence_kernel_address;8182struct list_head list;83};8485#endif /* KFD_KERNEL_QUEUE_H_ */868788