Skip to content

Commit 82a9ab3

Browse files
Lang Yualexdeucher
authored andcommitted
drm/amdgpu: Add a helper macro to align mqd size
MES FW uses address(mqd_addr + sizeof(struct mqd) + 3*sizeof(uint32_t)) as fence address and writes a 32 bit fence value to this address. Driver needs to allocate some extra memory(at least 4 DWs) in addition to sizeof(struct mqd) as mqd memory(limited to gfx/compute/sdma queue). For gfx11/12, sizeof(struct mqd) < PAGE_SIZE, KGD allocates mqd memory with PAGE_SIZE aligned works. For gfx12.1, sizeof(struct mqd) == PAGE_SIZE, it doesn't work. KFD mqd manager hardcodes mqd size to PAGE_SIZE/MQD_SIZE across different IP versions to solve this issue. To avoid hardcoding in differnet places and across different IP versions. Let's use AMDGPU_MQD_SIZE_ALIGN instead. It is used in two places. 1. mqd memory alloction 2. mqd stride handling for multi xcc config v2: Use AMDGPU_GPU_PAGE_ALIGN. (Mukul) Signed-off-by: Lang Yu <lang.yu@amd.com> Reviewed-by: David Belanger <david.belanger@amd.com> (v1) Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Mukul Joshi <mukul.joshi@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 8079b87 commit 82a9ab3

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,14 @@ struct amdgpu_device {
12391239
struct amdgpu_kfd_dev kfd;
12401240
};
12411241

1242+
/*
1243+
* MES FW uses address(mqd_addr + sizeof(struct mqd) + 3*sizeof(uint32_t))
1244+
* as fence address and writes a 32 bit fence value to this address.
1245+
* Driver needs to allocate at least 4 DWs extra memory in addition to
1246+
* sizeof(struct mqd). Add 8 DWs and align to AMDGPU_GPU_PAGE_SIZE for safety.
1247+
*/
1248+
#define AMDGPU_MQD_SIZE_ALIGN(mqd_size) AMDGPU_GPU_PAGE_ALIGN(((mqd_size) + 32))
1249+
12421250
static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
12431251
uint8_t ip, uint8_t inst)
12441252
{

0 commit comments

Comments
 (0)