Commit 58ff791a authored by Hawking Zhang's avatar Hawking Zhang Committed by Alex Deucher

drm/amdgpu: switch to cached fw flags for gpu virt cap

Check cached firmware_flags to determine if gpu
virtualization is supported in vbios
Signed-off-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarJohn Clements <john.clements@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 5968c6a2
...@@ -68,23 +68,20 @@ uint32_t amdgpu_atomfirmware_query_firmware_capability(struct amdgpu_device *ade ...@@ -68,23 +68,20 @@ uint32_t amdgpu_atomfirmware_query_firmware_capability(struct amdgpu_device *ade
return fw_cap; return fw_cap;
} }
bool amdgpu_atomfirmware_gpu_supports_virtualization(struct amdgpu_device *adev) /*
* Helper function to query gpu virtualizaiton capability
*
* @adev: amdgpu_device pointer
*
* Return true if gpu virtualization is supported or false if not
*/
bool amdgpu_atomfirmware_gpu_virtualization_supported(struct amdgpu_device *adev)
{ {
int index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, u32 fw_cap;
firmwareinfo);
uint16_t data_offset;
if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context, index, NULL, fw_cap = adev->mode_info.firmware_flags;
NULL, NULL, &data_offset)) {
struct atom_firmware_info_v3_1 *firmware_info =
(struct atom_firmware_info_v3_1 *)(adev->mode_info.atom_context->bios +
data_offset);
if (le32_to_cpu(firmware_info->firmware_capability) & return (fw_cap & ATOM_FIRMWARE_CAP_GPU_VIRTUALIZATION) ? true : false;
ATOM_FIRMWARE_CAP_GPU_VIRTUALIZATION)
return true;
}
return false;
} }
void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev) void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#define get_index_into_master_table(master_table, table_name) (offsetof(struct master_table, table_name) / sizeof(uint16_t)) #define get_index_into_master_table(master_table, table_name) (offsetof(struct master_table, table_name) / sizeof(uint16_t))
uint32_t amdgpu_atomfirmware_query_firmware_capability(struct amdgpu_device *adev); uint32_t amdgpu_atomfirmware_query_firmware_capability(struct amdgpu_device *adev);
bool amdgpu_atomfirmware_gpu_supports_virtualization(struct amdgpu_device *adev); bool amdgpu_atomfirmware_gpu_virtualization_supported(struct amdgpu_device *adev);
void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev); void amdgpu_atomfirmware_scratch_regs_init(struct amdgpu_device *adev);
int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev); int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev);
int amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev, int amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev,
......
...@@ -3034,7 +3034,7 @@ static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev) ...@@ -3034,7 +3034,7 @@ static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev)
{ {
if (amdgpu_sriov_vf(adev)) { if (amdgpu_sriov_vf(adev)) {
if (adev->is_atom_fw) { if (adev->is_atom_fw) {
if (amdgpu_atomfirmware_gpu_supports_virtualization(adev)) if (amdgpu_atomfirmware_gpu_virtualization_supported(adev))
adev->virt.caps |= AMDGPU_SRIOV_CAPS_SRIOV_VBIOS; adev->virt.caps |= AMDGPU_SRIOV_CAPS_SRIOV_VBIOS;
} else { } else {
if (amdgpu_atombios_has_gpu_virtualization_table(adev)) if (amdgpu_atombios_has_gpu_virtualization_table(adev))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment