Skip to content

Commit 49e8e63

Browse files
committed
Merge tag 'amd-drm-next-6.2-2022-11-04' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
amd-drm-next-6.2-2022-11-04: amdgpu: - Add TMZ support for GC 11.0.1 - More IP version check conversions - Mode2 reset fixes for sienna cichlid - SMU 13.x fixes - RAS enablement on MP 13.x - Replace kmap with kmap_local_page() - Misc Clang warning fixes - SR-IOV fixes for GC 11.x - PCI AER fix - DCN 3.2.x commit sequence rework - SDMA 4.x doorbell fix - Expose additional new GC 11.x firmware versions - Misc code cleanups - S0i3 fixes - More DC FPU cleanup - Add more DC kerneldoc - Misc spelling and grammer fixes - DCN 3.1.x fixes - Plane modifier fix - MCA RAS enablement - Secure display locking fix - RAS TA rework - RAS EEPROM fixes - Fail suspend if eviction fails - Drop AMD specific DSC workarounds in favor of drm EDID quirks - SR-IOV suspend/resume fixes - Enable DCN support for ARM - Enable secure display on DCN 2.1 amdkfd: - Cache size fixes for GC 10.3.x - kfd_dev struct cleanup - GC11.x CWSR trap handler fix - Userptr fixes - Warning fixes radeon: - Replace kmap with kmap_local_page() UAPI: - Expose additional new GC 11.x firmware versions via the existing INFO query drm: - Add some new EDID DSC quirks Signed-off-by: Dave Airlie <[email protected]> # Conflicts: # drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 60ba8c5 + fcf00f8 commit 49e8e63

File tree

164 files changed

+3182
-2344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+3182
-2344
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,12 @@ extern int amdgpu_use_xgmi_p2p;
219219
extern int sched_policy;
220220
extern bool debug_evictions;
221221
extern bool no_system_mem_limit;
222+
extern int halt_if_hws_hang;
222223
#else
223224
static const int __maybe_unused sched_policy = KFD_SCHED_POLICY_HWS;
224225
static const bool __maybe_unused debug_evictions; /* = false */
225226
static const bool __maybe_unused no_system_mem_limit;
227+
static const int __maybe_unused halt_if_hws_hang;
226228
#endif
227229
#ifdef CONFIG_HSA_AMD_P2P
228230
extern bool pcie_p2p;
@@ -675,7 +677,7 @@ enum amd_hw_ip_block_type {
675677
MAX_HWIP
676678
};
677679

678-
#define HWIP_MAX_INSTANCE 11
680+
#define HWIP_MAX_INSTANCE 28
679681

680682
#define HW_ID_MAX 300
681683
#define IP_VERSION(mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv))

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)
195195
}
196196

197197
adev->kfd.init_complete = kgd2kfd_device_init(adev->kfd.dev,
198-
adev_to_drm(adev), &gpu_resources);
198+
&gpu_resources);
199199

200200
amdgpu_amdkfd_total_mem_size += adev->gmc.real_vram_size;
201201

@@ -706,6 +706,13 @@ int amdgpu_amdkfd_submit_ib(struct amdgpu_device *adev,
706706

707707
void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)
708708
{
709+
/* Temporary workaround to fix issues observed in some
710+
* compute applications when GFXOFF is enabled on GFX11.
711+
*/
712+
if (IP_VERSION_MAJ(adev->ip_versions[GC_HWIP][0]) == 11) {
713+
pr_debug("GFXOFF is %s\n", idle ? "enabled" : "disabled");
714+
amdgpu_gfx_off_ctrl(adev, idle);
715+
}
709716
amdgpu_dpm_switch_power_profile(adev,
710717
PP_SMC_POWER_PROFILE_COMPUTE,
711718
!idle);
@@ -753,9 +760,7 @@ bool amdgpu_amdkfd_have_atomics_support(struct amdgpu_device *adev)
753760

754761
void amdgpu_amdkfd_ras_poison_consumption_handler(struct amdgpu_device *adev, bool reset)
755762
{
756-
struct ras_err_data err_data = {0, 0, 0, NULL};
757-
758-
amdgpu_umc_poison_handler(adev, &err_data, reset);
763+
amdgpu_umc_poison_handler(adev, reset);
759764
}
760765

761766
bool amdgpu_amdkfd_ras_query_utcl2_poison_status(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,6 @@ int kgd2kfd_init(void);
353353
void kgd2kfd_exit(void);
354354
struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf);
355355
bool kgd2kfd_device_init(struct kfd_dev *kfd,
356-
struct drm_device *ddev,
357356
const struct kgd2kfd_shared_resources *gpu_resources);
358357
void kgd2kfd_device_exit(struct kfd_dev *kfd);
359358
void kgd2kfd_suspend(struct kfd_dev *kfd, bool run_pm);
@@ -381,7 +380,7 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf)
381380
}
382381

383382
static inline
384-
bool kgd2kfd_device_init(struct kfd_dev *kfd, struct drm_device *ddev,
383+
bool kgd2kfd_device_init(struct kfd_dev *kfd,
385384
const struct kgd2kfd_shared_resources *gpu_resources)
386385
{
387386
return false;

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev, int pasid,
787787
for (se_idx = 0; se_idx < se_cnt; se_idx++) {
788788
for (sh_idx = 0; sh_idx < sh_cnt; sh_idx++) {
789789

790-
gfx_v9_0_select_se_sh(adev, se_idx, sh_idx, 0xffffffff);
790+
amdgpu_gfx_select_se_sh(adev, se_idx, sh_idx, 0xffffffff);
791791
queue_map = RREG32_SOC15(GC, 0, mmSPI_CSQ_WF_ACTIVE_STATUS);
792792

793793
/*
@@ -820,7 +820,7 @@ void kgd_gfx_v9_get_cu_occupancy(struct amdgpu_device *adev, int pasid,
820820
}
821821
}
822822

823-
gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
823+
amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
824824
soc15_grbm_select(adev, 0, 0, 0, 0);
825825
unlock_spi_csq_mutexes(adev);
826826

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ static uint64_t get_pte_flags(struct amdgpu_device *adev, struct kgd_mem *mem)
418418
if (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_EXECUTABLE)
419419
mapping_flags |= AMDGPU_VM_PAGE_EXECUTABLE;
420420

421-
switch (adev->asic_type) {
422-
case CHIP_ARCTURUS:
423-
case CHIP_ALDEBARAN:
421+
switch (adev->ip_versions[GC_HWIP][0]) {
422+
case IP_VERSION(9, 4, 1):
423+
case IP_VERSION(9, 4, 2):
424424
if (mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_VRAM) {
425425
if (bo_adev == adev) {
426426
if (uncached)
@@ -429,7 +429,7 @@ static uint64_t get_pte_flags(struct amdgpu_device *adev, struct kgd_mem *mem)
429429
mapping_flags |= AMDGPU_VM_MTYPE_CC;
430430
else
431431
mapping_flags |= AMDGPU_VM_MTYPE_RW;
432-
if (adev->asic_type == CHIP_ALDEBARAN &&
432+
if ((adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2)) &&
433433
adev->gmc.xgmi.connected_to_cpu)
434434
snoop = true;
435435
} else {
@@ -510,13 +510,13 @@ kfd_mem_dmamap_userptr(struct kgd_mem *mem,
510510
struct ttm_tt *ttm = bo->tbo.ttm;
511511
int ret;
512512

513+
if (WARN_ON(ttm->num_pages != src_ttm->num_pages))
514+
return -EINVAL;
515+
513516
ttm->sg = kmalloc(sizeof(*ttm->sg), GFP_KERNEL);
514517
if (unlikely(!ttm->sg))
515518
return -ENOMEM;
516519

517-
if (WARN_ON(ttm->num_pages != src_ttm->num_pages))
518-
return -EINVAL;
519-
520520
/* Same sequence as in amdgpu_ttm_tt_pin_userptr */
521521
ret = sg_alloc_table_from_pages(ttm->sg, src_ttm->pages,
522522
ttm->num_pages, 0,
@@ -1907,16 +1907,6 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
19071907
*/
19081908
mutex_lock(&mem->process_info->lock);
19091909

1910-
/* Lock mmap-sem. If we find an invalid userptr BO, we can be
1911-
* sure that the MMU notifier is no longer running
1912-
* concurrently and the queues are actually stopped
1913-
*/
1914-
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) {
1915-
mmap_write_lock(current->mm);
1916-
is_invalid_userptr = atomic_read(&mem->invalid);
1917-
mmap_write_unlock(current->mm);
1918-
}
1919-
19201910
mutex_lock(&mem->lock);
19211911

19221912
domain = mem->domain;

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,10 @@ static int amdgpu_ctx_init(struct amdgpu_ctx_mgr *mgr, int32_t priority,
326326
if (r)
327327
return r;
328328

329-
ctx->stable_pstate = current_stable_pstate;
329+
if (mgr->adev->pm.stable_pstate_ctx)
330+
ctx->stable_pstate = mgr->adev->pm.stable_pstate_ctx->stable_pstate;
331+
else
332+
ctx->stable_pstate = current_stable_pstate;
330333

331334
return 0;
332335
}

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,7 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev)
15681568
* @pdev: pci dev pointer
15691569
* @state: vga_switcheroo state
15701570
*
1571-
* Callback for the switcheroo driver. Suspends or resumes the
1571+
* Callback for the switcheroo driver. Suspends or resumes
15721572
* the asics before or after it is powered up using ACPI methods.
15731573
*/
15741574
static void amdgpu_switcheroo_set_state(struct pci_dev *pdev,
@@ -2397,7 +2397,7 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
23972397
adev->ip_blocks[i].status.hw = true;
23982398

23992399
/* right after GMC hw init, we create CSA */
2400-
if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
2400+
if (amdgpu_mcbp) {
24012401
r = amdgpu_allocate_static_csa(adev, &adev->virt.csa_obj,
24022402
AMDGPU_GEM_DOMAIN_VRAM,
24032403
AMDGPU_CSA_SIZE);
@@ -3210,6 +3210,15 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32103210
return r;
32113211
}
32123212
adev->ip_blocks[i].status.hw = true;
3213+
3214+
if (adev->in_s0ix && adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) {
3215+
/* disable gfxoff for IP resume. The gfxoff will be re-enabled in
3216+
* amdgpu_device_resume() after IP resume.
3217+
*/
3218+
amdgpu_gfx_off_ctrl(adev, false);
3219+
DRM_DEBUG("will disable gfxoff for re-initializing other blocks\n");
3220+
}
3221+
32133222
}
32143223

32153224
return 0;
@@ -4051,15 +4060,18 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)
40514060
* at suspend time.
40524061
*
40534062
*/
4054-
static void amdgpu_device_evict_resources(struct amdgpu_device *adev)
4063+
static int amdgpu_device_evict_resources(struct amdgpu_device *adev)
40554064
{
4065+
int ret;
4066+
40564067
/* No need to evict vram on APUs for suspend to ram or s2idle */
40574068
if ((adev->in_s3 || adev->in_s0ix) && (adev->flags & AMD_IS_APU))
4058-
return;
4069+
return 0;
40594070

4060-
if (amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM))
4071+
ret = amdgpu_ttm_evict_resources(adev, TTM_PL_VRAM);
4072+
if (ret)
40614073
DRM_WARN("evicting device resources failed\n");
4062-
4074+
return ret;
40634075
}
40644076

40654077
/*
@@ -4109,7 +4121,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)
41094121
if (!adev->in_s0ix)
41104122
amdgpu_amdkfd_suspend(adev, adev->in_runpm);
41114123

4112-
amdgpu_device_evict_resources(adev);
4124+
r = amdgpu_device_evict_resources(adev);
4125+
if (r)
4126+
return r;
41134127

41144128
amdgpu_fence_driver_hw_fini(adev);
41154129

@@ -4183,8 +4197,17 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)
41834197
}
41844198

41854199
/* Make sure IB tests flushed */
4200+
if (amdgpu_sriov_vf(adev))
4201+
amdgpu_irq_gpu_reset_resume_helper(adev);
41864202
flush_delayed_work(&adev->delayed_init_work);
41874203

4204+
if (adev->in_s0ix) {
4205+
/* re-enable gfxoff after IP resume. This re-enables gfxoff after
4206+
* it was disabled for IP resume in amdgpu_device_ip_resume_phase2().
4207+
*/
4208+
amdgpu_gfx_off_ctrl(adev, true);
4209+
DRM_DEBUG("will enable gfxoff for the mission mode\n");
4210+
}
41884211
if (fbcon)
41894212
drm_fb_helper_set_suspend_unlocked(adev_to_drm(adev)->fb_helper, false);
41904213

@@ -5381,7 +5404,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
53815404
drm_sched_start(&ring->sched, !tmp_adev->asic_reset_res);
53825405
}
53835406

5384-
if (adev->enable_mes)
5407+
if (adev->enable_mes && adev->ip_versions[GC_HWIP][0] != IP_VERSION(11, 0, 3))
53855408
amdgpu_mes_self_test(tmp_adev);
53865409

53875410
if (!drm_drv_uses_atomic_modeset(adev_to_drm(tmp_adev)) && !job_signaled) {

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2201,7 +2201,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)
22012201
pm_runtime_forbid(dev->dev);
22022202
}
22032203

2204-
if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2)) {
2204+
if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2) &&
2205+
!amdgpu_sriov_vf(adev)) {
22052206
bool need_to_reset_gpu = false;
22062207

22072208
if (adev->gmc.xgmi.num_physical_nodes > 1) {

drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ void amdgpu_gmc_tmz_set(struct amdgpu_device *adev)
542542
case IP_VERSION(10, 3, 1):
543543
/* YELLOW_CARP*/
544544
case IP_VERSION(10, 3, 3):
545+
case IP_VERSION(11, 0, 1):
545546
/* Don't enable it by default yet.
546547
*/
547548
if (amdgpu_tmz < 1) {

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,17 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
337337
fw_info->feature = adev->psp.cap_feature_version;
338338
break;
339339
case AMDGPU_INFO_FW_MES_KIQ:
340-
fw_info->ver = adev->mes.ucode_fw_version[0];
341-
fw_info->feature = 0;
340+
fw_info->ver = adev->mes.kiq_version & AMDGPU_MES_VERSION_MASK;
341+
fw_info->feature = (adev->mes.kiq_version & AMDGPU_MES_FEAT_VERSION_MASK)
342+
>> AMDGPU_MES_FEAT_VERSION_SHIFT;
342343
break;
343344
case AMDGPU_INFO_FW_MES:
344-
fw_info->ver = adev->mes.ucode_fw_version[1];
345+
fw_info->ver = adev->mes.sched_version & AMDGPU_MES_VERSION_MASK;
346+
fw_info->feature = (adev->mes.sched_version & AMDGPU_MES_FEAT_VERSION_MASK)
347+
>> AMDGPU_MES_FEAT_VERSION_SHIFT;
348+
break;
349+
case AMDGPU_INFO_FW_IMU:
350+
fw_info->ver = adev->gfx.imu_fw_version;
345351
fw_info->feature = 0;
346352
break;
347353
default:
@@ -790,7 +796,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
790796
dev_info->ids_flags = 0;
791797
if (adev->flags & AMD_IS_APU)
792798
dev_info->ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
793-
if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
799+
if (amdgpu_mcbp)
794800
dev_info->ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
795801
if (amdgpu_is_tmz(adev))
796802
dev_info->ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
@@ -1166,7 +1172,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
11661172
goto error_vm;
11671173
}
11681174

1169-
if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
1175+
if (amdgpu_mcbp) {
11701176
uint64_t csa_addr = amdgpu_csa_vaddr(adev) & AMDGPU_GMC_HOLE_MASK;
11711177

11721178
r = amdgpu_map_static_csa(adev, &fpriv->vm, adev->virt.csa_obj,
@@ -1230,7 +1236,7 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,
12301236
if (amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_VCE) != NULL)
12311237
amdgpu_vce_free_handles(adev, file_priv);
12321238

1233-
if (amdgpu_mcbp || amdgpu_sriov_vf(adev)) {
1239+
if (amdgpu_mcbp) {
12341240
/* TODO: how to handle reserve failure */
12351241
BUG_ON(amdgpu_bo_reserve(adev->virt.csa_obj, true));
12361242
amdgpu_vm_bo_del(adev, fpriv->csa_va);
@@ -1520,6 +1526,15 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
15201526
fw_info.feature, fw_info.ver);
15211527
}
15221528

1529+
/* IMU */
1530+
query_fw.fw_type = AMDGPU_INFO_FW_IMU;
1531+
query_fw.index = 0;
1532+
ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
1533+
if (ret)
1534+
return ret;
1535+
seq_printf(m, "IMU feature version: %u, firmware version: 0x%08x\n",
1536+
fw_info.feature, fw_info.ver);
1537+
15231538
/* PSP SOS */
15241539
query_fw.fw_type = AMDGPU_INFO_FW_SOS;
15251540
ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);

0 commit comments

Comments
 (0)