diff options
author | Dave Airlie <airlied@redhat.com> | 2016-05-11 21:16:55 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-05-11 21:16:55 -0400 |
commit | 7d020672615d09cf6ec42c500f34d70adf6758a9 (patch) | |
tree | 9802fd588de854c788a59449233ea42acd107cc0 | |
parent | 95306975e9dd38ba2775dd96cb29987ecc7d9360 (diff) | |
parent | b4eeed590deeff13a53db641129f0301d70248f3 (diff) |
Merge branch 'drm-next-4.7' of git://people.freedesktop.org/~agd5f/linux into drm-next
More amdgpu fixes for 4.7. Highlights:
- enable async pageflips
- UVD fixes for polaris
- lots of GPUVM fixes
- whitespace and code cleanups
- misc bug fixes
* 'drm-next-4.7' of git://people.freedesktop.org/~agd5f/linux: (32 commits)
drm/amd/powerplay: rewrite pp_sw_init to make code readable
drm/amdgpu/dce11: fix audio offset for asics with >7 audio pins
drm/amdgpu: fix and cleanup user fence handling v2
drm/amdgpu: move VM fields into job
drm/amdgpu: move the context from the IBs into the job
drm/amdgpu: move context switch handling into common code v2
drm/amdgpu: move preamble IB handling into common code
drm/amdgpu/gfx7: fix pipeline sync
amdgpu/uvd: separate context buffer from DPB
drm/amdgpu: use fence_context to judge ctx switch v2
drm/amd/amdgpu: Added more named DRM info messages for debugging
drm/amd/amdgpu: Add name field to amd_ip_funcs (v2)
drm/amdgpu: Support DRM_MODE_PAGE_FLIP_ASYNC (v2)
drm/amdgpu/dce11: don't share PLLs on Polaris
drm/amdgpu: Drop unused parameter for *get_sleep_divider_id_from_clock
drm/amdgpu: Simplify calculation in *get_sleep_divider_id_from_clock
drm/amdgpu: Use max macro in *get_sleep_divider_id_from_clock
drm/amd/powerplay: Use defined constants for minium engine clock
drm/amdgpu: add missing licenses on a couple of files
drm/amdgpu: fetch cu_info once at init
...
62 files changed, 513 insertions, 395 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 113fd4bf9b64..2a009c398dcb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -283,7 +283,8 @@ struct amdgpu_ring_funcs { | |||
283 | int (*parse_cs)(struct amdgpu_cs_parser *p, uint32_t ib_idx); | 283 | int (*parse_cs)(struct amdgpu_cs_parser *p, uint32_t ib_idx); |
284 | /* command emit functions */ | 284 | /* command emit functions */ |
285 | void (*emit_ib)(struct amdgpu_ring *ring, | 285 | void (*emit_ib)(struct amdgpu_ring *ring, |
286 | struct amdgpu_ib *ib); | 286 | struct amdgpu_ib *ib, |
287 | unsigned vm_id, bool ctx_switch); | ||
287 | void (*emit_fence)(struct amdgpu_ring *ring, uint64_t addr, | 288 | void (*emit_fence)(struct amdgpu_ring *ring, uint64_t addr, |
288 | uint64_t seq, unsigned flags); | 289 | uint64_t seq, unsigned flags); |
289 | void (*emit_pipeline_sync)(struct amdgpu_ring *ring); | 290 | void (*emit_pipeline_sync)(struct amdgpu_ring *ring); |
@@ -367,13 +368,6 @@ struct amdgpu_fence_driver { | |||
367 | #define AMDGPU_FENCE_FLAG_64BIT (1 << 0) | 368 | #define AMDGPU_FENCE_FLAG_64BIT (1 << 0) |
368 | #define AMDGPU_FENCE_FLAG_INT (1 << 1) | 369 | #define AMDGPU_FENCE_FLAG_INT (1 << 1) |
369 | 370 | ||
370 | struct amdgpu_user_fence { | ||
371 | /* write-back bo */ | ||
372 | struct amdgpu_bo *bo; | ||
373 | /* write-back address offset to bo start */ | ||
374 | uint32_t offset; | ||
375 | }; | ||
376 | |||
377 | int amdgpu_fence_driver_init(struct amdgpu_device *adev); | 371 | int amdgpu_fence_driver_init(struct amdgpu_device *adev); |
378 | void amdgpu_fence_driver_fini(struct amdgpu_device *adev); | 372 | void amdgpu_fence_driver_fini(struct amdgpu_device *adev); |
379 | void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev); | 373 | void amdgpu_fence_driver_force_completion(struct amdgpu_device *adev); |
@@ -507,9 +501,10 @@ void amdgpu_gem_object_close(struct drm_gem_object *obj, | |||
507 | struct drm_file *file_priv); | 501 | struct drm_file *file_priv); |
508 | unsigned long amdgpu_gem_timeout(uint64_t timeout_ns); | 502 | unsigned long amdgpu_gem_timeout(uint64_t timeout_ns); |
509 | struct sg_table *amdgpu_gem_prime_get_sg_table(struct drm_gem_object *obj); | 503 | struct sg_table *amdgpu_gem_prime_get_sg_table(struct drm_gem_object *obj); |
510 | struct drm_gem_object *amdgpu_gem_prime_import_sg_table(struct drm_device *dev, | 504 | struct drm_gem_object * |
511 | struct dma_buf_attachment *attach, | 505 | amdgpu_gem_prime_import_sg_table(struct drm_device *dev, |
512 | struct sg_table *sg); | 506 | struct dma_buf_attachment *attach, |
507 | struct sg_table *sg); | ||
513 | struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev, | 508 | struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev, |
514 | struct drm_gem_object *gobj, | 509 | struct drm_gem_object *gobj, |
515 | int flags); | 510 | int flags); |
@@ -726,6 +721,7 @@ struct amdgpu_flip_work { | |||
726 | unsigned shared_count; | 721 | unsigned shared_count; |
727 | struct fence **shared; | 722 | struct fence **shared; |
728 | struct fence_cb cb; | 723 | struct fence_cb cb; |
724 | bool async; | ||
729 | }; | 725 | }; |
730 | 726 | ||
731 | 727 | ||
@@ -738,17 +734,7 @@ struct amdgpu_ib { | |||
738 | uint32_t length_dw; | 734 | uint32_t length_dw; |
739 | uint64_t gpu_addr; | 735 | uint64_t gpu_addr; |
740 | uint32_t *ptr; | 736 | uint32_t *ptr; |
741 | struct amdgpu_user_fence *user; | ||
742 | struct amdgpu_vm *vm; | ||
743 | unsigned vm_id; | ||
744 | uint64_t vm_pd_addr; | ||
745 | struct amdgpu_ctx *ctx; | ||
746 | uint32_t gds_base, gds_size; | ||
747 | uint32_t gws_base, gws_size; | ||
748 | uint32_t oa_base, oa_size; | ||
749 | uint32_t flags; | 737 | uint32_t flags; |
750 | /* resulting sequence number */ | ||
751 | uint64_t sequence; | ||
752 | }; | 738 | }; |
753 | 739 | ||
754 | enum amdgpu_ring_type { | 740 | enum amdgpu_ring_type { |
@@ -762,7 +748,7 @@ enum amdgpu_ring_type { | |||
762 | extern const struct amd_sched_backend_ops amdgpu_sched_ops; | 748 | extern const struct amd_sched_backend_ops amdgpu_sched_ops; |
763 | 749 | ||
764 | int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, | 750 | int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, |
765 | struct amdgpu_job **job); | 751 | struct amdgpu_job **job, struct amdgpu_vm *vm); |
766 | int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size, | 752 | int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size, |
767 | struct amdgpu_job **job); | 753 | struct amdgpu_job **job); |
768 | 754 | ||
@@ -777,7 +763,7 @@ struct amdgpu_ring { | |||
777 | struct amdgpu_device *adev; | 763 | struct amdgpu_device *adev; |
778 | const struct amdgpu_ring_funcs *funcs; | 764 | const struct amdgpu_ring_funcs *funcs; |
779 | struct amdgpu_fence_driver fence_drv; | 765 | struct amdgpu_fence_driver fence_drv; |
780 | struct amd_gpu_scheduler sched; | 766 | struct amd_gpu_scheduler sched; |
781 | 767 | ||
782 | spinlock_t fence_lock; | 768 | spinlock_t fence_lock; |
783 | struct amdgpu_bo *ring_obj; | 769 | struct amdgpu_bo *ring_obj; |
@@ -805,7 +791,7 @@ struct amdgpu_ring { | |||
805 | unsigned wptr_offs; | 791 | unsigned wptr_offs; |
806 | unsigned next_rptr_offs; | 792 | unsigned next_rptr_offs; |
807 | unsigned fence_offs; | 793 | unsigned fence_offs; |
808 | struct amdgpu_ctx *current_ctx; | 794 | uint64_t current_ctx; |
809 | enum amdgpu_ring_type type; | 795 | enum amdgpu_ring_type type; |
810 | char name[16]; | 796 | char name[16]; |
811 | unsigned cond_exe_offs; | 797 | unsigned cond_exe_offs; |
@@ -885,6 +871,9 @@ struct amdgpu_vm { | |||
885 | 871 | ||
886 | /* Scheduler entity for page table updates */ | 872 | /* Scheduler entity for page table updates */ |
887 | struct amd_sched_entity entity; | 873 | struct amd_sched_entity entity; |
874 | |||
875 | /* client id */ | ||
876 | u64 client_id; | ||
888 | }; | 877 | }; |
889 | 878 | ||
890 | struct amdgpu_vm_id { | 879 | struct amdgpu_vm_id { |
@@ -893,7 +882,7 @@ struct amdgpu_vm_id { | |||
893 | struct amdgpu_sync active; | 882 | struct amdgpu_sync active; |
894 | struct fence *last_flush; | 883 | struct fence *last_flush; |
895 | struct amdgpu_ring *last_user; | 884 | struct amdgpu_ring *last_user; |
896 | atomic_long_t owner; | 885 | atomic64_t owner; |
897 | 886 | ||
898 | uint64_t pd_gpu_addr; | 887 | uint64_t pd_gpu_addr; |
899 | /* last flushed PD/PT update */ | 888 | /* last flushed PD/PT update */ |
@@ -924,6 +913,8 @@ struct amdgpu_vm_manager { | |||
924 | struct amdgpu_ring *vm_pte_rings[AMDGPU_MAX_RINGS]; | 913 | struct amdgpu_ring *vm_pte_rings[AMDGPU_MAX_RINGS]; |
925 | unsigned vm_pte_num_rings; | 914 | unsigned vm_pte_num_rings; |
926 | atomic_t vm_pte_next_ring; | 915 | atomic_t vm_pte_next_ring; |
916 | /* client id counter */ | ||
917 | atomic64_t client_counter; | ||
927 | }; | 918 | }; |
928 | 919 | ||
929 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); | 920 | void amdgpu_vm_manager_init(struct amdgpu_device *adev); |
@@ -1143,6 +1134,12 @@ struct amdgpu_gca_config { | |||
1143 | uint32_t macrotile_mode_array[16]; | 1134 | uint32_t macrotile_mode_array[16]; |
1144 | }; | 1135 | }; |
1145 | 1136 | ||
1137 | struct amdgpu_cu_info { | ||
1138 | uint32_t number; /* total active CU number */ | ||
1139 | uint32_t ao_cu_mask; | ||
1140 | uint32_t bitmap[4][4]; | ||
1141 | }; | ||
1142 | |||
1146 | struct amdgpu_gfx { | 1143 | struct amdgpu_gfx { |
1147 | struct mutex gpu_clock_mutex; | 1144 | struct mutex gpu_clock_mutex; |
1148 | struct amdgpu_gca_config config; | 1145 | struct amdgpu_gca_config config; |
@@ -1175,17 +1172,19 @@ struct amdgpu_gfx { | |||
1175 | struct amdgpu_irq_src priv_reg_irq; | 1172 | struct amdgpu_irq_src priv_reg_irq; |
1176 | struct amdgpu_irq_src priv_inst_irq; | 1173 | struct amdgpu_irq_src priv_inst_irq; |
1177 | /* gfx status */ | 1174 | /* gfx status */ |
1178 | uint32_t gfx_current_status; | 1175 | uint32_t gfx_current_status; |
1179 | /* ce ram size*/ | 1176 | /* ce ram size*/ |
1180 | unsigned ce_ram_size; | 1177 | unsigned ce_ram_size; |
1178 | struct amdgpu_cu_info cu_info; | ||
1181 | }; | 1179 | }; |
1182 | 1180 | ||
1183 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | 1181 | int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, |
1184 | unsigned size, struct amdgpu_ib *ib); | 1182 | unsigned size, struct amdgpu_ib *ib); |
1185 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fence *f); | 1183 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, |
1184 | struct fence *f); | ||
1186 | int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | 1185 | int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, |
1187 | struct amdgpu_ib *ib, struct fence *last_vm_update, | 1186 | struct amdgpu_ib *ib, struct fence *last_vm_update, |
1188 | struct fence **f); | 1187 | struct amdgpu_job *job, struct fence **f); |
1189 | int amdgpu_ib_pool_init(struct amdgpu_device *adev); | 1188 | int amdgpu_ib_pool_init(struct amdgpu_device *adev); |
1190 | void amdgpu_ib_pool_fini(struct amdgpu_device *adev); | 1189 | void amdgpu_ib_pool_fini(struct amdgpu_device *adev); |
1191 | int amdgpu_ib_ring_tests(struct amdgpu_device *adev); | 1190 | int amdgpu_ib_ring_tests(struct amdgpu_device *adev); |
@@ -1210,7 +1209,7 @@ void amdgpu_ring_fini(struct amdgpu_ring *ring); | |||
1210 | struct amdgpu_cs_chunk { | 1209 | struct amdgpu_cs_chunk { |
1211 | uint32_t chunk_id; | 1210 | uint32_t chunk_id; |
1212 | uint32_t length_dw; | 1211 | uint32_t length_dw; |
1213 | uint32_t *kdata; | 1212 | void *kdata; |
1214 | }; | 1213 | }; |
1215 | 1214 | ||
1216 | struct amdgpu_cs_parser { | 1215 | struct amdgpu_cs_parser { |
@@ -1241,13 +1240,25 @@ struct amdgpu_cs_parser { | |||
1241 | struct amdgpu_job { | 1240 | struct amdgpu_job { |
1242 | struct amd_sched_job base; | 1241 | struct amd_sched_job base; |
1243 | struct amdgpu_device *adev; | 1242 | struct amdgpu_device *adev; |
1243 | struct amdgpu_vm *vm; | ||
1244 | struct amdgpu_ring *ring; | 1244 | struct amdgpu_ring *ring; |
1245 | struct amdgpu_sync sync; | 1245 | struct amdgpu_sync sync; |
1246 | struct amdgpu_ib *ibs; | 1246 | struct amdgpu_ib *ibs; |
1247 | struct fence *fence; /* the hw fence */ | 1247 | struct fence *fence; /* the hw fence */ |
1248 | uint32_t num_ibs; | 1248 | uint32_t num_ibs; |
1249 | void *owner; | 1249 | void *owner; |
1250 | struct amdgpu_user_fence uf; | 1250 | uint64_t ctx; |
1251 | unsigned vm_id; | ||
1252 | uint64_t vm_pd_addr; | ||
1253 | uint32_t gds_base, gds_size; | ||
1254 | uint32_t gws_base, gws_size; | ||
1255 | uint32_t oa_base, oa_size; | ||
1256 | |||
1257 | /* user fence handling */ | ||
1258 | struct amdgpu_bo *uf_bo; | ||
1259 | uint32_t uf_offset; | ||
1260 | uint64_t uf_sequence; | ||
1261 | |||
1251 | }; | 1262 | }; |
1252 | #define to_amdgpu_job(sched_job) \ | 1263 | #define to_amdgpu_job(sched_job) \ |
1253 | container_of((sched_job), struct amdgpu_job, base) | 1264 | container_of((sched_job), struct amdgpu_job, base) |
@@ -1694,7 +1705,7 @@ struct amdgpu_sdma { | |||
1694 | struct amdgpu_sdma_instance instance[AMDGPU_MAX_SDMA_INSTANCES]; | 1705 | struct amdgpu_sdma_instance instance[AMDGPU_MAX_SDMA_INSTANCES]; |
1695 | struct amdgpu_irq_src trap_irq; | 1706 | struct amdgpu_irq_src trap_irq; |
1696 | struct amdgpu_irq_src illegal_inst_irq; | 1707 | struct amdgpu_irq_src illegal_inst_irq; |
1697 | int num_instances; | 1708 | int num_instances; |
1698 | }; | 1709 | }; |
1699 | 1710 | ||
1700 | /* | 1711 | /* |
@@ -1787,13 +1798,6 @@ struct amdgpu_allowed_register_entry { | |||
1787 | bool grbm_indexed; | 1798 | bool grbm_indexed; |
1788 | }; | 1799 | }; |
1789 | 1800 | ||
1790 | struct amdgpu_cu_info { | ||
1791 | uint32_t number; /* total active CU number */ | ||
1792 | uint32_t ao_cu_mask; | ||
1793 | uint32_t bitmap[4][4]; | ||
1794 | }; | ||
1795 | |||
1796 | |||
1797 | /* | 1801 | /* |
1798 | * ASIC specific functions. | 1802 | * ASIC specific functions. |
1799 | */ | 1803 | */ |
@@ -1811,7 +1815,6 @@ struct amdgpu_asic_funcs { | |||
1811 | u32 (*get_xclk)(struct amdgpu_device *adev); | 1815 | u32 (*get_xclk)(struct amdgpu_device *adev); |
1812 | /* get the gpu clock counter */ | 1816 | /* get the gpu clock counter */ |
1813 | uint64_t (*get_gpu_clock_counter)(struct amdgpu_device *adev); | 1817 | uint64_t (*get_gpu_clock_counter)(struct amdgpu_device *adev); |
1814 | int (*get_cu_info)(struct amdgpu_device *adev, struct amdgpu_cu_info *info); | ||
1815 | /* MM block clocks */ | 1818 | /* MM block clocks */ |
1816 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); | 1819 | int (*set_uvd_clocks)(struct amdgpu_device *adev, u32 vclk, u32 dclk); |
1817 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); | 1820 | int (*set_vce_clocks)(struct amdgpu_device *adev, u32 evclk, u32 ecclk); |
@@ -1948,11 +1951,11 @@ struct amdgpu_device { | |||
1948 | bool shutdown; | 1951 | bool shutdown; |
1949 | bool need_dma32; | 1952 | bool need_dma32; |
1950 | bool accel_working; | 1953 | bool accel_working; |
1951 | struct work_struct reset_work; | 1954 | struct work_struct reset_work; |
1952 | struct notifier_block acpi_nb; | 1955 | struct notifier_block acpi_nb; |
1953 | struct amdgpu_i2c_chan *i2c_bus[AMDGPU_MAX_I2C_BUS]; | 1956 | struct amdgpu_i2c_chan *i2c_bus[AMDGPU_MAX_I2C_BUS]; |
1954 | struct amdgpu_debugfs debugfs[AMDGPU_DEBUGFS_MAX_COMPONENTS]; | 1957 | struct amdgpu_debugfs debugfs[AMDGPU_DEBUGFS_MAX_COMPONENTS]; |
1955 | unsigned debugfs_count; | 1958 | unsigned debugfs_count; |
1956 | #if defined(CONFIG_DEBUG_FS) | 1959 | #if defined(CONFIG_DEBUG_FS) |
1957 | struct dentry *debugfs_regs[AMDGPU_DEBUGFS_MAX_COMPONENTS]; | 1960 | struct dentry *debugfs_regs[AMDGPU_DEBUGFS_MAX_COMPONENTS]; |
1958 | #endif | 1961 | #endif |
@@ -2203,7 +2206,6 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
2203 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) | 2206 | #define amdgpu_asic_read_disabled_bios(adev) (adev)->asic_funcs->read_disabled_bios((adev)) |
2204 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) | 2207 | #define amdgpu_asic_read_bios_from_rom(adev, b, l) (adev)->asic_funcs->read_bios_from_rom((adev), (b), (l)) |
2205 | #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v))) | 2208 | #define amdgpu_asic_read_register(adev, se, sh, offset, v)((adev)->asic_funcs->read_register((adev), (se), (sh), (offset), (v))) |
2206 | #define amdgpu_asic_get_cu_info(adev, info) (adev)->asic_funcs->get_cu_info((adev), (info)) | ||
2207 | #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid)) | 2209 | #define amdgpu_gart_flush_gpu_tlb(adev, vmid) (adev)->gart.gart_funcs->flush_gpu_tlb((adev), (vmid)) |
2208 | #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags)) | 2210 | #define amdgpu_gart_set_pte_pde(adev, pt, idx, addr, flags) (adev)->gart.gart_funcs->set_pte_pde((adev), (pt), (idx), (addr), (flags)) |
2209 | #define amdgpu_vm_copy_pte(adev, ib, pe, src, count) ((adev)->vm_manager.vm_pte_funcs->copy_pte((ib), (pe), (src), (count))) | 2211 | #define amdgpu_vm_copy_pte(adev, ib, pe, src, count) ((adev)->vm_manager.vm_pte_funcs->copy_pte((ib), (pe), (src), (count))) |
@@ -2215,7 +2217,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
2215 | #define amdgpu_ring_get_rptr(r) (r)->funcs->get_rptr((r)) | 2217 | #define amdgpu_ring_get_rptr(r) (r)->funcs->get_rptr((r)) |
2216 | #define amdgpu_ring_get_wptr(r) (r)->funcs->get_wptr((r)) | 2218 | #define amdgpu_ring_get_wptr(r) (r)->funcs->get_wptr((r)) |
2217 | #define amdgpu_ring_set_wptr(r) (r)->funcs->set_wptr((r)) | 2219 | #define amdgpu_ring_set_wptr(r) (r)->funcs->set_wptr((r)) |
2218 | #define amdgpu_ring_emit_ib(r, ib) (r)->funcs->emit_ib((r), (ib)) | 2220 | #define amdgpu_ring_emit_ib(r, ib, vm_id, c) (r)->funcs->emit_ib((r), (ib), (vm_id), (c)) |
2219 | #define amdgpu_ring_emit_pipeline_sync(r) (r)->funcs->emit_pipeline_sync((r)) | 2221 | #define amdgpu_ring_emit_pipeline_sync(r) (r)->funcs->emit_pipeline_sync((r)) |
2220 | #define amdgpu_ring_emit_vm_flush(r, vmid, addr) (r)->funcs->emit_vm_flush((r), (vmid), (addr)) | 2222 | #define amdgpu_ring_emit_vm_flush(r, vmid, addr) (r)->funcs->emit_vm_flush((r), (vmid), (addr)) |
2221 | #define amdgpu_ring_emit_fence(r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags)) | 2223 | #define amdgpu_ring_emit_fence(r, addr, seq, flags) (r)->funcs->emit_fence((r), (addr), (seq), (flags)) |
@@ -2238,7 +2240,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) | |||
2238 | #define amdgpu_display_hpd_set_polarity(adev, h) (adev)->mode_info.funcs->hpd_set_polarity((adev), (h)) | 2240 | #define amdgpu_display_hpd_set_polarity(adev, h) (adev)->mode_info.funcs->hpd_set_polarity((adev), (h)) |
2239 | #define amdgpu_display_hpd_get_gpio_reg(adev) (adev)->mode_info.funcs->hpd_get_gpio_reg((adev)) | 2241 | #define amdgpu_display_hpd_get_gpio_reg(adev) (adev)->mode_info.funcs->hpd_get_gpio_reg((adev)) |
2240 | #define amdgpu_display_bandwidth_update(adev) (adev)->mode_info.funcs->bandwidth_update((adev)) | 2242 | #define amdgpu_display_bandwidth_update(adev) (adev)->mode_info.funcs->bandwidth_update((adev)) |
2241 | #define amdgpu_display_page_flip(adev, crtc, base) (adev)->mode_info.funcs->page_flip((adev), (crtc), (base)) | 2243 | #define amdgpu_display_page_flip(adev, crtc, base, async) (adev)->mode_info.funcs->page_flip((adev), (crtc), (base), (async)) |
2242 | #define amdgpu_display_page_flip_get_scanoutpos(adev, crtc, vbl, pos) (adev)->mode_info.funcs->page_flip_get_scanoutpos((adev), (crtc), (vbl), (pos)) | 2244 | #define amdgpu_display_page_flip_get_scanoutpos(adev, crtc, vbl, pos) (adev)->mode_info.funcs->page_flip_get_scanoutpos((adev), (crtc), (vbl), (pos)) |
2243 | #define amdgpu_display_add_encoder(adev, e, s, c) (adev)->mode_info.funcs->add_encoder((adev), (e), (s), (c)) | 2245 | #define amdgpu_display_add_encoder(adev, e, s, c) (adev)->mode_info.funcs->add_encoder((adev), (e), (s), (c)) |
2244 | #define amdgpu_display_add_connector(adev, ci, sd, ct, ib, coi, h, r) (adev)->mode_info.funcs->add_connector((adev), (ci), (sd), (ct), (ib), (coi), (h), (r)) | 2246 | #define amdgpu_display_add_connector(adev, ci, sd, ct, ib, coi, h, r) (adev)->mode_info.funcs->add_connector((adev), (ci), (sd), (ct), (ib), (coi), (h), (r)) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c index 49838dfe9bda..252edba16e36 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c | |||
@@ -480,6 +480,7 @@ static int acp_set_powergating_state(void *handle, | |||
480 | } | 480 | } |
481 | 481 | ||
482 | const struct amd_ip_funcs acp_ip_funcs = { | 482 | const struct amd_ip_funcs acp_ip_funcs = { |
483 | .name = "acp_ip", | ||
483 | .early_init = acp_early_init, | 484 | .early_init = acp_early_init, |
484 | .late_init = NULL, | 485 | .late_init = NULL, |
485 | .sw_init = acp_sw_init, | 486 | .sw_init = acp_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c index eacd810fc09b..35d0856738ae 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | |||
@@ -263,7 +263,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, | |||
263 | for (i = 0; i < args->in.bo_number; ++i) { | 263 | for (i = 0; i < args->in.bo_number; ++i) { |
264 | if (copy_from_user(&info[i], uptr, bytes)) | 264 | if (copy_from_user(&info[i], uptr, bytes)) |
265 | goto error_free; | 265 | goto error_free; |
266 | 266 | ||
267 | uptr += args->in.bo_info_size; | 267 | uptr += args->in.bo_info_size; |
268 | } | 268 | } |
269 | } | 269 | } |
@@ -271,7 +271,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, | |||
271 | switch (args->in.operation) { | 271 | switch (args->in.operation) { |
272 | case AMDGPU_BO_LIST_OP_CREATE: | 272 | case AMDGPU_BO_LIST_OP_CREATE: |
273 | r = amdgpu_bo_list_create(fpriv, &list, &handle); | 273 | r = amdgpu_bo_list_create(fpriv, &list, &handle); |
274 | if (r) | 274 | if (r) |
275 | goto error_free; | 275 | goto error_free; |
276 | 276 | ||
277 | r = amdgpu_bo_list_set(adev, filp, list, info, | 277 | r = amdgpu_bo_list_set(adev, filp, list, info, |
@@ -281,7 +281,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data, | |||
281 | goto error_free; | 281 | goto error_free; |
282 | 282 | ||
283 | break; | 283 | break; |
284 | 284 | ||
285 | case AMDGPU_BO_LIST_OP_DESTROY: | 285 | case AMDGPU_BO_LIST_OP_DESTROY: |
286 | amdgpu_bo_list_destroy(fpriv, handle); | 286 | amdgpu_bo_list_destroy(fpriv, handle); |
287 | handle = 0; | 287 | handle = 0; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c index 490464e39322..199f76baf22c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | |||
@@ -793,7 +793,6 @@ static int amdgpu_cgs_query_system_info(struct cgs_device *cgs_device, | |||
793 | struct cgs_system_info *sys_info) | 793 | struct cgs_system_info *sys_info) |
794 | { | 794 | { |
795 | CGS_FUNC_ADEV; | 795 | CGS_FUNC_ADEV; |
796 | struct amdgpu_cu_info cu_info; | ||
797 | 796 | ||
798 | if (NULL == sys_info) | 797 | if (NULL == sys_info) |
799 | return -ENODEV; | 798 | return -ENODEV; |
@@ -818,8 +817,7 @@ static int amdgpu_cgs_query_system_info(struct cgs_device *cgs_device, | |||
818 | sys_info->value = adev->pg_flags; | 817 | sys_info->value = adev->pg_flags; |
819 | break; | 818 | break; |
820 | case CGS_SYSTEM_INFO_GFX_CU_INFO: | 819 | case CGS_SYSTEM_INFO_GFX_CU_INFO: |
821 | amdgpu_asic_get_cu_info(adev, &cu_info); | 820 | sys_info->value = adev->gfx.cu_info.number; |
822 | sys_info->value = cu_info.number; | ||
823 | break; | 821 | break; |
824 | default: | 822 | default: |
825 | return -ENODEV; | 823 | return -ENODEV; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 2ebba295d0e4..2bbeeb07c187 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -87,44 +87,42 @@ int amdgpu_cs_get_ring(struct amdgpu_device *adev, u32 ip_type, | |||
87 | } | 87 | } |
88 | 88 | ||
89 | static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, | 89 | static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p, |
90 | struct amdgpu_user_fence *uf, | 90 | struct drm_amdgpu_cs_chunk_fence *data, |
91 | struct drm_amdgpu_cs_chunk_fence *fence_data) | 91 | uint32_t *offset) |
92 | { | 92 | { |
93 | struct drm_gem_object *gobj; | 93 | struct drm_gem_object *gobj; |
94 | uint32_t handle; | ||
95 | 94 | ||
96 | handle = fence_data->handle; | ||
97 | gobj = drm_gem_object_lookup(p->adev->ddev, p->filp, | 95 | gobj = drm_gem_object_lookup(p->adev->ddev, p->filp, |
98 | fence_data->handle); | 96 | data->handle); |
99 | if (gobj == NULL) | 97 | if (gobj == NULL) |
100 | return -EINVAL; | 98 | return -EINVAL; |
101 | 99 | ||
102 | uf->bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); | 100 | p->uf_entry.robj = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); |
103 | uf->offset = fence_data->offset; | ||
104 | |||
105 | if (amdgpu_ttm_tt_get_usermm(uf->bo->tbo.ttm)) { | ||
106 | drm_gem_object_unreference_unlocked(gobj); | ||
107 | return -EINVAL; | ||
108 | } | ||
109 | |||
110 | p->uf_entry.robj = amdgpu_bo_ref(uf->bo); | ||
111 | p->uf_entry.priority = 0; | 101 | p->uf_entry.priority = 0; |
112 | p->uf_entry.tv.bo = &p->uf_entry.robj->tbo; | 102 | p->uf_entry.tv.bo = &p->uf_entry.robj->tbo; |
113 | p->uf_entry.tv.shared = true; | 103 | p->uf_entry.tv.shared = true; |
114 | p->uf_entry.user_pages = NULL; | 104 | p->uf_entry.user_pages = NULL; |
105 | *offset = data->offset; | ||
115 | 106 | ||
116 | drm_gem_object_unreference_unlocked(gobj); | 107 | drm_gem_object_unreference_unlocked(gobj); |
108 | |||
109 | if (amdgpu_ttm_tt_get_usermm(p->uf_entry.robj->tbo.ttm)) { | ||
110 | amdgpu_bo_unref(&p->uf_entry.robj); | ||
111 | return -EINVAL; | ||
112 | } | ||
113 | |||
117 | return 0; | 114 | return 0; |
118 | } | 115 | } |
119 | 116 | ||
120 | int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | 117 | int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) |
121 | { | 118 | { |
122 | struct amdgpu_fpriv *fpriv = p->filp->driver_priv; | 119 | struct amdgpu_fpriv *fpriv = p->filp->driver_priv; |
120 | struct amdgpu_vm *vm = &fpriv->vm; | ||
123 | union drm_amdgpu_cs *cs = data; | 121 | union drm_amdgpu_cs *cs = data; |
124 | uint64_t *chunk_array_user; | 122 | uint64_t *chunk_array_user; |
125 | uint64_t *chunk_array; | 123 | uint64_t *chunk_array; |
126 | struct amdgpu_user_fence uf = {}; | ||
127 | unsigned size, num_ibs = 0; | 124 | unsigned size, num_ibs = 0; |
125 | uint32_t uf_offset = 0; | ||
128 | int i; | 126 | int i; |
129 | int ret; | 127 | int ret; |
130 | 128 | ||
@@ -199,7 +197,8 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | |||
199 | goto free_partial_kdata; | 197 | goto free_partial_kdata; |
200 | } | 198 | } |
201 | 199 | ||
202 | ret = amdgpu_cs_user_fence_chunk(p, &uf, (void *)p->chunks[i].kdata); | 200 | ret = amdgpu_cs_user_fence_chunk(p, p->chunks[i].kdata, |
201 | &uf_offset); | ||
203 | if (ret) | 202 | if (ret) |
204 | goto free_partial_kdata; | 203 | goto free_partial_kdata; |
205 | 204 | ||
@@ -214,11 +213,14 @@ int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, void *data) | |||
214 | } | 213 | } |
215 | } | 214 | } |
216 | 215 | ||
217 | ret = amdgpu_job_alloc(p->adev, num_ibs, &p->job); | 216 | ret = amdgpu_job_alloc(p->adev, num_ibs, &p->job, vm); |
218 | if (ret) | 217 | if (ret) |
219 | goto free_all_kdata; | 218 | goto free_all_kdata; |
220 | 219 | ||
221 | p->job->uf = uf; | 220 | if (p->uf_entry.robj) { |
221 | p->job->uf_bo = amdgpu_bo_ref(p->uf_entry.robj); | ||
222 | p->job->uf_offset = uf_offset; | ||
223 | } | ||
222 | 224 | ||
223 | kfree(chunk_array); | 225 | kfree(chunk_array); |
224 | return 0; | 226 | return 0; |
@@ -376,7 +378,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, | |||
376 | INIT_LIST_HEAD(&duplicates); | 378 | INIT_LIST_HEAD(&duplicates); |
377 | amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd); | 379 | amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd); |
378 | 380 | ||
379 | if (p->job->uf.bo) | 381 | if (p->uf_entry.robj) |
380 | list_add(&p->uf_entry.tv.head, &p->validated); | 382 | list_add(&p->uf_entry.tv.head, &p->validated); |
381 | 383 | ||
382 | if (need_mmap_lock) | 384 | if (need_mmap_lock) |
@@ -472,6 +474,9 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, | |||
472 | goto error_validate; | 474 | goto error_validate; |
473 | 475 | ||
474 | if (p->bo_list) { | 476 | if (p->bo_list) { |
477 | struct amdgpu_bo *gds = p->bo_list->gds_obj; | ||
478 | struct amdgpu_bo *gws = p->bo_list->gws_obj; | ||
479 | struct amdgpu_bo *oa = p->bo_list->oa_obj; | ||
475 | struct amdgpu_vm *vm = &fpriv->vm; | 480 | struct amdgpu_vm *vm = &fpriv->vm; |
476 | unsigned i; | 481 | unsigned i; |
477 | 482 | ||
@@ -480,6 +485,19 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, | |||
480 | 485 | ||
481 | p->bo_list->array[i].bo_va = amdgpu_vm_bo_find(vm, bo); | 486 | p->bo_list->array[i].bo_va = amdgpu_vm_bo_find(vm, bo); |
482 | } | 487 | } |
488 | |||
489 | if (gds) { | ||
490 | p->job->gds_base = amdgpu_bo_gpu_offset(gds); | ||
491 | p->job->gds_size = amdgpu_bo_size(gds); | ||
492 | } | ||
493 | if (gws) { | ||
494 | p->job->gws_base = amdgpu_bo_gpu_offset(gws); | ||
495 | p->job->gws_size = amdgpu_bo_size(gws); | ||
496 | } | ||
497 | if (oa) { | ||
498 | p->job->oa_base = amdgpu_bo_gpu_offset(oa); | ||
499 | p->job->oa_size = amdgpu_bo_size(oa); | ||
500 | } | ||
483 | } | 501 | } |
484 | 502 | ||
485 | error_validate: | 503 | error_validate: |
@@ -740,41 +758,14 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev, | |||
740 | 758 | ||
741 | ib->length_dw = chunk_ib->ib_bytes / 4; | 759 | ib->length_dw = chunk_ib->ib_bytes / 4; |
742 | ib->flags = chunk_ib->flags; | 760 | ib->flags = chunk_ib->flags; |
743 | ib->ctx = parser->ctx; | ||
744 | j++; | 761 | j++; |
745 | } | 762 | } |
746 | 763 | ||
747 | /* add GDS resources to first IB */ | 764 | /* UVD & VCE fw doesn't support user fences */ |
748 | if (parser->bo_list) { | 765 | if (parser->job->uf_bo && ( |
749 | struct amdgpu_bo *gds = parser->bo_list->gds_obj; | 766 | parser->job->ring->type == AMDGPU_RING_TYPE_UVD || |
750 | struct amdgpu_bo *gws = parser->bo_list->gws_obj; | 767 | parser->job->ring->type == AMDGPU_RING_TYPE_VCE)) |
751 | struct amdgpu_bo *oa = parser->bo_list->oa_obj; | 768 | return -EINVAL; |
752 | struct amdgpu_ib *ib = &parser->job->ibs[0]; | ||
753 | |||
754 | if (gds) { | ||
755 | ib->gds_base = amdgpu_bo_gpu_offset(gds); | ||
756 | ib->gds_size = amdgpu_bo_size(gds); | ||
757 | } | ||
758 | if (gws) { | ||
759 | ib->gws_base = amdgpu_bo_gpu_offset(gws); | ||
760 | ib->gws_size = amdgpu_bo_size(gws); | ||
761 | } | ||
762 | if (oa) { | ||
763 | ib->oa_base = amdgpu_bo_gpu_offset(oa); | ||
764 | ib->oa_size = amdgpu_bo_size(oa); | ||
765 | } | ||
766 | } | ||
767 | /* wrap the last IB with user fence */ | ||
768 | if (parser->job->uf.bo) { | ||
769 | struct amdgpu_ib *ib = &parser->job->ibs[parser->job->num_ibs - 1]; | ||
770 | |||
771 | /* UVD & VCE fw doesn't support user fences */ | ||
772 | if (parser->job->ring->type == AMDGPU_RING_TYPE_UVD || | ||
773 | parser->job->ring->type == AMDGPU_RING_TYPE_VCE) | ||
774 | return -EINVAL; | ||
775 | |||
776 | ib->user = &parser->job->uf; | ||
777 | } | ||
778 | 769 | ||
779 | return 0; | 770 | return 0; |
780 | } | 771 | } |
@@ -839,6 +830,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, | |||
839 | union drm_amdgpu_cs *cs) | 830 | union drm_amdgpu_cs *cs) |
840 | { | 831 | { |
841 | struct amdgpu_ring *ring = p->job->ring; | 832 | struct amdgpu_ring *ring = p->job->ring; |
833 | struct amd_sched_entity *entity = &p->ctx->rings[ring->idx].entity; | ||
842 | struct fence *fence; | 834 | struct fence *fence; |
843 | struct amdgpu_job *job; | 835 | struct amdgpu_job *job; |
844 | int r; | 836 | int r; |
@@ -847,19 +839,19 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, | |||
847 | p->job = NULL; | 839 | p->job = NULL; |
848 | 840 | ||
849 | r = amd_sched_job_init(&job->base, &ring->sched, | 841 | r = amd_sched_job_init(&job->base, &ring->sched, |
850 | &p->ctx->rings[ring->idx].entity, | 842 | entity, amdgpu_job_timeout_func, |
851 | amdgpu_job_timeout_func, | 843 | amdgpu_job_free_func, |
852 | amdgpu_job_free_func, | 844 | p->filp, &fence); |
853 | p->filp, &fence); | ||
854 | if (r) { | 845 | if (r) { |
855 | amdgpu_job_free(job); | 846 | amdgpu_job_free(job); |
856 | return r; | 847 | return r; |
857 | } | 848 | } |
858 | 849 | ||
859 | job->owner = p->filp; | 850 | job->owner = p->filp; |
851 | job->ctx = entity->fence_context; | ||
860 | p->fence = fence_get(fence); | 852 | p->fence = fence_get(fence); |
861 | cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, fence); | 853 | cs->out.handle = amdgpu_ctx_add_fence(p->ctx, ring, fence); |
862 | job->ibs[job->num_ibs - 1].sequence = cs->out.handle; | 854 | job->uf_sequence = cs->out.handle; |
863 | 855 | ||
864 | trace_amdgpu_cs_ioctl(job); | 856 | trace_amdgpu_cs_ioctl(job); |
865 | amd_sched_entity_push_job(&job->base); | 857 | amd_sched_entity_push_job(&job->base); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 778330529ff5..bb8b149786d7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -348,7 +348,7 @@ static int amdgpu_doorbell_init(struct amdgpu_device *adev) | |||
348 | adev->doorbell.base = pci_resource_start(adev->pdev, 2); | 348 | adev->doorbell.base = pci_resource_start(adev->pdev, 2); |
349 | adev->doorbell.size = pci_resource_len(adev->pdev, 2); | 349 | adev->doorbell.size = pci_resource_len(adev->pdev, 2); |
350 | 350 | ||
351 | adev->doorbell.num_doorbells = min_t(u32, adev->doorbell.size / sizeof(u32), | 351 | adev->doorbell.num_doorbells = min_t(u32, adev->doorbell.size / sizeof(u32), |
352 | AMDGPU_DOORBELL_MAX_ASSIGNMENT+1); | 352 | AMDGPU_DOORBELL_MAX_ASSIGNMENT+1); |
353 | if (adev->doorbell.num_doorbells == 0) | 353 | if (adev->doorbell.num_doorbells == 0) |
354 | return -EINVAL; | 354 | return -EINVAL; |
@@ -1196,7 +1196,7 @@ static int amdgpu_early_init(struct amdgpu_device *adev) | |||
1196 | if (r == -ENOENT) { | 1196 | if (r == -ENOENT) { |
1197 | adev->ip_block_status[i].valid = false; | 1197 | adev->ip_block_status[i].valid = false; |
1198 | } else if (r) { | 1198 | } else if (r) { |
1199 | DRM_ERROR("early_init %d failed %d\n", i, r); | 1199 | DRM_ERROR("early_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1200 | return r; | 1200 | return r; |
1201 | } else { | 1201 | } else { |
1202 | adev->ip_block_status[i].valid = true; | 1202 | adev->ip_block_status[i].valid = true; |
@@ -1219,7 +1219,7 @@ static int amdgpu_init(struct amdgpu_device *adev) | |||
1219 | continue; | 1219 | continue; |
1220 | r = adev->ip_blocks[i].funcs->sw_init((void *)adev); | 1220 | r = adev->ip_blocks[i].funcs->sw_init((void *)adev); |
1221 | if (r) { | 1221 | if (r) { |
1222 | DRM_ERROR("sw_init %d failed %d\n", i, r); | 1222 | DRM_ERROR("sw_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1223 | return r; | 1223 | return r; |
1224 | } | 1224 | } |
1225 | adev->ip_block_status[i].sw = true; | 1225 | adev->ip_block_status[i].sw = true; |
@@ -1252,7 +1252,7 @@ static int amdgpu_init(struct amdgpu_device *adev) | |||
1252 | continue; | 1252 | continue; |
1253 | r = adev->ip_blocks[i].funcs->hw_init((void *)adev); | 1253 | r = adev->ip_blocks[i].funcs->hw_init((void *)adev); |
1254 | if (r) { | 1254 | if (r) { |
1255 | DRM_ERROR("hw_init %d failed %d\n", i, r); | 1255 | DRM_ERROR("hw_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1256 | return r; | 1256 | return r; |
1257 | } | 1257 | } |
1258 | adev->ip_block_status[i].hw = true; | 1258 | adev->ip_block_status[i].hw = true; |
@@ -1272,13 +1272,13 @@ static int amdgpu_late_init(struct amdgpu_device *adev) | |||
1272 | r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, | 1272 | r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, |
1273 | AMD_CG_STATE_GATE); | 1273 | AMD_CG_STATE_GATE); |
1274 | if (r) { | 1274 | if (r) { |
1275 | DRM_ERROR("set_clockgating_state(gate) %d failed %d\n", i, r); | 1275 | DRM_ERROR("set_clockgating_state(gate) of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1276 | return r; | 1276 | return r; |
1277 | } | 1277 | } |
1278 | if (adev->ip_blocks[i].funcs->late_init) { | 1278 | if (adev->ip_blocks[i].funcs->late_init) { |
1279 | r = adev->ip_blocks[i].funcs->late_init((void *)adev); | 1279 | r = adev->ip_blocks[i].funcs->late_init((void *)adev); |
1280 | if (r) { | 1280 | if (r) { |
1281 | DRM_ERROR("late_init %d failed %d\n", i, r); | 1281 | DRM_ERROR("late_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1282 | return r; | 1282 | return r; |
1283 | } | 1283 | } |
1284 | } | 1284 | } |
@@ -1302,13 +1302,13 @@ static int amdgpu_fini(struct amdgpu_device *adev) | |||
1302 | r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, | 1302 | r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, |
1303 | AMD_CG_STATE_UNGATE); | 1303 | AMD_CG_STATE_UNGATE); |
1304 | if (r) { | 1304 | if (r) { |
1305 | DRM_ERROR("set_clockgating_state(ungate) %d failed %d\n", i, r); | 1305 | DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1306 | return r; | 1306 | return r; |
1307 | } | 1307 | } |
1308 | r = adev->ip_blocks[i].funcs->hw_fini((void *)adev); | 1308 | r = adev->ip_blocks[i].funcs->hw_fini((void *)adev); |
1309 | /* XXX handle errors */ | 1309 | /* XXX handle errors */ |
1310 | if (r) { | 1310 | if (r) { |
1311 | DRM_DEBUG("hw_fini %d failed %d\n", i, r); | 1311 | DRM_DEBUG("hw_fini of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1312 | } | 1312 | } |
1313 | adev->ip_block_status[i].hw = false; | 1313 | adev->ip_block_status[i].hw = false; |
1314 | } | 1314 | } |
@@ -1319,7 +1319,7 @@ static int amdgpu_fini(struct amdgpu_device *adev) | |||
1319 | r = adev->ip_blocks[i].funcs->sw_fini((void *)adev); | 1319 | r = adev->ip_blocks[i].funcs->sw_fini((void *)adev); |
1320 | /* XXX handle errors */ | 1320 | /* XXX handle errors */ |
1321 | if (r) { | 1321 | if (r) { |
1322 | DRM_DEBUG("sw_fini %d failed %d\n", i, r); | 1322 | DRM_DEBUG("sw_fini of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1323 | } | 1323 | } |
1324 | adev->ip_block_status[i].sw = false; | 1324 | adev->ip_block_status[i].sw = false; |
1325 | adev->ip_block_status[i].valid = false; | 1325 | adev->ip_block_status[i].valid = false; |
@@ -1347,14 +1347,14 @@ static int amdgpu_suspend(struct amdgpu_device *adev) | |||
1347 | r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, | 1347 | r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, |
1348 | AMD_CG_STATE_UNGATE); | 1348 | AMD_CG_STATE_UNGATE); |
1349 | if (r) { | 1349 | if (r) { |
1350 | DRM_ERROR("set_clockgating_state(ungate) %d failed %d\n", i, r); | 1350 | DRM_ERROR("set_clockgating_state(ungate) of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1351 | } | 1351 | } |
1352 | } | 1352 | } |
1353 | /* XXX handle errors */ | 1353 | /* XXX handle errors */ |
1354 | r = adev->ip_blocks[i].funcs->suspend(adev); | 1354 | r = adev->ip_blocks[i].funcs->suspend(adev); |
1355 | /* XXX handle errors */ | 1355 | /* XXX handle errors */ |
1356 | if (r) { | 1356 | if (r) { |
1357 | DRM_ERROR("suspend %d failed %d\n", i, r); | 1357 | DRM_ERROR("suspend of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1358 | } | 1358 | } |
1359 | } | 1359 | } |
1360 | 1360 | ||
@@ -1370,7 +1370,7 @@ static int amdgpu_resume(struct amdgpu_device *adev) | |||
1370 | continue; | 1370 | continue; |
1371 | r = adev->ip_blocks[i].funcs->resume(adev); | 1371 | r = adev->ip_blocks[i].funcs->resume(adev); |
1372 | if (r) { | 1372 | if (r) { |
1373 | DRM_ERROR("resume %d failed %d\n", i, r); | 1373 | DRM_ERROR("resume of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); |
1374 | return r; | 1374 | return r; |
1375 | } | 1375 | } |
1376 | } | 1376 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c index c835abe65df3..726803069fef 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | |||
@@ -132,7 +132,7 @@ static void amdgpu_flip_work_func(struct work_struct *__work) | |||
132 | vblank->linedur_ns / 1000, stat, vpos, hpos); | 132 | vblank->linedur_ns / 1000, stat, vpos, hpos); |
133 | 133 | ||
134 | /* Do the flip (mmio) */ | 134 | /* Do the flip (mmio) */ |
135 | adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base); | 135 | adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base, work->async); |
136 | 136 | ||
137 | /* Set the flip status */ | 137 | /* Set the flip status */ |
138 | amdgpuCrtc->pflip_status = AMDGPU_FLIP_SUBMITTED; | 138 | amdgpuCrtc->pflip_status = AMDGPU_FLIP_SUBMITTED; |
@@ -197,6 +197,7 @@ int amdgpu_crtc_page_flip(struct drm_crtc *crtc, | |||
197 | work->event = event; | 197 | work->event = event; |
198 | work->adev = adev; | 198 | work->adev = adev; |
199 | work->crtc_id = amdgpu_crtc->crtc_id; | 199 | work->crtc_id = amdgpu_crtc->crtc_id; |
200 | work->async = (page_flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0; | ||
200 | 201 | ||
201 | /* schedule unpin of the old buffer */ | 202 | /* schedule unpin of the old buffer */ |
202 | old_amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); | 203 | old_amdgpu_fb = to_amdgpu_framebuffer(crtc->primary->fb); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h index c3f4e85594ff..503d54098128 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gds.h | |||
@@ -43,7 +43,7 @@ struct amdgpu_ring; | |||
43 | struct amdgpu_bo; | 43 | struct amdgpu_bo; |
44 | 44 | ||
45 | struct amdgpu_gds_asic_info { | 45 | struct amdgpu_gds_asic_info { |
46 | uint32_t total_size; | 46 | uint32_t total_size; |
47 | uint32_t gfx_partition_size; | 47 | uint32_t gfx_partition_size; |
48 | uint32_t cs_partition_size; | 48 | uint32_t cs_partition_size; |
49 | }; | 49 | }; |
@@ -52,8 +52,8 @@ struct amdgpu_gds { | |||
52 | struct amdgpu_gds_asic_info mem; | 52 | struct amdgpu_gds_asic_info mem; |
53 | struct amdgpu_gds_asic_info gws; | 53 | struct amdgpu_gds_asic_info gws; |
54 | struct amdgpu_gds_asic_info oa; | 54 | struct amdgpu_gds_asic_info oa; |
55 | /* At present, GDS, GWS and OA resources for gfx (graphics) | 55 | /* At present, GDS, GWS and OA resources for gfx (graphics) |
56 | * is always pre-allocated and available for graphics operation. | 56 | * is always pre-allocated and available for graphics operation. |
57 | * Such resource is shared between all gfx clients. | 57 | * Such resource is shared between all gfx clients. |
58 | * TODO: move this operation to user space | 58 | * TODO: move this operation to user space |
59 | * */ | 59 | * */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 0129617a7962..34e35423b78e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | |||
@@ -74,9 +74,6 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
74 | ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo); | 74 | ib->gpu_addr = amdgpu_sa_bo_gpu_addr(ib->sa_bo); |
75 | } | 75 | } |
76 | 76 | ||
77 | ib->vm = vm; | ||
78 | ib->vm_id = 0; | ||
79 | |||
80 | return 0; | 77 | return 0; |
81 | } | 78 | } |
82 | 79 | ||
@@ -89,7 +86,8 @@ int amdgpu_ib_get(struct amdgpu_device *adev, struct amdgpu_vm *vm, | |||
89 | * | 86 | * |
90 | * Free an IB (all asics). | 87 | * Free an IB (all asics). |
91 | */ | 88 | */ |
92 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fence *f) | 89 | void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, |
90 | struct fence *f) | ||
93 | { | 91 | { |
94 | amdgpu_sa_bo_free(adev, &ib->sa_bo, f); | 92 | amdgpu_sa_bo_free(adev, &ib->sa_bo, f); |
95 | } | 93 | } |
@@ -117,29 +115,37 @@ void amdgpu_ib_free(struct amdgpu_device *adev, struct amdgpu_ib *ib, struct fen | |||
117 | */ | 115 | */ |
118 | int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | 116 | int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, |
119 | struct amdgpu_ib *ibs, struct fence *last_vm_update, | 117 | struct amdgpu_ib *ibs, struct fence *last_vm_update, |
120 | struct fence **f) | 118 | struct amdgpu_job *job, struct fence **f) |
121 | { | 119 | { |
122 | struct amdgpu_device *adev = ring->adev; | 120 | struct amdgpu_device *adev = ring->adev; |
123 | struct amdgpu_ib *ib = &ibs[0]; | 121 | struct amdgpu_ib *ib = &ibs[0]; |
124 | struct amdgpu_ctx *ctx, *old_ctx; | 122 | bool skip_preamble, need_ctx_switch; |
123 | unsigned patch_offset = ~0; | ||
125 | struct amdgpu_vm *vm; | 124 | struct amdgpu_vm *vm; |
126 | struct fence *hwf; | 125 | struct fence *hwf; |
127 | unsigned i, patch_offset = ~0; | 126 | uint64_t ctx; |
128 | 127 | ||
128 | unsigned i; | ||
129 | int r = 0; | 129 | int r = 0; |
130 | 130 | ||
131 | if (num_ibs == 0) | 131 | if (num_ibs == 0) |
132 | return -EINVAL; | 132 | return -EINVAL; |
133 | 133 | ||
134 | ctx = ibs->ctx; | 134 | /* ring tests don't use a job */ |
135 | vm = ibs->vm; | 135 | if (job) { |
136 | vm = job->vm; | ||
137 | ctx = job->ctx; | ||
138 | } else { | ||
139 | vm = NULL; | ||
140 | ctx = 0; | ||
141 | } | ||
136 | 142 | ||
137 | if (!ring->ready) { | 143 | if (!ring->ready) { |
138 | dev_err(adev->dev, "couldn't schedule ib\n"); | 144 | dev_err(adev->dev, "couldn't schedule ib\n"); |
139 | return -EINVAL; | 145 | return -EINVAL; |
140 | } | 146 | } |
141 | 147 | ||
142 | if (vm && !ibs->vm_id) { | 148 | if (vm && !job->vm_id) { |
143 | dev_err(adev->dev, "VM IB without ID\n"); | 149 | dev_err(adev->dev, "VM IB without ID\n"); |
144 | return -EINVAL; | 150 | return -EINVAL; |
145 | } | 151 | } |
@@ -154,58 +160,54 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
154 | patch_offset = amdgpu_ring_init_cond_exec(ring); | 160 | patch_offset = amdgpu_ring_init_cond_exec(ring); |
155 | 161 | ||
156 | if (vm) { | 162 | if (vm) { |
157 | /* do context switch */ | 163 | r = amdgpu_vm_flush(ring, job->vm_id, job->vm_pd_addr, |
158 | r = amdgpu_vm_flush(ring, ib->vm_id, ib->vm_pd_addr, | 164 | job->gds_base, job->gds_size, |
159 | ib->gds_base, ib->gds_size, | 165 | job->gws_base, job->gws_size, |
160 | ib->gws_base, ib->gws_size, | 166 | job->oa_base, job->oa_size); |
161 | ib->oa_base, ib->oa_size); | ||
162 | if (r) { | 167 | if (r) { |
163 | amdgpu_ring_undo(ring); | 168 | amdgpu_ring_undo(ring); |
164 | return r; | 169 | return r; |
165 | } | 170 | } |
166 | |||
167 | if (ring->funcs->emit_hdp_flush) | ||
168 | amdgpu_ring_emit_hdp_flush(ring); | ||
169 | } | 171 | } |
170 | 172 | ||
173 | if (ring->funcs->emit_hdp_flush) | ||
174 | amdgpu_ring_emit_hdp_flush(ring); | ||
175 | |||
171 | /* always set cond_exec_polling to CONTINUE */ | 176 | /* always set cond_exec_polling to CONTINUE */ |
172 | *ring->cond_exe_cpu_addr = 1; | 177 | *ring->cond_exe_cpu_addr = 1; |
173 | 178 | ||
174 | old_ctx = ring->current_ctx; | 179 | skip_preamble = ring->current_ctx == ctx; |
180 | need_ctx_switch = ring->current_ctx != ctx; | ||
175 | for (i = 0; i < num_ibs; ++i) { | 181 | for (i = 0; i < num_ibs; ++i) { |
176 | ib = &ibs[i]; | 182 | ib = &ibs[i]; |
177 | 183 | ||
178 | if (ib->ctx != ctx || ib->vm != vm) { | 184 | /* drop preamble IBs if we don't have a context switch */ |
179 | ring->current_ctx = old_ctx; | 185 | if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && skip_preamble) |
180 | if (ib->vm_id) | 186 | continue; |
181 | amdgpu_vm_reset_id(adev, ib->vm_id); | ||
182 | amdgpu_ring_undo(ring); | ||
183 | return -EINVAL; | ||
184 | } | ||
185 | amdgpu_ring_emit_ib(ring, ib); | ||
186 | ring->current_ctx = ctx; | ||
187 | } | ||
188 | 187 | ||
189 | if (vm) { | 188 | amdgpu_ring_emit_ib(ring, ib, job ? job->vm_id : 0, |
190 | if (ring->funcs->emit_hdp_invalidate) | 189 | need_ctx_switch); |
191 | amdgpu_ring_emit_hdp_invalidate(ring); | 190 | need_ctx_switch = false; |
192 | } | 191 | } |
193 | 192 | ||
193 | if (ring->funcs->emit_hdp_invalidate) | ||
194 | amdgpu_ring_emit_hdp_invalidate(ring); | ||
195 | |||
194 | r = amdgpu_fence_emit(ring, &hwf); | 196 | r = amdgpu_fence_emit(ring, &hwf); |
195 | if (r) { | 197 | if (r) { |
196 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); | 198 | dev_err(adev->dev, "failed to emit fence (%d)\n", r); |
197 | ring->current_ctx = old_ctx; | 199 | if (job && job->vm_id) |
198 | if (ib->vm_id) | 200 | amdgpu_vm_reset_id(adev, job->vm_id); |
199 | amdgpu_vm_reset_id(adev, ib->vm_id); | ||
200 | amdgpu_ring_undo(ring); | 201 | amdgpu_ring_undo(ring); |
201 | return r; | 202 | return r; |
202 | } | 203 | } |
203 | 204 | ||
204 | /* wrap the last IB with fence */ | 205 | /* wrap the last IB with fence */ |
205 | if (ib->user) { | 206 | if (job && job->uf_bo) { |
206 | uint64_t addr = amdgpu_bo_gpu_offset(ib->user->bo); | 207 | uint64_t addr = amdgpu_bo_gpu_offset(job->uf_bo); |
207 | addr += ib->user->offset; | 208 | |
208 | amdgpu_ring_emit_fence(ring, addr, ib->sequence, | 209 | addr += job->uf_offset; |
210 | amdgpu_ring_emit_fence(ring, addr, job->uf_sequence, | ||
209 | AMDGPU_FENCE_FLAG_64BIT); | 211 | AMDGPU_FENCE_FLAG_64BIT); |
210 | } | 212 | } |
211 | 213 | ||
@@ -215,6 +217,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, | |||
215 | if (patch_offset != ~0 && ring->funcs->patch_cond_exec) | 217 | if (patch_offset != ~0 && ring->funcs->patch_cond_exec) |
216 | amdgpu_ring_patch_cond_exec(ring, patch_offset); | 218 | amdgpu_ring_patch_cond_exec(ring, patch_offset); |
217 | 219 | ||
220 | ring->current_ctx = ctx; | ||
218 | amdgpu_ring_commit(ring); | 221 | amdgpu_ring_commit(ring); |
219 | return 0; | 222 | return 0; |
220 | } | 223 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 4eea2a18d8bb..f0dafa514fe4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | |||
@@ -46,7 +46,7 @@ void amdgpu_job_timeout_func(struct work_struct *work) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, | 48 | int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, |
49 | struct amdgpu_job **job) | 49 | struct amdgpu_job **job, struct amdgpu_vm *vm) |
50 | { | 50 | { |
51 | size_t size = sizeof(struct amdgpu_job); | 51 | size_t size = sizeof(struct amdgpu_job); |
52 | 52 | ||
@@ -60,6 +60,7 @@ int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs, | |||
60 | return -ENOMEM; | 60 | return -ENOMEM; |
61 | 61 | ||
62 | (*job)->adev = adev; | 62 | (*job)->adev = adev; |
63 | (*job)->vm = vm; | ||
63 | (*job)->ibs = (void *)&(*job)[1]; | 64 | (*job)->ibs = (void *)&(*job)[1]; |
64 | (*job)->num_ibs = num_ibs; | 65 | (*job)->num_ibs = num_ibs; |
65 | INIT_WORK(&(*job)->base.work_free_job, amdgpu_job_free_handler); | 66 | INIT_WORK(&(*job)->base.work_free_job, amdgpu_job_free_handler); |
@@ -74,7 +75,7 @@ int amdgpu_job_alloc_with_ib(struct amdgpu_device *adev, unsigned size, | |||
74 | { | 75 | { |
75 | int r; | 76 | int r; |
76 | 77 | ||
77 | r = amdgpu_job_alloc(adev, 1, job); | 78 | r = amdgpu_job_alloc(adev, 1, job, NULL); |
78 | if (r) | 79 | if (r) |
79 | return r; | 80 | return r; |
80 | 81 | ||
@@ -96,7 +97,7 @@ void amdgpu_job_free(struct amdgpu_job *job) | |||
96 | amdgpu_sa_bo_free(job->adev, &job->ibs[i].sa_bo, f); | 97 | amdgpu_sa_bo_free(job->adev, &job->ibs[i].sa_bo, f); |
97 | fence_put(job->fence); | 98 | fence_put(job->fence); |
98 | 99 | ||
99 | amdgpu_bo_unref(&job->uf.bo); | 100 | amdgpu_bo_unref(&job->uf_bo); |
100 | amdgpu_sync_free(&job->sync); | 101 | amdgpu_sync_free(&job->sync); |
101 | 102 | ||
102 | if (!job->base.use_sched) | 103 | if (!job->base.use_sched) |
@@ -121,14 +122,13 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring, | |||
121 | return -EINVAL; | 122 | return -EINVAL; |
122 | 123 | ||
123 | r = amd_sched_job_init(&job->base, &ring->sched, | 124 | r = amd_sched_job_init(&job->base, &ring->sched, |
124 | entity, | 125 | entity, amdgpu_job_timeout_func, |
125 | amdgpu_job_timeout_func, | 126 | amdgpu_job_free_func, owner, &fence); |
126 | amdgpu_job_free_func, | ||
127 | owner, &fence); | ||
128 | if (r) | 127 | if (r) |
129 | return r; | 128 | return r; |
130 | 129 | ||
131 | job->owner = owner; | 130 | job->owner = owner; |
131 | job->ctx = entity->fence_context; | ||
132 | *f = fence_get(fence); | 132 | *f = fence_get(fence); |
133 | amd_sched_entity_push_job(&job->base); | 133 | amd_sched_entity_push_job(&job->base); |
134 | 134 | ||
@@ -138,27 +138,19 @@ int amdgpu_job_submit(struct amdgpu_job *job, struct amdgpu_ring *ring, | |||
138 | static struct fence *amdgpu_job_dependency(struct amd_sched_job *sched_job) | 138 | static struct fence *amdgpu_job_dependency(struct amd_sched_job *sched_job) |
139 | { | 139 | { |
140 | struct amdgpu_job *job = to_amdgpu_job(sched_job); | 140 | struct amdgpu_job *job = to_amdgpu_job(sched_job); |
141 | struct amdgpu_vm *vm = job->ibs->vm; | 141 | struct amdgpu_vm *vm = job->vm; |
142 | 142 | ||
143 | struct fence *fence = amdgpu_sync_get_fence(&job->sync); | 143 | struct fence *fence = amdgpu_sync_get_fence(&job->sync); |
144 | 144 | ||
145 | if (fence == NULL && vm && !job->ibs->vm_id) { | 145 | if (fence == NULL && vm && !job->vm_id) { |
146 | struct amdgpu_ring *ring = job->ring; | 146 | struct amdgpu_ring *ring = job->ring; |
147 | unsigned i, vm_id; | ||
148 | uint64_t vm_pd_addr; | ||
149 | int r; | 147 | int r; |
150 | 148 | ||
151 | r = amdgpu_vm_grab_id(vm, ring, &job->sync, | 149 | r = amdgpu_vm_grab_id(vm, ring, &job->sync, |
152 | &job->base.s_fence->base, | 150 | &job->base.s_fence->base, |
153 | &vm_id, &vm_pd_addr); | 151 | &job->vm_id, &job->vm_pd_addr); |
154 | if (r) | 152 | if (r) |
155 | DRM_ERROR("Error getting VM ID (%d)\n", r); | 153 | DRM_ERROR("Error getting VM ID (%d)\n", r); |
156 | else { | ||
157 | for (i = 0; i < job->num_ibs; ++i) { | ||
158 | job->ibs[i].vm_id = vm_id; | ||
159 | job->ibs[i].vm_pd_addr = vm_pd_addr; | ||
160 | } | ||
161 | } | ||
162 | 154 | ||
163 | fence = amdgpu_sync_get_fence(&job->sync); | 155 | fence = amdgpu_sync_get_fence(&job->sync); |
164 | } | 156 | } |
@@ -186,7 +178,7 @@ static struct fence *amdgpu_job_run(struct amd_sched_job *sched_job) | |||
186 | 178 | ||
187 | trace_amdgpu_sched_run_job(job); | 179 | trace_amdgpu_sched_run_job(job); |
188 | r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, | 180 | r = amdgpu_ib_schedule(job->ring, job->num_ibs, job->ibs, |
189 | job->sync.last_vm_update, &fence); | 181 | job->sync.last_vm_update, job, &fence); |
190 | if (r) { | 182 | if (r) { |
191 | DRM_ERROR("Error scheduling IBs (%d)\n", r); | 183 | DRM_ERROR("Error scheduling IBs (%d)\n", r); |
192 | goto err; | 184 | goto err; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 7db271278e70..40a23704a981 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | |||
@@ -427,7 +427,6 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
427 | } | 427 | } |
428 | case AMDGPU_INFO_DEV_INFO: { | 428 | case AMDGPU_INFO_DEV_INFO: { |
429 | struct drm_amdgpu_info_device dev_info = {}; | 429 | struct drm_amdgpu_info_device dev_info = {}; |
430 | struct amdgpu_cu_info cu_info; | ||
431 | 430 | ||
432 | dev_info.device_id = dev->pdev->device; | 431 | dev_info.device_id = dev->pdev->device; |
433 | dev_info.chip_rev = adev->rev_id; | 432 | dev_info.chip_rev = adev->rev_id; |
@@ -461,11 +460,11 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file | |||
461 | AMDGPU_GPU_PAGE_SIZE; | 460 | AMDGPU_GPU_PAGE_SIZE; |
462 | dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE; | 461 | dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE; |
463 | 462 | ||
464 | amdgpu_asic_get_cu_info(adev, &cu_info); | 463 | dev_info.cu_active_number = adev->gfx.cu_info.number; |
465 | dev_info.cu_active_number = cu_info.number; | 464 | dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask; |
466 | dev_info.cu_ao_mask = cu_info.ao_cu_mask; | ||
467 | dev_info.ce_ram_size = adev->gfx.ce_ram_size; | 465 | dev_info.ce_ram_size = adev->gfx.ce_ram_size; |
468 | memcpy(&dev_info.cu_bitmap[0], &cu_info.bitmap[0], sizeof(cu_info.bitmap)); | 466 | memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0], |
467 | sizeof(adev->gfx.cu_info.bitmap)); | ||
469 | dev_info.vram_type = adev->mc.vram_type; | 468 | dev_info.vram_type = adev->mc.vram_type; |
470 | dev_info.vram_bit_width = adev->mc.vram_width; | 469 | dev_info.vram_bit_width = adev->mc.vram_width; |
471 | dev_info.vce_harvest_config = adev->vce.harvest_config; | 470 | dev_info.vce_harvest_config = adev->vce.harvest_config; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 81bd964d3dfc..6b1d7d306564 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | |||
@@ -283,7 +283,7 @@ struct amdgpu_display_funcs { | |||
283 | u32 (*hpd_get_gpio_reg)(struct amdgpu_device *adev); | 283 | u32 (*hpd_get_gpio_reg)(struct amdgpu_device *adev); |
284 | /* pageflipping */ | 284 | /* pageflipping */ |
285 | void (*page_flip)(struct amdgpu_device *adev, | 285 | void (*page_flip)(struct amdgpu_device *adev, |
286 | int crtc_id, u64 crtc_base); | 286 | int crtc_id, u64 crtc_base, bool async); |
287 | int (*page_flip_get_scanoutpos)(struct amdgpu_device *adev, int crtc, | 287 | int (*page_flip_get_scanoutpos)(struct amdgpu_device *adev, int crtc, |
288 | u32 *vbl, u32 *position); | 288 | u32 *vbl, u32 *position); |
289 | /* display topology setup */ | 289 | /* display topology setup */ |
@@ -530,7 +530,7 @@ struct amdgpu_framebuffer { | |||
530 | ((em) == ATOM_ENCODER_MODE_DP_MST)) | 530 | ((em) == ATOM_ENCODER_MODE_DP_MST)) |
531 | 531 | ||
532 | /* Driver internal use only flags of amdgpu_get_crtc_scanoutpos() */ | 532 | /* Driver internal use only flags of amdgpu_get_crtc_scanoutpos() */ |
533 | #define USE_REAL_VBLANKSTART (1 << 30) | 533 | #define USE_REAL_VBLANKSTART (1 << 30) |
534 | #define GET_DISTANCE_TO_VBLANKSTART (1 << 31) | 534 | #define GET_DISTANCE_TO_VBLANKSTART (1 << 31) |
535 | 535 | ||
536 | void amdgpu_link_encoder_connector(struct drm_device *dev); | 536 | void amdgpu_link_encoder_connector(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c index be565955bcc7..6bd961fb43dc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | |||
@@ -304,6 +304,7 @@ static int amdgpu_pp_soft_reset(void *handle) | |||
304 | } | 304 | } |
305 | 305 | ||
306 | const struct amd_ip_funcs amdgpu_pp_ip_funcs = { | 306 | const struct amd_ip_funcs amdgpu_pp_ip_funcs = { |
307 | .name = "amdgpu_powerplay", | ||
307 | .early_init = amdgpu_pp_early_init, | 308 | .early_init = amdgpu_pp_early_init, |
308 | .late_init = amdgpu_pp_late_init, | 309 | .late_init = amdgpu_pp_late_init, |
309 | .sw_init = amdgpu_pp_sw_init, | 310 | .sw_init = amdgpu_pp_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c index be6388f73ba2..7700dc22f243 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | |||
@@ -57,9 +57,10 @@ void amdgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) | |||
57 | ttm_bo_kunmap(&bo->dma_buf_vmap); | 57 | ttm_bo_kunmap(&bo->dma_buf_vmap); |
58 | } | 58 | } |
59 | 59 | ||
60 | struct drm_gem_object *amdgpu_gem_prime_import_sg_table(struct drm_device *dev, | 60 | struct drm_gem_object * |
61 | struct dma_buf_attachment *attach, | 61 | amdgpu_gem_prime_import_sg_table(struct drm_device *dev, |
62 | struct sg_table *sg) | 62 | struct dma_buf_attachment *attach, |
63 | struct sg_table *sg) | ||
63 | { | 64 | { |
64 | struct reservation_object *resv = attach->dmabuf->resv; | 65 | struct reservation_object *resv = attach->dmabuf->resv; |
65 | struct amdgpu_device *adev = dev->dev_private; | 66 | struct amdgpu_device *adev = dev->dev_private; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c index abda242980ba..01abfc21b4a2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | |||
@@ -41,13 +41,15 @@ | |||
41 | 41 | ||
42 | /* 1 second timeout */ | 42 | /* 1 second timeout */ |
43 | #define UVD_IDLE_TIMEOUT_MS 1000 | 43 | #define UVD_IDLE_TIMEOUT_MS 1000 |
44 | /* Polaris10/11 firmware version */ | ||
45 | #define FW_1_66_16 ((1 << 24) | (66 << 16) | (16 << 8)) | ||
44 | 46 | ||
45 | /* Firmware Names */ | 47 | /* Firmware Names */ |
46 | #ifdef CONFIG_DRM_AMDGPU_CIK | 48 | #ifdef CONFIG_DRM_AMDGPU_CIK |
47 | #define FIRMWARE_BONAIRE "radeon/bonaire_uvd.bin" | 49 | #define FIRMWARE_BONAIRE "radeon/bonaire_uvd.bin" |
48 | #define FIRMWARE_KABINI "radeon/kabini_uvd.bin" | 50 | #define FIRMWARE_KABINI "radeon/kabini_uvd.bin" |
49 | #define FIRMWARE_KAVERI "radeon/kaveri_uvd.bin" | 51 | #define FIRMWARE_KAVERI "radeon/kaveri_uvd.bin" |
50 | #define FIRMWARE_HAWAII "radeon/hawaii_uvd.bin" | 52 | #define FIRMWARE_HAWAII "radeon/hawaii_uvd.bin" |
51 | #define FIRMWARE_MULLINS "radeon/mullins_uvd.bin" | 53 | #define FIRMWARE_MULLINS "radeon/mullins_uvd.bin" |
52 | #endif | 54 | #endif |
53 | #define FIRMWARE_TONGA "amdgpu/tonga_uvd.bin" | 55 | #define FIRMWARE_TONGA "amdgpu/tonga_uvd.bin" |
@@ -184,6 +186,12 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev) | |||
184 | adev->uvd.fw_version = ((version_major << 24) | (version_minor << 16) | | 186 | adev->uvd.fw_version = ((version_major << 24) | (version_minor << 16) | |
185 | (family_id << 8)); | 187 | (family_id << 8)); |
186 | 188 | ||
189 | if ((adev->asic_type == CHIP_POLARIS10 || | ||
190 | adev->asic_type == CHIP_POLARIS11) && | ||
191 | (adev->uvd.fw_version < FW_1_66_16)) | ||
192 | DRM_ERROR("POLARIS10/11 UVD firmware version %hu.%hu is too old.\n", | ||
193 | version_major, version_minor); | ||
194 | |||
187 | bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) | 195 | bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) |
188 | + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE | 196 | + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE |
189 | + AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles; | 197 | + AMDGPU_UVD_SESSION_SIZE * adev->uvd.max_handles; |
@@ -414,7 +422,8 @@ static int amdgpu_uvd_cs_pass1(struct amdgpu_uvd_cs_ctx *ctx) | |||
414 | * | 422 | * |
415 | * Peek into the decode message and calculate the necessary buffer sizes. | 423 | * Peek into the decode message and calculate the necessary buffer sizes. |
416 | */ | 424 | */ |
417 | static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) | 425 | static int amdgpu_uvd_cs_msg_decode(struct amdgpu_device *adev, uint32_t *msg, |
426 | unsigned buf_sizes[]) | ||
418 | { | 427 | { |
419 | unsigned stream_type = msg[4]; | 428 | unsigned stream_type = msg[4]; |
420 | unsigned width = msg[6]; | 429 | unsigned width = msg[6]; |
@@ -436,7 +445,6 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) | |||
436 | 445 | ||
437 | switch (stream_type) { | 446 | switch (stream_type) { |
438 | case 0: /* H264 */ | 447 | case 0: /* H264 */ |
439 | case 7: /* H264 Perf */ | ||
440 | switch(level) { | 448 | switch(level) { |
441 | case 30: | 449 | case 30: |
442 | num_dpb_buffer = 8100 / fs_in_mb; | 450 | num_dpb_buffer = 8100 / fs_in_mb; |
@@ -514,6 +522,54 @@ static int amdgpu_uvd_cs_msg_decode(uint32_t *msg, unsigned buf_sizes[]) | |||
514 | min_dpb_size += ALIGN(width_in_mb * height_in_mb * 32, 64); | 522 | min_dpb_size += ALIGN(width_in_mb * height_in_mb * 32, 64); |
515 | break; | 523 | break; |
516 | 524 | ||
525 | case 7: /* H264 Perf */ | ||
526 | switch(level) { | ||
527 | case 30: | ||
528 | num_dpb_buffer = 8100 / fs_in_mb; | ||
529 | break; | ||
530 | case 31: | ||
531 | num_dpb_buffer = 18000 / fs_in_mb; | ||
532 | break; | ||
533 | case 32: | ||
534 | num_dpb_buffer = 20480 / fs_in_mb; | ||
535 | break; | ||
536 | case 41: | ||
537 | num_dpb_buffer = 32768 / fs_in_mb; | ||
538 | break; | ||
539 | case 42: | ||
540 | num_dpb_buffer = 34816 / fs_in_mb; | ||
541 | break; | ||
542 | case 50: | ||
543 | num_dpb_buffer = 110400 / fs_in_mb; | ||
544 | break; | ||
545 | case 51: | ||
546 | num_dpb_buffer = 184320 / fs_in_mb; | ||
547 | break; | ||
548 | default: | ||
549 | num_dpb_buffer = 184320 / fs_in_mb; | ||
550 | break; | ||
551 | } | ||
552 | num_dpb_buffer++; | ||
553 | if (num_dpb_buffer > 17) | ||
554 | num_dpb_buffer = 17; | ||
555 | |||
556 | /* reference picture buffer */ | ||
557 | min_dpb_size = image_size * num_dpb_buffer; | ||
558 | |||
559 | if (adev->asic_type < CHIP_POLARIS10){ | ||
560 | /* macroblock context buffer */ | ||
561 | min_dpb_size += | ||
562 | width_in_mb * height_in_mb * num_dpb_buffer * 192; | ||
563 | |||
564 | /* IT surface buffer */ | ||
565 | min_dpb_size += width_in_mb * height_in_mb * 32; | ||
566 | } else { | ||
567 | /* macroblock context buffer */ | ||
568 | min_ctx_size = | ||
569 | width_in_mb * height_in_mb * num_dpb_buffer * 192; | ||
570 | } | ||
571 | break; | ||
572 | |||
517 | case 16: /* H265 */ | 573 | case 16: /* H265 */ |
518 | image_size = (ALIGN(width, 16) * ALIGN(height, 16) * 3) / 2; | 574 | image_size = (ALIGN(width, 16) * ALIGN(height, 16) * 3) / 2; |
519 | image_size = ALIGN(image_size, 256); | 575 | image_size = ALIGN(image_size, 256); |
@@ -609,7 +665,7 @@ static int amdgpu_uvd_cs_msg(struct amdgpu_uvd_cs_ctx *ctx, | |||
609 | 665 | ||
610 | case 1: | 666 | case 1: |
611 | /* it's a decode msg, calc buffer sizes */ | 667 | /* it's a decode msg, calc buffer sizes */ |
612 | r = amdgpu_uvd_cs_msg_decode(msg, ctx->buf_sizes); | 668 | r = amdgpu_uvd_cs_msg_decode(adev, msg, ctx->buf_sizes); |
613 | amdgpu_bo_kunmap(bo); | 669 | amdgpu_bo_kunmap(bo); |
614 | if (r) | 670 | if (r) |
615 | return r; | 671 | return r; |
@@ -910,7 +966,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo, | |||
910 | ib->length_dw = 16; | 966 | ib->length_dw = 16; |
911 | 967 | ||
912 | if (direct) { | 968 | if (direct) { |
913 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); | 969 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, NULL, &f); |
914 | job->fence = f; | 970 | job->fence = f; |
915 | if (r) | 971 | if (r) |
916 | goto err_free; | 972 | goto err_free; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index 22a4d96fedb7..875626a2eccb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | |||
@@ -41,9 +41,9 @@ | |||
41 | /* Firmware Names */ | 41 | /* Firmware Names */ |
42 | #ifdef CONFIG_DRM_AMDGPU_CIK | 42 | #ifdef CONFIG_DRM_AMDGPU_CIK |
43 | #define FIRMWARE_BONAIRE "radeon/bonaire_vce.bin" | 43 | #define FIRMWARE_BONAIRE "radeon/bonaire_vce.bin" |
44 | #define FIRMWARE_KABINI "radeon/kabini_vce.bin" | 44 | #define FIRMWARE_KABINI "radeon/kabini_vce.bin" |
45 | #define FIRMWARE_KAVERI "radeon/kaveri_vce.bin" | 45 | #define FIRMWARE_KAVERI "radeon/kaveri_vce.bin" |
46 | #define FIRMWARE_HAWAII "radeon/hawaii_vce.bin" | 46 | #define FIRMWARE_HAWAII "radeon/hawaii_vce.bin" |
47 | #define FIRMWARE_MULLINS "radeon/mullins_vce.bin" | 47 | #define FIRMWARE_MULLINS "radeon/mullins_vce.bin" |
48 | #endif | 48 | #endif |
49 | #define FIRMWARE_TONGA "amdgpu/tonga_vce.bin" | 49 | #define FIRMWARE_TONGA "amdgpu/tonga_vce.bin" |
@@ -436,7 +436,7 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, | |||
436 | for (i = ib->length_dw; i < ib_size_dw; ++i) | 436 | for (i = ib->length_dw; i < ib_size_dw; ++i) |
437 | ib->ptr[i] = 0x0; | 437 | ib->ptr[i] = 0x0; |
438 | 438 | ||
439 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); | 439 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, NULL, &f); |
440 | job->fence = f; | 440 | job->fence = f; |
441 | if (r) | 441 | if (r) |
442 | goto err; | 442 | goto err; |
@@ -498,7 +498,7 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | |||
498 | ib->ptr[i] = 0x0; | 498 | ib->ptr[i] = 0x0; |
499 | 499 | ||
500 | if (direct) { | 500 | if (direct) { |
501 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); | 501 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, NULL, &f); |
502 | job->fence = f; | 502 | job->fence = f; |
503 | if (r) | 503 | if (r) |
504 | goto err; | 504 | goto err; |
@@ -762,7 +762,8 @@ out: | |||
762 | * @ib: the IB to execute | 762 | * @ib: the IB to execute |
763 | * | 763 | * |
764 | */ | 764 | */ |
765 | void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib) | 765 | void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib, |
766 | unsigned vm_id, bool ctx_switch) | ||
766 | { | 767 | { |
767 | amdgpu_ring_write(ring, VCE_CMD_IB); | 768 | amdgpu_ring_write(ring, VCE_CMD_IB); |
768 | amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr)); | 769 | amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr)); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h index ef99d2370182..f40cf761c66f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h | |||
@@ -34,7 +34,8 @@ int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | |||
34 | bool direct, struct fence **fence); | 34 | bool direct, struct fence **fence); |
35 | void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp); | 35 | void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp); |
36 | int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx); | 36 | int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx); |
37 | void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib); | 37 | void amdgpu_vce_ring_emit_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib, |
38 | unsigned vm_id, bool ctx_switch); | ||
38 | void amdgpu_vce_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq, | 39 | void amdgpu_vce_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq, |
39 | unsigned flags); | 40 | unsigned flags); |
40 | int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring); | 41 | int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring); |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 856116a874bb..ea708cb94862 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -185,7 +185,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
185 | if (!id) | 185 | if (!id) |
186 | continue; | 186 | continue; |
187 | 187 | ||
188 | if (atomic_long_read(&id->owner) != (long)vm) | 188 | if (atomic64_read(&id->owner) != vm->client_id) |
189 | continue; | 189 | continue; |
190 | 190 | ||
191 | if (pd_addr != id->pd_gpu_addr) | 191 | if (pd_addr != id->pd_gpu_addr) |
@@ -261,7 +261,7 @@ int amdgpu_vm_grab_id(struct amdgpu_vm *vm, struct amdgpu_ring *ring, | |||
261 | 261 | ||
262 | list_move_tail(&id->list, &adev->vm_manager.ids_lru); | 262 | list_move_tail(&id->list, &adev->vm_manager.ids_lru); |
263 | id->last_user = ring; | 263 | id->last_user = ring; |
264 | atomic_long_set(&id->owner, (long)vm); | 264 | atomic64_set(&id->owner, vm->client_id); |
265 | vm->ids[ring->idx] = id; | 265 | vm->ids[ring->idx] = id; |
266 | 266 | ||
267 | *vm_id = id - adev->vm_manager.ids; | 267 | *vm_id = id - adev->vm_manager.ids; |
@@ -300,10 +300,12 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, | |||
300 | int r; | 300 | int r; |
301 | 301 | ||
302 | if (ring->funcs->emit_pipeline_sync && ( | 302 | if (ring->funcs->emit_pipeline_sync && ( |
303 | pd_addr != AMDGPU_VM_NO_FLUSH || gds_switch_needed)) | 303 | pd_addr != AMDGPU_VM_NO_FLUSH || gds_switch_needed || |
304 | ring->type == AMDGPU_RING_TYPE_COMPUTE)) | ||
304 | amdgpu_ring_emit_pipeline_sync(ring); | 305 | amdgpu_ring_emit_pipeline_sync(ring); |
305 | 306 | ||
306 | if (pd_addr != AMDGPU_VM_NO_FLUSH) { | 307 | if (ring->funcs->emit_vm_flush && |
308 | pd_addr != AMDGPU_VM_NO_FLUSH) { | ||
307 | struct fence *fence; | 309 | struct fence *fence; |
308 | 310 | ||
309 | trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id); | 311 | trace_amdgpu_vm_flush(pd_addr, ring->idx, vm_id); |
@@ -1386,6 +1388,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
1386 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) | 1388 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) |
1387 | vm->ids[i] = NULL; | 1389 | vm->ids[i] = NULL; |
1388 | vm->va = RB_ROOT; | 1390 | vm->va = RB_ROOT; |
1391 | vm->client_id = atomic64_inc_return(&adev->vm_manager.client_counter); | ||
1389 | spin_lock_init(&vm->status_lock); | 1392 | spin_lock_init(&vm->status_lock); |
1390 | INIT_LIST_HEAD(&vm->invalidated); | 1393 | INIT_LIST_HEAD(&vm->invalidated); |
1391 | INIT_LIST_HEAD(&vm->cleared); | 1394 | INIT_LIST_HEAD(&vm->cleared); |
@@ -1477,15 +1480,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) | |||
1477 | 1480 | ||
1478 | amdgpu_bo_unref(&vm->page_directory); | 1481 | amdgpu_bo_unref(&vm->page_directory); |
1479 | fence_put(vm->page_directory_fence); | 1482 | fence_put(vm->page_directory_fence); |
1480 | |||
1481 | for (i = 0; i < AMDGPU_MAX_RINGS; ++i) { | ||
1482 | struct amdgpu_vm_id *id = vm->ids[i]; | ||
1483 | |||
1484 | if (!id) | ||
1485 | continue; | ||
1486 | |||
1487 | atomic_long_cmpxchg(&id->owner, (long)vm, 0); | ||
1488 | } | ||
1489 | } | 1483 | } |
1490 | 1484 | ||
1491 | /** | 1485 | /** |
@@ -1510,6 +1504,7 @@ void amdgpu_vm_manager_init(struct amdgpu_device *adev) | |||
1510 | } | 1504 | } |
1511 | 1505 | ||
1512 | atomic_set(&adev->vm_manager.vm_pte_next_ring, 0); | 1506 | atomic_set(&adev->vm_manager.vm_pte_next_ring, 0); |
1507 | atomic64_set(&adev->vm_manager.client_counter, 0); | ||
1513 | } | 1508 | } |
1514 | 1509 | ||
1515 | /** | 1510 | /** |
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.h b/drivers/gpu/drm/amd/amdgpu/atom.h index fece8f45dc7a..49daf6d723e5 100644 --- a/drivers/gpu/drm/amd/amdgpu/atom.h +++ b/drivers/gpu/drm/amd/amdgpu/atom.h | |||
@@ -92,7 +92,7 @@ | |||
92 | #define ATOM_WS_AND_MASK 0x45 | 92 | #define ATOM_WS_AND_MASK 0x45 |
93 | #define ATOM_WS_FB_WINDOW 0x46 | 93 | #define ATOM_WS_FB_WINDOW 0x46 |
94 | #define ATOM_WS_ATTRIBUTES 0x47 | 94 | #define ATOM_WS_ATTRIBUTES 0x47 |
95 | #define ATOM_WS_REGPTR 0x48 | 95 | #define ATOM_WS_REGPTR 0x48 |
96 | 96 | ||
97 | #define ATOM_IIO_NOP 0 | 97 | #define ATOM_IIO_NOP 0 |
98 | #define ATOM_IIO_START 1 | 98 | #define ATOM_IIO_START 1 |
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c index 90f83b21b38c..ea407db1fbcf 100644 --- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c | |||
@@ -2549,19 +2549,17 @@ static int ci_get_dependency_volt_by_clk(struct amdgpu_device *adev, | |||
2549 | return 0; | 2549 | return 0; |
2550 | } | 2550 | } |
2551 | 2551 | ||
2552 | static u8 ci_get_sleep_divider_id_from_clock(struct amdgpu_device *adev, | 2552 | static u8 ci_get_sleep_divider_id_from_clock(u32 sclk, u32 min_sclk_in_sr) |
2553 | u32 sclk, u32 min_sclk_in_sr) | ||
2554 | { | 2553 | { |
2555 | u32 i; | 2554 | u32 i; |
2556 | u32 tmp; | 2555 | u32 tmp; |
2557 | u32 min = (min_sclk_in_sr > CISLAND_MINIMUM_ENGINE_CLOCK) ? | 2556 | u32 min = max(min_sclk_in_sr, (u32)CISLAND_MINIMUM_ENGINE_CLOCK); |
2558 | min_sclk_in_sr : CISLAND_MINIMUM_ENGINE_CLOCK; | ||
2559 | 2557 | ||
2560 | if (sclk < min) | 2558 | if (sclk < min) |
2561 | return 0; | 2559 | return 0; |
2562 | 2560 | ||
2563 | for (i = CISLAND_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { | 2561 | for (i = CISLAND_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { |
2564 | tmp = sclk / (1 << i); | 2562 | tmp = sclk >> i; |
2565 | if (tmp >= min || i == 0) | 2563 | if (tmp >= min || i == 0) |
2566 | break; | 2564 | break; |
2567 | } | 2565 | } |
@@ -3358,8 +3356,7 @@ static int ci_populate_single_graphic_level(struct amdgpu_device *adev, | |||
3358 | graphic_level->PowerThrottle = 0; | 3356 | graphic_level->PowerThrottle = 0; |
3359 | 3357 | ||
3360 | if (pi->caps_sclk_ds) | 3358 | if (pi->caps_sclk_ds) |
3361 | graphic_level->DeepSleepDivId = ci_get_sleep_divider_id_from_clock(adev, | 3359 | graphic_level->DeepSleepDivId = ci_get_sleep_divider_id_from_clock(engine_clock, |
3362 | engine_clock, | ||
3363 | CISLAND_MINIMUM_ENGINE_CLOCK); | 3360 | CISLAND_MINIMUM_ENGINE_CLOCK); |
3364 | 3361 | ||
3365 | graphic_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; | 3362 | graphic_level->DisplayWatermark = PPSMC_DISPLAY_WATERMARK_LOW; |
@@ -6363,7 +6360,7 @@ static int ci_dpm_set_interrupt_state(struct amdgpu_device *adev, | |||
6363 | } | 6360 | } |
6364 | 6361 | ||
6365 | static int ci_dpm_process_interrupt(struct amdgpu_device *adev, | 6362 | static int ci_dpm_process_interrupt(struct amdgpu_device *adev, |
6366 | struct amdgpu_irq_src *source, | 6363 | struct amdgpu_irq_src *source, |
6367 | struct amdgpu_iv_entry *entry) | 6364 | struct amdgpu_iv_entry *entry) |
6368 | { | 6365 | { |
6369 | bool queue_thermal = false; | 6366 | bool queue_thermal = false; |
@@ -6405,6 +6402,7 @@ static int ci_dpm_set_powergating_state(void *handle, | |||
6405 | } | 6402 | } |
6406 | 6403 | ||
6407 | const struct amd_ip_funcs ci_dpm_ip_funcs = { | 6404 | const struct amd_ip_funcs ci_dpm_ip_funcs = { |
6405 | .name = "ci_dpm", | ||
6408 | .early_init = ci_dpm_early_init, | 6406 | .early_init = ci_dpm_early_init, |
6409 | .late_init = ci_dpm_late_init, | 6407 | .late_init = ci_dpm_late_init, |
6410 | .sw_init = ci_dpm_sw_init, | 6408 | .sw_init = ci_dpm_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c index c6127d66de11..07bc795a4ca9 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik.c +++ b/drivers/gpu/drm/amd/amdgpu/cik.c | |||
@@ -2007,7 +2007,6 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = | |||
2007 | .get_xclk = &cik_get_xclk, | 2007 | .get_xclk = &cik_get_xclk, |
2008 | .set_uvd_clocks = &cik_set_uvd_clocks, | 2008 | .set_uvd_clocks = &cik_set_uvd_clocks, |
2009 | .set_vce_clocks = &cik_set_vce_clocks, | 2009 | .set_vce_clocks = &cik_set_vce_clocks, |
2010 | .get_cu_info = &gfx_v7_0_get_cu_info, | ||
2011 | /* these should be moved to their own ip modules */ | 2010 | /* these should be moved to their own ip modules */ |
2012 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, | 2011 | .get_gpu_clock_counter = &gfx_v7_0_get_gpu_clock_counter, |
2013 | .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle, | 2012 | .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle, |
@@ -2233,6 +2232,7 @@ static int cik_common_set_powergating_state(void *handle, | |||
2233 | } | 2232 | } |
2234 | 2233 | ||
2235 | const struct amd_ip_funcs cik_common_ip_funcs = { | 2234 | const struct amd_ip_funcs cik_common_ip_funcs = { |
2235 | .name = "cik_common", | ||
2236 | .early_init = cik_common_early_init, | 2236 | .early_init = cik_common_early_init, |
2237 | .late_init = NULL, | 2237 | .late_init = NULL, |
2238 | .sw_init = cik_common_sw_init, | 2238 | .sw_init = cik_common_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_ih.c b/drivers/gpu/drm/amd/amdgpu/cik_ih.c index f2f14fe26784..845c21b1b2ee 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_ih.c | |||
@@ -243,7 +243,7 @@ static void cik_ih_decode_iv(struct amdgpu_device *adev, | |||
243 | /* wptr/rptr are in bytes! */ | 243 | /* wptr/rptr are in bytes! */ |
244 | u32 ring_index = adev->irq.ih.rptr >> 2; | 244 | u32 ring_index = adev->irq.ih.rptr >> 2; |
245 | uint32_t dw[4]; | 245 | uint32_t dw[4]; |
246 | 246 | ||
247 | dw[0] = le32_to_cpu(adev->irq.ih.ring[ring_index + 0]); | 247 | dw[0] = le32_to_cpu(adev->irq.ih.ring[ring_index + 0]); |
248 | dw[1] = le32_to_cpu(adev->irq.ih.ring[ring_index + 1]); | 248 | dw[1] = le32_to_cpu(adev->irq.ih.ring[ring_index + 1]); |
249 | dw[2] = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]); | 249 | dw[2] = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]); |
@@ -415,6 +415,7 @@ static int cik_ih_set_powergating_state(void *handle, | |||
415 | } | 415 | } |
416 | 416 | ||
417 | const struct amd_ip_funcs cik_ih_ip_funcs = { | 417 | const struct amd_ip_funcs cik_ih_ip_funcs = { |
418 | .name = "cik_ih", | ||
418 | .early_init = cik_ih_early_init, | 419 | .early_init = cik_ih_early_init, |
419 | .late_init = NULL, | 420 | .late_init = NULL, |
420 | .sw_init = cik_ih_sw_init, | 421 | .sw_init = cik_ih_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c index b7ed9d376001..518dca43b133 100644 --- a/drivers/gpu/drm/amd/amdgpu/cik_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/cik_sdma.c | |||
@@ -210,9 +210,10 @@ static void cik_sdma_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count) | |||
210 | * Schedule an IB in the DMA ring (CIK). | 210 | * Schedule an IB in the DMA ring (CIK). |
211 | */ | 211 | */ |
212 | static void cik_sdma_ring_emit_ib(struct amdgpu_ring *ring, | 212 | static void cik_sdma_ring_emit_ib(struct amdgpu_ring *ring, |
213 | struct amdgpu_ib *ib) | 213 | struct amdgpu_ib *ib, |
214 | unsigned vm_id, bool ctx_switch) | ||
214 | { | 215 | { |
215 | u32 extra_bits = ib->vm_id & 0xf; | 216 | u32 extra_bits = vm_id & 0xf; |
216 | u32 next_rptr = ring->wptr + 5; | 217 | u32 next_rptr = ring->wptr + 5; |
217 | 218 | ||
218 | while ((next_rptr & 7) != 4) | 219 | while ((next_rptr & 7) != 4) |
@@ -643,7 +644,7 @@ static int cik_sdma_ring_test_ib(struct amdgpu_ring *ring) | |||
643 | ib.ptr[3] = 1; | 644 | ib.ptr[3] = 1; |
644 | ib.ptr[4] = 0xDEADBEEF; | 645 | ib.ptr[4] = 0xDEADBEEF; |
645 | ib.length_dw = 5; | 646 | ib.length_dw = 5; |
646 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f); | 647 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, NULL, &f); |
647 | if (r) | 648 | if (r) |
648 | goto err1; | 649 | goto err1; |
649 | 650 | ||
@@ -1223,6 +1224,7 @@ static int cik_sdma_set_powergating_state(void *handle, | |||
1223 | } | 1224 | } |
1224 | 1225 | ||
1225 | const struct amd_ip_funcs cik_sdma_ip_funcs = { | 1226 | const struct amd_ip_funcs cik_sdma_ip_funcs = { |
1227 | .name = "cik_sdma", | ||
1226 | .early_init = cik_sdma_early_init, | 1228 | .early_init = cik_sdma_early_init, |
1227 | .late_init = NULL, | 1229 | .late_init = NULL, |
1228 | .sw_init = cik_sdma_sw_init, | 1230 | .sw_init = cik_sdma_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/cikd.h b/drivers/gpu/drm/amd/amdgpu/cikd.h index 60d4493206dd..c4f6f00d62bc 100644 --- a/drivers/gpu/drm/amd/amdgpu/cikd.h +++ b/drivers/gpu/drm/amd/amdgpu/cikd.h | |||
@@ -190,8 +190,8 @@ | |||
190 | # define MACRO_TILE_ASPECT(x) ((x) << 4) | 190 | # define MACRO_TILE_ASPECT(x) ((x) << 4) |
191 | # define NUM_BANKS(x) ((x) << 6) | 191 | # define NUM_BANKS(x) ((x) << 6) |
192 | 192 | ||
193 | #define MSG_ENTER_RLC_SAFE_MODE 1 | 193 | #define MSG_ENTER_RLC_SAFE_MODE 1 |
194 | #define MSG_EXIT_RLC_SAFE_MODE 0 | 194 | #define MSG_EXIT_RLC_SAFE_MODE 0 |
195 | 195 | ||
196 | /* | 196 | /* |
197 | * PM4 | 197 | * PM4 |
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c index bf1847b28d9c..fa4449e126e6 100644 --- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c | |||
@@ -2230,6 +2230,7 @@ static void cz_dpm_powergate_vce(struct amdgpu_device *adev, bool gate) | |||
2230 | } | 2230 | } |
2231 | 2231 | ||
2232 | const struct amd_ip_funcs cz_dpm_ip_funcs = { | 2232 | const struct amd_ip_funcs cz_dpm_ip_funcs = { |
2233 | .name = "cz_dpm", | ||
2233 | .early_init = cz_dpm_early_init, | 2234 | .early_init = cz_dpm_early_init, |
2234 | .late_init = cz_dpm_late_init, | 2235 | .late_init = cz_dpm_late_init, |
2235 | .sw_init = cz_dpm_sw_init, | 2236 | .sw_init = cz_dpm_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_ih.c b/drivers/gpu/drm/amd/amdgpu/cz_ih.c index 23bd9122b15d..863cb16f6126 100644 --- a/drivers/gpu/drm/amd/amdgpu/cz_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/cz_ih.c | |||
@@ -222,7 +222,7 @@ static void cz_ih_decode_iv(struct amdgpu_device *adev, | |||
222 | /* wptr/rptr are in bytes! */ | 222 | /* wptr/rptr are in bytes! */ |
223 | u32 ring_index = adev->irq.ih.rptr >> 2; | 223 | u32 ring_index = adev->irq.ih.rptr >> 2; |
224 | uint32_t dw[4]; | 224 | uint32_t dw[4]; |
225 | 225 | ||
226 | dw[0] = le32_to_cpu(adev->irq.ih.ring[ring_index + 0]); | 226 | dw[0] = le32_to_cpu(adev->irq.ih.ring[ring_index + 0]); |
227 | dw[1] = le32_to_cpu(adev->irq.ih.ring[ring_index + 1]); | 227 | dw[1] = le32_to_cpu(adev->irq.ih.ring[ring_index + 1]); |
228 | dw[2] = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]); | 228 | dw[2] = le32_to_cpu(adev->irq.ih.ring[ring_index + 2]); |
@@ -396,6 +396,7 @@ static int cz_ih_set_powergating_state(void *handle, | |||
396 | } | 396 | } |
397 | 397 | ||
398 | const struct amd_ip_funcs cz_ih_ip_funcs = { | 398 | const struct amd_ip_funcs cz_ih_ip_funcs = { |
399 | .name = "cz_ih", | ||
399 | .early_init = cz_ih_early_init, | 400 | .early_init = cz_ih_early_init, |
400 | .late_init = NULL, | 401 | .late_init = NULL, |
401 | .sw_init = cz_ih_sw_init, | 402 | .sw_init = cz_ih_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_smumgr.h b/drivers/gpu/drm/amd/amdgpu/cz_smumgr.h index 924d355b4e2c..026342fcf0f3 100644 --- a/drivers/gpu/drm/amd/amdgpu/cz_smumgr.h +++ b/drivers/gpu/drm/amd/amdgpu/cz_smumgr.h | |||
@@ -77,7 +77,7 @@ struct cz_smu_private_data { | |||
77 | uint8_t driver_buffer_length; | 77 | uint8_t driver_buffer_length; |
78 | uint8_t scratch_buffer_length; | 78 | uint8_t scratch_buffer_length; |
79 | uint16_t toc_entry_used_count; | 79 | uint16_t toc_entry_used_count; |
80 | uint16_t toc_entry_initialize_index; | 80 | uint16_t toc_entry_initialize_index; |
81 | uint16_t toc_entry_power_profiling_index; | 81 | uint16_t toc_entry_power_profiling_index; |
82 | uint16_t toc_entry_aram; | 82 | uint16_t toc_entry_aram; |
83 | uint16_t toc_entry_ih_register_restore_task_index; | 83 | uint16_t toc_entry_ih_register_restore_task_index; |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 8af5fbc60e5b..be1cf388c2ec 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | |||
@@ -284,10 +284,16 @@ static void dce_v10_0_pageflip_interrupt_fini(struct amdgpu_device *adev) | |||
284 | * surface base address. | 284 | * surface base address. |
285 | */ | 285 | */ |
286 | static void dce_v10_0_page_flip(struct amdgpu_device *adev, | 286 | static void dce_v10_0_page_flip(struct amdgpu_device *adev, |
287 | int crtc_id, u64 crtc_base) | 287 | int crtc_id, u64 crtc_base, bool async) |
288 | { | 288 | { |
289 | struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; | 289 | struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; |
290 | u32 tmp; | ||
290 | 291 | ||
292 | /* flip at hsync for async, default is vsync */ | ||
293 | tmp = RREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset); | ||
294 | tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL, | ||
295 | GRPH_SURFACE_UPDATE_H_RETRACE_EN, async ? 1 : 0); | ||
296 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp); | ||
291 | /* update the primary scanout address */ | 297 | /* update the primary scanout address */ |
292 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 298 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
293 | upper_32_bits(crtc_base)); | 299 | upper_32_bits(crtc_base)); |
@@ -2211,6 +2217,14 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2211 | 2217 | ||
2212 | dce_v10_0_vga_enable(crtc, false); | 2218 | dce_v10_0_vga_enable(crtc, false); |
2213 | 2219 | ||
2220 | /* Make sure surface address is updated at vertical blank rather than | ||
2221 | * horizontal blank | ||
2222 | */ | ||
2223 | tmp = RREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset); | ||
2224 | tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL, | ||
2225 | GRPH_SURFACE_UPDATE_H_RETRACE_EN, 0); | ||
2226 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp); | ||
2227 | |||
2214 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 2228 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
2215 | upper_32_bits(fb_location)); | 2229 | upper_32_bits(fb_location)); |
2216 | WREG32(mmGRPH_SECONDARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 2230 | WREG32(mmGRPH_SECONDARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
@@ -2261,13 +2275,6 @@ static int dce_v10_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2261 | WREG32(mmVIEWPORT_SIZE + amdgpu_crtc->crtc_offset, | 2275 | WREG32(mmVIEWPORT_SIZE + amdgpu_crtc->crtc_offset, |
2262 | (viewport_w << 16) | viewport_h); | 2276 | (viewport_w << 16) | viewport_h); |
2263 | 2277 | ||
2264 | /* pageflip setup */ | ||
2265 | /* make sure flip is at vb rather than hb */ | ||
2266 | tmp = RREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset); | ||
2267 | tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL, | ||
2268 | GRPH_SURFACE_UPDATE_H_RETRACE_EN, 0); | ||
2269 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp); | ||
2270 | |||
2271 | /* set pageflip to happen only at start of vblank interval (front porch) */ | 2278 | /* set pageflip to happen only at start of vblank interval (front porch) */ |
2272 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 3); | 2279 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 3); |
2273 | 2280 | ||
@@ -2992,6 +2999,8 @@ static int dce_v10_0_sw_init(void *handle) | |||
2992 | 2999 | ||
2993 | adev->ddev->mode_config.funcs = &amdgpu_mode_funcs; | 3000 | adev->ddev->mode_config.funcs = &amdgpu_mode_funcs; |
2994 | 3001 | ||
3002 | adev->ddev->mode_config.async_page_flip = true; | ||
3003 | |||
2995 | adev->ddev->mode_config.max_width = 16384; | 3004 | adev->ddev->mode_config.max_width = 16384; |
2996 | adev->ddev->mode_config.max_height = 16384; | 3005 | adev->ddev->mode_config.max_height = 16384; |
2997 | 3006 | ||
@@ -3490,6 +3499,7 @@ static int dce_v10_0_set_powergating_state(void *handle, | |||
3490 | } | 3499 | } |
3491 | 3500 | ||
3492 | const struct amd_ip_funcs dce_v10_0_ip_funcs = { | 3501 | const struct amd_ip_funcs dce_v10_0_ip_funcs = { |
3502 | .name = "dce_v10_0", | ||
3493 | .early_init = dce_v10_0_early_init, | 3503 | .early_init = dce_v10_0_early_init, |
3494 | .late_init = NULL, | 3504 | .late_init = NULL, |
3495 | .sw_init = dce_v10_0_sw_init, | 3505 | .sw_init = dce_v10_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index dda9ffb68df8..1e0988572a2f 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | |||
@@ -302,10 +302,17 @@ static void dce_v11_0_pageflip_interrupt_fini(struct amdgpu_device *adev) | |||
302 | * surface base address. | 302 | * surface base address. |
303 | */ | 303 | */ |
304 | static void dce_v11_0_page_flip(struct amdgpu_device *adev, | 304 | static void dce_v11_0_page_flip(struct amdgpu_device *adev, |
305 | int crtc_id, u64 crtc_base) | 305 | int crtc_id, u64 crtc_base, bool async) |
306 | { | 306 | { |
307 | struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; | 307 | struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; |
308 | u32 tmp; | ||
308 | 309 | ||
310 | /* flip at hsync for async, default is vsync */ | ||
311 | /* use UPDATE_IMMEDIATE_EN instead for async? */ | ||
312 | tmp = RREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset); | ||
313 | tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL, | ||
314 | GRPH_SURFACE_UPDATE_H_RETRACE_EN, async ? 1 : 0); | ||
315 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp); | ||
309 | /* update the scanout addresses */ | 316 | /* update the scanout addresses */ |
310 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 317 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
311 | upper_32_bits(crtc_base)); | 318 | upper_32_bits(crtc_base)); |
@@ -1595,6 +1602,7 @@ static const u32 pin_offsets[] = | |||
1595 | AUD4_REGISTER_OFFSET, | 1602 | AUD4_REGISTER_OFFSET, |
1596 | AUD5_REGISTER_OFFSET, | 1603 | AUD5_REGISTER_OFFSET, |
1597 | AUD6_REGISTER_OFFSET, | 1604 | AUD6_REGISTER_OFFSET, |
1605 | AUD7_REGISTER_OFFSET, | ||
1598 | }; | 1606 | }; |
1599 | 1607 | ||
1600 | static int dce_v11_0_audio_init(struct amdgpu_device *adev) | 1608 | static int dce_v11_0_audio_init(struct amdgpu_device *adev) |
@@ -2185,6 +2193,14 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2185 | 2193 | ||
2186 | dce_v11_0_vga_enable(crtc, false); | 2194 | dce_v11_0_vga_enable(crtc, false); |
2187 | 2195 | ||
2196 | /* Make sure surface address is updated at vertical blank rather than | ||
2197 | * horizontal blank | ||
2198 | */ | ||
2199 | tmp = RREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset); | ||
2200 | tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL, | ||
2201 | GRPH_SURFACE_UPDATE_H_RETRACE_EN, 0); | ||
2202 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp); | ||
2203 | |||
2188 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 2204 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
2189 | upper_32_bits(fb_location)); | 2205 | upper_32_bits(fb_location)); |
2190 | WREG32(mmGRPH_SECONDARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 2206 | WREG32(mmGRPH_SECONDARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
@@ -2235,13 +2251,6 @@ static int dce_v11_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2235 | WREG32(mmVIEWPORT_SIZE + amdgpu_crtc->crtc_offset, | 2251 | WREG32(mmVIEWPORT_SIZE + amdgpu_crtc->crtc_offset, |
2236 | (viewport_w << 16) | viewport_h); | 2252 | (viewport_w << 16) | viewport_h); |
2237 | 2253 | ||
2238 | /* pageflip setup */ | ||
2239 | /* make sure flip is at vb rather than hb */ | ||
2240 | tmp = RREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset); | ||
2241 | tmp = REG_SET_FIELD(tmp, GRPH_FLIP_CONTROL, | ||
2242 | GRPH_SURFACE_UPDATE_H_RETRACE_EN, 0); | ||
2243 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp); | ||
2244 | |||
2245 | /* set pageflip to happen only at start of vblank interval (front porch) */ | 2254 | /* set pageflip to happen only at start of vblank interval (front porch) */ |
2246 | WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 3); | 2255 | WREG32(mmCRTC_MASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 3); |
2247 | 2256 | ||
@@ -2419,10 +2428,6 @@ static u32 dce_v11_0_pick_pll(struct drm_crtc *crtc) | |||
2419 | 2428 | ||
2420 | if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(amdgpu_crtc->encoder))) | 2429 | if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(amdgpu_crtc->encoder))) |
2421 | return ATOM_DP_DTO; | 2430 | return ATOM_DP_DTO; |
2422 | /* use the same PPLL for all monitors with the same clock */ | ||
2423 | pll = amdgpu_pll_get_shared_nondp_ppll(crtc); | ||
2424 | if (pll != ATOM_PPLL_INVALID) | ||
2425 | return pll; | ||
2426 | 2431 | ||
2427 | switch (amdgpu_encoder->encoder_id) { | 2432 | switch (amdgpu_encoder->encoder_id) { |
2428 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: | 2433 | case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: |
@@ -3046,6 +3051,8 @@ static int dce_v11_0_sw_init(void *handle) | |||
3046 | 3051 | ||
3047 | adev->ddev->mode_config.funcs = &amdgpu_mode_funcs; | 3052 | adev->ddev->mode_config.funcs = &amdgpu_mode_funcs; |
3048 | 3053 | ||
3054 | adev->ddev->mode_config.async_page_flip = true; | ||
3055 | |||
3049 | adev->ddev->mode_config.max_width = 16384; | 3056 | adev->ddev->mode_config.max_width = 16384; |
3050 | adev->ddev->mode_config.max_height = 16384; | 3057 | adev->ddev->mode_config.max_height = 16384; |
3051 | 3058 | ||
@@ -3553,6 +3560,7 @@ static int dce_v11_0_set_powergating_state(void *handle, | |||
3553 | } | 3560 | } |
3554 | 3561 | ||
3555 | const struct amd_ip_funcs dce_v11_0_ip_funcs = { | 3562 | const struct amd_ip_funcs dce_v11_0_ip_funcs = { |
3563 | .name = "dce_v11_0", | ||
3556 | .early_init = dce_v11_0_early_init, | 3564 | .early_init = dce_v11_0_early_init, |
3557 | .late_init = NULL, | 3565 | .late_init = NULL, |
3558 | .sw_init = dce_v11_0_sw_init, | 3566 | .sw_init = dce_v11_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index 25e6af03c406..c087f930d67e 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | |||
@@ -233,10 +233,13 @@ static void dce_v8_0_pageflip_interrupt_fini(struct amdgpu_device *adev) | |||
233 | * surface base address. | 233 | * surface base address. |
234 | */ | 234 | */ |
235 | static void dce_v8_0_page_flip(struct amdgpu_device *adev, | 235 | static void dce_v8_0_page_flip(struct amdgpu_device *adev, |
236 | int crtc_id, u64 crtc_base) | 236 | int crtc_id, u64 crtc_base, bool async) |
237 | { | 237 | { |
238 | struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; | 238 | struct amdgpu_crtc *amdgpu_crtc = adev->mode_info.crtcs[crtc_id]; |
239 | 239 | ||
240 | /* flip at hsync for async, default is vsync */ | ||
241 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, async ? | ||
242 | GRPH_FLIP_CONTROL__GRPH_SURFACE_UPDATE_H_RETRACE_EN_MASK : 0); | ||
240 | /* update the primary scanout addresses */ | 243 | /* update the primary scanout addresses */ |
241 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 244 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
242 | upper_32_bits(crtc_base)); | 245 | upper_32_bits(crtc_base)); |
@@ -1999,7 +2002,7 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
1999 | uint32_t fb_format, fb_pitch_pixels; | 2002 | uint32_t fb_format, fb_pitch_pixels; |
2000 | u32 fb_swap = (GRPH_ENDIAN_NONE << GRPH_SWAP_CNTL__GRPH_ENDIAN_SWAP__SHIFT); | 2003 | u32 fb_swap = (GRPH_ENDIAN_NONE << GRPH_SWAP_CNTL__GRPH_ENDIAN_SWAP__SHIFT); |
2001 | u32 pipe_config; | 2004 | u32 pipe_config; |
2002 | u32 tmp, viewport_w, viewport_h; | 2005 | u32 viewport_w, viewport_h; |
2003 | int r; | 2006 | int r; |
2004 | bool bypass_lut = false; | 2007 | bool bypass_lut = false; |
2005 | 2008 | ||
@@ -2135,6 +2138,11 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2135 | 2138 | ||
2136 | dce_v8_0_vga_enable(crtc, false); | 2139 | dce_v8_0_vga_enable(crtc, false); |
2137 | 2140 | ||
2141 | /* Make sure surface address is updated at vertical blank rather than | ||
2142 | * horizontal blank | ||
2143 | */ | ||
2144 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, 0); | ||
2145 | |||
2138 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 2146 | WREG32(mmGRPH_PRIMARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
2139 | upper_32_bits(fb_location)); | 2147 | upper_32_bits(fb_location)); |
2140 | WREG32(mmGRPH_SECONDARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, | 2148 | WREG32(mmGRPH_SECONDARY_SURFACE_ADDRESS_HIGH + amdgpu_crtc->crtc_offset, |
@@ -2182,12 +2190,6 @@ static int dce_v8_0_crtc_do_set_base(struct drm_crtc *crtc, | |||
2182 | WREG32(mmVIEWPORT_SIZE + amdgpu_crtc->crtc_offset, | 2190 | WREG32(mmVIEWPORT_SIZE + amdgpu_crtc->crtc_offset, |
2183 | (viewport_w << 16) | viewport_h); | 2191 | (viewport_w << 16) | viewport_h); |
2184 | 2192 | ||
2185 | /* pageflip setup */ | ||
2186 | /* make sure flip is at vb rather than hb */ | ||
2187 | tmp = RREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset); | ||
2188 | tmp &= ~GRPH_FLIP_CONTROL__GRPH_SURFACE_UPDATE_H_RETRACE_EN_MASK; | ||
2189 | WREG32(mmGRPH_FLIP_CONTROL + amdgpu_crtc->crtc_offset, tmp); | ||
2190 | |||
2191 | /* set pageflip to happen only at start of vblank interval (front porch) */ | 2193 | /* set pageflip to happen only at start of vblank interval (front porch) */ |
2192 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 3); | 2194 | WREG32(mmMASTER_UPDATE_MODE + amdgpu_crtc->crtc_offset, 3); |
2193 | 2195 | ||
@@ -2902,6 +2904,8 @@ static int dce_v8_0_sw_init(void *handle) | |||
2902 | 2904 | ||
2903 | adev->ddev->mode_config.funcs = &amdgpu_mode_funcs; | 2905 | adev->ddev->mode_config.funcs = &amdgpu_mode_funcs; |
2904 | 2906 | ||
2907 | adev->ddev->mode_config.async_page_flip = true; | ||
2908 | |||
2905 | adev->ddev->mode_config.max_width = 16384; | 2909 | adev->ddev->mode_config.max_width = 16384; |
2906 | adev->ddev->mode_config.max_height = 16384; | 2910 | adev->ddev->mode_config.max_height = 16384; |
2907 | 2911 | ||
@@ -3420,6 +3424,7 @@ static int dce_v8_0_set_powergating_state(void *handle, | |||
3420 | } | 3424 | } |
3421 | 3425 | ||
3422 | const struct amd_ip_funcs dce_v8_0_ip_funcs = { | 3426 | const struct amd_ip_funcs dce_v8_0_ip_funcs = { |
3427 | .name = "dce_v8_0", | ||
3423 | .early_init = dce_v8_0_early_init, | 3428 | .early_init = dce_v8_0_early_init, |
3424 | .late_init = NULL, | 3429 | .late_init = NULL, |
3425 | .sw_init = dce_v8_0_sw_init, | 3430 | .sw_init = dce_v8_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c b/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c index 6d133450d3cc..245cabf06575 100644 --- a/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/fiji_dpm.c | |||
@@ -143,6 +143,7 @@ static int fiji_dpm_set_powergating_state(void *handle, | |||
143 | } | 143 | } |
144 | 144 | ||
145 | const struct amd_ip_funcs fiji_dpm_ip_funcs = { | 145 | const struct amd_ip_funcs fiji_dpm_ip_funcs = { |
146 | .name = "fiji_dpm", | ||
146 | .early_init = fiji_dpm_early_init, | 147 | .early_init = fiji_dpm_early_init, |
147 | .late_init = NULL, | 148 | .late_init = NULL, |
148 | .sw_init = fiji_dpm_sw_init, | 149 | .sw_init = fiji_dpm_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 6686c9c3005d..7f18a53ab53a 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | |||
@@ -53,7 +53,6 @@ | |||
53 | static void gfx_v7_0_set_ring_funcs(struct amdgpu_device *adev); | 53 | static void gfx_v7_0_set_ring_funcs(struct amdgpu_device *adev); |
54 | static void gfx_v7_0_set_irq_funcs(struct amdgpu_device *adev); | 54 | static void gfx_v7_0_set_irq_funcs(struct amdgpu_device *adev); |
55 | static void gfx_v7_0_set_gds_init(struct amdgpu_device *adev); | 55 | static void gfx_v7_0_set_gds_init(struct amdgpu_device *adev); |
56 | int gfx_v7_0_get_cu_info(struct amdgpu_device *, struct amdgpu_cu_info *); | ||
57 | 56 | ||
58 | MODULE_FIRMWARE("radeon/bonaire_pfp.bin"); | 57 | MODULE_FIRMWARE("radeon/bonaire_pfp.bin"); |
59 | MODULE_FIRMWARE("radeon/bonaire_me.bin"); | 58 | MODULE_FIRMWARE("radeon/bonaire_me.bin"); |
@@ -882,6 +881,7 @@ static u32 gfx_v7_0_get_csb_size(struct amdgpu_device *adev); | |||
882 | static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *buffer); | 881 | static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *buffer); |
883 | static void gfx_v7_0_init_cp_pg_table(struct amdgpu_device *adev); | 882 | static void gfx_v7_0_init_cp_pg_table(struct amdgpu_device *adev); |
884 | static void gfx_v7_0_init_pg(struct amdgpu_device *adev); | 883 | static void gfx_v7_0_init_pg(struct amdgpu_device *adev); |
884 | static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev); | ||
885 | 885 | ||
886 | /* | 886 | /* |
887 | * Core functions | 887 | * Core functions |
@@ -1718,6 +1718,7 @@ static void gfx_v7_0_gpu_init(struct amdgpu_device *adev) | |||
1718 | gfx_v7_0_tiling_mode_table_init(adev); | 1718 | gfx_v7_0_tiling_mode_table_init(adev); |
1719 | 1719 | ||
1720 | gfx_v7_0_setup_rb(adev); | 1720 | gfx_v7_0_setup_rb(adev); |
1721 | gfx_v7_0_get_cu_info(adev); | ||
1721 | 1722 | ||
1722 | /* set HW defaults for 3D engine */ | 1723 | /* set HW defaults for 3D engine */ |
1723 | WREG32(mmCP_MEQ_THRESHOLDS, | 1724 | WREG32(mmCP_MEQ_THRESHOLDS, |
@@ -2029,17 +2030,13 @@ static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring, | |||
2029 | * on the gfx ring for execution by the GPU. | 2030 | * on the gfx ring for execution by the GPU. |
2030 | */ | 2031 | */ |
2031 | static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | 2032 | static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, |
2032 | struct amdgpu_ib *ib) | 2033 | struct amdgpu_ib *ib, |
2034 | unsigned vm_id, bool ctx_switch) | ||
2033 | { | 2035 | { |
2034 | bool need_ctx_switch = ring->current_ctx != ib->ctx; | ||
2035 | u32 header, control = 0; | 2036 | u32 header, control = 0; |
2036 | u32 next_rptr = ring->wptr + 5; | 2037 | u32 next_rptr = ring->wptr + 5; |
2037 | 2038 | ||
2038 | /* drop the CE preamble IB for the same context */ | 2039 | if (ctx_switch) |
2039 | if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && !need_ctx_switch) | ||
2040 | return; | ||
2041 | |||
2042 | if (need_ctx_switch) | ||
2043 | next_rptr += 2; | 2040 | next_rptr += 2; |
2044 | 2041 | ||
2045 | next_rptr += 4; | 2042 | next_rptr += 4; |
@@ -2050,7 +2047,7 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | |||
2050 | amdgpu_ring_write(ring, next_rptr); | 2047 | amdgpu_ring_write(ring, next_rptr); |
2051 | 2048 | ||
2052 | /* insert SWITCH_BUFFER packet before first IB in the ring frame */ | 2049 | /* insert SWITCH_BUFFER packet before first IB in the ring frame */ |
2053 | if (need_ctx_switch) { | 2050 | if (ctx_switch) { |
2054 | amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | 2051 | amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); |
2055 | amdgpu_ring_write(ring, 0); | 2052 | amdgpu_ring_write(ring, 0); |
2056 | } | 2053 | } |
@@ -2060,7 +2057,7 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | |||
2060 | else | 2057 | else |
2061 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); | 2058 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); |
2062 | 2059 | ||
2063 | control |= ib->length_dw | (ib->vm_id << 24); | 2060 | control |= ib->length_dw | (vm_id << 24); |
2064 | 2061 | ||
2065 | amdgpu_ring_write(ring, header); | 2062 | amdgpu_ring_write(ring, header); |
2066 | amdgpu_ring_write(ring, | 2063 | amdgpu_ring_write(ring, |
@@ -2073,7 +2070,8 @@ static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | |||
2073 | } | 2070 | } |
2074 | 2071 | ||
2075 | static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring, | 2072 | static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring, |
2076 | struct amdgpu_ib *ib) | 2073 | struct amdgpu_ib *ib, |
2074 | unsigned vm_id, bool ctx_switch) | ||
2077 | { | 2075 | { |
2078 | u32 header, control = 0; | 2076 | u32 header, control = 0; |
2079 | u32 next_rptr = ring->wptr + 5; | 2077 | u32 next_rptr = ring->wptr + 5; |
@@ -2088,7 +2086,7 @@ static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring, | |||
2088 | 2086 | ||
2089 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); | 2087 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); |
2090 | 2088 | ||
2091 | control |= ib->length_dw | (ib->vm_id << 24); | 2089 | control |= ib->length_dw | (vm_id << 24); |
2092 | 2090 | ||
2093 | amdgpu_ring_write(ring, header); | 2091 | amdgpu_ring_write(ring, header); |
2094 | amdgpu_ring_write(ring, | 2092 | amdgpu_ring_write(ring, |
@@ -2136,7 +2134,7 @@ static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring) | |||
2136 | ib.ptr[2] = 0xDEADBEEF; | 2134 | ib.ptr[2] = 0xDEADBEEF; |
2137 | ib.length_dw = 3; | 2135 | ib.length_dw = 3; |
2138 | 2136 | ||
2139 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f); | 2137 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, NULL, &f); |
2140 | if (r) | 2138 | if (r) |
2141 | goto err2; | 2139 | goto err2; |
2142 | 2140 | ||
@@ -3053,6 +3051,19 @@ static int gfx_v7_0_cp_resume(struct amdgpu_device *adev) | |||
3053 | static void gfx_v7_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) | 3051 | static void gfx_v7_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) |
3054 | { | 3052 | { |
3055 | int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); | 3053 | int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); |
3054 | uint32_t seq = ring->fence_drv.sync_seq; | ||
3055 | uint64_t addr = ring->fence_drv.gpu_addr; | ||
3056 | |||
3057 | amdgpu_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); | ||
3058 | amdgpu_ring_write(ring, (WAIT_REG_MEM_MEM_SPACE(1) | /* memory */ | ||
3059 | WAIT_REG_MEM_FUNCTION(3) | /* equal */ | ||
3060 | WAIT_REG_MEM_ENGINE(usepfp))); /* pfp or me */ | ||
3061 | amdgpu_ring_write(ring, addr & 0xfffffffc); | ||
3062 | amdgpu_ring_write(ring, upper_32_bits(addr) & 0xffffffff); | ||
3063 | amdgpu_ring_write(ring, seq); | ||
3064 | amdgpu_ring_write(ring, 0xffffffff); | ||
3065 | amdgpu_ring_write(ring, 4); /* poll interval */ | ||
3066 | |||
3056 | if (usepfp) { | 3067 | if (usepfp) { |
3057 | /* synce CE with ME to prevent CE fetch CEIB before context switch done */ | 3068 | /* synce CE with ME to prevent CE fetch CEIB before context switch done */ |
3058 | amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | 3069 | amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); |
@@ -3080,18 +3091,6 @@ static void gfx_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring, | |||
3080 | unsigned vm_id, uint64_t pd_addr) | 3091 | unsigned vm_id, uint64_t pd_addr) |
3081 | { | 3092 | { |
3082 | int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); | 3093 | int usepfp = (ring->type == AMDGPU_RING_TYPE_GFX); |
3083 | uint32_t seq = ring->fence_drv.sync_seq; | ||
3084 | uint64_t addr = ring->fence_drv.gpu_addr; | ||
3085 | |||
3086 | amdgpu_ring_write(ring, PACKET3(PACKET3_WAIT_REG_MEM, 5)); | ||
3087 | amdgpu_ring_write(ring, (WAIT_REG_MEM_MEM_SPACE(1) | /* memory */ | ||
3088 | WAIT_REG_MEM_FUNCTION(3) | /* equal */ | ||
3089 | WAIT_REG_MEM_ENGINE(usepfp))); /* pfp or me */ | ||
3090 | amdgpu_ring_write(ring, addr & 0xfffffffc); | ||
3091 | amdgpu_ring_write(ring, upper_32_bits(addr) & 0xffffffff); | ||
3092 | amdgpu_ring_write(ring, seq); | ||
3093 | amdgpu_ring_write(ring, 0xffffffff); | ||
3094 | amdgpu_ring_write(ring, 4); /* poll interval */ | ||
3095 | 3094 | ||
3096 | amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); | 3095 | amdgpu_ring_write(ring, PACKET3(PACKET3_WRITE_DATA, 3)); |
3097 | amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | | 3096 | amdgpu_ring_write(ring, (WRITE_DATA_ENGINE_SEL(usepfp) | |
@@ -3869,18 +3868,13 @@ static u32 gfx_v7_0_get_cu_active_bitmap(struct amdgpu_device *adev) | |||
3869 | 3868 | ||
3870 | static void gfx_v7_0_init_ao_cu_mask(struct amdgpu_device *adev) | 3869 | static void gfx_v7_0_init_ao_cu_mask(struct amdgpu_device *adev) |
3871 | { | 3870 | { |
3872 | uint32_t tmp, active_cu_number; | 3871 | u32 tmp; |
3873 | struct amdgpu_cu_info cu_info; | ||
3874 | |||
3875 | gfx_v7_0_get_cu_info(adev, &cu_info); | ||
3876 | tmp = cu_info.ao_cu_mask; | ||
3877 | active_cu_number = cu_info.number; | ||
3878 | 3872 | ||
3879 | WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, tmp); | 3873 | WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask); |
3880 | 3874 | ||
3881 | tmp = RREG32(mmRLC_MAX_PG_CU); | 3875 | tmp = RREG32(mmRLC_MAX_PG_CU); |
3882 | tmp &= ~RLC_MAX_PG_CU__MAX_POWERED_UP_CU_MASK; | 3876 | tmp &= ~RLC_MAX_PG_CU__MAX_POWERED_UP_CU_MASK; |
3883 | tmp |= (active_cu_number << RLC_MAX_PG_CU__MAX_POWERED_UP_CU__SHIFT); | 3877 | tmp |= (adev->gfx.cu_info.number << RLC_MAX_PG_CU__MAX_POWERED_UP_CU__SHIFT); |
3884 | WREG32(mmRLC_MAX_PG_CU, tmp); | 3878 | WREG32(mmRLC_MAX_PG_CU, tmp); |
3885 | } | 3879 | } |
3886 | 3880 | ||
@@ -4898,6 +4892,7 @@ static int gfx_v7_0_set_powergating_state(void *handle, | |||
4898 | } | 4892 | } |
4899 | 4893 | ||
4900 | const struct amd_ip_funcs gfx_v7_0_ip_funcs = { | 4894 | const struct amd_ip_funcs gfx_v7_0_ip_funcs = { |
4895 | .name = "gfx_v7_0", | ||
4901 | .early_init = gfx_v7_0_early_init, | 4896 | .early_init = gfx_v7_0_early_init, |
4902 | .late_init = gfx_v7_0_late_init, | 4897 | .late_init = gfx_v7_0_late_init, |
4903 | .sw_init = gfx_v7_0_sw_init, | 4898 | .sw_init = gfx_v7_0_sw_init, |
@@ -5015,14 +5010,11 @@ static void gfx_v7_0_set_gds_init(struct amdgpu_device *adev) | |||
5015 | } | 5010 | } |
5016 | 5011 | ||
5017 | 5012 | ||
5018 | int gfx_v7_0_get_cu_info(struct amdgpu_device *adev, | 5013 | static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev) |
5019 | struct amdgpu_cu_info *cu_info) | ||
5020 | { | 5014 | { |
5021 | int i, j, k, counter, active_cu_number = 0; | 5015 | int i, j, k, counter, active_cu_number = 0; |
5022 | u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0; | 5016 | u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0; |
5023 | 5017 | struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info; | |
5024 | if (!adev || !cu_info) | ||
5025 | return -EINVAL; | ||
5026 | 5018 | ||
5027 | memset(cu_info, 0, sizeof(*cu_info)); | 5019 | memset(cu_info, 0, sizeof(*cu_info)); |
5028 | 5020 | ||
@@ -5053,6 +5045,4 @@ int gfx_v7_0_get_cu_info(struct amdgpu_device *adev, | |||
5053 | 5045 | ||
5054 | cu_info->number = active_cu_number; | 5046 | cu_info->number = active_cu_number; |
5055 | cu_info->ao_cu_mask = ao_cu_mask; | 5047 | cu_info->ao_cu_mask = ao_cu_mask; |
5056 | |||
5057 | return 0; | ||
5058 | } | 5048 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h index c04bfbabfc88..e747aa935c88 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h | |||
@@ -32,6 +32,5 @@ void gfx_v7_0_exit_rlc_safe_mode(struct amdgpu_device *adev); | |||
32 | void gfx_v7_0_rlc_stop(struct amdgpu_device *adev); | 32 | void gfx_v7_0_rlc_stop(struct amdgpu_device *adev); |
33 | uint64_t gfx_v7_0_get_gpu_clock_counter(struct amdgpu_device *adev); | 33 | uint64_t gfx_v7_0_get_gpu_clock_counter(struct amdgpu_device *adev); |
34 | void gfx_v7_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); | 34 | void gfx_v7_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); |
35 | int gfx_v7_0_get_cu_info(struct amdgpu_device *adev, struct amdgpu_cu_info *cu_info); | ||
36 | 35 | ||
37 | #endif | 36 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 021c17e50d51..92647fbf5b8b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -603,7 +603,7 @@ static const u32 stoney_golden_settings_a11[] = | |||
603 | mmPA_SC_LINE_STIPPLE_STATE, 0x0000ff0f, 0x00000000, | 603 | mmPA_SC_LINE_STIPPLE_STATE, 0x0000ff0f, 0x00000000, |
604 | mmRLC_CGCG_CGLS_CTRL, 0x00000003, 0x0001003c, | 604 | mmRLC_CGCG_CGLS_CTRL, 0x00000003, 0x0001003c, |
605 | mmTA_CNTL_AUX, 0x000f000f, 0x000b0000, | 605 | mmTA_CNTL_AUX, 0x000f000f, 0x000b0000, |
606 | mmTCC_CTRL, 0x00100000, 0xf31fff7f, | 606 | mmTCC_CTRL, 0x00100000, 0xf31fff7f, |
607 | mmTCC_EXE_DISABLE, 0x00000002, 0x00000002, | 607 | mmTCC_EXE_DISABLE, 0x00000002, 0x00000002, |
608 | mmTCP_ADDR_CONFIG, 0x0000000f, 0x000000f1, | 608 | mmTCP_ADDR_CONFIG, 0x0000000f, 0x000000f1, |
609 | mmTCP_CHAN_STEER_LO, 0xffffffff, 0x10101010, | 609 | mmTCP_CHAN_STEER_LO, 0xffffffff, 0x10101010, |
@@ -636,6 +636,7 @@ static void gfx_v8_0_set_irq_funcs(struct amdgpu_device *adev); | |||
636 | static void gfx_v8_0_set_gds_init(struct amdgpu_device *adev); | 636 | static void gfx_v8_0_set_gds_init(struct amdgpu_device *adev); |
637 | static void gfx_v8_0_set_rlc_funcs(struct amdgpu_device *adev); | 637 | static void gfx_v8_0_set_rlc_funcs(struct amdgpu_device *adev); |
638 | static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev); | 638 | static u32 gfx_v8_0_get_csb_size(struct amdgpu_device *adev); |
639 | static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev); | ||
639 | 640 | ||
640 | static void gfx_v8_0_init_golden_registers(struct amdgpu_device *adev) | 641 | static void gfx_v8_0_init_golden_registers(struct amdgpu_device *adev) |
641 | { | 642 | { |
@@ -800,7 +801,7 @@ static int gfx_v8_0_ring_test_ib(struct amdgpu_ring *ring) | |||
800 | ib.ptr[2] = 0xDEADBEEF; | 801 | ib.ptr[2] = 0xDEADBEEF; |
801 | ib.length_dw = 3; | 802 | ib.length_dw = 3; |
802 | 803 | ||
803 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f); | 804 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, NULL, &f); |
804 | if (r) | 805 | if (r) |
805 | goto err2; | 806 | goto err2; |
806 | 807 | ||
@@ -1551,7 +1552,7 @@ static int gfx_v8_0_do_edc_gpr_workarounds(struct amdgpu_device *adev) | |||
1551 | ib.ptr[ib.length_dw++] = EVENT_TYPE(7) | EVENT_INDEX(4); | 1552 | ib.ptr[ib.length_dw++] = EVENT_TYPE(7) | EVENT_INDEX(4); |
1552 | 1553 | ||
1553 | /* shedule the ib on the ring */ | 1554 | /* shedule the ib on the ring */ |
1554 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f); | 1555 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, NULL, &f); |
1555 | if (r) { | 1556 | if (r) { |
1556 | DRM_ERROR("amdgpu: ib submit failed (%d).\n", r); | 1557 | DRM_ERROR("amdgpu: ib submit failed (%d).\n", r); |
1557 | goto fail; | 1558 | goto fail; |
@@ -3431,6 +3432,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev) | |||
3431 | gfx_v8_0_tiling_mode_table_init(adev); | 3432 | gfx_v8_0_tiling_mode_table_init(adev); |
3432 | 3433 | ||
3433 | gfx_v8_0_setup_rb(adev); | 3434 | gfx_v8_0_setup_rb(adev); |
3435 | gfx_v8_0_get_cu_info(adev); | ||
3434 | 3436 | ||
3435 | /* XXX SH_MEM regs */ | 3437 | /* XXX SH_MEM regs */ |
3436 | /* where to put LDS, scratch, GPUVM in FSA64 space */ | 3438 | /* where to put LDS, scratch, GPUVM in FSA64 space */ |
@@ -5644,17 +5646,13 @@ static void gfx_v8_0_ring_emit_hdp_invalidate(struct amdgpu_ring *ring) | |||
5644 | } | 5646 | } |
5645 | 5647 | ||
5646 | static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | 5648 | static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, |
5647 | struct amdgpu_ib *ib) | 5649 | struct amdgpu_ib *ib, |
5650 | unsigned vm_id, bool ctx_switch) | ||
5648 | { | 5651 | { |
5649 | bool need_ctx_switch = ring->current_ctx != ib->ctx; | ||
5650 | u32 header, control = 0; | 5652 | u32 header, control = 0; |
5651 | u32 next_rptr = ring->wptr + 5; | 5653 | u32 next_rptr = ring->wptr + 5; |
5652 | 5654 | ||
5653 | /* drop the CE preamble IB for the same context */ | 5655 | if (ctx_switch) |
5654 | if ((ib->flags & AMDGPU_IB_FLAG_PREAMBLE) && !need_ctx_switch) | ||
5655 | return; | ||
5656 | |||
5657 | if (need_ctx_switch) | ||
5658 | next_rptr += 2; | 5656 | next_rptr += 2; |
5659 | 5657 | ||
5660 | next_rptr += 4; | 5658 | next_rptr += 4; |
@@ -5665,7 +5663,7 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | |||
5665 | amdgpu_ring_write(ring, next_rptr); | 5663 | amdgpu_ring_write(ring, next_rptr); |
5666 | 5664 | ||
5667 | /* insert SWITCH_BUFFER packet before first IB in the ring frame */ | 5665 | /* insert SWITCH_BUFFER packet before first IB in the ring frame */ |
5668 | if (need_ctx_switch) { | 5666 | if (ctx_switch) { |
5669 | amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); | 5667 | amdgpu_ring_write(ring, PACKET3(PACKET3_SWITCH_BUFFER, 0)); |
5670 | amdgpu_ring_write(ring, 0); | 5668 | amdgpu_ring_write(ring, 0); |
5671 | } | 5669 | } |
@@ -5675,7 +5673,7 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | |||
5675 | else | 5673 | else |
5676 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); | 5674 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); |
5677 | 5675 | ||
5678 | control |= ib->length_dw | (ib->vm_id << 24); | 5676 | control |= ib->length_dw | (vm_id << 24); |
5679 | 5677 | ||
5680 | amdgpu_ring_write(ring, header); | 5678 | amdgpu_ring_write(ring, header); |
5681 | amdgpu_ring_write(ring, | 5679 | amdgpu_ring_write(ring, |
@@ -5688,7 +5686,8 @@ static void gfx_v8_0_ring_emit_ib_gfx(struct amdgpu_ring *ring, | |||
5688 | } | 5686 | } |
5689 | 5687 | ||
5690 | static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring, | 5688 | static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring, |
5691 | struct amdgpu_ib *ib) | 5689 | struct amdgpu_ib *ib, |
5690 | unsigned vm_id, bool ctx_switch) | ||
5692 | { | 5691 | { |
5693 | u32 header, control = 0; | 5692 | u32 header, control = 0; |
5694 | u32 next_rptr = ring->wptr + 5; | 5693 | u32 next_rptr = ring->wptr + 5; |
@@ -5704,7 +5703,7 @@ static void gfx_v8_0_ring_emit_ib_compute(struct amdgpu_ring *ring, | |||
5704 | 5703 | ||
5705 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); | 5704 | header = PACKET3(PACKET3_INDIRECT_BUFFER, 2); |
5706 | 5705 | ||
5707 | control |= ib->length_dw | (ib->vm_id << 24); | 5706 | control |= ib->length_dw | (vm_id << 24); |
5708 | 5707 | ||
5709 | amdgpu_ring_write(ring, header); | 5708 | amdgpu_ring_write(ring, header); |
5710 | amdgpu_ring_write(ring, | 5709 | amdgpu_ring_write(ring, |
@@ -6064,6 +6063,7 @@ static int gfx_v8_0_priv_inst_irq(struct amdgpu_device *adev, | |||
6064 | } | 6063 | } |
6065 | 6064 | ||
6066 | const struct amd_ip_funcs gfx_v8_0_ip_funcs = { | 6065 | const struct amd_ip_funcs gfx_v8_0_ip_funcs = { |
6066 | .name = "gfx_v8_0", | ||
6067 | .early_init = gfx_v8_0_early_init, | 6067 | .early_init = gfx_v8_0_early_init, |
6068 | .late_init = gfx_v8_0_late_init, | 6068 | .late_init = gfx_v8_0_late_init, |
6069 | .sw_init = gfx_v8_0_sw_init, | 6069 | .sw_init = gfx_v8_0_sw_init, |
@@ -6212,14 +6212,11 @@ static u32 gfx_v8_0_get_cu_active_bitmap(struct amdgpu_device *adev) | |||
6212 | return (~data) & mask; | 6212 | return (~data) & mask; |
6213 | } | 6213 | } |
6214 | 6214 | ||
6215 | int gfx_v8_0_get_cu_info(struct amdgpu_device *adev, | 6215 | static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev) |
6216 | struct amdgpu_cu_info *cu_info) | ||
6217 | { | 6216 | { |
6218 | int i, j, k, counter, active_cu_number = 0; | 6217 | int i, j, k, counter, active_cu_number = 0; |
6219 | u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0; | 6218 | u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0; |
6220 | 6219 | struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info; | |
6221 | if (!adev || !cu_info) | ||
6222 | return -EINVAL; | ||
6223 | 6220 | ||
6224 | memset(cu_info, 0, sizeof(*cu_info)); | 6221 | memset(cu_info, 0, sizeof(*cu_info)); |
6225 | 6222 | ||
@@ -6250,6 +6247,4 @@ int gfx_v8_0_get_cu_info(struct amdgpu_device *adev, | |||
6250 | 6247 | ||
6251 | cu_info->number = active_cu_number; | 6248 | cu_info->number = active_cu_number; |
6252 | cu_info->ao_cu_mask = ao_cu_mask; | 6249 | cu_info->ao_cu_mask = ao_cu_mask; |
6253 | |||
6254 | return 0; | ||
6255 | } | 6250 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h index 021e05193cb9..16a49f53a2fa 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h | |||
@@ -28,6 +28,5 @@ extern const struct amd_ip_funcs gfx_v8_0_ip_funcs; | |||
28 | 28 | ||
29 | uint64_t gfx_v8_0_get_gpu_clock_counter(struct amdgpu_device *adev); | 29 | uint64_t gfx_v8_0_get_gpu_clock_counter(struct amdgpu_device *adev); |
30 | void gfx_v8_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); | 30 | void gfx_v8_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num); |
31 | int gfx_v8_0_get_cu_info(struct amdgpu_device *adev, struct amdgpu_cu_info *cu_info); | ||
32 | 31 | ||
33 | #endif | 32 | #endif |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 48e4800eafcc..1feb6439cb0b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | |||
@@ -1261,6 +1261,7 @@ static int gmc_v7_0_set_powergating_state(void *handle, | |||
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | const struct amd_ip_funcs gmc_v7_0_ip_funcs = { | 1263 | const struct amd_ip_funcs gmc_v7_0_ip_funcs = { |
1264 | .name = "gmc_v7_0", | ||
1264 | .early_init = gmc_v7_0_early_init, | 1265 | .early_init = gmc_v7_0_early_init, |
1265 | .late_init = gmc_v7_0_late_init, | 1266 | .late_init = gmc_v7_0_late_init, |
1266 | .sw_init = gmc_v7_0_sw_init, | 1267 | .sw_init = gmc_v7_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 53c3339e2cfd..9945d5bbf1fe 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | |||
@@ -1423,6 +1423,7 @@ static int gmc_v8_0_set_powergating_state(void *handle, | |||
1423 | } | 1423 | } |
1424 | 1424 | ||
1425 | const struct amd_ip_funcs gmc_v8_0_ip_funcs = { | 1425 | const struct amd_ip_funcs gmc_v8_0_ip_funcs = { |
1426 | .name = "gmc_v8_0", | ||
1426 | .early_init = gmc_v8_0_early_init, | 1427 | .early_init = gmc_v8_0_early_init, |
1427 | .late_init = gmc_v8_0_late_init, | 1428 | .late_init = gmc_v8_0_late_init, |
1428 | .sw_init = gmc_v8_0_sw_init, | 1429 | .sw_init = gmc_v8_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c b/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c index 57a96132a8a2..460bc8ad37e6 100644 --- a/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/iceland_dpm.c | |||
@@ -157,6 +157,7 @@ static int iceland_dpm_set_powergating_state(void *handle, | |||
157 | } | 157 | } |
158 | 158 | ||
159 | const struct amd_ip_funcs iceland_dpm_ip_funcs = { | 159 | const struct amd_ip_funcs iceland_dpm_ip_funcs = { |
160 | .name = "iceland_dpm", | ||
160 | .early_init = iceland_dpm_early_init, | 161 | .early_init = iceland_dpm_early_init, |
161 | .late_init = NULL, | 162 | .late_init = NULL, |
162 | .sw_init = iceland_dpm_sw_init, | 163 | .sw_init = iceland_dpm_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c index 5c4001e2538e..39bfc52d0b42 100644 --- a/drivers/gpu/drm/amd/amdgpu/iceland_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/iceland_ih.c | |||
@@ -394,6 +394,7 @@ static int iceland_ih_set_powergating_state(void *handle, | |||
394 | } | 394 | } |
395 | 395 | ||
396 | const struct amd_ip_funcs iceland_ih_ip_funcs = { | 396 | const struct amd_ip_funcs iceland_ih_ip_funcs = { |
397 | .name = "iceland_ih", | ||
397 | .early_init = iceland_ih_early_init, | 398 | .early_init = iceland_ih_early_init, |
398 | .late_init = NULL, | 399 | .late_init = NULL, |
399 | .sw_init = iceland_ih_sw_init, | 400 | .sw_init = iceland_ih_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c index 4bd1e551cccd..b45f54714574 100644 --- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c | |||
@@ -135,11 +135,6 @@ static void sumo_take_smu_control(struct amdgpu_device *adev, bool enable) | |||
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | 137 | ||
138 | static u32 sumo_get_sleep_divider_from_id(u32 id) | ||
139 | { | ||
140 | return 1 << id; | ||
141 | } | ||
142 | |||
143 | static void sumo_construct_sclk_voltage_mapping_table(struct amdgpu_device *adev, | 138 | static void sumo_construct_sclk_voltage_mapping_table(struct amdgpu_device *adev, |
144 | struct sumo_sclk_voltage_mapping_table *sclk_voltage_mapping_table, | 139 | struct sumo_sclk_voltage_mapping_table *sclk_voltage_mapping_table, |
145 | ATOM_AVAILABLE_SCLK_LIST *table) | 140 | ATOM_AVAILABLE_SCLK_LIST *table) |
@@ -2176,8 +2171,7 @@ static u8 kv_get_sleep_divider_id_from_clock(struct amdgpu_device *adev, | |||
2176 | struct kv_power_info *pi = kv_get_pi(adev); | 2171 | struct kv_power_info *pi = kv_get_pi(adev); |
2177 | u32 i; | 2172 | u32 i; |
2178 | u32 temp; | 2173 | u32 temp; |
2179 | u32 min = (min_sclk_in_sr > KV_MINIMUM_ENGINE_CLOCK) ? | 2174 | u32 min = max(min_sclk_in_sr, (u32)KV_MINIMUM_ENGINE_CLOCK); |
2180 | min_sclk_in_sr : KV_MINIMUM_ENGINE_CLOCK; | ||
2181 | 2175 | ||
2182 | if (sclk < min) | 2176 | if (sclk < min) |
2183 | return 0; | 2177 | return 0; |
@@ -2186,7 +2180,7 @@ static u8 kv_get_sleep_divider_id_from_clock(struct amdgpu_device *adev, | |||
2186 | return 0; | 2180 | return 0; |
2187 | 2181 | ||
2188 | for (i = KV_MAX_DEEPSLEEP_DIVIDER_ID; i > 0; i--) { | 2182 | for (i = KV_MAX_DEEPSLEEP_DIVIDER_ID; i > 0; i--) { |
2189 | temp = sclk / sumo_get_sleep_divider_from_id(i); | 2183 | temp = sclk >> i; |
2190 | if (temp >= min) | 2184 | if (temp >= min) |
2191 | break; | 2185 | break; |
2192 | } | 2186 | } |
@@ -3244,6 +3238,7 @@ static int kv_dpm_set_powergating_state(void *handle, | |||
3244 | } | 3238 | } |
3245 | 3239 | ||
3246 | const struct amd_ip_funcs kv_dpm_ip_funcs = { | 3240 | const struct amd_ip_funcs kv_dpm_ip_funcs = { |
3241 | .name = "kv_dpm", | ||
3247 | .early_init = kv_dpm_early_init, | 3242 | .early_init = kv_dpm_early_init, |
3248 | .late_init = kv_dpm_late_init, | 3243 | .late_init = kv_dpm_late_init, |
3249 | .sw_init = kv_dpm_sw_init, | 3244 | .sw_init = kv_dpm_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c index e6d3544fda06..f4c3130d3fdb 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c | |||
@@ -242,9 +242,10 @@ static void sdma_v2_4_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count) | |||
242 | * Schedule an IB in the DMA ring (VI). | 242 | * Schedule an IB in the DMA ring (VI). |
243 | */ | 243 | */ |
244 | static void sdma_v2_4_ring_emit_ib(struct amdgpu_ring *ring, | 244 | static void sdma_v2_4_ring_emit_ib(struct amdgpu_ring *ring, |
245 | struct amdgpu_ib *ib) | 245 | struct amdgpu_ib *ib, |
246 | unsigned vm_id, bool ctx_switch) | ||
246 | { | 247 | { |
247 | u32 vmid = ib->vm_id & 0xf; | 248 | u32 vmid = vm_id & 0xf; |
248 | u32 next_rptr = ring->wptr + 5; | 249 | u32 next_rptr = ring->wptr + 5; |
249 | 250 | ||
250 | while ((next_rptr & 7) != 2) | 251 | while ((next_rptr & 7) != 2) |
@@ -701,7 +702,7 @@ static int sdma_v2_4_ring_test_ib(struct amdgpu_ring *ring) | |||
701 | ib.ptr[7] = SDMA_PKT_HEADER_OP(SDMA_OP_NOP); | 702 | ib.ptr[7] = SDMA_PKT_HEADER_OP(SDMA_OP_NOP); |
702 | ib.length_dw = 8; | 703 | ib.length_dw = 8; |
703 | 704 | ||
704 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f); | 705 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, NULL, &f); |
705 | if (r) | 706 | if (r) |
706 | goto err1; | 707 | goto err1; |
707 | 708 | ||
@@ -1230,6 +1231,7 @@ static int sdma_v2_4_set_powergating_state(void *handle, | |||
1230 | } | 1231 | } |
1231 | 1232 | ||
1232 | const struct amd_ip_funcs sdma_v2_4_ip_funcs = { | 1233 | const struct amd_ip_funcs sdma_v2_4_ip_funcs = { |
1234 | .name = "sdma_v2_4", | ||
1233 | .early_init = sdma_v2_4_early_init, | 1235 | .early_init = sdma_v2_4_early_init, |
1234 | .late_init = NULL, | 1236 | .late_init = NULL, |
1235 | .sw_init = sdma_v2_4_sw_init, | 1237 | .sw_init = sdma_v2_4_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c index 00b43700c956..063f08a9957a 100644 --- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | |||
@@ -400,9 +400,10 @@ static void sdma_v3_0_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count) | |||
400 | * Schedule an IB in the DMA ring (VI). | 400 | * Schedule an IB in the DMA ring (VI). |
401 | */ | 401 | */ |
402 | static void sdma_v3_0_ring_emit_ib(struct amdgpu_ring *ring, | 402 | static void sdma_v3_0_ring_emit_ib(struct amdgpu_ring *ring, |
403 | struct amdgpu_ib *ib) | 403 | struct amdgpu_ib *ib, |
404 | unsigned vm_id, bool ctx_switch) | ||
404 | { | 405 | { |
405 | u32 vmid = ib->vm_id & 0xf; | 406 | u32 vmid = vm_id & 0xf; |
406 | u32 next_rptr = ring->wptr + 5; | 407 | u32 next_rptr = ring->wptr + 5; |
407 | 408 | ||
408 | while ((next_rptr & 7) != 2) | 409 | while ((next_rptr & 7) != 2) |
@@ -925,7 +926,7 @@ static int sdma_v3_0_ring_test_ib(struct amdgpu_ring *ring) | |||
925 | ib.ptr[7] = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP); | 926 | ib.ptr[7] = SDMA_PKT_NOP_HEADER_OP(SDMA_OP_NOP); |
926 | ib.length_dw = 8; | 927 | ib.length_dw = 8; |
927 | 928 | ||
928 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, &f); | 929 | r = amdgpu_ib_schedule(ring, 1, &ib, NULL, NULL, &f); |
929 | if (r) | 930 | if (r) |
930 | goto err1; | 931 | goto err1; |
931 | 932 | ||
@@ -1542,6 +1543,7 @@ static int sdma_v3_0_set_powergating_state(void *handle, | |||
1542 | } | 1543 | } |
1543 | 1544 | ||
1544 | const struct amd_ip_funcs sdma_v3_0_ip_funcs = { | 1545 | const struct amd_ip_funcs sdma_v3_0_ip_funcs = { |
1546 | .name = "sdma_v3_0", | ||
1545 | .early_init = sdma_v3_0_early_init, | 1547 | .early_init = sdma_v3_0_early_init, |
1546 | .late_init = NULL, | 1548 | .late_init = NULL, |
1547 | .sw_init = sdma_v3_0_sw_init, | 1549 | .sw_init = sdma_v3_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c b/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c index 552f0f42a39f..b7615cefcac4 100644 --- a/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c +++ b/drivers/gpu/drm/amd/amdgpu/tonga_dpm.c | |||
@@ -143,6 +143,7 @@ static int tonga_dpm_set_powergating_state(void *handle, | |||
143 | } | 143 | } |
144 | 144 | ||
145 | const struct amd_ip_funcs tonga_dpm_ip_funcs = { | 145 | const struct amd_ip_funcs tonga_dpm_ip_funcs = { |
146 | .name = "tonga_dpm", | ||
146 | .early_init = tonga_dpm_early_init, | 147 | .early_init = tonga_dpm_early_init, |
147 | .late_init = NULL, | 148 | .late_init = NULL, |
148 | .sw_init = tonga_dpm_sw_init, | 149 | .sw_init = tonga_dpm_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c index 55cdab849089..f036af937fbc 100644 --- a/drivers/gpu/drm/amd/amdgpu/tonga_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/tonga_ih.c | |||
@@ -417,6 +417,7 @@ static int tonga_ih_set_powergating_state(void *handle, | |||
417 | } | 417 | } |
418 | 418 | ||
419 | const struct amd_ip_funcs tonga_ih_ip_funcs = { | 419 | const struct amd_ip_funcs tonga_ih_ip_funcs = { |
420 | .name = "tonga_ih", | ||
420 | .early_init = tonga_ih_early_init, | 421 | .early_init = tonga_ih_early_init, |
421 | .late_init = NULL, | 422 | .late_init = NULL, |
422 | .sw_init = tonga_ih_sw_init, | 423 | .sw_init = tonga_ih_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c index abd37a7eb4c6..f07551476a70 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | |||
@@ -489,7 +489,8 @@ static int uvd_v4_2_ring_test_ring(struct amdgpu_ring *ring) | |||
489 | * Write ring commands to execute the indirect buffer | 489 | * Write ring commands to execute the indirect buffer |
490 | */ | 490 | */ |
491 | static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring, | 491 | static void uvd_v4_2_ring_emit_ib(struct amdgpu_ring *ring, |
492 | struct amdgpu_ib *ib) | 492 | struct amdgpu_ib *ib, |
493 | unsigned vm_id, bool ctx_switch) | ||
493 | { | 494 | { |
494 | amdgpu_ring_write(ring, PACKET0(mmUVD_RBC_IB_BASE, 0)); | 495 | amdgpu_ring_write(ring, PACKET0(mmUVD_RBC_IB_BASE, 0)); |
495 | amdgpu_ring_write(ring, ib->gpu_addr); | 496 | amdgpu_ring_write(ring, ib->gpu_addr); |
@@ -739,6 +740,7 @@ static int uvd_v4_2_set_powergating_state(void *handle, | |||
739 | } | 740 | } |
740 | 741 | ||
741 | const struct amd_ip_funcs uvd_v4_2_ip_funcs = { | 742 | const struct amd_ip_funcs uvd_v4_2_ip_funcs = { |
743 | .name = "uvd_v4_2", | ||
742 | .early_init = uvd_v4_2_early_init, | 744 | .early_init = uvd_v4_2_early_init, |
743 | .late_init = NULL, | 745 | .late_init = NULL, |
744 | .sw_init = uvd_v4_2_sw_init, | 746 | .sw_init = uvd_v4_2_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c index 1c1a0e2c7e0f..e0a76a883d46 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | |||
@@ -539,7 +539,8 @@ static int uvd_v5_0_ring_test_ring(struct amdgpu_ring *ring) | |||
539 | * Write ring commands to execute the indirect buffer | 539 | * Write ring commands to execute the indirect buffer |
540 | */ | 540 | */ |
541 | static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring, | 541 | static void uvd_v5_0_ring_emit_ib(struct amdgpu_ring *ring, |
542 | struct amdgpu_ib *ib) | 542 | struct amdgpu_ib *ib, |
543 | unsigned vm_id, bool ctx_switch) | ||
543 | { | 544 | { |
544 | amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_64BIT_BAR_LOW, 0)); | 545 | amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_64BIT_BAR_LOW, 0)); |
545 | amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr)); | 546 | amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr)); |
@@ -791,6 +792,7 @@ static int uvd_v5_0_set_powergating_state(void *handle, | |||
791 | } | 792 | } |
792 | 793 | ||
793 | const struct amd_ip_funcs uvd_v5_0_ip_funcs = { | 794 | const struct amd_ip_funcs uvd_v5_0_ip_funcs = { |
795 | .name = "uvd_v5_0", | ||
794 | .early_init = uvd_v5_0_early_init, | 796 | .early_init = uvd_v5_0_early_init, |
795 | .late_init = NULL, | 797 | .late_init = NULL, |
796 | .sw_init = uvd_v5_0_sw_init, | 798 | .sw_init = uvd_v5_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c index d015cb0c9eb5..c9929d665c01 100644 --- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | |||
@@ -631,7 +631,8 @@ static int uvd_v6_0_ring_test_ring(struct amdgpu_ring *ring) | |||
631 | * Write ring commands to execute the indirect buffer | 631 | * Write ring commands to execute the indirect buffer |
632 | */ | 632 | */ |
633 | static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring, | 633 | static void uvd_v6_0_ring_emit_ib(struct amdgpu_ring *ring, |
634 | struct amdgpu_ib *ib) | 634 | struct amdgpu_ib *ib, |
635 | unsigned vm_id, bool ctx_switch) | ||
635 | { | 636 | { |
636 | amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_64BIT_BAR_LOW, 0)); | 637 | amdgpu_ring_write(ring, PACKET0(mmUVD_LMI_RBC_IB_64BIT_BAR_LOW, 0)); |
637 | amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr)); | 638 | amdgpu_ring_write(ring, lower_32_bits(ib->gpu_addr)); |
@@ -895,6 +896,7 @@ static int uvd_v6_0_set_powergating_state(void *handle, | |||
895 | } | 896 | } |
896 | 897 | ||
897 | const struct amd_ip_funcs uvd_v6_0_ip_funcs = { | 898 | const struct amd_ip_funcs uvd_v6_0_ip_funcs = { |
899 | .name = "uvd_v6_0", | ||
898 | .early_init = uvd_v6_0_early_init, | 900 | .early_init = uvd_v6_0_early_init, |
899 | .late_init = NULL, | 901 | .late_init = NULL, |
900 | .sw_init = uvd_v6_0_sw_init, | 902 | .sw_init = uvd_v6_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c index 95f6e579427d..45d92aceb485 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | |||
@@ -567,6 +567,7 @@ static int vce_v2_0_set_powergating_state(void *handle, | |||
567 | } | 567 | } |
568 | 568 | ||
569 | const struct amd_ip_funcs vce_v2_0_ip_funcs = { | 569 | const struct amd_ip_funcs vce_v2_0_ip_funcs = { |
570 | .name = "vce_v2_0", | ||
570 | .early_init = vce_v2_0_early_init, | 571 | .early_init = vce_v2_0_early_init, |
571 | .late_init = NULL, | 572 | .late_init = NULL, |
572 | .sw_init = vce_v2_0_sw_init, | 573 | .sw_init = vce_v2_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c index e1d6ae7e1629..30e8099e94c5 100644 --- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | |||
@@ -40,9 +40,9 @@ | |||
40 | 40 | ||
41 | #define GRBM_GFX_INDEX__VCE_INSTANCE__SHIFT 0x04 | 41 | #define GRBM_GFX_INDEX__VCE_INSTANCE__SHIFT 0x04 |
42 | #define GRBM_GFX_INDEX__VCE_INSTANCE_MASK 0x10 | 42 | #define GRBM_GFX_INDEX__VCE_INSTANCE_MASK 0x10 |
43 | #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR0 0x8616 | 43 | #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR0 0x8616 |
44 | #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR1 0x8617 | 44 | #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR1 0x8617 |
45 | #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR2 0x8618 | 45 | #define mmVCE_LMI_VCPU_CACHE_40BIT_BAR2 0x8618 |
46 | 46 | ||
47 | #define VCE_V3_0_FW_SIZE (384 * 1024) | 47 | #define VCE_V3_0_FW_SIZE (384 * 1024) |
48 | #define VCE_V3_0_STACK_SIZE (64 * 1024) | 48 | #define VCE_V3_0_STACK_SIZE (64 * 1024) |
@@ -674,6 +674,7 @@ static int vce_v3_0_set_powergating_state(void *handle, | |||
674 | } | 674 | } |
675 | 675 | ||
676 | const struct amd_ip_funcs vce_v3_0_ip_funcs = { | 676 | const struct amd_ip_funcs vce_v3_0_ip_funcs = { |
677 | .name = "vce_v3_0", | ||
677 | .early_init = vce_v3_0_early_init, | 678 | .early_init = vce_v3_0_early_init, |
678 | .late_init = NULL, | 679 | .late_init = NULL, |
679 | .sw_init = vce_v3_0_sw_init, | 680 | .sw_init = vce_v3_0_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c index 340a166da911..2c88d0b66cf3 100644 --- a/drivers/gpu/drm/amd/amdgpu/vi.c +++ b/drivers/gpu/drm/amd/amdgpu/vi.c | |||
@@ -1118,7 +1118,6 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = | |||
1118 | .get_xclk = &vi_get_xclk, | 1118 | .get_xclk = &vi_get_xclk, |
1119 | .set_uvd_clocks = &vi_set_uvd_clocks, | 1119 | .set_uvd_clocks = &vi_set_uvd_clocks, |
1120 | .set_vce_clocks = &vi_set_vce_clocks, | 1120 | .set_vce_clocks = &vi_set_vce_clocks, |
1121 | .get_cu_info = &gfx_v8_0_get_cu_info, | ||
1122 | /* these should be moved to their own ip modules */ | 1121 | /* these should be moved to their own ip modules */ |
1123 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, | 1122 | .get_gpu_clock_counter = &gfx_v8_0_get_gpu_clock_counter, |
1124 | .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle, | 1123 | .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle, |
@@ -1193,7 +1192,8 @@ static int vi_common_early_init(void *handle) | |||
1193 | adev->external_rev_id = adev->rev_id + 0x50; | 1192 | adev->external_rev_id = adev->rev_id + 0x50; |
1194 | break; | 1193 | break; |
1195 | case CHIP_CARRIZO: | 1194 | case CHIP_CARRIZO: |
1196 | adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | | 1195 | adev->cg_flags = AMD_CG_SUPPORT_UVD_MGCG | |
1196 | AMD_CG_SUPPORT_GFX_MGCG | | ||
1197 | AMD_CG_SUPPORT_GFX_MGLS | | 1197 | AMD_CG_SUPPORT_GFX_MGLS | |
1198 | AMD_CG_SUPPORT_GFX_RLC_LS | | 1198 | AMD_CG_SUPPORT_GFX_RLC_LS | |
1199 | AMD_CG_SUPPORT_GFX_CP_LS | | 1199 | AMD_CG_SUPPORT_GFX_CP_LS | |
@@ -1408,6 +1408,7 @@ static int vi_common_set_powergating_state(void *handle, | |||
1408 | } | 1408 | } |
1409 | 1409 | ||
1410 | const struct amd_ip_funcs vi_common_ip_funcs = { | 1410 | const struct amd_ip_funcs vi_common_ip_funcs = { |
1411 | .name = "vi_common", | ||
1411 | .early_init = vi_common_early_init, | 1412 | .early_init = vi_common_early_init, |
1412 | .late_init = NULL, | 1413 | .late_init = NULL, |
1413 | .sw_init = vi_common_sw_init, | 1414 | .sw_init = vi_common_sw_init, |
diff --git a/drivers/gpu/drm/amd/amdgpu/vid.h b/drivers/gpu/drm/amd/amdgpu/vid.h index ace49976f7be..062ee1676480 100644 --- a/drivers/gpu/drm/amd/amdgpu/vid.h +++ b/drivers/gpu/drm/amd/amdgpu/vid.h | |||
@@ -54,7 +54,8 @@ | |||
54 | #define AUD3_REGISTER_OFFSET (0x17b4 - 0x17a8) | 54 | #define AUD3_REGISTER_OFFSET (0x17b4 - 0x17a8) |
55 | #define AUD4_REGISTER_OFFSET (0x17b8 - 0x17a8) | 55 | #define AUD4_REGISTER_OFFSET (0x17b8 - 0x17a8) |
56 | #define AUD5_REGISTER_OFFSET (0x17bc - 0x17a8) | 56 | #define AUD5_REGISTER_OFFSET (0x17bc - 0x17a8) |
57 | #define AUD6_REGISTER_OFFSET (0x17c4 - 0x17a8) | 57 | #define AUD6_REGISTER_OFFSET (0x17c0 - 0x17a8) |
58 | #define AUD7_REGISTER_OFFSET (0x17c4 - 0x17a8) | ||
58 | 59 | ||
59 | /* hpd instance offsets */ | 60 | /* hpd instance offsets */ |
60 | #define HPD0_REGISTER_OFFSET (0x1898 - 0x1898) | 61 | #define HPD0_REGISTER_OFFSET (0x1898 - 0x1898) |
@@ -365,7 +366,7 @@ | |||
365 | #define VCE_CMD_IB 0x00000002 | 366 | #define VCE_CMD_IB 0x00000002 |
366 | #define VCE_CMD_FENCE 0x00000003 | 367 | #define VCE_CMD_FENCE 0x00000003 |
367 | #define VCE_CMD_TRAP 0x00000004 | 368 | #define VCE_CMD_TRAP 0x00000004 |
368 | #define VCE_CMD_IB_AUTO 0x00000005 | 369 | #define VCE_CMD_IB_AUTO 0x00000005 |
369 | #define VCE_CMD_SEMAPHORE 0x00000006 | 370 | #define VCE_CMD_SEMAPHORE 0x00000006 |
370 | 371 | ||
371 | #endif | 372 | #endif |
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h index ea9ee4644139..6080951d539d 100644 --- a/drivers/gpu/drm/amd/include/amd_shared.h +++ b/drivers/gpu/drm/amd/include/amd_shared.h | |||
@@ -143,6 +143,8 @@ enum amd_pm_state_type { | |||
143 | }; | 143 | }; |
144 | 144 | ||
145 | struct amd_ip_funcs { | 145 | struct amd_ip_funcs { |
146 | /* Name of IP block */ | ||
147 | char *name; | ||
146 | /* sets up early driver state (pre sw_init), does not configure hw - Optional */ | 148 | /* sets up early driver state (pre sw_init), does not configure hw - Optional */ |
147 | int (*early_init)(void *handle); | 149 | int (*early_init)(void *handle); |
148 | /* sets up late driver/hw state (post hw_init) - Optional */ | 150 | /* sets up late driver/hw state (post hw_init) - Optional */ |
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c index aba587cfce81..8e345bfddb69 100644 --- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c +++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c | |||
@@ -68,15 +68,18 @@ static int pp_sw_init(void *handle) | |||
68 | return -EINVAL; | 68 | return -EINVAL; |
69 | 69 | ||
70 | ret = hwmgr->pptable_func->pptable_init(hwmgr); | 70 | ret = hwmgr->pptable_func->pptable_init(hwmgr); |
71 | if (ret) | ||
72 | goto err; | ||
71 | 73 | ||
72 | if (ret == 0) | 74 | ret = hwmgr->hwmgr_func->backend_init(hwmgr); |
73 | ret = hwmgr->hwmgr_func->backend_init(hwmgr); | ||
74 | |||
75 | if (ret) | 75 | if (ret) |
76 | printk(KERN_ERR "amdgpu: powerplay initialization failed\n"); | 76 | goto err; |
77 | else | ||
78 | printk(KERN_INFO "amdgpu: powerplay initialized\n"); | ||
79 | 77 | ||
78 | pr_info("amdgpu: powerplay initialized\n"); | ||
79 | |||
80 | return 0; | ||
81 | err: | ||
82 | pr_err("amdgpu: powerplay initialization failed\n"); | ||
80 | return ret; | 83 | return ret; |
81 | } | 84 | } |
82 | 85 | ||
@@ -340,6 +343,7 @@ static int pp_resume(void *handle) | |||
340 | } | 343 | } |
341 | 344 | ||
342 | const struct amd_ip_funcs pp_ip_funcs = { | 345 | const struct amd_ip_funcs pp_ip_funcs = { |
346 | .name = "powerplay", | ||
343 | .early_init = pp_early_init, | 347 | .early_init = pp_early_init, |
344 | .late_init = NULL, | 348 | .late_init = NULL, |
345 | .sw_init = pp_sw_init, | 349 | .sw_init = pp_sw_init, |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c index 55e877c4b862..c94f9faa220a 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/fiji_hwmgr.c | |||
@@ -465,14 +465,14 @@ static int fiji_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr) | |||
465 | table_info->vdd_dep_on_mclk; | 465 | table_info->vdd_dep_on_mclk; |
466 | 466 | ||
467 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table != NULL, | 467 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table != NULL, |
468 | "VDD dependency on SCLK table is missing. \ | 468 | "VDD dependency on SCLK table is missing. \ |
469 | This table is mandatory", return -EINVAL); | 469 | This table is mandatory", return -EINVAL); |
470 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table->count >= 1, | 470 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table->count >= 1, |
471 | "VDD dependency on SCLK table has to have is missing. \ | 471 | "VDD dependency on SCLK table has to have is missing. \ |
472 | This table is mandatory", return -EINVAL); | 472 | This table is mandatory", return -EINVAL); |
473 | 473 | ||
474 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table != NULL, | 474 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table != NULL, |
475 | "VDD dependency on MCLK table is missing. \ | 475 | "VDD dependency on MCLK table is missing. \ |
476 | This table is mandatory", return -EINVAL); | 476 | This table is mandatory", return -EINVAL); |
477 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table->count >= 1, | 477 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table->count >= 1, |
478 | "VDD dependency on MCLK table has to have is missing. \ | 478 | "VDD dependency on MCLK table has to have is missing. \ |
@@ -1898,16 +1898,16 @@ static int fiji_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr, | |||
1898 | return 0; | 1898 | return 0; |
1899 | } | 1899 | } |
1900 | 1900 | ||
1901 | static uint8_t fiji_get_sleep_divider_id_from_clock(struct pp_hwmgr *hwmgr, | 1901 | static uint8_t fiji_get_sleep_divider_id_from_clock(uint32_t clock, |
1902 | uint32_t clock, uint32_t clock_insr) | 1902 | uint32_t clock_insr) |
1903 | { | 1903 | { |
1904 | uint8_t i; | 1904 | uint8_t i; |
1905 | uint32_t temp; | 1905 | uint32_t temp; |
1906 | uint32_t min = clock_insr > 2500 ? clock_insr : 2500; | 1906 | uint32_t min = max(clock_insr, (uint32_t)FIJI_MINIMUM_ENGINE_CLOCK); |
1907 | 1907 | ||
1908 | PP_ASSERT_WITH_CODE((clock >= min), "Engine clock can't satisfy stutter requirement!", return 0); | 1908 | PP_ASSERT_WITH_CODE((clock >= min), "Engine clock can't satisfy stutter requirement!", return 0); |
1909 | for (i = FIJI_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { | 1909 | for (i = FIJI_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { |
1910 | temp = clock / (1UL << i); | 1910 | temp = clock >> i; |
1911 | 1911 | ||
1912 | if (temp >= min || i == 0) | 1912 | if (temp >= min || i == 0) |
1913 | break; | 1913 | break; |
@@ -1961,7 +1961,7 @@ static int fiji_populate_single_graphic_level(struct pp_hwmgr *hwmgr, | |||
1961 | data->display_timing.min_clock_in_sr = hwmgr->display_config.min_core_set_clock_in_sr; | 1961 | data->display_timing.min_clock_in_sr = hwmgr->display_config.min_core_set_clock_in_sr; |
1962 | 1962 | ||
1963 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) | 1963 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) |
1964 | level->DeepSleepDivId = fiji_get_sleep_divider_id_from_clock(hwmgr, clock, | 1964 | level->DeepSleepDivId = fiji_get_sleep_divider_id_from_clock(clock, |
1965 | hwmgr->display_config.min_core_set_clock_in_sr); | 1965 | hwmgr->display_config.min_core_set_clock_in_sr); |
1966 | 1966 | ||
1967 | 1967 | ||
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c index 010199fb7126..93768fa1dcdc 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c | |||
@@ -1175,11 +1175,11 @@ static int polaris10_populate_single_graphic_level(struct pp_hwmgr *hwmgr, | |||
1175 | if (phm_cap_enabled(hwmgr->platformDescriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) | 1175 | if (phm_cap_enabled(hwmgr->platformDescriptor.platformCaps, PHM_PlatformCaps_SclkDeepSleep)) |
1176 | level->DeepSleepDivId = PhwFiji_GetSleepDividerIdFromClock(hwmgr, clock, minClocks.engineClockInSR); | 1176 | level->DeepSleepDivId = PhwFiji_GetSleepDividerIdFromClock(hwmgr, clock, minClocks.engineClockInSR); |
1177 | */ | 1177 | */ |
1178 | PP_ASSERT_WITH_CODE((clock >= 2500), "Engine clock can't satisfy stutter requirement!", return 0); | 1178 | PP_ASSERT_WITH_CODE((clock >= POLARIS10_MINIMUM_ENGINE_CLOCK), "Engine clock can't satisfy stutter requirement!", return 0); |
1179 | for (i = POLARIS10_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { | 1179 | for (i = POLARIS10_MAX_DEEPSLEEP_DIVIDER_ID; ; i--) { |
1180 | temp = clock / (1UL << i); | 1180 | temp = clock >> i; |
1181 | 1181 | ||
1182 | if (temp >= 2500 || i == 0) | 1182 | if (temp >= POLARIS10_MINIMUM_ENGINE_CLOCK || i == 0) |
1183 | break; | 1183 | break; |
1184 | } | 1184 | } |
1185 | 1185 | ||
@@ -2900,14 +2900,14 @@ static int polaris10_set_private_data_based_on_pptable(struct pp_hwmgr *hwmgr) | |||
2900 | table_info->vdd_dep_on_mclk; | 2900 | table_info->vdd_dep_on_mclk; |
2901 | 2901 | ||
2902 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table != NULL, | 2902 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table != NULL, |
2903 | "VDD dependency on SCLK table is missing. \ | 2903 | "VDD dependency on SCLK table is missing. \ |
2904 | This table is mandatory", return -EINVAL); | 2904 | This table is mandatory", return -EINVAL); |
2905 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table->count >= 1, | 2905 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table->count >= 1, |
2906 | "VDD dependency on SCLK table has to have is missing. \ | 2906 | "VDD dependency on SCLK table has to have is missing. \ |
2907 | This table is mandatory", return -EINVAL); | 2907 | This table is mandatory", return -EINVAL); |
2908 | 2908 | ||
2909 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table != NULL, | 2909 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table != NULL, |
2910 | "VDD dependency on MCLK table is missing. \ | 2910 | "VDD dependency on MCLK table is missing. \ |
2911 | This table is mandatory", return -EINVAL); | 2911 | This table is mandatory", return -EINVAL); |
2912 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table->count >= 1, | 2912 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table->count >= 1, |
2913 | "VDD dependency on MCLK table has to have is missing. \ | 2913 | "VDD dependency on MCLK table has to have is missing. \ |
@@ -4628,7 +4628,7 @@ int polaris10_upload_mc_firmware(struct pp_hwmgr *hwmgr) | |||
4628 | data->need_long_memory_training = true; | 4628 | data->need_long_memory_training = true; |
4629 | 4629 | ||
4630 | /* | 4630 | /* |
4631 | * PPMCME_FirmwareDescriptorEntry *pfd = NULL; | 4631 | * PPMCME_FirmwareDescriptorEntry *pfd = NULL; |
4632 | pfd = &tonga_mcmeFirmware; | 4632 | pfd = &tonga_mcmeFirmware; |
4633 | if (0 == PHM_READ_FIELD(hwmgr->device, MC_SEQ_SUP_CNTL, RUN)) | 4633 | if (0 == PHM_READ_FIELD(hwmgr->device, MC_SEQ_SUP_CNTL, RUN)) |
4634 | polaris10_load_mc_microcode(hwmgr, pfd->dpmThreshold, | 4634 | polaris10_load_mc_microcode(hwmgr, pfd->dpmThreshold, |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c index 7b2d5000292d..58742e0d1492 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_acpi.c | |||
@@ -1,3 +1,26 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Advanced Micro Devices, Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | */ | ||
23 | |||
1 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
2 | #include "linux/delay.h" | 25 | #include "linux/delay.h" |
3 | #include "hwmgr.h" | 26 | #include "hwmgr.h" |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c index 8ba3ad5e7111..da9f5f1b6dc2 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | |||
@@ -1041,10 +1041,10 @@ int atomctrl_calculate_voltage_evv_on_sclk( | |||
1041 | } | 1041 | } |
1042 | 1042 | ||
1043 | /** atomctrl_get_voltage_evv_on_sclk gets voltage via call to ATOM COMMAND table. | 1043 | /** atomctrl_get_voltage_evv_on_sclk gets voltage via call to ATOM COMMAND table. |
1044 | * @param hwmgr input: pointer to hwManager | 1044 | * @param hwmgr input: pointer to hwManager |
1045 | * @param voltage_type input: type of EVV voltage VDDC or VDDGFX | 1045 | * @param voltage_type input: type of EVV voltage VDDC or VDDGFX |
1046 | * @param sclk input: in 10Khz unit. DPM state SCLK frequency | 1046 | * @param sclk input: in 10Khz unit. DPM state SCLK frequency |
1047 | * which is define in PPTable SCLK/VDDC dependence | 1047 | * which is define in PPTable SCLK/VDDC dependence |
1048 | * table associated with this virtual_voltage_Id | 1048 | * table associated with this virtual_voltage_Id |
1049 | * @param virtual_voltage_Id input: voltage id which match per voltage DPM state: 0xff01, 0xff02.. 0xff08 | 1049 | * @param virtual_voltage_Id input: voltage id which match per voltage DPM state: 0xff01, 0xff02.. 0xff08 |
1050 | * @param voltage output: real voltage level in unit of mv | 1050 | * @param voltage output: real voltage level in unit of mv |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c index 670b6288933f..1faad92b50d3 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.c | |||
@@ -2416,18 +2416,17 @@ int tonga_calculate_sclk_params(struct pp_hwmgr *hwmgr, | |||
2416 | return 0; | 2416 | return 0; |
2417 | } | 2417 | } |
2418 | 2418 | ||
2419 | static uint8_t tonga_get_sleep_divider_id_from_clock(struct pp_hwmgr *hwmgr, | 2419 | static uint8_t tonga_get_sleep_divider_id_from_clock(uint32_t engine_clock, |
2420 | uint32_t engine_clock, uint32_t min_engine_clock_in_sr) | 2420 | uint32_t min_engine_clock_in_sr) |
2421 | { | 2421 | { |
2422 | uint32_t i, temp; | 2422 | uint32_t i, temp; |
2423 | uint32_t min = (min_engine_clock_in_sr > TONGA_MINIMUM_ENGINE_CLOCK) ? | 2423 | uint32_t min = max(min_engine_clock_in_sr, (uint32_t)TONGA_MINIMUM_ENGINE_CLOCK); |
2424 | min_engine_clock_in_sr : TONGA_MINIMUM_ENGINE_CLOCK; | ||
2425 | 2424 | ||
2426 | PP_ASSERT_WITH_CODE((engine_clock >= min), | 2425 | PP_ASSERT_WITH_CODE((engine_clock >= min), |
2427 | "Engine clock can't satisfy stutter requirement!", return 0); | 2426 | "Engine clock can't satisfy stutter requirement!", return 0); |
2428 | 2427 | ||
2429 | for (i = TONGA_MAX_DEEPSLEEP_DIVIDER_ID;; i--) { | 2428 | for (i = TONGA_MAX_DEEPSLEEP_DIVIDER_ID;; i--) { |
2430 | temp = engine_clock / (1 << i); | 2429 | temp = engine_clock >> i; |
2431 | 2430 | ||
2432 | if(temp >= min || i == 0) | 2431 | if(temp >= min || i == 0) |
2433 | break; | 2432 | break; |
@@ -2487,7 +2486,7 @@ static int tonga_populate_single_graphic_level(struct pp_hwmgr *hwmgr, uint32_t | |||
2487 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, | 2486 | if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, |
2488 | PHM_PlatformCaps_SclkDeepSleep)) | 2487 | PHM_PlatformCaps_SclkDeepSleep)) |
2489 | graphic_level->DeepSleepDivId = | 2488 | graphic_level->DeepSleepDivId = |
2490 | tonga_get_sleep_divider_id_from_clock(hwmgr, engine_clock, | 2489 | tonga_get_sleep_divider_id_from_clock(engine_clock, |
2491 | data->display_timing.min_clock_insr); | 2490 | data->display_timing.min_clock_insr); |
2492 | 2491 | ||
2493 | /* Default to slow, highest DPM level will be set to PPSMC_DISPLAY_WATERMARK_LOW later.*/ | 2492 | /* Default to slow, highest DPM level will be set to PPSMC_DISPLAY_WATERMARK_LOW later.*/ |
@@ -2683,7 +2682,7 @@ static int tonga_populate_all_memory_levels(struct pp_hwmgr *hwmgr) | |||
2683 | struct TONGA_DLL_SPEED_SETTING { | 2682 | struct TONGA_DLL_SPEED_SETTING { |
2684 | uint16_t Min; /* Minimum Data Rate*/ | 2683 | uint16_t Min; /* Minimum Data Rate*/ |
2685 | uint16_t Max; /* Maximum Data Rate*/ | 2684 | uint16_t Max; /* Maximum Data Rate*/ |
2686 | uint32_t dll_speed; /* The desired DLL_SPEED setting*/ | 2685 | uint32_t dll_speed; /* The desired DLL_SPEED setting*/ |
2687 | }; | 2686 | }; |
2688 | 2687 | ||
2689 | static int tonga_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) | 2688 | static int tonga_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr) |
@@ -3316,14 +3315,14 @@ static int tonga_set_private_var_based_on_pptale(struct pp_hwmgr *hwmgr) | |||
3316 | pptable_info->vdd_dep_on_mclk; | 3315 | pptable_info->vdd_dep_on_mclk; |
3317 | 3316 | ||
3318 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table != NULL, | 3317 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table != NULL, |
3319 | "VDD dependency on SCLK table is missing. \ | 3318 | "VDD dependency on SCLK table is missing. \ |
3320 | This table is mandatory", return -1); | 3319 | This table is mandatory", return -1); |
3321 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table->count >= 1, | 3320 | PP_ASSERT_WITH_CODE(allowed_sclk_vdd_table->count >= 1, |
3322 | "VDD dependency on SCLK table has to have is missing. \ | 3321 | "VDD dependency on SCLK table has to have is missing. \ |
3323 | This table is mandatory", return -1); | 3322 | This table is mandatory", return -1); |
3324 | 3323 | ||
3325 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table != NULL, | 3324 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table != NULL, |
3326 | "VDD dependency on MCLK table is missing. \ | 3325 | "VDD dependency on MCLK table is missing. \ |
3327 | This table is mandatory", return -1); | 3326 | This table is mandatory", return -1); |
3328 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table->count >= 1, | 3327 | PP_ASSERT_WITH_CODE(allowed_mclk_vdd_table->count >= 1, |
3329 | "VDD dependency on MCLK table has to have is missing. \ | 3328 | "VDD dependency on MCLK table has to have is missing. \ |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h index c6a6b4006dc1..573cd39fe78d 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/tonga_hwmgr.h | |||
@@ -74,7 +74,7 @@ struct tonga_power_state { | |||
74 | }; | 74 | }; |
75 | 75 | ||
76 | struct _phw_tonga_dpm_level { | 76 | struct _phw_tonga_dpm_level { |
77 | bool enabled; | 77 | bool enabled; |
78 | uint32_t value; | 78 | uint32_t value; |
79 | uint32_t param1; | 79 | uint32_t param1; |
80 | }; | 80 | }; |
@@ -237,20 +237,20 @@ struct tonga_hwmgr { | |||
237 | irq_handler_func_t ctf_callback; | 237 | irq_handler_func_t ctf_callback; |
238 | void *ctf_context; | 238 | void *ctf_context; |
239 | 239 | ||
240 | phw_tonga_clock_registers clock_registers; | 240 | phw_tonga_clock_registers clock_registers; |
241 | phw_tonga_voltage_smio_registers voltage_smio_registers; | 241 | phw_tonga_voltage_smio_registers voltage_smio_registers; |
242 | 242 | ||
243 | bool is_memory_GDDR5; | 243 | bool is_memory_GDDR5; |
244 | uint16_t acpi_vddc; | 244 | uint16_t acpi_vddc; |
245 | bool pspp_notify_required; /* Flag to indicate if PSPP notification to SBIOS is required */ | 245 | bool pspp_notify_required; /* Flag to indicate if PSPP notification to SBIOS is required */ |
246 | uint16_t force_pcie_gen; /* The forced PCI-E speed if not 0xffff */ | 246 | uint16_t force_pcie_gen; /* The forced PCI-E speed if not 0xffff */ |
247 | uint16_t acpi_pcie_gen; /* The PCI-E speed at ACPI time */ | 247 | uint16_t acpi_pcie_gen; /* The PCI-E speed at ACPI time */ |
248 | uint32_t pcie_gen_cap; /* The PCI-E speed capabilities bitmap from CAIL */ | 248 | uint32_t pcie_gen_cap; /* The PCI-E speed capabilities bitmap from CAIL */ |
249 | uint32_t pcie_lane_cap; /* The PCI-E lane capabilities bitmap from CAIL */ | 249 | uint32_t pcie_lane_cap; /* The PCI-E lane capabilities bitmap from CAIL */ |
250 | uint32_t pcie_spc_cap; /* Symbol Per Clock Capabilities from registry */ | 250 | uint32_t pcie_spc_cap; /* Symbol Per Clock Capabilities from registry */ |
251 | phw_tonga_leakage_voltage vddc_leakage; /* The Leakage VDDC supported (based on leakage ID).*/ | 251 | phw_tonga_leakage_voltage vddc_leakage; /* The Leakage VDDC supported (based on leakage ID).*/ |
252 | phw_tonga_leakage_voltage vddcgfx_leakage; /* The Leakage VDDC supported (based on leakage ID). */ | 252 | phw_tonga_leakage_voltage vddcgfx_leakage; /* The Leakage VDDC supported (based on leakage ID). */ |
253 | phw_tonga_leakage_voltage vddci_leakage; /* The Leakage VDDCI supported (based on leakage ID). */ | 253 | phw_tonga_leakage_voltage vddci_leakage; /* The Leakage VDDCI supported (based on leakage ID). */ |
254 | 254 | ||
255 | uint32_t mvdd_control; | 255 | uint32_t mvdd_control; |
256 | uint32_t vddc_mask_low; | 256 | uint32_t vddc_mask_low; |
@@ -263,8 +263,8 @@ struct tonga_hwmgr { | |||
263 | uint32_t mclk_stutter_mode_threshold; | 263 | uint32_t mclk_stutter_mode_threshold; |
264 | uint32_t mclk_edc_enable_threshold; | 264 | uint32_t mclk_edc_enable_threshold; |
265 | uint32_t mclk_edc_wr_enable_threshold; | 265 | uint32_t mclk_edc_wr_enable_threshold; |
266 | bool is_uvd_enabled; | 266 | bool is_uvd_enabled; |
267 | bool is_xdma_enabled; | 267 | bool is_xdma_enabled; |
268 | phw_tonga_vbios_boot_state vbios_boot_state; | 268 | phw_tonga_vbios_boot_state vbios_boot_state; |
269 | 269 | ||
270 | bool battery_state; | 270 | bool battery_state; |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h index c96e5b1baae0..fd4ce7aaeee9 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | |||
@@ -500,7 +500,7 @@ struct phm_dynamic_state_info { | |||
500 | struct phm_ppm_table *ppm_parameter_table; | 500 | struct phm_ppm_table *ppm_parameter_table; |
501 | struct phm_cac_tdp_table *cac_dtp_table; | 501 | struct phm_cac_tdp_table *cac_dtp_table; |
502 | struct phm_clock_voltage_dependency_table *vdd_gfx_dependency_on_sclk; | 502 | struct phm_clock_voltage_dependency_table *vdd_gfx_dependency_on_sclk; |
503 | struct phm_vq_budgeting_table *vq_budgeting_table; | 503 | struct phm_vq_budgeting_table *vq_budgeting_table; |
504 | }; | 504 | }; |
505 | 505 | ||
506 | struct pp_fan_info { | 506 | struct pp_fan_info { |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h b/drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h index f8ba071f39c8..eb0f79f9c876 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h +++ b/drivers/gpu/drm/amd/powerplay/inc/smu_ucode_xfer_cz.h | |||
@@ -1,3 +1,25 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Advanced Micro Devices, Inc. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | */ | ||
1 | // CZ Ucode Loading Definitions | 23 | // CZ Ucode Loading Definitions |
2 | #ifndef SMU_UCODE_XFER_CZ_H | 24 | #ifndef SMU_UCODE_XFER_CZ_H |
3 | #define SMU_UCODE_XFER_CZ_H | 25 | #define SMU_UCODE_XFER_CZ_H |
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index 169f70fe949c..070095a9433c 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | |||
@@ -74,7 +74,7 @@ struct amd_sched_fence { | |||
74 | struct amd_gpu_scheduler *sched; | 74 | struct amd_gpu_scheduler *sched; |
75 | spinlock_t lock; | 75 | spinlock_t lock; |
76 | void *owner; | 76 | void *owner; |
77 | struct amd_sched_job *s_job; | 77 | struct amd_sched_job *s_job; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | struct amd_sched_job { | 80 | struct amd_sched_job { |