There is no vbios post during emulation, use the common hw_init to
simulate the post

Change-Id: If363766cdd1d0dee9505c5b390732a35e6b80dee
Signed-off-by: Shaoyun Liu <shaoyun....@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 05bf9b6..5ff784b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1340,6 +1340,20 @@ static int amdgpu_device_ip_init(struct amdgpu_device 
*adev)
                        return r;
                }
                adev->ip_blocks[i].status.sw = true;
+#ifdef AMDGPU_EMULATION_BUILD
+               /* Need to do common hw init first on emulation  */
+               if (adev->ip_blocks[i].version->type == 
AMD_IP_BLOCK_TYPE_COMMON) {
+                       DRM_DEBUG("hw_init of IP block %s\n",
+                               adev->ip_blocks[i].version->funcs->name);
+                       r = adev->ip_blocks[i].version->funcs->hw_init((void 
*)adev);
+                       if (r) {
+                               DRM_ERROR("hw_init of IP block <%s> failed 
%d\n",
+                                         
adev->ip_blocks[i].version->funcs->name, r);
+                               return r;
+                       }
+                       adev->ip_blocks[i].status.hw = true;
+               }
+#endif
                /* need to do gmc hw init early so we can allocate gpu mem */
                if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
                        r = amdgpu_device_vram_scratch_init(adev);
@@ -1373,8 +1387,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device 
*adev)
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (!adev->ip_blocks[i].status.sw)
                        continue;
-               /* gmc hw init is done early */
-               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC)
+               if (adev->ip_blocks[i].status.hw)
                        continue;
                r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
                if (r) {
@@ -1915,6 +1928,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        if (runtime)
                vga_switcheroo_init_domain_pm_ops(adev->dev, 
&adev->vga_pm_domain);
 
+#ifndef AMDGPU_EMULATION_BUILD
        /* Read BIOS */
        if (!amdgpu_get_bios(adev)) {
                r = -EINVAL;
@@ -1966,6 +1980,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                if (!amdgpu_device_has_dc_support(adev))
                        amdgpu_atombios_i2c_init(adev);
        }
+#endif
 
        /* Fence driver */
        r = amdgpu_fence_driver_init(adev);
@@ -2109,7 +2124,9 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        /* free i2c buses */
        if (!amdgpu_device_has_dc_support(adev))
                amdgpu_i2c_fini(adev);
+#ifndef AMDGPU_EMULATION_BUILD
        amdgpu_atombios_fini(adev);
+#endif
        kfree(adev->bios);
        adev->bios = NULL;
        if (!pci_is_thunderbolt_attached(adev->pdev))
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to