diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index d97efc1a3109..4acc92b9eec6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -110,7 +110,7 @@ void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v, | |||
110 | bool always_indirect) | 110 | bool always_indirect) |
111 | { | 111 | { |
112 | trace_amdgpu_mm_wreg(adev->pdev->device, reg, v); | 112 | trace_amdgpu_mm_wreg(adev->pdev->device, reg, v); |
113 | 113 | ||
114 | if ((reg * 4) < adev->rmmio_size && !always_indirect) | 114 | if ((reg * 4) < adev->rmmio_size && !always_indirect) |
115 | writel(v, ((void __iomem *)adev->rmmio) + (reg * 4)); | 115 | writel(v, ((void __iomem *)adev->rmmio) + (reg * 4)); |
116 | else { | 116 | else { |
@@ -1485,13 +1485,10 @@ static int amdgpu_resume(struct amdgpu_device *adev) | |||
1485 | return 0; | 1485 | return 0; |
1486 | } | 1486 | } |
1487 | 1487 | ||
1488 | static bool amdgpu_device_is_virtual(void) | 1488 | static void amdgpu_device_detect_sriov_bios(struct amdgpu_device *adev) |
1489 | { | 1489 | { |
1490 | #ifdef CONFIG_X86 | 1490 | if (amdgpu_atombios_has_gpu_virtualization_table(adev)) |
1491 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); | 1491 | adev->virtualization.virtual_caps |= AMDGPU_SRIOV_CAPS_SRIOV_VBIOS; |
1492 | #else | ||
1493 | return false; | ||
1494 | #endif | ||
1495 | } | 1492 | } |
1496 | 1493 | ||
1497 | /** | 1494 | /** |
@@ -1648,25 +1645,25 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1648 | goto failed; | 1645 | goto failed; |
1649 | } | 1646 | } |
1650 | 1647 | ||
1651 | /* See if the asic supports SR-IOV */ | 1648 | /* detect if we are with an SRIOV vbios */ |
1652 | adev->virtualization.supports_sr_iov = | 1649 | amdgpu_device_detect_sriov_bios(adev); |
1653 | amdgpu_atombios_has_gpu_virtualization_table(adev); | ||
1654 | |||
1655 | /* Check if we are executing in a virtualized environment */ | ||
1656 | adev->virtualization.is_virtual = amdgpu_device_is_virtual(); | ||
1657 | adev->virtualization.caps = amdgpu_asic_get_virtual_caps(adev); | ||
1658 | 1650 | ||
1659 | /* Post card if necessary */ | 1651 | /* Post card if necessary */ |
1660 | if (!amdgpu_card_posted(adev) || | 1652 | if (!amdgpu_sriov_vf(adev) && |
1661 | (adev->virtualization.is_virtual && | 1653 | (!amdgpu_card_posted(adev) || amdgpu_passthrough(adev))) { |
1662 | !(adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN))) { | ||
1663 | if (!adev->bios) { | 1654 | if (!adev->bios) { |
1664 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); | 1655 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); |
1665 | r = -EINVAL; | 1656 | r = -EINVAL; |
1666 | goto failed; | 1657 | goto failed; |
1667 | } | 1658 | } |
1668 | DRM_INFO("GPU not posted. posting now...\n"); | 1659 | DRM_INFO("GPU not posted. posting now...\n"); |
1669 | amdgpu_atom_asic_init(adev->mode_info.atom_context); | 1660 | r = amdgpu_atom_asic_init(adev->mode_info.atom_context); |
1661 | if (r) { | ||
1662 | dev_err(adev->dev, "gpu post error!\n"); | ||
1663 | goto failed; | ||
1664 | } | ||
1665 | } else { | ||
1666 | DRM_INFO("GPU post is not needed\n"); | ||
1670 | } | 1667 | } |
1671 | 1668 | ||
1672 | /* Initialize clocks */ | 1669 | /* Initialize clocks */ |