diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 38 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 52 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/df_v3_6.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 27 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/soc15.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 4 |
15 files changed, 123 insertions, 96 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index 8f6f45567bfa..305143fcc1ce 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | |||
@@ -342,15 +342,12 @@ void get_local_mem_info(struct kgd_dev *kgd, | |||
342 | mem_info->local_mem_size_public, | 342 | mem_info->local_mem_size_public, |
343 | mem_info->local_mem_size_private); | 343 | mem_info->local_mem_size_private); |
344 | 344 | ||
345 | if (amdgpu_emu_mode == 1) { | ||
346 | mem_info->mem_clk_max = 100; | ||
347 | return; | ||
348 | } | ||
349 | |||
350 | if (amdgpu_sriov_vf(adev)) | 345 | if (amdgpu_sriov_vf(adev)) |
351 | mem_info->mem_clk_max = adev->clock.default_mclk / 100; | 346 | mem_info->mem_clk_max = adev->clock.default_mclk / 100; |
352 | else | 347 | else if (adev->powerplay.pp_funcs) |
353 | mem_info->mem_clk_max = amdgpu_dpm_get_mclk(adev, false) / 100; | 348 | mem_info->mem_clk_max = amdgpu_dpm_get_mclk(adev, false) / 100; |
349 | else | ||
350 | mem_info->mem_clk_max = 100; | ||
354 | } | 351 | } |
355 | 352 | ||
356 | uint64_t get_gpu_clock_counter(struct kgd_dev *kgd) | 353 | uint64_t get_gpu_clock_counter(struct kgd_dev *kgd) |
@@ -367,13 +364,12 @@ uint32_t get_max_engine_clock_in_mhz(struct kgd_dev *kgd) | |||
367 | struct amdgpu_device *adev = (struct amdgpu_device *)kgd; | 364 | struct amdgpu_device *adev = (struct amdgpu_device *)kgd; |
368 | 365 | ||
369 | /* the sclk is in quantas of 10kHz */ | 366 | /* the sclk is in quantas of 10kHz */ |
370 | if (amdgpu_emu_mode == 1) | ||
371 | return 100; | ||
372 | |||
373 | if (amdgpu_sriov_vf(adev)) | 367 | if (amdgpu_sriov_vf(adev)) |
374 | return adev->clock.default_sclk / 100; | 368 | return adev->clock.default_sclk / 100; |
375 | 369 | else if (adev->powerplay.pp_funcs) | |
376 | return amdgpu_dpm_get_sclk(adev, false) / 100; | 370 | return amdgpu_dpm_get_sclk(adev, false) / 100; |
371 | else | ||
372 | return 100; | ||
377 | } | 373 | } |
378 | 374 | ||
379 | void get_cu_info(struct kgd_dev *kgd, struct kfd_cu_info *cu_info) | 375 | void get_cu_info(struct kgd_dev *kgd, struct kfd_cu_info *cu_info) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c index 1bcb2b247335..daa06e7c5bb7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c | |||
@@ -569,7 +569,6 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = { | |||
569 | { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 569 | { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
570 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 570 | { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
571 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, | 571 | { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX }, |
572 | { 0x1002, 0x67DF, 0x1028, 0x0774, AMDGPU_PX_QUIRK_FORCE_ATPX }, | ||
573 | { 0, 0, 0, 0, 0 }, | 572 | { 0, 0, 0, 0, 0 }, |
574 | }; | 573 | }; |
575 | 574 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 9c1d491d742e..82312a7bc6ad 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | |||
@@ -522,6 +522,9 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, | |||
522 | struct amdgpu_bo_list_entry *e; | 522 | struct amdgpu_bo_list_entry *e; |
523 | struct list_head duplicates; | 523 | struct list_head duplicates; |
524 | unsigned i, tries = 10; | 524 | unsigned i, tries = 10; |
525 | struct amdgpu_bo *gds; | ||
526 | struct amdgpu_bo *gws; | ||
527 | struct amdgpu_bo *oa; | ||
525 | int r; | 528 | int r; |
526 | 529 | ||
527 | INIT_LIST_HEAD(&p->validated); | 530 | INIT_LIST_HEAD(&p->validated); |
@@ -652,31 +655,36 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p, | |||
652 | 655 | ||
653 | amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved, | 656 | amdgpu_cs_report_moved_bytes(p->adev, p->bytes_moved, |
654 | p->bytes_moved_vis); | 657 | p->bytes_moved_vis); |
658 | |||
655 | if (p->bo_list) { | 659 | if (p->bo_list) { |
656 | struct amdgpu_bo *gds = p->bo_list->gds_obj; | ||
657 | struct amdgpu_bo *gws = p->bo_list->gws_obj; | ||
658 | struct amdgpu_bo *oa = p->bo_list->oa_obj; | ||
659 | struct amdgpu_vm *vm = &fpriv->vm; | 660 | struct amdgpu_vm *vm = &fpriv->vm; |
660 | unsigned i; | 661 | unsigned i; |
661 | 662 | ||
663 | gds = p->bo_list->gds_obj; | ||
664 | gws = p->bo_list->gws_obj; | ||
665 | oa = p->bo_list->oa_obj; | ||
662 | for (i = 0; i < p->bo_list->num_entries; i++) { | 666 | for (i = 0; i < p->bo_list->num_entries; i++) { |
663 | struct amdgpu_bo *bo = p->bo_list->array[i].robj; | 667 | struct amdgpu_bo *bo = p->bo_list->array[i].robj; |
664 | 668 | ||
665 | p->bo_list->array[i].bo_va = amdgpu_vm_bo_find(vm, bo); | 669 | p->bo_list->array[i].bo_va = amdgpu_vm_bo_find(vm, bo); |
666 | } | 670 | } |
671 | } else { | ||
672 | gds = p->adev->gds.gds_gfx_bo; | ||
673 | gws = p->adev->gds.gws_gfx_bo; | ||
674 | oa = p->adev->gds.oa_gfx_bo; | ||
675 | } | ||
667 | 676 | ||
668 | if (gds) { | 677 | if (gds) { |
669 | p->job->gds_base = amdgpu_bo_gpu_offset(gds); | 678 | p->job->gds_base = amdgpu_bo_gpu_offset(gds); |
670 | p->job->gds_size = amdgpu_bo_size(gds); | 679 | p->job->gds_size = amdgpu_bo_size(gds); |
671 | } | 680 | } |
672 | if (gws) { | 681 | if (gws) { |
673 | p->job->gws_base = amdgpu_bo_gpu_offset(gws); | 682 | p->job->gws_base = amdgpu_bo_gpu_offset(gws); |
674 | p->job->gws_size = amdgpu_bo_size(gws); | 683 | p->job->gws_size = amdgpu_bo_size(gws); |
675 | } | 684 | } |
676 | if (oa) { | 685 | if (oa) { |
677 | p->job->oa_base = amdgpu_bo_gpu_offset(oa); | 686 | p->job->oa_base = amdgpu_bo_gpu_offset(oa); |
678 | p->job->oa_size = amdgpu_bo_size(oa); | 687 | p->job->oa_size = amdgpu_bo_size(oa); |
679 | } | ||
680 | } | 688 | } |
681 | 689 | ||
682 | if (!r && p->uf_entry.robj) { | 690 | if (!r && p->uf_entry.robj) { |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 290e279abf0d..3317d1536f4f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1730,6 +1730,18 @@ static int amdgpu_device_ip_late_set_cg_state(struct amdgpu_device *adev) | |||
1730 | } | 1730 | } |
1731 | } | 1731 | } |
1732 | } | 1732 | } |
1733 | |||
1734 | if (adev->powerplay.pp_feature & PP_GFXOFF_MASK) { | ||
1735 | /* enable gfx powergating */ | ||
1736 | amdgpu_device_ip_set_powergating_state(adev, | ||
1737 | AMD_IP_BLOCK_TYPE_GFX, | ||
1738 | AMD_PG_STATE_GATE); | ||
1739 | /* enable gfxoff */ | ||
1740 | amdgpu_device_ip_set_powergating_state(adev, | ||
1741 | AMD_IP_BLOCK_TYPE_SMC, | ||
1742 | AMD_PG_STATE_GATE); | ||
1743 | } | ||
1744 | |||
1733 | return 0; | 1745 | return 0; |
1734 | } | 1746 | } |
1735 | 1747 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 2c8e27370284..5fb156a01774 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <drm/drmP.h> | 30 | #include <drm/drmP.h> |
31 | #include <drm/amdgpu_drm.h> | 31 | #include <drm/amdgpu_drm.h> |
32 | #include "amdgpu.h" | 32 | #include "amdgpu.h" |
33 | #include "amdgpu_display.h" | ||
33 | 34 | ||
34 | void amdgpu_gem_object_free(struct drm_gem_object *gobj) | 35 | void amdgpu_gem_object_free(struct drm_gem_object *gobj) |
35 | { | 36 | { |
@@ -235,6 +236,13 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, | |||
235 | /* create a gem object to contain this object in */ | 236 | /* create a gem object to contain this object in */ |
236 | if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS | | 237 | if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS | |
237 | AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) { | 238 | AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) { |
239 | if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) { | ||
240 | /* if gds bo is created from user space, it must be | ||
241 | * passed to bo list | ||
242 | */ | ||
243 | DRM_ERROR("GDS bo cannot be per-vm-bo\n"); | ||
244 | return -EINVAL; | ||
245 | } | ||
238 | flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS; | 246 | flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS; |
239 | if (args->in.domains == AMDGPU_GEM_DOMAIN_GDS) | 247 | if (args->in.domains == AMDGPU_GEM_DOMAIN_GDS) |
240 | size = size << AMDGPU_GDS_SHIFT; | 248 | size = size << AMDGPU_GDS_SHIFT; |
@@ -749,15 +757,16 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv, | |||
749 | struct amdgpu_device *adev = dev->dev_private; | 757 | struct amdgpu_device *adev = dev->dev_private; |
750 | struct drm_gem_object *gobj; | 758 | struct drm_gem_object *gobj; |
751 | uint32_t handle; | 759 | uint32_t handle; |
760 | u32 domain; | ||
752 | int r; | 761 | int r; |
753 | 762 | ||
754 | args->pitch = amdgpu_align_pitch(adev, args->width, | 763 | args->pitch = amdgpu_align_pitch(adev, args->width, |
755 | DIV_ROUND_UP(args->bpp, 8), 0); | 764 | DIV_ROUND_UP(args->bpp, 8), 0); |
756 | args->size = (u64)args->pitch * args->height; | 765 | args->size = (u64)args->pitch * args->height; |
757 | args->size = ALIGN(args->size, PAGE_SIZE); | 766 | args->size = ALIGN(args->size, PAGE_SIZE); |
758 | 767 | domain = amdgpu_bo_get_preferred_pin_domain(adev, | |
759 | r = amdgpu_gem_object_create(adev, args->size, 0, | 768 | amdgpu_display_supported_domains(adev)); |
760 | AMDGPU_GEM_DOMAIN_VRAM, | 769 | r = amdgpu_gem_object_create(adev, args->size, 0, domain, |
761 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, | 770 | AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED, |
762 | false, NULL, &gobj); | 771 | false, NULL, &gobj); |
763 | if (r) | 772 | if (r) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 6a9e46ae7f0a..5e4e1bd90383 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -703,11 +703,7 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, | |||
703 | /* This assumes only APU display buffers are pinned with (VRAM|GTT). | 703 | /* This assumes only APU display buffers are pinned with (VRAM|GTT). |
704 | * See function amdgpu_display_supported_domains() | 704 | * See function amdgpu_display_supported_domains() |
705 | */ | 705 | */ |
706 | if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) { | 706 | domain = amdgpu_bo_get_preferred_pin_domain(adev, domain); |
707 | domain = AMDGPU_GEM_DOMAIN_VRAM; | ||
708 | if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD) | ||
709 | domain = AMDGPU_GEM_DOMAIN_GTT; | ||
710 | } | ||
711 | 707 | ||
712 | if (bo->pin_count) { | 708 | if (bo->pin_count) { |
713 | uint32_t mem_type = bo->tbo.mem.mem_type; | 709 | uint32_t mem_type = bo->tbo.mem.mem_type; |
@@ -1066,3 +1062,14 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo) | |||
1066 | 1062 | ||
1067 | return bo->tbo.offset; | 1063 | return bo->tbo.offset; |
1068 | } | 1064 | } |
1065 | |||
1066 | uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev, | ||
1067 | uint32_t domain) | ||
1068 | { | ||
1069 | if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) { | ||
1070 | domain = AMDGPU_GEM_DOMAIN_VRAM; | ||
1071 | if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD) | ||
1072 | domain = AMDGPU_GEM_DOMAIN_GTT; | ||
1073 | } | ||
1074 | return domain; | ||
1075 | } | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 540e03fa159f..731748033878 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
@@ -289,7 +289,8 @@ int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev, | |||
289 | struct reservation_object *resv, | 289 | struct reservation_object *resv, |
290 | struct dma_fence **fence, | 290 | struct dma_fence **fence, |
291 | bool direct); | 291 | bool direct); |
292 | 292 | uint32_t amdgpu_bo_get_preferred_pin_domain(struct amdgpu_device *adev, | |
293 | uint32_t domain); | ||
293 | 294 | ||
294 | /* | 295 | /* |
295 | * sub allocation | 296 | * sub allocation |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 8851bcdfc260..127e87b470ff 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | |||
@@ -49,8 +49,6 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work); | |||
49 | 49 | ||
50 | int amdgpu_vcn_sw_init(struct amdgpu_device *adev) | 50 | int amdgpu_vcn_sw_init(struct amdgpu_device *adev) |
51 | { | 51 | { |
52 | struct amdgpu_ring *ring; | ||
53 | struct drm_sched_rq *rq; | ||
54 | unsigned long bo_size; | 52 | unsigned long bo_size; |
55 | const char *fw_name; | 53 | const char *fw_name; |
56 | const struct common_firmware_header *hdr; | 54 | const struct common_firmware_header *hdr; |
@@ -84,6 +82,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) | |||
84 | } | 82 | } |
85 | 83 | ||
86 | hdr = (const struct common_firmware_header *)adev->vcn.fw->data; | 84 | hdr = (const struct common_firmware_header *)adev->vcn.fw->data; |
85 | adev->vcn.fw_version = le32_to_cpu(hdr->ucode_version); | ||
87 | family_id = le32_to_cpu(hdr->ucode_version) & 0xff; | 86 | family_id = le32_to_cpu(hdr->ucode_version) & 0xff; |
88 | version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff; | 87 | version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff; |
89 | version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff; | 88 | version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff; |
@@ -102,24 +101,6 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev) | |||
102 | return r; | 101 | return r; |
103 | } | 102 | } |
104 | 103 | ||
105 | ring = &adev->vcn.ring_dec; | ||
106 | rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL]; | ||
107 | r = drm_sched_entity_init(&ring->sched, &adev->vcn.entity_dec, | ||
108 | rq, NULL); | ||
109 | if (r != 0) { | ||
110 | DRM_ERROR("Failed setting up VCN dec run queue.\n"); | ||
111 | return r; | ||
112 | } | ||
113 | |||
114 | ring = &adev->vcn.ring_enc[0]; | ||
115 | rq = &ring->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL]; | ||
116 | r = drm_sched_entity_init(&ring->sched, &adev->vcn.entity_enc, | ||
117 | rq, NULL); | ||
118 | if (r != 0) { | ||
119 | DRM_ERROR("Failed setting up VCN enc run queue.\n"); | ||
120 | return r; | ||
121 | } | ||
122 | |||
123 | return 0; | 104 | return 0; |
124 | } | 105 | } |
125 | 106 | ||
@@ -129,10 +110,6 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev) | |||
129 | 110 | ||
130 | kfree(adev->vcn.saved_bo); | 111 | kfree(adev->vcn.saved_bo); |
131 | 112 | ||
132 | drm_sched_entity_fini(&adev->vcn.ring_dec.sched, &adev->vcn.entity_dec); | ||
133 | |||
134 | drm_sched_entity_fini(&adev->vcn.ring_enc[0].sched, &adev->vcn.entity_enc); | ||
135 | |||
136 | amdgpu_bo_free_kernel(&adev->vcn.vcpu_bo, | 113 | amdgpu_bo_free_kernel(&adev->vcn.vcpu_bo, |
137 | &adev->vcn.gpu_addr, | 114 | &adev->vcn.gpu_addr, |
138 | (void **)&adev->vcn.cpu_addr); | 115 | (void **)&adev->vcn.cpu_addr); |
@@ -278,7 +255,7 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring) | |||
278 | } | 255 | } |
279 | 256 | ||
280 | static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, | 257 | static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, |
281 | struct amdgpu_bo *bo, bool direct, | 258 | struct amdgpu_bo *bo, |
282 | struct dma_fence **fence) | 259 | struct dma_fence **fence) |
283 | { | 260 | { |
284 | struct amdgpu_device *adev = ring->adev; | 261 | struct amdgpu_device *adev = ring->adev; |
@@ -306,19 +283,12 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, | |||
306 | } | 283 | } |
307 | ib->length_dw = 16; | 284 | ib->length_dw = 16; |
308 | 285 | ||
309 | if (direct) { | 286 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); |
310 | r = amdgpu_ib_schedule(ring, 1, ib, NULL, &f); | 287 | job->fence = dma_fence_get(f); |
311 | job->fence = dma_fence_get(f); | 288 | if (r) |
312 | if (r) | 289 | goto err_free; |
313 | goto err_free; | ||
314 | 290 | ||
315 | amdgpu_job_free(job); | 291 | amdgpu_job_free(job); |
316 | } else { | ||
317 | r = amdgpu_job_submit(job, ring, &adev->vcn.entity_dec, | ||
318 | AMDGPU_FENCE_OWNER_UNDEFINED, &f); | ||
319 | if (r) | ||
320 | goto err_free; | ||
321 | } | ||
322 | 292 | ||
323 | amdgpu_bo_fence(bo, f, false); | 293 | amdgpu_bo_fence(bo, f, false); |
324 | amdgpu_bo_unreserve(bo); | 294 | amdgpu_bo_unreserve(bo); |
@@ -370,11 +340,11 @@ static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t hand | |||
370 | for (i = 14; i < 1024; ++i) | 340 | for (i = 14; i < 1024; ++i) |
371 | msg[i] = cpu_to_le32(0x0); | 341 | msg[i] = cpu_to_le32(0x0); |
372 | 342 | ||
373 | return amdgpu_vcn_dec_send_msg(ring, bo, true, fence); | 343 | return amdgpu_vcn_dec_send_msg(ring, bo, fence); |
374 | } | 344 | } |
375 | 345 | ||
376 | static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, | 346 | static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle, |
377 | bool direct, struct dma_fence **fence) | 347 | struct dma_fence **fence) |
378 | { | 348 | { |
379 | struct amdgpu_device *adev = ring->adev; | 349 | struct amdgpu_device *adev = ring->adev; |
380 | struct amdgpu_bo *bo = NULL; | 350 | struct amdgpu_bo *bo = NULL; |
@@ -396,7 +366,7 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han | |||
396 | for (i = 6; i < 1024; ++i) | 366 | for (i = 6; i < 1024; ++i) |
397 | msg[i] = cpu_to_le32(0x0); | 367 | msg[i] = cpu_to_le32(0x0); |
398 | 368 | ||
399 | return amdgpu_vcn_dec_send_msg(ring, bo, direct, fence); | 369 | return amdgpu_vcn_dec_send_msg(ring, bo, fence); |
400 | } | 370 | } |
401 | 371 | ||
402 | int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout) | 372 | int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout) |
@@ -410,7 +380,7 @@ int amdgpu_vcn_dec_ring_test_ib(struct amdgpu_ring *ring, long timeout) | |||
410 | goto error; | 380 | goto error; |
411 | } | 381 | } |
412 | 382 | ||
413 | r = amdgpu_vcn_dec_get_destroy_msg(ring, 1, true, &fence); | 383 | r = amdgpu_vcn_dec_get_destroy_msg(ring, 1, &fence); |
414 | if (r) { | 384 | if (r) { |
415 | DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r); | 385 | DRM_ERROR("amdgpu: failed to get destroy ib (%ld).\n", r); |
416 | goto error; | 386 | goto error; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h index 181e6afa9847..773010b9ff15 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | |||
@@ -67,8 +67,6 @@ struct amdgpu_vcn { | |||
67 | struct amdgpu_ring ring_dec; | 67 | struct amdgpu_ring ring_dec; |
68 | struct amdgpu_ring ring_enc[AMDGPU_VCN_MAX_ENC_RINGS]; | 68 | struct amdgpu_ring ring_enc[AMDGPU_VCN_MAX_ENC_RINGS]; |
69 | struct amdgpu_irq_src irq; | 69 | struct amdgpu_irq_src irq; |
70 | struct drm_sched_entity entity_dec; | ||
71 | struct drm_sched_entity entity_enc; | ||
72 | unsigned num_enc_rings; | 70 | unsigned num_enc_rings; |
73 | }; | 71 | }; |
74 | 72 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index ccba88cc8c54..b0eb2f537392 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | |||
@@ -2123,7 +2123,8 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, | |||
2123 | before->last = saddr - 1; | 2123 | before->last = saddr - 1; |
2124 | before->offset = tmp->offset; | 2124 | before->offset = tmp->offset; |
2125 | before->flags = tmp->flags; | 2125 | before->flags = tmp->flags; |
2126 | list_add(&before->list, &tmp->list); | 2126 | before->bo_va = tmp->bo_va; |
2127 | list_add(&before->list, &tmp->bo_va->invalids); | ||
2127 | } | 2128 | } |
2128 | 2129 | ||
2129 | /* Remember mapping split at the end */ | 2130 | /* Remember mapping split at the end */ |
@@ -2133,7 +2134,8 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, | |||
2133 | after->offset = tmp->offset; | 2134 | after->offset = tmp->offset; |
2134 | after->offset += after->start - tmp->start; | 2135 | after->offset += after->start - tmp->start; |
2135 | after->flags = tmp->flags; | 2136 | after->flags = tmp->flags; |
2136 | list_add(&after->list, &tmp->list); | 2137 | after->bo_va = tmp->bo_va; |
2138 | list_add(&after->list, &tmp->bo_va->invalids); | ||
2137 | } | 2139 | } |
2138 | 2140 | ||
2139 | list_del(&tmp->list); | 2141 | list_del(&tmp->list); |
diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c index 60608b3df881..d5ebe566809b 100644 --- a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c +++ b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c | |||
@@ -64,7 +64,7 @@ static u32 df_v3_6_get_hbm_channel_number(struct amdgpu_device *adev) | |||
64 | int fb_channel_number; | 64 | int fb_channel_number; |
65 | 65 | ||
66 | fb_channel_number = adev->df_funcs->get_fb_channel_number(adev); | 66 | fb_channel_number = adev->df_funcs->get_fb_channel_number(adev); |
67 | if (fb_channel_number > ARRAY_SIZE(df_v3_6_channel_number)) | 67 | if (fb_channel_number >= ARRAY_SIZE(df_v3_6_channel_number)) |
68 | fb_channel_number = 0; | 68 | fb_channel_number = 0; |
69 | 69 | ||
70 | return df_v3_6_channel_number[fb_channel_number]; | 70 | return df_v3_6_channel_number[fb_channel_number]; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index d7530fdfaad5..a69153435ea7 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | |||
@@ -111,6 +111,7 @@ static const struct soc15_reg_golden golden_settings_gc_9_0_vg10[] = | |||
111 | 111 | ||
112 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] = | 112 | static const struct soc15_reg_golden golden_settings_gc_9_0_vg20[] = |
113 | { | 113 | { |
114 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_DCC_CONFIG, 0x0f000080, 0x04000080), | ||
114 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_2, 0x0f000000, 0x0a000000), | 115 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_2, 0x0f000000, 0x0a000000), |
115 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_3, 0x30000000, 0x10000000), | 116 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmCB_HW_CONTROL_3, 0x30000000, 0x10000000), |
116 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0xf3e777ff, 0x22014042), | 117 | SOC15_REG_GOLDEN_VALUE(GC, 0, mmGB_ADDR_CONFIG, 0xf3e777ff, 0x22014042), |
@@ -1837,13 +1838,15 @@ static void gfx_v9_1_parse_ind_reg_list(int *register_list_format, | |||
1837 | int indirect_offset, | 1838 | int indirect_offset, |
1838 | int list_size, | 1839 | int list_size, |
1839 | int *unique_indirect_regs, | 1840 | int *unique_indirect_regs, |
1840 | int *unique_indirect_reg_count, | 1841 | int unique_indirect_reg_count, |
1841 | int *indirect_start_offsets, | 1842 | int *indirect_start_offsets, |
1842 | int *indirect_start_offsets_count) | 1843 | int *indirect_start_offsets_count, |
1844 | int max_start_offsets_count) | ||
1843 | { | 1845 | { |
1844 | int idx; | 1846 | int idx; |
1845 | 1847 | ||
1846 | for (; indirect_offset < list_size; indirect_offset++) { | 1848 | for (; indirect_offset < list_size; indirect_offset++) { |
1849 | WARN_ON(*indirect_start_offsets_count >= max_start_offsets_count); | ||
1847 | indirect_start_offsets[*indirect_start_offsets_count] = indirect_offset; | 1850 | indirect_start_offsets[*indirect_start_offsets_count] = indirect_offset; |
1848 | *indirect_start_offsets_count = *indirect_start_offsets_count + 1; | 1851 | *indirect_start_offsets_count = *indirect_start_offsets_count + 1; |
1849 | 1852 | ||
@@ -1851,14 +1854,14 @@ static void gfx_v9_1_parse_ind_reg_list(int *register_list_format, | |||
1851 | indirect_offset += 2; | 1854 | indirect_offset += 2; |
1852 | 1855 | ||
1853 | /* look for the matching indice */ | 1856 | /* look for the matching indice */ |
1854 | for (idx = 0; idx < *unique_indirect_reg_count; idx++) { | 1857 | for (idx = 0; idx < unique_indirect_reg_count; idx++) { |
1855 | if (unique_indirect_regs[idx] == | 1858 | if (unique_indirect_regs[idx] == |
1856 | register_list_format[indirect_offset] || | 1859 | register_list_format[indirect_offset] || |
1857 | !unique_indirect_regs[idx]) | 1860 | !unique_indirect_regs[idx]) |
1858 | break; | 1861 | break; |
1859 | } | 1862 | } |
1860 | 1863 | ||
1861 | BUG_ON(idx >= *unique_indirect_reg_count); | 1864 | BUG_ON(idx >= unique_indirect_reg_count); |
1862 | 1865 | ||
1863 | if (!unique_indirect_regs[idx]) | 1866 | if (!unique_indirect_regs[idx]) |
1864 | unique_indirect_regs[idx] = register_list_format[indirect_offset]; | 1867 | unique_indirect_regs[idx] = register_list_format[indirect_offset]; |
@@ -1893,9 +1896,10 @@ static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev) | |||
1893 | adev->gfx.rlc.reg_list_format_direct_reg_list_length, | 1896 | adev->gfx.rlc.reg_list_format_direct_reg_list_length, |
1894 | adev->gfx.rlc.reg_list_format_size_bytes >> 2, | 1897 | adev->gfx.rlc.reg_list_format_size_bytes >> 2, |
1895 | unique_indirect_regs, | 1898 | unique_indirect_regs, |
1896 | &unique_indirect_reg_count, | 1899 | unique_indirect_reg_count, |
1897 | indirect_start_offsets, | 1900 | indirect_start_offsets, |
1898 | &indirect_start_offsets_count); | 1901 | &indirect_start_offsets_count, |
1902 | ARRAY_SIZE(indirect_start_offsets)); | ||
1899 | 1903 | ||
1900 | /* enable auto inc in case it is disabled */ | 1904 | /* enable auto inc in case it is disabled */ |
1901 | tmp = RREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_CNTL)); | 1905 | tmp = RREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_CNTL)); |
@@ -3404,11 +3408,6 @@ static int gfx_v9_0_late_init(void *handle) | |||
3404 | if (r) | 3408 | if (r) |
3405 | return r; | 3409 | return r; |
3406 | 3410 | ||
3407 | r = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_GFX, | ||
3408 | AMD_PG_STATE_GATE); | ||
3409 | if (r) | ||
3410 | return r; | ||
3411 | |||
3412 | return 0; | 3411 | return 0; |
3413 | } | 3412 | } |
3414 | 3413 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c index 0c768e388ace..727071fee6f6 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | |||
@@ -47,6 +47,8 @@ MODULE_FIRMWARE("amdgpu/vega20_asd.bin"); | |||
47 | 47 | ||
48 | #define smnMP1_FIRMWARE_FLAGS 0x3010028 | 48 | #define smnMP1_FIRMWARE_FLAGS 0x3010028 |
49 | 49 | ||
50 | static uint32_t sos_old_versions[] = {1517616, 1510592, 1448594, 1446554}; | ||
51 | |||
50 | static int | 52 | static int |
51 | psp_v3_1_get_fw_type(struct amdgpu_firmware_info *ucode, enum psp_gfx_fw_type *type) | 53 | psp_v3_1_get_fw_type(struct amdgpu_firmware_info *ucode, enum psp_gfx_fw_type *type) |
52 | { | 54 | { |
@@ -210,12 +212,31 @@ static int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp) | |||
210 | return ret; | 212 | return ret; |
211 | } | 213 | } |
212 | 214 | ||
215 | static bool psp_v3_1_match_version(struct amdgpu_device *adev, uint32_t ver) | ||
216 | { | ||
217 | int i; | ||
218 | |||
219 | if (ver == adev->psp.sos_fw_version) | ||
220 | return true; | ||
221 | |||
222 | /* | ||
223 | * Double check if the latest four legacy versions. | ||
224 | * If yes, it is still the right version. | ||
225 | */ | ||
226 | for (i = 0; i < sizeof(sos_old_versions) / sizeof(uint32_t); i++) { | ||
227 | if (sos_old_versions[i] == adev->psp.sos_fw_version) | ||
228 | return true; | ||
229 | } | ||
230 | |||
231 | return false; | ||
232 | } | ||
233 | |||
213 | static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) | 234 | static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) |
214 | { | 235 | { |
215 | int ret; | 236 | int ret; |
216 | unsigned int psp_gfxdrv_command_reg = 0; | 237 | unsigned int psp_gfxdrv_command_reg = 0; |
217 | struct amdgpu_device *adev = psp->adev; | 238 | struct amdgpu_device *adev = psp->adev; |
218 | uint32_t sol_reg; | 239 | uint32_t sol_reg, ver; |
219 | 240 | ||
220 | /* Check sOS sign of life register to confirm sys driver and sOS | 241 | /* Check sOS sign of life register to confirm sys driver and sOS |
221 | * are already been loaded. | 242 | * are already been loaded. |
@@ -248,6 +269,10 @@ static int psp_v3_1_bootloader_load_sos(struct psp_context *psp) | |||
248 | RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81), | 269 | RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81), |
249 | 0, true); | 270 | 0, true); |
250 | 271 | ||
272 | ver = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_58); | ||
273 | if (!psp_v3_1_match_version(adev, ver)) | ||
274 | DRM_WARN("SOS version doesn't match\n"); | ||
275 | |||
251 | return ret; | 276 | return ret; |
252 | } | 277 | } |
253 | 278 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 68b4a22a8892..83f2717fcf81 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c | |||
@@ -685,6 +685,7 @@ static int soc15_common_early_init(void *handle) | |||
685 | AMD_CG_SUPPORT_BIF_MGCG | | 685 | AMD_CG_SUPPORT_BIF_MGCG | |
686 | AMD_CG_SUPPORT_BIF_LS | | 686 | AMD_CG_SUPPORT_BIF_LS | |
687 | AMD_CG_SUPPORT_HDP_MGCG | | 687 | AMD_CG_SUPPORT_HDP_MGCG | |
688 | AMD_CG_SUPPORT_HDP_LS | | ||
688 | AMD_CG_SUPPORT_ROM_MGCG | | 689 | AMD_CG_SUPPORT_ROM_MGCG | |
689 | AMD_CG_SUPPORT_VCE_MGCG | | 690 | AMD_CG_SUPPORT_VCE_MGCG | |
690 | AMD_CG_SUPPORT_UVD_MGCG; | 691 | AMD_CG_SUPPORT_UVD_MGCG; |
diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c index 110b294ebed3..29684c3ea4ef 100644 --- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | |||
@@ -769,14 +769,14 @@ static int vcn_v1_0_stop(struct amdgpu_device *adev) | |||
769 | return 0; | 769 | return 0; |
770 | } | 770 | } |
771 | 771 | ||
772 | bool vcn_v1_0_is_idle(void *handle) | 772 | static bool vcn_v1_0_is_idle(void *handle) |
773 | { | 773 | { |
774 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 774 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
775 | 775 | ||
776 | return (RREG32_SOC15(VCN, 0, mmUVD_STATUS) == 0x2); | 776 | return (RREG32_SOC15(VCN, 0, mmUVD_STATUS) == 0x2); |
777 | } | 777 | } |
778 | 778 | ||
779 | int vcn_v1_0_wait_for_idle(void *handle) | 779 | static int vcn_v1_0_wait_for_idle(void *handle) |
780 | { | 780 | { |
781 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; | 781 | struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
782 | int ret = 0; | 782 | int ret = 0; |