Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd: Add a helper to tell whether an IP block HW is enabled

There is already a helper for telling if a block is valid, but if
IP handling wants to check if it's HW is enabled no such helper
exists.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Mario Limonciello and committed by
Alex Deucher
152dca4e bd07b3f0

+24 -1
+2
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 372 372 u64 *flags); 373 373 int amdgpu_device_ip_wait_for_idle(struct amdgpu_device *adev, 374 374 enum amd_ip_block_type block_type); 375 + bool amdgpu_device_ip_is_hw(struct amdgpu_device *adev, 376 + enum amd_ip_block_type block_type); 375 377 bool amdgpu_device_ip_is_valid(struct amdgpu_device *adev, 376 378 enum amd_ip_block_type block_type); 377 379 int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
+22 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 2387 2387 } 2388 2388 2389 2389 /** 2390 - * amdgpu_device_ip_is_valid - is the hardware IP enabled 2390 + * amdgpu_device_ip_is_hw - is the hardware IP enabled 2391 2391 * 2392 2392 * @adev: amdgpu_device pointer 2393 2393 * @block_type: Type of hardware IP (SMU, GFX, UVD, etc.) 2394 2394 * 2395 2395 * Check if the hardware IP is enable or not. 2396 2396 * Returns true if it the IP is enable, false if not. 2397 + */ 2398 + bool amdgpu_device_ip_is_hw(struct amdgpu_device *adev, 2399 + enum amd_ip_block_type block_type) 2400 + { 2401 + int i; 2402 + 2403 + for (i = 0; i < adev->num_ip_blocks; i++) { 2404 + if (adev->ip_blocks[i].version->type == block_type) 2405 + return adev->ip_blocks[i].status.hw; 2406 + } 2407 + return false; 2408 + } 2409 + 2410 + /** 2411 + * amdgpu_device_ip_is_valid - is the hardware IP valid 2412 + * 2413 + * @adev: amdgpu_device pointer 2414 + * @block_type: Type of hardware IP (SMU, GFX, UVD, etc.) 2415 + * 2416 + * Check if the hardware IP is valid or not. 2417 + * Returns true if it the IP is valid, false if not. 2397 2418 */ 2398 2419 bool amdgpu_device_ip_is_valid(struct amdgpu_device *adev, 2399 2420 enum amd_ip_block_type block_type)