diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-15 20:24:13 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-15 20:24:13 -0400 |
commit | 0ab15bdeb2943bd6491a35ec4eeb53a9a4436525 (patch) | |
tree | 18158456567ce126e10de5adba7b51a9c7e4fe0a | |
parent | d9724d3b1d007fa042c768a2eec708f33d70539d (diff) | |
parent | 871fd8403de10b9ba9c284105475ab52b96be248 (diff) |
Merge branch 'drm-fixes-4.7' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
radeon and amdgpu fixes for 4.7. Highlights:
- fixes for GPU VM passthrough
- fixes for powerplay on Polaris GPUs
- pll fixes for rs780/880
* 'drm-fixes-4.7' of git://people.freedesktop.org/~agd5f/linux:
drm/amd/powerplay: select samu dpm 0 as boot level on polaris.
drm/amd/powerplay: update powerplay table parsing
Revert "drm/amdgpu: add pipeline sync while vmid switch in same ctx"
drm/amdgpu/gfx7: fix broken condition check
drm/radeon: fix asic initialization for virtualized environments
amdgpu: fix asic initialization for virtualized environments (v2)
drm/radeon: don't use fractional dividers on RS[78]80 if SS is enabled
drm/radeon: do not hard reset GPU while freezing on r600/r700 family
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/cik.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vi.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | 91 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/atombios_crtc.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 23 |
13 files changed, 175 insertions, 56 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 01c36b8d6222..e055d5be1c3c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -799,7 +799,6 @@ struct amdgpu_ring { | |||
799 | unsigned cond_exe_offs; | 799 | unsigned cond_exe_offs; |
800 | u64 cond_exe_gpu_addr; | 800 | u64 cond_exe_gpu_addr; |
801 | volatile u32 *cond_exe_cpu_addr; | 801 | volatile u32 *cond_exe_cpu_addr; |
802 | int vmid; | ||
803 | }; | 802 | }; |
804 | 803 | ||
805 | /* | 804 | /* |
@@ -937,8 +936,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
937 | unsigned vm_id, uint64_t pd_addr, | 936 | unsigned vm_id, uint64_t pd_addr, |
938 | uint32_t gds_base, uint32_t gds_size, | 937 | uint32_t gds_base, uint32_t gds_size, |
939 | uint32_t gws_base, uint32_t gws_size, | 938 | uint32_t gws_base, uint32_t gws_size, |
940 | uint32_t oa_base, uint32_t oa_size, | 939 | uint32_t oa_base, uint32_t oa_size); |
941 | bool vmid_switch); | ||
942 | void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vm_id); | 940 | void amdgpu_vm_reset_id(struct amdgpu_device *adev, unsigned vm_id); |
943 | uint64_t amdgpu_vm_map_gart(const dma_addr_t *pages_addr, uint64_t addr); | 941 | uint64_t amdgpu_vm_map_gart(const dma_addr_t *pages_addr, uint64_t addr); |
944 | int amdgpu_vm_update_page_directory(struct amdgpu_device *adev, | 942 | int amdgpu_vm_update_page_directory(struct amdgpu_device *adev, |
@@ -1822,6 +1820,8 @@ struct amdgpu_asic_funcs { | |||
1822 | /* MM block clocks */ | 1820 | /* MM block clocks */ |
1823 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); | 1821 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); |
1824 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); | 1822 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); |
1823 | /* query virtual capabilities */ | ||
1824 | u32 (*get_virtual_caps)(struct amdgpu_device *adev); | ||
1825 | }; | 1825 | }; |
1826 | 1826 | ||
1827 | /* | 1827 | /* |
@@ -1916,8 +1916,12 @@ void amdgpu_cgs_destroy_device(struct cgs_device *cgs_device); | |||
1916 | 1916 | ||
1917 | 1917 | ||
1918 | /* GPU virtualization */ | 1918 | /* GPU virtualization */ |
1919 | #define AMDGPU_VIRT_CAPS_SRIOV_EN (1 << 0) | ||
1920 | #define AMDGPU_VIRT_CAPS_IS_VF (1 << 1) | ||
1919 | struct amdgpu_virtualization { | 1921 | struct amdgpu_virtualization { |
1920 | bool supports_sr_iov; | 1922 | bool supports_sr_iov; |
1923 | bool is_virtual; | ||
1924 | u32 caps; | ||
1921 | }; | 1925 | }; |
1922 | 1926 | ||
1923 | /* | 1927 | /* |
@@ -2206,6 +2210,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
2206 | #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev)) | 2210 | #define amdgpu_asic_get_xclk(adev) (adev)->asic_funcs->get_xclk((adev)) |
2207 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) | 2211 | #define amdgpu_asic_set_uvd_clocks(adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d)) |
2208 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) | 2212 | #define amdgpu_asic_set_vce_clocks(adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec)) |
2213 | #define amdgpu_asic_get_virtual_caps(adev) ((adev)->asic_funcs->get_virtual_caps((adev))) | ||
2209 | #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev)) | 2214 | #define amdgpu_asic_get_gpu_clock_counter(adev) (adev)->asic_funcs->get_gpu_clock_counter((adev)) |
2210 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) | 2215 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) |
2211 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) | 2216 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 964f31404f17..66482b429458 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1385,6 +1385,15 @@ static int amdgpu_resume(struct amdgpu_device *adev) | |||
1385 | return 0; | 1385 | return 0; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | static bool amdgpu_device_is_virtual(void) | ||
1389 | { | ||
1390 | #ifdef CONFIG_X86 | ||
1391 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
1392 | #else | ||
1393 | return false; | ||
1394 | #endif | ||
1395 | } | ||
1396 | |||
1388 | /** | 1397 | /** |
1389 | * amdgpu_device_init - initialize the driver | 1398 | * amdgpu_device_init - initialize the driver |
1390 | * | 1399 | * |
@@ -1519,8 +1528,14 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
1519 | adev->virtualization.supports_sr_iov = | 1528 | adev->virtualization.supports_sr_iov = |
1520 | amdgpu_atombios_has_gpu_virtualization_table(adev); | 1529 | amdgpu_atombios_has_gpu_virtualization_table(adev); |
1521 | 1530 | ||
1531 | /* Check if we are executing in a virtualized environment */ | ||
1532 | adev->virtualization.is_virtual = amdgpu_device_is_virtual(); | ||
1533 | adev->virtualization.caps = amdgpu_asic_get_virtual_caps(adev); | ||
1534 | |||
1522 | /* Post card if necessary */ | 1535 | /* Post card if necessary */ |
1523 | if (!amdgpu_card_posted(adev)) { | 1536 | if (!amdgpu_card_posted(adev) || |
1537 | (adev->virtualization.is_virtual && | ||
1538 | !adev->virtualization.caps & AMDGPU_VIRT_CAPS_SRIOV_EN)) { | ||
1524 | if (!adev->bios) { | 1539 | if (!adev->bios) { |
1525 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); | 1540 | dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n"); |
1526 | return -EINVAL; | 1541 | return -EINVAL; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 7a0b1e50f293..34e35423b78e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |||
@@ -122,7 +122,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
122 | bool skip_preamble, need_ctx_switch; | 122 | bool skip_preamble, need_ctx_switch; |
123 | unsigned patch_offset = ~0; | 123 | unsigned patch_offset = ~0; |
124 | struct amdgpu_vm *vm; | 124 | struct amdgpu_vm *vm; |
125 | int vmid = 0, old_vmid = ring->vmid; | ||
126 | struct fence *hwf; | 125 | struct fence *hwf; |
127 | uint64_t ctx; | 126 | uint64_t ctx; |
128 | 127 | ||
@@ -136,11 +135,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
136 | if (job) { | 135 | if (job) { |
137 | vm = job->vm; | 136 | vm = job->vm; |
138 | ctx = job->ctx; | 137 | ctx = job->ctx; |
139 | vmid = job->vm_id; | ||
140 | } else { | 138 | } else { |
141 | vm = NULL; | 139 | vm = NULL; |
142 | ctx = 0; | 140 | ctx = 0; |
143 | vmid = 0; | ||
144 | } | 141 | } |
145 | 142 | ||
146 | if (!ring->ready) { | 143 | if (!ring->ready) { |
@@ -166,8 +163,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
166 | r = amdgpu_vm_flush(ring, job->vm_id, job->vm_pd_addr, | 163 | r = amdgpu_vm_flush(ring, job->vm_id, job->vm_pd_addr, |
167 | job->gds_base, job->gds_size, | 164 | job->gds_base, job->gds_size, |
168 | job->gws_base, job->gws_size, | 165 | job->gws_base, job->gws_size, |
169 | job->oa_base, job->oa_size, | 166 | job->oa_base, job->oa_size); |
170 | (ring->current_ctx == ctx) && (old_vmid != vmid)); | ||
171 | if (r) { | 167 | if (r) { |
172 | amdgpu_ring_undo(ring); | 168 | amdgpu_ring_undo(ring); |
173 | return r; | 169 | return r; |
@@ -184,6 +180,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
184 | need_ctx_switch = ring->current_ctx != ctx; | 180 | need_ctx_switch = ring->current_ctx != ctx; |
185 | for (i = 0; i < num_ibs; ++i) { | 181 | for (i = 0; i < num_ibs; ++i) { |
186 | ib = &ibs[i]; | 182 | ib = &ibs[i]; |
183 | |||
187 | /* drop preamble IBs if we don't have a context switch */ | 184 | /* drop preamble IBs if we don't have a context switch */ |
188 | if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble) | 185 | if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble) |
189 | continue; | 186 | continue; |
@@ -191,7 +188,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
191 | amdgpu_ring_emit_ib(ring, ib, job ? job->vm_id : 0, | 188 | amdgpu_ring_emit_ib(ring, ib, job ? job->vm_id : 0, |
192 | need_ctx_switch); | 189 | need_ctx_switch); |
193 | need_ctx_switch = false; | 190 | need_ctx_switch = false; |
194 | ring->vmid = vmid; | ||
195 | } | 191 | } |
196 | 192 | ||
197 | if (ring->funcs->emit_hdp_invalidate) | 193 | if (ring->funcs->emit_hdp_invalidate) |
@@ -202,7 +198,6 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
202 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); | 198 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); |
203 | if (job && job->vm_id) | 199 | if (job && job->vm_id) |
204 | amdgpu_vm_reset_id(adev, job->vm_id); | 200 | amdgpu_vm_reset_id(adev, job->vm_id); |
205 | ring->vmid = old_vmid; | ||
206 | amdgpu_ring_undo(ring); | 201 | amdgpu_ring_undo(ring); |
207 | return r; | 202 | return r; |
208 | } | 203 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 62a4c127620f..9f36ed30ba11 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -298,8 +298,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
298 | unsigned vm_id, uint64_t pd_addr, | 298 | unsigned vm_id, uint64_t pd_addr, |
299 | uint32_t gds_base, uint32_t gds_size, | 299 | uint32_t gds_base, uint32_t gds_size, |
300 | uint32_t gws_base, uint32_t gws_size, | 300 | uint32_t gws_base, uint32_t gws_size, |
301 | uint32_t oa_base, uint32_t oa_size, | 301 | uint32_t oa_base, uint32_t oa_size) |
302 | bool vmid_switch) | ||
303 | { | 302 | { |
304 | struct amdgpu_device *adev = ring->adev; | 303 | struct amdgpu_device *adev = ring->adev; |
305 | struct amdgpu_vm_id *id = &adev->vm_manager.ids[vm_id]; | 304 | struct amdgpu_vm_id *id = &adev->vm_manager.ids[vm_id]; |
@@ -313,7 +312,8 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
313 | int r; | 312 | int r; |
314 | 313 | ||
315 | if (ring->funcs->emit_pipeline_sync && ( | 314 | if (ring->funcs->emit_pipeline_sync && ( |
316 | pd_addr != AMDGPU_VM_NO_FLUSH || gds_switch_needed || vmid_switch)) | 315 | pd_addr != AMDGPU_VM_NO_FLUSH || gds_switch_needed || |
316 | ring->type == AMDGPU_RING_TYPE_COMPUTE)) | ||
317 | amdgpu_ring_emit_pipeline_sync(ring); | 317 | amdgpu_ring_emit_pipeline_sync(ring); |
318 | 318 | ||
319 | if (ring->funcs->emit_vm_flush && | 319 | if (ring->funcs->emit_vm_flush && |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index 07bc795a4ca9..910431808542 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c | |||
@@ -962,6 +962,12 @@ static bool cik_read_bios_from_rom(struct amdgpu_device *adev, | |||
962 | return true; | 962 | return true; |
963 | } | 963 | } |
964 | 964 | ||
965 | static u32 cik_get_virtual_caps(struct amdgpu_device *adev) | ||
966 | { | ||
967 | /* CIK does not support SR-IOV */ | ||
968 | return 0; | ||
969 | } | ||
970 | |||
965 | static const struct amdgpu_allowed_register_entry cik_allowed_read_registers[] = { | 971 | static const struct amdgpu_allowed_register_entry cik_allowed_read_registers[] = { |
966 | {mmGRBM_STATUS, false}, | 972 | {mmGRBM_STATUS, false}, |
967 | {mmGB_ADDR_CONFIG, false}, | 973 | {mmGB_ADDR_CONFIG, false}, |
@@ -2007,6 +2013,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = | |||
2007 | .get_xclk = &cik_get_xclk, | 2013 | .get_xclk = &cik_get_xclk, |
2008 | .set_uvd_clocks = &cik_set_uvd_clocks, | 2014 | .set_uvd_clocks = &cik_set_uvd_clocks, |
2009 | .set_vce_clocks = &cik_set_vce_clocks, | 2015 | .set_vce_clocks = &cik_set_vce_clocks, |
2016 | .get_virtual_caps = &cik_get_virtual_caps, | ||
2010 | /* these should be moved to their own ip modules */ | 2017 | /* these should be moved to their own ip modules */ |
2011 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, | 2018 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, |
2012 | .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle, | 2019 | .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle, |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 8c6ad1e72f02..fc8ff4d3ccf8 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
@@ -4833,7 +4833,7 @@ static int gfx_v7_0_eop_irq(struct amdgpu_device *adev, | |||
4833 | case 2: | 4833 | case 2: |
4834 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { | 4834 | for (i = 0; i < adev->gfx.num_compute_rings; i++) { |
4835 | ring = &adev->gfx.compute_ring[i]; | 4835 | ring = &adev->gfx.compute_ring[i]; |
4836 | if ((ring->me == me_id) & (ring->pipe == pipe_id)) | 4836 | if ((ring->me == me_id) && (ring->pipe == pipe_id)) |
4837 | amdgpu_fence_process(ring); | 4837 | amdgpu_fence_process(ring); |
4838 | } | 4838 | } |
4839 | break; | 4839 | break; |
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index 2c88d0b66cf3..a65c96029476 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
@@ -421,6 +421,20 @@ static bool vi_read_bios_from_rom(struct amdgpu_device *adev, | |||
421 | return true; | 421 | return true; |
422 | } | 422 | } |
423 | 423 | ||
424 | static u32 vi_get_virtual_caps(struct amdgpu_device *adev) | ||
425 | { | ||
426 | u32 caps = 0; | ||
427 | u32 reg = RREG32(mmBIF_IOV_FUNC_IDENTIFIER); | ||
428 | |||
429 | if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, IOV_ENABLE)) | ||
430 | caps |= AMDGPU_VIRT_CAPS_SRIOV_EN; | ||
431 | |||
432 | if (REG_GET_FIELD(reg, BIF_IOV_FUNC_IDENTIFIER, FUNC_IDENTIFIER)) | ||
433 | caps |= AMDGPU_VIRT_CAPS_IS_VF; | ||
434 | |||
435 | return caps; | ||
436 | } | ||
437 | |||
424 | static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = { | 438 | static const struct amdgpu_allowed_register_entry tonga_allowed_read_registers[] = { |
425 | {mmGB_MACROTILE_MODE7, true}, | 439 | {mmGB_MACROTILE_MODE7, true}, |
426 | }; | 440 | }; |
@@ -1118,6 +1132,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = | |||
1118 | .get_xclk = &vi_get_xclk, | 1132 | .get_xclk = &vi_get_xclk, |
1119 | .set_uvd_clocks = &vi_set_uvd_clocks, | 1133 | .set_uvd_clocks = &vi_set_uvd_clocks, |
1120 | .set_vce_clocks = &vi_set_vce_clocks, | 1134 | .set_vce_clocks = &vi_set_vce_clocks, |
1135 | .get_virtual_caps = &vi_get_virtual_caps, | ||
1121 | /* these should be moved to their own ip modules */ | 1136 | /* these should be moved to their own ip modules */ |
1122 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, | 1137 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, |
1123 | .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle, | 1138 | .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle, |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h index 347fef127ce9..2930a3355948 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr_ppt.h | |||
@@ -39,6 +39,7 @@ struct phm_ppt_v1_clock_voltage_dependency_record { | |||
39 | uint8_t phases; | 39 | uint8_t phases; |
40 | uint8_t cks_enable; | 40 | uint8_t cks_enable; |
41 | uint8_t cks_voffset; | 41 | uint8_t cks_voffset; |
42 | uint32_t sclk_offset; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | typedef struct phm_ppt_v1_clock_voltage_dependency_record phm_ppt_v1_clock_voltage_dependency_record; | 45 | typedef struct phm_ppt_v1_clock_voltage_dependency_record phm_ppt_v1_clock_voltage_dependency_record; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index aa6be033f21b..1400bc420881 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
@@ -999,7 +999,7 @@ static int polaris10_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, | |||
999 | vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), | 999 | vddci = phm_find_closest_vddci(&(data->vddci_voltage_table), |
1000 | (dep_table->entries[i].vddc - | 1000 | (dep_table->entries[i].vddc - |
1001 | (uint16_t)data->vddc_vddci_delta)); | 1001 | (uint16_t)data->vddc_vddci_delta)); |
1002 | *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; | 1002 | *voltage |= (vddci * VOLTAGE_SCALE) << VDDCI_SHIFT; |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | if (POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) | 1005 | if (POLARIS10_VOLTAGE_CONTROL_NONE == data->mvdd_control) |
@@ -3520,10 +3520,11 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, | |||
3520 | ATOM_Tonga_State *state_entry = (ATOM_Tonga_State *)state; | 3520 | ATOM_Tonga_State *state_entry = (ATOM_Tonga_State *)state; |
3521 | ATOM_Tonga_POWERPLAYTABLE *powerplay_table = | 3521 | ATOM_Tonga_POWERPLAYTABLE *powerplay_table = |
3522 | (ATOM_Tonga_POWERPLAYTABLE *)pp_table; | 3522 | (ATOM_Tonga_POWERPLAYTABLE *)pp_table; |
3523 | ATOM_Tonga_SCLK_Dependency_Table *sclk_dep_table = | 3523 | PPTable_Generic_SubTable_Header *sclk_dep_table = |
3524 | (ATOM_Tonga_SCLK_Dependency_Table *) | 3524 | (PPTable_Generic_SubTable_Header *) |
3525 | (((unsigned long)powerplay_table) + | 3525 | (((unsigned long)powerplay_table) + |
3526 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); | 3526 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); |
3527 | |||
3527 | ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = | 3528 | ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = |
3528 | (ATOM_Tonga_MCLK_Dependency_Table *) | 3529 | (ATOM_Tonga_MCLK_Dependency_Table *) |
3529 | (((unsigned long)powerplay_table) + | 3530 | (((unsigned long)powerplay_table) + |
@@ -3575,7 +3576,11 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, | |||
3575 | /* Performance levels are arranged from low to high. */ | 3576 | /* Performance levels are arranged from low to high. */ |
3576 | performance_level->memory_clock = mclk_dep_table->entries | 3577 | performance_level->memory_clock = mclk_dep_table->entries |
3577 | [state_entry->ucMemoryClockIndexLow].ulMclk; | 3578 | [state_entry->ucMemoryClockIndexLow].ulMclk; |
3578 | performance_level->engine_clock = sclk_dep_table->entries | 3579 | if (sclk_dep_table->ucRevId == 0) |
3580 | performance_level->engine_clock = ((ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
3581 | [state_entry->ucEngineClockIndexLow].ulSclk; | ||
3582 | else if (sclk_dep_table->ucRevId == 1) | ||
3583 | performance_level->engine_clock = ((ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
3579 | [state_entry->ucEngineClockIndexLow].ulSclk; | 3584 | [state_entry->ucEngineClockIndexLow].ulSclk; |
3580 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, | 3585 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, |
3581 | state_entry->ucPCIEGenLow); | 3586 | state_entry->ucPCIEGenLow); |
@@ -3586,8 +3591,14 @@ static int polaris10_get_pp_table_entry_callback_func(struct pp_hwmgr *hwmgr, | |||
3586 | [polaris10_power_state->performance_level_count++]); | 3591 | [polaris10_power_state->performance_level_count++]); |
3587 | performance_level->memory_clock = mclk_dep_table->entries | 3592 | performance_level->memory_clock = mclk_dep_table->entries |
3588 | [state_entry->ucMemoryClockIndexHigh].ulMclk; | 3593 | [state_entry->ucMemoryClockIndexHigh].ulMclk; |
3589 | performance_level->engine_clock = sclk_dep_table->entries | 3594 | |
3595 | if (sclk_dep_table->ucRevId == 0) | ||
3596 | performance_level->engine_clock = ((ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
3590 | [state_entry->ucEngineClockIndexHigh].ulSclk; | 3597 | [state_entry->ucEngineClockIndexHigh].ulSclk; |
3598 | else if (sclk_dep_table->ucRevId == 1) | ||
3599 | performance_level->engine_clock = ((ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table)->entries | ||
3600 | [state_entry->ucEngineClockIndexHigh].ulSclk; | ||
3601 | |||
3591 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, | 3602 | performance_level->pcie_gen = get_pcie_gen_support(data->pcie_gen_cap, |
3592 | state_entry->ucPCIEGenHigh); | 3603 | state_entry->ucPCIEGenHigh); |
3593 | performance_level->pcie_lane = get_pcie_lane_support(data->pcie_lane_cap, | 3604 | performance_level->pcie_lane = get_pcie_lane_support(data->pcie_lane_cap, |
@@ -3645,7 +3656,6 @@ static int polaris10_get_pp_table_entry(struct pp_hwmgr *hwmgr, | |||
3645 | switch (state->classification.ui_label) { | 3656 | switch (state->classification.ui_label) { |
3646 | case PP_StateUILabel_Performance: | 3657 | case PP_StateUILabel_Performance: |
3647 | data->use_pcie_performance_levels = true; | 3658 | data->use_pcie_performance_levels = true; |
3648 | |||
3649 | for (i = 0; i < ps->performance_level_count; i++) { | 3659 | for (i = 0; i < ps->performance_level_count; i++) { |
3650 | if (data->pcie_gen_performance.max < | 3660 | if (data->pcie_gen_performance.max < |
3651 | ps->performance_levels[i].pcie_gen) | 3661 | ps->performance_levels[i].pcie_gen) |
@@ -3661,7 +3671,6 @@ static int polaris10_get_pp_table_entry(struct pp_hwmgr *hwmgr, | |||
3661 | ps->performance_levels[i].pcie_lane) | 3671 | ps->performance_levels[i].pcie_lane) |
3662 | data->pcie_lane_performance.max = | 3672 | data->pcie_lane_performance.max = |
3663 | ps->performance_levels[i].pcie_lane; | 3673 | ps->performance_levels[i].pcie_lane; |
3664 | |||
3665 | if (data->pcie_lane_performance.min > | 3674 | if (data->pcie_lane_performance.min > |
3666 | ps->performance_levels[i].pcie_lane) | 3675 | ps->performance_levels[i].pcie_lane) |
3667 | data->pcie_lane_performance.min = | 3676 | data->pcie_lane_performance.min = |
@@ -4187,12 +4196,9 @@ int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate) | |||
4187 | { | 4196 | { |
4188 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); | 4197 | struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); |
4189 | uint32_t mm_boot_level_offset, mm_boot_level_value; | 4198 | uint32_t mm_boot_level_offset, mm_boot_level_value; |
4190 | struct phm_ppt_v1_information *table_info = | ||
4191 | (struct phm_ppt_v1_information *)(hwmgr->pptable); | ||
4192 | 4199 | ||
4193 | if (!bgate) { | 4200 | if (!bgate) { |
4194 | data->smc_state_table.SamuBootLevel = | 4201 | data->smc_state_table.SamuBootLevel = 0; |
4195 | (uint8_t) (table_info->mm_dep_table->count - 1); | ||
4196 | mm_boot_level_offset = data->dpm_table_start + | 4202 | mm_boot_level_offset = data->dpm_table_start + |
4197 | offsetof(SMU74_Discrete_DpmTable, SamuBootLevel); | 4203 | offsetof(SMU74_Discrete_DpmTable, SamuBootLevel); |
4198 | mm_boot_level_offset /= 4; | 4204 | mm_boot_level_offset /= 4; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h index 1b44f4e9b8f5..f127198aafc4 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_pptable.h | |||
@@ -197,6 +197,22 @@ typedef struct _ATOM_Tonga_SCLK_Dependency_Table { | |||
197 | ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ | 197 | ATOM_Tonga_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ |
198 | } ATOM_Tonga_SCLK_Dependency_Table; | 198 | } ATOM_Tonga_SCLK_Dependency_Table; |
199 | 199 | ||
200 | typedef struct _ATOM_Polaris_SCLK_Dependency_Record { | ||
201 | UCHAR ucVddInd; /* Base voltage */ | ||
202 | USHORT usVddcOffset; /* Offset relative to base voltage */ | ||
203 | ULONG ulSclk; | ||
204 | USHORT usEdcCurrent; | ||
205 | UCHAR ucReliabilityTemperature; | ||
206 | UCHAR ucCKSVOffsetandDisable; /* Bits 0~6: Voltage offset for CKS, Bit 7: Disable/enable for the SCLK level. */ | ||
207 | ULONG ulSclkOffset; | ||
208 | } ATOM_Polaris_SCLK_Dependency_Record; | ||
209 | |||
210 | typedef struct _ATOM_Polaris_SCLK_Dependency_Table { | ||
211 | UCHAR ucRevId; | ||
212 | UCHAR ucNumEntries; /* Number of entries. */ | ||
213 | ATOM_Polaris_SCLK_Dependency_Record entries[1]; /* Dynamically allocate entries. */ | ||
214 | } ATOM_Polaris_SCLK_Dependency_Table; | ||
215 | |||
200 | typedef struct _ATOM_Tonga_PCIE_Record { | 216 | typedef struct _ATOM_Tonga_PCIE_Record { |
201 | UCHAR ucPCIEGenSpeed; | 217 | UCHAR ucPCIEGenSpeed; |
202 | UCHAR usPCIELaneWidth; | 218 | UCHAR usPCIELaneWidth; |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c index 296ec7ef6d45..671fdb4d615a 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_processpptables.c | |||
@@ -408,41 +408,78 @@ static int get_mclk_voltage_dependency_table( | |||
408 | static int get_sclk_voltage_dependency_table( | 408 | static int get_sclk_voltage_dependency_table( |
409 | struct pp_hwmgr *hwmgr, | 409 | struct pp_hwmgr *hwmgr, |
410 | phm_ppt_v1_clock_voltage_dependency_table **pp_tonga_sclk_dep_table, | 410 | phm_ppt_v1_clock_voltage_dependency_table **pp_tonga_sclk_dep_table, |
411 | const ATOM_Tonga_SCLK_Dependency_Table * sclk_dep_table | 411 | const PPTable_Generic_SubTable_Header *sclk_dep_table |
412 | ) | 412 | ) |
413 | { | 413 | { |
414 | uint32_t table_size, i; | 414 | uint32_t table_size, i; |
415 | phm_ppt_v1_clock_voltage_dependency_table *sclk_table; | 415 | phm_ppt_v1_clock_voltage_dependency_table *sclk_table; |
416 | 416 | ||
417 | PP_ASSERT_WITH_CODE((0 != sclk_dep_table->ucNumEntries), | 417 | if (sclk_dep_table->ucRevId < 1) { |
418 | "Invalid PowerPlay Table!", return -1); | 418 | const ATOM_Tonga_SCLK_Dependency_Table *tonga_table = |
419 | (ATOM_Tonga_SCLK_Dependency_Table *)sclk_dep_table; | ||
419 | 420 | ||
420 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) | 421 | PP_ASSERT_WITH_CODE((0 != tonga_table->ucNumEntries), |
421 | * sclk_dep_table->ucNumEntries; | 422 | "Invalid PowerPlay Table!", return -1); |
422 | 423 | ||
423 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) | 424 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) |
424 | kzalloc(table_size, GFP_KERNEL); | 425 | * tonga_table->ucNumEntries; |
425 | 426 | ||
426 | if (NULL == sclk_table) | 427 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) |
427 | return -ENOMEM; | 428 | kzalloc(table_size, GFP_KERNEL); |
428 | 429 | ||
429 | memset(sclk_table, 0x00, table_size); | 430 | if (NULL == sclk_table) |
430 | 431 | return -ENOMEM; | |
431 | sclk_table->count = (uint32_t)sclk_dep_table->ucNumEntries; | 432 | |
432 | 433 | memset(sclk_table, 0x00, table_size); | |
433 | for (i = 0; i < sclk_dep_table->ucNumEntries; i++) { | 434 | |
434 | sclk_table->entries[i].vddInd = | 435 | sclk_table->count = (uint32_t)tonga_table->ucNumEntries; |
435 | sclk_dep_table->entries[i].ucVddInd; | 436 | |
436 | sclk_table->entries[i].vdd_offset = | 437 | for (i = 0; i < tonga_table->ucNumEntries; i++) { |
437 | sclk_dep_table->entries[i].usVddcOffset; | 438 | sclk_table->entries[i].vddInd = |
438 | sclk_table->entries[i].clk = | 439 | tonga_table->entries[i].ucVddInd; |
439 | sclk_dep_table->entries[i].ulSclk; | 440 | sclk_table->entries[i].vdd_offset = |
440 | sclk_table->entries[i].cks_enable = | 441 | tonga_table->entries[i].usVddcOffset; |
441 | (((sclk_dep_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0; | 442 | sclk_table->entries[i].clk = |
442 | sclk_table->entries[i].cks_voffset = | 443 | tonga_table->entries[i].ulSclk; |
443 | (sclk_dep_table->entries[i].ucCKSVOffsetandDisable & 0x7F); | 444 | sclk_table->entries[i].cks_enable = |
444 | } | 445 | (((tonga_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0; |
446 | sclk_table->entries[i].cks_voffset = | ||
447 | (tonga_table->entries[i].ucCKSVOffsetandDisable & 0x7F); | ||
448 | } | ||
449 | } else { | ||
450 | const ATOM_Polaris_SCLK_Dependency_Table *polaris_table = | ||
451 | (ATOM_Polaris_SCLK_Dependency_Table *)sclk_dep_table; | ||
445 | 452 | ||
453 | PP_ASSERT_WITH_CODE((0 != polaris_table->ucNumEntries), | ||
454 | "Invalid PowerPlay Table!", return -1); | ||
455 | |||
456 | table_size = sizeof(uint32_t) + sizeof(phm_ppt_v1_clock_voltage_dependency_record) | ||
457 | * polaris_table->ucNumEntries; | ||
458 | |||
459 | sclk_table = (phm_ppt_v1_clock_voltage_dependency_table *) | ||
460 | kzalloc(table_size, GFP_KERNEL); | ||
461 | |||
462 | if (NULL == sclk_table) | ||
463 | return -ENOMEM; | ||
464 | |||
465 | memset(sclk_table, 0x00, table_size); | ||
466 | |||
467 | sclk_table->count = (uint32_t)polaris_table->ucNumEntries; | ||
468 | |||
469 | for (i = 0; i < polaris_table->ucNumEntries; i++) { | ||
470 | sclk_table->entries[i].vddInd = | ||
471 | polaris_table->entries[i].ucVddInd; | ||
472 | sclk_table->entries[i].vdd_offset = | ||
473 | polaris_table->entries[i].usVddcOffset; | ||
474 | sclk_table->entries[i].clk = | ||
475 | polaris_table->entries[i].ulSclk; | ||
476 | sclk_table->entries[i].cks_enable = | ||
477 | (((polaris_table->entries[i].ucCKSVOffsetandDisable & 0x80) >> 7) == 0) ? 1 : 0; | ||
478 | sclk_table->entries[i].cks_voffset = | ||
479 | (polaris_table->entries[i].ucCKSVOffsetandDisable & 0x7F); | ||
480 | sclk_table->entries[i].sclk_offset = polaris_table->entries[i].ulSclkOffset; | ||
481 | } | ||
482 | } | ||
446 | *pp_tonga_sclk_dep_table = sclk_table; | 483 | *pp_tonga_sclk_dep_table = sclk_table; |
447 | 484 | ||
448 | return 0; | 485 | return 0; |
@@ -708,8 +745,8 @@ static int init_clock_voltage_dependency( | |||
708 | const ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = | 745 | const ATOM_Tonga_MCLK_Dependency_Table *mclk_dep_table = |
709 | (const ATOM_Tonga_MCLK_Dependency_Table *)(((unsigned long) powerplay_table) + | 746 | (const ATOM_Tonga_MCLK_Dependency_Table *)(((unsigned long) powerplay_table) + |
710 | le16_to_cpu(powerplay_table->usMclkDependencyTableOffset)); | 747 | le16_to_cpu(powerplay_table->usMclkDependencyTableOffset)); |
711 | const ATOM_Tonga_SCLK_Dependency_Table *sclk_dep_table = | 748 | const PPTable_Generic_SubTable_Header *sclk_dep_table = |
712 | (const ATOM_Tonga_SCLK_Dependency_Table *)(((unsigned long) powerplay_table) + | 749 | (const PPTable_Generic_SubTable_Header *)(((unsigned long) powerplay_table) + |
713 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); | 750 | le16_to_cpu(powerplay_table->usSclkDependencyTableOffset)); |
714 | const ATOM_Tonga_Hard_Limit_Table *pHardLimits = | 751 | const ATOM_Tonga_Hard_Limit_Table *pHardLimits = |
715 | (const ATOM_Tonga_Hard_Limit_Table *)(((unsigned long) powerplay_table) + | 752 | (const ATOM_Tonga_Hard_Limit_Table *)(((unsigned long) powerplay_table) + |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 2e216e2ea78c..259cd6e6d71c 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -589,7 +589,8 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
589 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev) || ASIC_IS_DCE8(rdev)) | 589 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev) || ASIC_IS_DCE8(rdev)) |
590 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 590 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
591 | /* use frac fb div on RS780/RS880 */ | 591 | /* use frac fb div on RS780/RS880 */ |
592 | if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) | 592 | if (((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880)) |
593 | && !radeon_crtc->ss_enabled) | ||
593 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 594 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
594 | if (ASIC_IS_DCE32(rdev) && mode->clock > 165000) | 595 | if (ASIC_IS_DCE32(rdev) && mode->clock > 165000) |
595 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 596 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
@@ -626,7 +627,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
626 | if (radeon_crtc->ss.refdiv) { | 627 | if (radeon_crtc->ss.refdiv) { |
627 | radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV; | 628 | radeon_crtc->pll_flags |= RADEON_PLL_USE_REF_DIV; |
628 | radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv; | 629 | radeon_crtc->pll_reference_div = radeon_crtc->ss.refdiv; |
629 | if (ASIC_IS_AVIVO(rdev)) | 630 | if (rdev->family >= CHIP_RV770) |
630 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; | 631 | radeon_crtc->pll_flags |= RADEON_PLL_USE_FRAC_FB_DIV; |
631 | } | 632 | } |
632 | } | 633 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index e721e6b2766e..21c44b2293bc 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -630,6 +630,23 @@ void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
630 | /* | 630 | /* |
631 | * GPU helpers function. | 631 | * GPU helpers function. |
632 | */ | 632 | */ |
633 | |||
634 | /** | ||
635 | * radeon_device_is_virtual - check if we are running is a virtual environment | ||
636 | * | ||
637 | * Check if the asic has been passed through to a VM (all asics). | ||
638 | * Used at driver startup. | ||
639 | * Returns true if virtual or false if not. | ||
640 | */ | ||
641 | static bool radeon_device_is_virtual(void) | ||
642 | { | ||
643 | #ifdef CONFIG_X86 | ||
644 | return boot_cpu_has(X86_FEATURE_HYPERVISOR); | ||
645 | #else | ||
646 | return false; | ||
647 | #endif | ||
648 | } | ||
649 | |||
633 | /** | 650 | /** |
634 | * radeon_card_posted - check if the hw has already been initialized | 651 | * radeon_card_posted - check if the hw has already been initialized |
635 | * | 652 | * |
@@ -643,6 +660,10 @@ bool radeon_card_posted(struct radeon_device *rdev) | |||
643 | { | 660 | { |
644 | uint32_t reg; | 661 | uint32_t reg; |
645 | 662 | ||
663 | /* for pass through, always force asic_init */ | ||
664 | if (radeon_device_is_virtual()) | ||
665 | return false; | ||
666 | |||
646 | /* required for EFI mode on macbook2,1 which uses an r5xx asic */ | 667 | /* required for EFI mode on macbook2,1 which uses an r5xx asic */ |
647 | if (efi_enabled(EFI_BOOT) && | 668 | if (efi_enabled(EFI_BOOT) && |
648 | (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && | 669 | (rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && |
@@ -1631,7 +1652,7 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, | |||
1631 | radeon_agp_suspend(rdev); | 1652 | radeon_agp_suspend(rdev); |
1632 | 1653 | ||
1633 | pci_save_state(dev->pdev); | 1654 | pci_save_state(dev->pdev); |
1634 | if (freeze && rdev->family >= CHIP_R600) { | 1655 | if (freeze && rdev->family >= CHIP_CEDAR) { |
1635 | rdev->asic->asic_reset(rdev, true); | 1656 | rdev->asic->asic_reset(rdev, true); |
1636 | pci_restore_state(dev->pdev); | 1657 | pci_restore_state(dev->pdev); |
1637 | } else if (suspend) { | 1658 | } else if (suspend) { |