/* * Copyright 2018 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * */ #ifndef AMDGPU_DOORBELL_H #define AMDGPU_DOORBELL_H /* * GPU doorbell structures, functions & helpers */ struct amdgpu_doorbell { … }; /* Reserved doorbells for amdgpu (including multimedia). * KFD can use all the rest in the 2M doorbell bar. * For asic before vega10, doorbell is 32-bit, so the * index/offset is in dword. For vega10 and after, doorbell * can be 64-bit, so the index defined is in qword. */ struct amdgpu_doorbell_index { … }; enum AMDGPU_DOORBELL_ASSIGNMENT { … }; enum AMDGPU_VEGA20_DOORBELL_ASSIGNMENT { … }; enum AMDGPU_NAVI10_DOORBELL_ASSIGNMENT { … }; /* * 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space */ enum AMDGPU_DOORBELL64_ASSIGNMENT { … }; enum AMDGPU_DOORBELL_ASSIGNMENT_LAYOUT1 { … }; u32 amdgpu_mm_rdoorbell(struct amdgpu_device *adev, u32 index); void amdgpu_mm_wdoorbell(struct amdgpu_device *adev, u32 index, u32 v); u64 amdgpu_mm_rdoorbell64(struct amdgpu_device *adev, u32 index); void amdgpu_mm_wdoorbell64(struct amdgpu_device *adev, u32 index, u64 v); /* * GPU doorbell aperture helpers function. */ int amdgpu_doorbell_init(struct amdgpu_device *adev); void amdgpu_doorbell_fini(struct amdgpu_device *adev); int amdgpu_doorbell_create_kernel_doorbells(struct amdgpu_device *adev); uint32_t amdgpu_doorbell_index_on_bar(struct amdgpu_device *adev, struct amdgpu_bo *db_bo, uint32_t doorbell_index, uint32_t db_size); #define RDOORBELL32(index) … #define WDOORBELL32(index, v) … #define RDOORBELL64(index) … #define WDOORBELL64(index, v) … #endif