diff options
author | Shaoyun Liu <Shaoyun.Liu@amd.com> | 2018-02-01 17:37:50 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-02-19 14:19:47 -0500 |
commit | bfca02892773d2702aeeec9a290cf99464c3c0c1 (patch) | |
tree | 945557101cfa41ac3dd9f51b1457682323c9074d /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | 6c24a85d236eb2348d2e221993769fd93c168f65 (diff) |
drm/amdgpu: Basic emulation support
Add amdgpu_emu_mode module parameter to control the emulation mode
Avoid vbios operation on emulation since there is no vbios post duirng emulation,
use the common hw_init to simulate the post
Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Acked-By: Alex Deucher <alexander.deucher@amd.com>
Acked-By: Christian Konig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 628ed92fe9a2..3c0299bad59c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1310,6 +1310,20 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) | |||
1310 | return r; | 1310 | return r; |
1311 | } | 1311 | } |
1312 | adev->ip_blocks[i].status.sw = true; | 1312 | adev->ip_blocks[i].status.sw = true; |
1313 | |||
1314 | if (amdgpu_emu_mode == 1) { | ||
1315 | /* Need to do common hw init first on emulation */ | ||
1316 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON) { | ||
1317 | r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev); | ||
1318 | if (r) { | ||
1319 | DRM_ERROR("hw_init of IP block <%s> failed %d\n", | ||
1320 | adev->ip_blocks[i].version->funcs->name, r); | ||
1321 | return r; | ||
1322 | } | ||
1323 | adev->ip_blocks[i].status.hw = true; | ||
1324 | } | ||
1325 | } | ||
1326 | |||
1313 | /* need to do gmc hw init early so we can allocate gpu mem */ | 1327 | /* need to do gmc hw init early so we can allocate gpu mem */ |
1314 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { | 1328 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) { |
1315 | r = amdgpu_device_vram_scratch_init(adev); | 1329 | r = amdgpu_device_vram_scratch_init(adev); |
@@ -1343,8 +1357,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev) | |||
1343 | for (i = 0; i < adev->num_ip_blocks; i++) { | 1357 | for (i = 0; i < adev->num_ip_blocks; i++) { |
1344 | if (!adev->ip_blocks[i].status.sw) | 1358 | if (!adev->ip_blocks[i].status.sw) |
1345 | continue; | 1359 | continue; |
1346 | /* gmc hw init is done early */ | 1360 | if (adev->ip_blocks[i].status.hw) |
1347 | if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) | ||
1348 | continue; | 1361 | continue; |
1349 | r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev); | 1362 | r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev); |
1350 | if (r) { | 1363 | if (r) { |
@@ -1884,6 +1897,9 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1884 | if (runtime) | 1897 | if (runtime) |
1885 | vga_switcheroo_init_domain_pm_ops(adev->dev, &adev->vga_pm_domain); | 1898 | vga_switcheroo_init_domain_pm_ops(adev->dev, &adev->vga_pm_domain); |
1886 | 1899 | ||
1900 | if (amdgpu_emu_mode == 1) | ||
1901 | goto fence_driver_init; | ||
1902 | |||
1887 | /* Read BIOS */ | 1903 | /* Read BIOS */ |
1888 | if (!amdgpu_get_bios(adev)) { | 1904 | if (!amdgpu_get_bios(adev)) { |
1889 | r = -EINVAL; | 1905 | r = -EINVAL; |
@@ -1936,6 +1952,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1936 | amdgpu_atombios_i2c_init(adev); | 1952 | amdgpu_atombios_i2c_init(adev); |
1937 | } | 1953 | } |
1938 | 1954 | ||
1955 | fence_driver_init: | ||
1939 | /* Fence driver */ | 1956 | /* Fence driver */ |
1940 | r = amdgpu_fence_driver_init(adev); | 1957 | r = amdgpu_fence_driver_init(adev); |
1941 | if (r) { | 1958 | if (r) { |
@@ -2078,7 +2095,10 @@ void amdgpu_device_fini(struct amdgpu_device *adev) | |||
2078 | /* free i2c buses */ | 2095 | /* free i2c buses */ |
2079 | if (!amdgpu_device_has_dc_support(adev)) | 2096 | if (!amdgpu_device_has_dc_support(adev)) |
2080 | amdgpu_i2c_fini(adev); | 2097 | amdgpu_i2c_fini(adev); |
2081 | amdgpu_atombios_fini(adev); | 2098 | |
2099 | if (amdgpu_emu_mode != 1) | ||
2100 | amdgpu_atombios_fini(adev); | ||
2101 | |||
2082 | kfree(adev->bios); | 2102 | kfree(adev->bios); |
2083 | adev->bios = NULL; | 2103 | adev->bios = NULL; |
2084 | if (!pci_is_thunderbolt_attached(adev->pdev)) | 2104 | if (!pci_is_thunderbolt_attached(adev->pdev)) |