diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/vi.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vi.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index b688e2f77419..a8154d0ac288 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
@@ -445,18 +445,21 @@ static bool vi_read_bios_from_rom(struct amdgpu_device *adev, | |||
445 | return true; | 445 | return true; |
446 | } | 446 | } |
447 | 447 | ||
448 | static u32 vi_get_virtual_caps(struct amdgpu_device *adev) | 448 | static void vi_detect_hw_virtualization(struct amdgpu_device *adev) |
449 | { | 449 | { |
450 | u32 caps = 0; | 450 | uint32_t reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER); |
451 | u32 reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER); | 451 | /* bit0: 0 means pf and 1 means vf */ |
452 | /* bit31: 0 means disable IOV and 1 means enable */ | ||
453 | if (reg & 1) | ||
454 | adev->virtualization.virtual_caps |= AMDGPU_SRIOV_CAPS_IS_VF; | ||
452 | 455 | ||
453 | if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, IOV_ENABLE)) | 456 | if (reg & 0x80000000) |
454 | caps |= AMDGPU_VIRT_CAPS_SRIOV_EN; | 457 | adev->virtualization.virtual_caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV; |
455 | 458 | ||
456 | if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, FUNC_IDENTIFIER)) | 459 | if (reg == 0) { |
457 | caps |= AMDGPU_VIRT_CAPS_IS_VF; | 460 | if (is_virtual_machine()) /* passthrough mode exclus sr-iov mode */ |
458 | 461 | adev->virtualization.virtual_caps |= AMDGPU_PASSTHROUGH_MODE; | |
459 | return caps; | 462 | } |
460 | } | 463 | } |
461 | 464 | ||
462 | static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = { | 465 | static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = { |
@@ -1521,13 +1524,13 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = | |||
1521 | { | 1524 | { |
1522 | .read_disabled_bios = &vi_read_disabled_bios, | 1525 | .read_disabled_bios = &vi_read_disabled_bios, |
1523 | .read_bios_from_rom = &vi_read_bios_from_rom, | 1526 | .read_bios_from_rom = &vi_read_bios_from_rom, |
1527 | .detect_hw_virtualization = vi_detect_hw_virtualization, | ||
1524 | .read_register = &vi_read_register, | 1528 | .read_register = &vi_read_register, |
1525 | .reset = &vi_asic_reset, | 1529 | .reset = &vi_asic_reset, |
1526 | .set_vga_state = &vi_vga_set_state, | 1530 | .set_vga_state = &vi_vga_set_state, |
1527 | .get_xclk = &vi_get_xclk, | 1531 | .get_xclk = &vi_get_xclk, |
1528 | .set_uvd_clocks = &vi_set_uvd_clocks, | 1532 | .set_uvd_clocks = &vi_set_uvd_clocks, |
1529 | .set_vce_clocks = &vi_set_vce_clocks, | 1533 | .set_vce_clocks = &vi_set_vce_clocks, |
1530 | .get_virtual_caps = &vi_get_virtual_caps, | ||
1531 | }; | 1534 | }; |
1532 | 1535 | ||
1533 | static int vi_common_early_init(void *handle) | 1536 | static int vi_common_early_init(void *handle) |
@@ -1657,6 +1660,10 @@ static int vi_common_early_init(void *handle) | |||
1657 | return -EINVAL; | 1660 | return -EINVAL; |
1658 | } | 1661 | } |
1659 | 1662 | ||
1663 | /* in early init stage, vbios code won't work */ | ||
1664 | if (adev->asic_funcs->detect_hw_virtualization) | ||
1665 | amdgpu_asic_detect_hw_virtualization(adev); | ||
1666 | |||
1660 | if (amdgpu_smc_load_fw && smc_enabled) | 1667 | if (amdgpu_smc_load_fw && smc_enabled) |
1661 | adev->firmware.smu_load = true; | 1668 | adev->firmware.smu_load = true; |
1662 | 1669 | ||