[PATCH] drm/amdkfd: init drm_client with funcs hook
otherwise drm_client_dev_unregister() would try to kfree(&adev->kfd.client). Signed-off-by: Flora Cui --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c index 067690ba7bff..81af6bf2f052 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c @@ -138,6 +138,9 @@ static void amdgpu_amdkfd_reset_work(struct work_struct *work) amdgpu_device_gpu_recover(adev, NULL, &reset_context); } +static const struct drm_client_funcs kfd_client_funcs = { + .unregister = drm_client_release, +}; void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) { int i; @@ -161,7 +164,7 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev) .enable_mes = adev->enable_mes, }; - ret = drm_client_init(&adev->ddev, &adev->kfd.client, "kfd", NULL); + ret = drm_client_init(&adev->ddev, &adev->kfd.client, "kfd", &kfd_client_funcs); if (ret) { dev_err(adev->dev, "Failed to init DRM client: %d\n", ret); return; -- 2.34.1
Re: Failed to create a rescuer kthread for the amdgpu-reset-dev workqueue
Well the driver load is interrupted for some reason. Have you set any timeout for modprobe? Regards, Christian. Am 12.01.24 um 09:11 schrieb Thomas Perrot: Hello, We are updating the kernel from the 6.1 to the 6.6 and we observe an amdgpu’s regression with Radeon RX580 8GB and SiFive Unmatched: “workqueue: Failed to create a rescuer kthread for wq 'amdgpu-reset- dev': -EINTR [drm:amdgpu_reset_create_reset_domain [amdgpu]] *ERROR* Failed to allocate wq for amdgpu_reset_domain! amdgpu :07:00.0: amdgpu: Fatal error during GPU init amdgpu :07:00.0: amdgpu: amdgpu: finishing device. amdgpu: probe of :07:00.0 failed with error -12” We tried to figure it out without success for the moment, do you have some advice to identify the root cause and to fix it? Kind regards, Thomas Perrot
Failed to create a rescuer kthread for the amdgpu-reset-dev workqueue
Hello, We are updating the kernel from the 6.1 to the 6.6 and we observe an amdgpu’s regression with Radeon RX580 8GB and SiFive Unmatched: “workqueue: Failed to create a rescuer kthread for wq 'amdgpu-reset- dev': -EINTR [drm:amdgpu_reset_create_reset_domain [amdgpu]] *ERROR* Failed to allocate wq for amdgpu_reset_domain! amdgpu :07:00.0: amdgpu: Fatal error during GPU init amdgpu :07:00.0: amdgpu: amdgpu: finishing device. amdgpu: probe of :07:00.0 failed with error -12” We tried to figure it out without success for the moment, do you have some advice to identify the root cause and to fix it? Kind regards, Thomas Perrot -- Thomas Perrot, Bootlin Embedded Linux and kernel engineering https://bootlin.com signature.asc Description: This is a digitally signed message part
Re: [PATCH] drm/amdgpu: Fix the null pointer when load rlc firmware
[Public] Acked-by: Alex Deucher From: Ma, Jun Sent: Friday, January 12, 2024 1:26 AM To: amd-gfx@lists.freedesktop.org ; Koenig, Christian ; Deucher, Alexander Cc: Ma, Jun Subject: [PATCH] drm/amdgpu: Fix the null pointer when load rlc firmware If the RLC firmware is invalid because of wrong header size, the pointer to the rlc firmware is released in function amdgpu_ucode_request. There will be a null pointer error in subsequent use. So skip validation to fix it. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index d2c34436aefc..4d90e570b3cd 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -3996,16 +3996,13 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev) if (!amdgpu_sriov_vf(adev)) { snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix); - err = amdgpu_ucode_request(adev, &adev->gfx.rlc_fw, fw_name); - /* don't check this. There are apparently firmwares in the wild with -* incorrect size in the header -*/ - if (err == -ENODEV) - goto out; + err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev); if (err) - dev_dbg(adev->dev, - "gfx10: amdgpu_ucode_request() failed \"%s\"\n", - fw_name); + goto out; + + /* don't validate this firmware. There are apparently firmwares +* in the wild with incorrect size in the header +*/ rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data; version_major = le16_to_cpu(rlc_hdr->header.header_version_major); version_minor = le16_to_cpu(rlc_hdr->header.header_version_minor); -- 2.34.1
[PATCH] drm/amdgpu: fix return value in aca_bank_hwip_is_matched()
The aca_bank_hwip_is_matched() function is type bool. This error path return -EINVAL which is cast to true, but it should return false instead. Fixes: 22a4fa4709e3 ("drm/amdgpu: implement RAS ACA driver framework") Signed-off-by: Dan Carpenter --- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c index 6074a529caf7..1d3ae7c241e5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c @@ -182,7 +182,7 @@ static bool aca_bank_hwip_is_matched(struct aca_bank *bank, enum aca_hwip_type t u64 ipid; if (!bank || type == ACA_HWIP_TYPE_UNKNOW) - return -EINVAL; + return false; hwip = &aca_hwid_mcatypes[type]; if (!hwip->hwid) -- 2.43.0
[bug report] drm/amdgpu: Auto-validate DMABuf imports in compute VMs
Hello Felix Kuehling, This is a semi-automatic email about new static checker warnings. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1480 amdgpu_vm_handle_moved() warn: variable dereferenced before check 'bo_va->base.bo' (see line 1453) drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 1452 base.vm_status); 1453 resv = bo_va->base.bo->tbo.base.resv; Unchecked dereference 1454 spin_unlock(&vm->status_lock); 1455 1456 /* Try to reserve the BO to avoid clearing its ptes */ 1457 if (!adev->debug_vm && dma_resv_trylock(resv)) { 1458 clear = false; 1459 unlock = true; 1460 /* The caller is already holding the reservation lock */ 1461 } else if (ticket && dma_resv_locking_ctx(resv) == ticket) { 1462 clear = false; 1463 unlock = false; 1464 /* Somebody else is using the BO right now */ 1465 } else { 1466 clear = true; 1467 unlock = false; 1468 } 1469 1470 r = amdgpu_vm_bo_update(adev, bo_va, clear); 1471 1472 if (unlock) 1473 dma_resv_unlock(resv); 1474 if (r) 1475 return r; 1476 1477 /* Remember evicted DMABuf imports in compute VMs for later 1478 * validation 1479 */ 1480 if (vm->is_compute_context && bo_va->base.bo && ^^ The patch adds this NULL check but hopefully it's not required. 1481 bo_va->base.bo->tbo.base.import_attach && 1482 (!bo_va->base.bo->tbo.resource || regards, dan carpenter
Re: [PATCH 3/6] drm/amdgpu: prefer snprintf over sprintf
On Fri, 12 Jan 2024, kernel test robot wrote: > Hi Jani, > > kernel test robot noticed the following build warnings: > > [auto build test WARNING on drm-misc/drm-misc-next] > [also build test WARNING on drm-intel/for-linux-next > drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.7 > next-20240111] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: > https://github.com/intel-lab-lkp/linux/commits/Jani-Nikula/drm-nouveau-acr-ga102-remove-unused-but-set-variable/20240111-014206 > base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next > patch link: > https://lore.kernel.org/r/fea7a52924f98b1ac24f4a7e6ba21d7754422430.1704908087.git.jani.nikula%40intel.com > patch subject: [PATCH 3/6] drm/amdgpu: prefer snprintf over sprintf > config: sparc64-allmodconfig > (https://download.01.org/0day-ci/archive/20240112/202401121126.i9vgrvmb-...@intel.com/config) > compiler: sparc64-linux-gcc (GCC) 13.2.0 > reproduce (this is a W=1 build): > (https://download.01.org/0day-ci/archive/20240112/202401121126.i9vgrvmb-...@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version > of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Closes: > https://lore.kernel.org/oe-kbuild-all/202401121126.i9vgrvmb-...@intel.com/ > > All warnings (new ones prefixed by >>): > >drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c: In function > 'amdgpu_gfx_kiq_init_ring': >>> drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:332:61: warning: '%d' directive >>> output may be truncated writing between 1 and 10 bytes into a region of >>> size between 0 and 8 [-Wformat-truncation=] > 332 | snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", > | ^~ >drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:332:50: note: directive argument > in the range [0, 2147483647] > 332 | snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", > | ^ >drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c:332:9: note: 'snprintf' output > between 12 and 41 bytes into a destination of size 16 > 332 | snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", > | ^~~ > 333 | xcc_id, ring->me, ring->pipe, ring->queue); > | ~~ As the commit message says, This will trade the W=1 warning -Wformat-overflow to -Wformat-truncation. This lets us enable -Wformat-overflow subsystem wide. BR, Jani. > > > vim +332 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > >306 >307int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, >308 struct amdgpu_ring *ring, >309 struct amdgpu_irq_src *irq, int > xcc_id) >310{ >311struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id]; >312int r = 0; >313 >314spin_lock_init(&kiq->ring_lock); >315 >316ring->adev = NULL; >317ring->ring_obj = NULL; >318ring->use_doorbell = true; >319ring->xcc_id = xcc_id; >320ring->vm_hub = AMDGPU_GFXHUB(xcc_id); >321ring->doorbell_index = >322(adev->doorbell_index.kiq + >323 xcc_id * > adev->doorbell_index.xcc_doorbell_range) >324<< 1; >325 >326r = amdgpu_gfx_kiq_acquire(adev, ring, xcc_id); >327if (r) >328return r; >329 >330ring->eop_gpu_addr = kiq->eop_gpu_addr; >331ring->no_scheduler = true; > > 332snprintf(ring->name, sizeof(ring->name), > "kiq_%d.%d.%d.%d", >333 xcc_id, ring->me, ring->pipe, ring->queue); >334r = amdgpu_ring_init(adev, ring, 1024, irq, > AMDGPU_CP_KIQ_IRQ_DRIVER0, >335 AMDGPU_RING_PRIO_DEFAULT, NULL); >336if (r) >337dev_warn(adev->dev, "(%d) failed to init kiq > ring\n", r); >338 >339return r; >340} >341 -- Jani Nikula, Intel
Re: [PATCH] drm/amdkfd: reserve the BO before validating it
[AMD Official Use Only - General] On 2024-01-11 11:19, Felix Kuehling wrote: > On 2024-01-11 02:22, Lang Yu wrote: >> Fixes: 410f08516e0f ("drm/amdkfd: Move dma unmapping after TLB flush") >> >> [ 41.708711] WARNING: CPU: 0 PID: 1463 at >> drivers/gpu/drm/ttm/ttm_bo.c:846 ttm_bo_validate+0x146/0x1b0 [ttm] >> [ 41.708989] Call Trace: >> [ 41.708992] >> [ 41.708996] ? show_regs+0x6c/0x80 >> [ 41.709000] ? ttm_bo_validate+0x146/0x1b0 [ttm] >> [ 41.709008] ? __warn+0x93/0x190 >> [ 41.709014] ? ttm_bo_validate+0x146/0x1b0 [ttm] >> [ 41.709024] ? report_bug+0x1f9/0x210 >> [ 41.709035] ? handle_bug+0x46/0x80 >> [ 41.709041] ? exc_invalid_op+0x1d/0x80 >> [ 41.709048] ? asm_exc_invalid_op+0x1f/0x30 >> [ 41.709057] ? amdgpu_amdkfd_gpuvm_dmaunmap_mem+0x2c/0x80 [amdgpu] >> [ 41.709185] ? ttm_bo_validate+0x146/0x1b0 [ttm] >> [ 41.709197] ? amdgpu_amdkfd_gpuvm_dmaunmap_mem+0x2c/0x80 [amdgpu] >> [ 41.709337] ? srso_alias_return_thunk+0x5/0x7f >> [ 41.709346] kfd_mem_dmaunmap_attachment+0x9e/0x1e0 [amdgpu] >> [ 41.709467] amdgpu_amdkfd_gpuvm_dmaunmap_mem+0x56/0x80 [amdgpu] >> [ 41.709586] kfd_ioctl_unmap_memory_from_gpu+0x1b7/0x300 [amdgpu] >> [ 41.709710] kfd_ioctl+0x1ec/0x650 [amdgpu] >> [ 41.709822] ? __pfx_kfd_ioctl_unmap_memory_from_gpu+0x10/0x10 >> [amdgpu] >> [ 41.709945] ? srso_alias_return_thunk+0x5/0x7f >> [ 41.709949] ? tomoyo_file_ioctl+0x20/0x30 >> [ 41.709959] __x64_sys_ioctl+0x9c/0xd0 >> [ 41.709967] do_syscall_64+0x3f/0x90 >> [ 41.709973] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 >> >> Signed-off-by: Lang Yu >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 7 ++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c >> index 48697b789342..f5542a4ab8ed 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c >> @@ -2095,8 +2095,13 @@ void amdgpu_amdkfd_gpuvm_dmaunmap_mem(struct >> kgd_mem *mem, void *drm_priv) >> mutex_lock(&mem->lock); >> list_for_each_entry(entry, &mem->attachments, list) { >> -if (entry->bo_va->base.vm == vm) >> +if (entry->bo_va->base.vm != vm) >> +continue; >> + >> +if (!WARN_ON(amdgpu_bo_reserve(entry->bo_va->base.bo, true))) { >> kfd_mem_dmaunmap_attachment(mem, entry); >> +amdgpu_bo_unreserve(entry->bo_va->base.bo); >> +} > > I'm pretty sure someone else worked on a fix for this before. This is > not a good solution. We need to handle failed reservations (due to > ERESTARTSYS) and make sure that the unmap ioctl can be restarted > correctly in that case. > > See > https://lore.kernel.org/amd-gfx/530aac57-5561-4d1d-879a-93b108e5c...@gmail.com/ > > David, do you have any update on this work? > I tried to solve this same problem. After feedback from November's post, I updated my patch. In testing, I found that my patch (attached to avoid cluttering this thread and to make clear the patch is not ready for primetime) causes lockdep to emit possible circular dependency warnings, so I haven't pursued it any further. > Regards, > Felix > > >> } >> mutex_unlock(&mem->lock); From 5f00ef4518ae1971f2cd31a89a647380b49fbe43 Mon Sep 17 00:00:00 2001 From: David Francis Date: Thu, 5 Oct 2023 11:36:06 -0400 Subject: [PATCH] drm/amdgpu: Acquire ttm locks for dmaunmap dmaunmap can call ttm_bo_validate, which expects the ttm dma_resv to be held. Acquire the locks in amdgpu_amdkfd_gpuvm_dmaunmap_mem. Because the dmaunmap step can now fail, it is now necessary to track which attachments have and have not been dmaunmapped. This failure can also cause the sync_memory step of the ioctl to be repeated; it is idempotent, so this should not cause any issues. Signed-off-by: David Francis --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 3 ++- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 18 +++--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 ++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h index 3ad8dc523b42..aeed6a893902 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h @@ -58,6 +58,7 @@ struct kfd_mem_attachment { struct list_head list; enum kfd_mem_attachment_type type; bool is_mapped; + bool is_dmamapped; struct amdgpu_bo_va *bo_va; struct amdgpu_device *adev; uint64_t va; @@ -302,7 +303,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(struct amdgpu_device *adev, struct kgd_mem *mem, void *drm_priv); int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu( struct amdgpu_device *adev, struct kgd_mem *mem, void *drm_priv); -void amdgpu_amdkfd_gpuvm_dmaunmap_mem(struct kgd_mem *mem, void *drm_priv); +int amdgpu_amdkfd_gpuvm_dm
Re: [PATCH 0/3] Update LLVM Phabricator and Bugzilla links
On Tue, Jan 9, 2024 at 5:26 PM Nathan Chancellor wrote: > > This series updates all instances of LLVM Phabricator and Bugzilla links > to point to GitHub commits directly and LLVM's Bugzilla to GitHub issue > shortlinks respectively. > > I split up the Phabricator patch into BPF selftests and the rest of the > kernel in case the BPF folks want to take it separately from the rest of > the series, there are obviously no dependency issues in that case. The > Bugzilla change was mechanical enough and should have no conflicts. > > I am aiming this at Andrew and CC'ing other lists, in case maintainers > want to chime in, but I think this is pretty uncontroversial (famous > last words...). > Acked-by: Alex Deucher > --- > Nathan Chancellor (3): > selftests/bpf: Update LLVM Phabricator links > arch and include: Update LLVM Phabricator links > treewide: Update LLVM Bugzilla links > > arch/arm64/Kconfig | 4 +-- > arch/powerpc/Makefile | 4 +-- > arch/powerpc/kvm/book3s_hv_nested.c| 2 +- > arch/riscv/Kconfig | 2 +- > arch/riscv/include/asm/ftrace.h| 2 +- > arch/s390/include/asm/ftrace.h | 2 +- > arch/x86/power/Makefile| 2 +- > crypto/blake2b_generic.c | 2 +- > drivers/firmware/efi/libstub/Makefile | 2 +- > drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 2 +- > drivers/media/test-drivers/vicodec/codec-fwht.c| 2 +- > drivers/regulator/Kconfig | 2 +- > include/asm-generic/vmlinux.lds.h | 2 +- > include/linux/compiler-clang.h | 2 +- > lib/Kconfig.kasan | 2 +- > lib/raid6/Makefile | 2 +- > lib/stackinit_kunit.c | 2 +- > mm/slab_common.c | 2 +- > net/bridge/br_multicast.c | 2 +- > security/Kconfig | 2 +- > tools/testing/selftests/bpf/README.rst | 32 > +++--- > tools/testing/selftests/bpf/prog_tests/xdpwall.c | 2 +- > .../selftests/bpf/progs/test_core_reloc_type_id.c | 2 +- > 23 files changed, 40 insertions(+), 40 deletions(-) > --- > base-commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a > change-id: 20240109-update-llvm-links-d03f9d649e1e > > Best regards, > -- > Nathan Chancellor >
Re: [PATCH 3/6] drm/amdgpu: prefer snprintf over sprintf
On Wed, Jan 10, 2024 at 12:39 PM Jani Nikula wrote: > > This will trade the W=1 warning -Wformat-overflow to > -Wformat-truncation. This lets us enable -Wformat-overflow subsystem > wide. > > Cc: Alex Deucher > Cc: Christian König > Cc: Pan, Xinhui > Cc: amd-gfx@lists.freedesktop.org > Signed-off-by: Jani Nikula Acked-by: Alex Deucher Feel free to take this via whichever tree makes sense. Alex > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > index b9674c57c436..82b4b2019fca 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c > @@ -329,7 +329,8 @@ int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, > > ring->eop_gpu_addr = kiq->eop_gpu_addr; > ring->no_scheduler = true; > - sprintf(ring->name, "kiq_%d.%d.%d.%d", xcc_id, ring->me, ring->pipe, > ring->queue); > + snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d", > +xcc_id, ring->me, ring->pipe, ring->queue); > r = amdgpu_ring_init(adev, ring, 1024, irq, AMDGPU_CP_KIQ_IRQ_DRIVER0, > AMDGPU_RING_PRIO_DEFAULT, NULL); > if (r) > -- > 2.39.2 >
RE: [PATCH 00/19] DC Patches January 10, 2024
[Public] Hi all, This week this patchset was tested on the following systems: * Lenovo ThinkBook T13s Gen4 with AMD Ryzen 5 6600U * MSI Gaming X Trio RX 6800 * Gigabyte Gaming OC RX 7900 XTX These systems were tested on the following display/connection types: * eDP, (1080p 60hz [5650U]) (1920x1200 60hz [6600U]) (2560x1600 120hz[6600U]) * VGA and DVI (1680x1050 60hz [DP to VGA/DVI, USB-C to VGA/DVI]) * DP/HDMI/USB-C (1440p 170hz, 4k 60hz, 4k 144hz, 4k 240hz [Includes USB-C to DP/HDMI adapters]) * Thunderbolt (LG Ultrafine 5k) * MST (Startech MST14DP123DP [DP to 3x DP] and 2x 4k 60Hz displays) * DSC (with Cable Matters 101075 [DP to 3x DP] with 3x 4k60 displays, and HP Hook G2 with 1 4k60 display) * USB 4 (Kensington SD5700T and 1x 4k 60Hz display) * PCON (Club3D CAC-1085 and 1x 4k 144Hz display [at 4k 120HZ, as that is the max the adapter supports]) The testing is a mix of automated and manual tests. Manual testing includes (but is not limited to): * Changing display configurations and settings * Benchmark testing * Feature testing (Freesync, etc.) Automated testing includes (but is not limited to): * Script testing (scripts to automate some of the manual checks) * IGT testing The patchset consists of the amd-staging-drm-next branch (Head commit - b2db1b01c3ec drm/amdgpu: update regGL2C_CTRL4 value in golden setting) with new patches added on top of it. Tested on Ubuntu 22.04.3, on Wayland and X11, using KDE Plasma and Gnome. Tested-by: Daniel Wheeler Thank you, Dan Wheeler Sr. Technologist | AMD SW Display -- 1 Commerce Valley Dr E, Thornhill, ON L3T 7X6 amd.com -Original Message- From: Hung, Alex Sent: Wednesday, January 10, 2024 4:53 PM To: amd-gfx@lists.freedesktop.org Cc: Wentland, Harry ; Li, Sun peng (Leo) ; Siqueira, Rodrigo ; Pillai, Aurabindo ; Li, Roman ; Lin, Wayne ; stylon.w...@amd.com; Gutierrez, Agustin ; Chung, ChiaHsuan (Tom) ; Wu, Hersen ; Zuo, Jerry ; Hung, Alex ; Wheeler, Daniel Subject: [PATCH 00/19] DC Patches January 10, 2024 This DC patchset brings improvements in multiple areas. In summary, we highlight: * Fixes on DCN35 and DML2. * Enhancements in DMUB. * Improvements on IPS, DP and MPO and others. Cc: Daniel Wheeler Alvin Lee (2): drm/amd/display: Add Replay IPS register for DMUB command table drm/amd/display: Ensure populate uclk in bb construction Charlene Liu (2): drm/amd/display: Add logging resource checks drm/amd/display: Update P010 scaling cap Dillon Varone (1): drm/amd/display: Init link enc resources in dc_state only if res_pool presents Dmytro Laktyushkin (1): drm/amd/display: Fix dml2 assigned pipe search George Shen (1): drm/amd/display: Add DP audio BW validation Ilya Bakoulin (1): drm/amd/display: Clear OPTC mem select on disable Martin Leung (1): drm/amd/display: 3.2.267 Nicholas Kazlauskas (5): drm/amd/display: Allow IPS2 during Replay drm/amd/display: Port DENTIST hang and TDR fixes to OTG disable W/A drm/amd/display: Rework DC Z10 restore drm/amd/display: Set default Z8 minimum residency for DCN35 drm/amd/display: Allow Z8 for multiplane configurations on DCN35 Ovidiu Bunea (1): drm/amd/display: Fix DML2 watermark calculation Tom Chung (1): drm/amd/display: Enable Panel Replay for static screen use case Wayne Lin (1): drm/amd/display: Align the returned error code with legacy DP Wenjing Liu (2): drm/amd/display: Floor to mhz when requesting dpp disp clock changes to SMU drm/amd/display: Reenable windowed mpo odm support .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 ++- .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c| 59 +++- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 5 + .../amd/display/amdgpu_dm/amdgpu_dm_replay.c | 119 +--- .../amd/display/amdgpu_dm/amdgpu_dm_replay.h | 4 +- .../dc/clk_mgr/dcn314/dcn314_clk_mgr.c| 21 +- .../display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 40 ++- .../display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c | 25 +- drivers/gpu/drm/amd/display/dc/core/dc.c | 15 +- .../gpu/drm/amd/display/dc/core/dc_resource.c | 4 + .../gpu/drm/amd/display/dc/core/dc_state.c| 8 +- .../gpu/drm/amd/display/dc/core/dc_stream.c | 9 +- drivers/gpu/drm/amd/display/dc/dc.h | 3 +- .../gpu/drm/amd/display/dc/dce/dce_audio.c| 288 +- .../gpu/drm/amd/display/dc/dce/dce_audio.h| 3 +- .../dc/dml/dcn30/display_mode_vba_30.c| 16 +- .../amd/display/dc/dml/dcn303/dcn303_fpu.c| 11 + .../drm/amd/display/dc/dml/dcn35/dcn35_fpu.c | 4 +- .../amd/display/dc/dml2/display_mode_core.c | 14 +- .../display/dc/dml2/dml2_dc_resource_mgmt.c | 36 ++- .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 56 +++- .../amd/display/dc/hwss/dcn
[PATCH 2/6] drm/radeon: convert to using is_hdmi and has_audio from display info
Prefer the parsed results for is_hdmi and has_audio in display info over calling drm_detect_hdmi_monitor() and drm_detect_monitor_audio(), respectively. Cc: Alex Deucher Cc: Christian König Cc: Pan, Xinhui Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Jani Nikula --- drivers/gpu/drm/radeon/atombios_encoders.c | 10 +- drivers/gpu/drm/radeon/evergreen_hdmi.c| 5 ++--- drivers/gpu/drm/radeon/radeon_audio.c | 6 +++--- drivers/gpu/drm/radeon/radeon_connectors.c | 12 ++-- drivers/gpu/drm/radeon/radeon_display.c| 2 +- drivers/gpu/drm/radeon/radeon_encoders.c | 4 ++-- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index 6e537c5bd295..386fd5f0a762 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c @@ -701,7 +701,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) if (radeon_connector->use_digital && (radeon_connector->audio == RADEON_AUDIO_ENABLE)) return ATOM_ENCODER_MODE_HDMI; - else if (drm_detect_hdmi_monitor(radeon_connector_edid(connector)) && + else if (connector->display_info.is_hdmi && (radeon_connector->audio == RADEON_AUDIO_AUTO)) return ATOM_ENCODER_MODE_HDMI; else if (radeon_connector->use_digital) @@ -720,7 +720,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) if (radeon_audio != 0) { if (radeon_connector->audio == RADEON_AUDIO_ENABLE) return ATOM_ENCODER_MODE_HDMI; - else if (drm_detect_hdmi_monitor(radeon_connector_edid(connector)) && + else if (connector->display_info.is_hdmi && (radeon_connector->audio == RADEON_AUDIO_AUTO)) return ATOM_ENCODER_MODE_HDMI; else @@ -737,14 +737,14 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { if (radeon_audio != 0 && - drm_detect_monitor_audio(radeon_connector_edid(connector)) && + connector->display_info.has_audio && ASIC_IS_DCE4(rdev) && !ASIC_IS_DCE5(rdev)) return ATOM_ENCODER_MODE_DP_AUDIO; return ATOM_ENCODER_MODE_DP; } else if (radeon_audio != 0) { if (radeon_connector->audio == RADEON_AUDIO_ENABLE) return ATOM_ENCODER_MODE_HDMI; - else if (drm_detect_hdmi_monitor(radeon_connector_edid(connector)) && + else if (connector->display_info.is_hdmi && (radeon_connector->audio == RADEON_AUDIO_AUTO)) return ATOM_ENCODER_MODE_HDMI; else @@ -755,7 +755,7 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) break; case DRM_MODE_CONNECTOR_eDP: if (radeon_audio != 0 && - drm_detect_monitor_audio(radeon_connector_edid(connector)) && + connector->display_info.has_audio && ASIC_IS_DCE4(rdev) && !ASIC_IS_DCE5(rdev)) return ATOM_ENCODER_MODE_DP_AUDIO; return ATOM_ENCODER_MODE_DP; diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 681119c91d94..09dda114e218 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c @@ -412,7 +412,7 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) if (enable) { struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); - if (connector && drm_detect_monitor_audio(radeon_connector_edid(connector))) { + if (connector && connector->display_info.has_audio) { WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, HDMI_AVI_INFO_SEND | /* enable AVI info frames */ HDMI_AVI_INFO_CONT | /* required for audio info values to be updated */ @@ -450,8 +450,7 @@ void evergreen_dp_enable(struct drm_encoder *encoder, bool enable) if (!dig || !dig->afmt) return; - if (enable && connector && - drm_detect_monitor_audio(radeon_connector_edid(connector))) { + if (enable && connector && connector->display_info.has_audio) {
[PATCH 3/6] drm/radeon: remove radeon_connector_edid() and stop using edid_blob_ptr
radeon_connector_edid() copies the EDID from edid_blob_ptr as a side effect if radeon_connector->edid isn't initialized. However, everywhere that the returned EDID is used, the EDID should have been set beforehands. Only the drm EDID code should look at the EDID property, anyway, so stop using it. Cc: Alex Deucher Cc: Christian König Cc: Pan, Xinhui Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Jani Nikula --- drivers/gpu/drm/radeon/radeon_audio.c | 7 --- drivers/gpu/drm/radeon/radeon_connectors.c | 15 --- drivers/gpu/drm/radeon/radeon_mode.h | 2 -- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index e88c35d003c5..05ee473dcfbb 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c @@ -304,6 +304,7 @@ void radeon_audio_endpoint_wreg(struct radeon_device *rdev, u32 offset, static void radeon_audio_write_sad_regs(struct drm_encoder *encoder) { struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); + struct radeon_connector *radeon_connector = to_radeon_connector(connector); struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); struct cea_sad *sads; int sad_count; @@ -311,7 +312,7 @@ static void radeon_audio_write_sad_regs(struct drm_encoder *encoder) if (!connector) return; - sad_count = drm_edid_to_sad(radeon_connector_edid(connector), &sads); + sad_count = drm_edid_to_sad(radeon_connector->edid, &sads); if (sad_count < 0) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); if (sad_count <= 0) @@ -327,6 +328,7 @@ static void radeon_audio_write_sad_regs(struct drm_encoder *encoder) static void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder) { struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); + struct radeon_connector *radeon_connector = to_radeon_connector(connector); struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); u8 *sadb = NULL; int sad_count; @@ -334,8 +336,7 @@ static void radeon_audio_write_speaker_allocation(struct drm_encoder *encoder) if (!connector) return; - sad_count = drm_edid_to_speaker_allocation(radeon_connector_edid(connector), - &sadb); + sad_count = drm_edid_to_speaker_allocation(radeon_connector->edid, &sadb); if (sad_count < 0) { DRM_DEBUG("Couldn't read Speaker Allocation Data Block: %d\n", sad_count); diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 81b5c3c8f658..80879e946342 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c @@ -255,21 +255,6 @@ static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, return NULL; } -struct edid *radeon_connector_edid(struct drm_connector *connector) -{ - struct radeon_connector *radeon_connector = to_radeon_connector(connector); - struct drm_property_blob *edid_blob = connector->edid_blob_ptr; - - if (radeon_connector->edid) { - return radeon_connector->edid; - } else if (edid_blob) { - struct edid *edid = kmemdup(edid_blob->data, edid_blob->length, GFP_KERNEL); - if (edid) - radeon_connector->edid = edid; - } - return radeon_connector->edid; -} - static void radeon_connector_get_edid(struct drm_connector *connector) { struct drm_device *dev = connector->dev; diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 59c4db13d90a..0d2f7785a099 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h @@ -704,8 +704,6 @@ extern u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connecto extern bool radeon_connector_is_dp12_capable(struct drm_connector *connector); extern int radeon_get_monitor_bpc(struct drm_connector *connector); -extern struct edid *radeon_connector_edid(struct drm_connector *connector); - extern void radeon_connector_hotplug(struct drm_connector *connector); extern int radeon_dp_mode_valid_helper(struct drm_connector *connector, struct drm_display_mode *mode); -- 2.39.2
[PATCH 4/6] drm/amdgpu: remove amdgpu_connector_edid() and stop using edid_blob_ptr
amdgpu_connector_edid() copies the EDID from edid_blob_ptr as a side effect if amdgpu_connector->edid isn't initialized. However, everywhere that the returned EDID is used, the EDID should have been set beforehands. Only the drm EDID code should look at the EDID property, anyway, so stop using it. Cc: Alex Deucher Cc: Christian König Cc: Pan, Xinhui Cc: amd-gfx@lists.freedesktop.org Signed-off-by: Jani Nikula --- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 16 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h | 1 - drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 4 ++-- 6 files changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index 9caba10315a8..cae7479c3ecf 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c @@ -246,22 +246,6 @@ amdgpu_connector_find_encoder(struct drm_connector *connector, return NULL; } -struct edid *amdgpu_connector_edid(struct drm_connector *connector) -{ - struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); - struct drm_property_blob *edid_blob = connector->edid_blob_ptr; - - if (amdgpu_connector->edid) { - return amdgpu_connector->edid; - } else if (edid_blob) { - struct edid *edid = kmemdup(edid_blob->data, edid_blob->length, GFP_KERNEL); - - if (edid) - amdgpu_connector->edid = edid; - } - return amdgpu_connector->edid; -} - static struct edid * amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev) { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h index 61fcef15ad72..eff833b6ed31 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.h @@ -24,7 +24,6 @@ #ifndef __AMDGPU_CONNECTORS_H__ #define __AMDGPU_CONNECTORS_H__ -struct edid *amdgpu_connector_edid(struct drm_connector *connector); void amdgpu_connector_hotplug(struct drm_connector *connector); int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector); u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector); diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index 587ee632a3b8..d0ba782f5aea 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c @@ -1297,7 +1297,7 @@ static void dce_v10_0_audio_write_speaker_allocation(struct drm_encoder *encoder return; } - sad_count = drm_edid_to_speaker_allocation(amdgpu_connector_edid(connector), &sadb); + sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb); if (sad_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count); sad_count = 0; @@ -1367,7 +1367,7 @@ static void dce_v10_0_audio_write_sad_regs(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads); + sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads); if (sad_count < 0) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); if (sad_count <= 0) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index f22ec27365bd..d540bef6f331 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c @@ -1329,7 +1329,7 @@ static void dce_v11_0_audio_write_speaker_allocation(struct drm_encoder *encoder return; } - sad_count = drm_edid_to_speaker_allocation(amdgpu_connector_edid(connector), &sadb); + sad_count = drm_edid_to_speaker_allocation(amdgpu_connector->edid, &sadb); if (sad_count < 0) { DRM_ERROR("Couldn't read Speaker Allocation Data Block: %d\n", sad_count); sad_count = 0; @@ -1399,7 +1399,7 @@ static void dce_v11_0_audio_write_sad_regs(struct drm_encoder *encoder) return; } - sad_count = drm_edid_to_sad(amdgpu_connector_edid(connector), &sads); + sad_count = drm_edid_to_sad(amdgpu_connector->edid, &sads); if (sad_count < 0) DRM_ERROR("Couldn't read SADs: %d\n", sad_count); if (sad_count <= 0) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index 4dbe9b3259b5..7112d184eaad 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -1201,7 +1201,7 @@ static void dce_v6_0_audio_write_speaker_allocation(struct drm_en
[pull] amdgpu, amdkfd drm-fixes-6.8
Hi Dave, Sima, Fixes for 6.8. The following changes since commit e54478fbdad20f2c58d0a4f99d01299ed8e7fe9c: Merge tag 'amd-drm-next-6.8-2024-01-05' of https://gitlab.freedesktop.org/agd5f/linux into drm-next (2024-01-09 09:07:50 +1000) are available in the Git repository at: https://gitlab.freedesktop.org/agd5f/linux.git tags/amd-drm-fixes-6.8-2024-01-12 for you to fetch changes up to 3b23fd46e2af68b47902caa3f88d60f73c5d85f7: drm/amd/pm: Fix smuv13.0.6 current clock reporting (2024-01-11 23:33:37 -0500) amd-drm-fixes-6.8-2024-01-12: amdgpu: - SubVP fixes - VRR fixes - USB4 fixes - DCN 3.5 fixes - GFX11 harvesting fix - RAS fixes - Misc small fixes - KFD dma-buf import fixes - Power reporting fixes - ATHUB 3.3 fix - SR-IOV fix - Add missing fw release for fiji - GFX 11.5 fix - Debugging module parameter fix - SMU 13.0.6 fixes amdkfd: - Fix lockdep warnings - Fix sparse __rcu warnings - Bump interface version so userspace knows that the kernel supports dma-bufs exported from KFD Most of the fixes for this went into 6.7, but the last fix is in this PR - HMM fix - SVM fix Alex Deucher (4): drm/amdgpu: fix avg vs input power reporting on smu7 drm/amdgpu: fall back to INPUT power for AVG power via INFO IOCTL drm/amdgpu/pm: clarify debugfs pm output drm/amdgpu: drop exp hw support check for GC 9.4.3 Aric Cyr (1): drm/amd/display: 3.2.266 Candice Li (2): drm/amdgpu: Drop unnecessary sentences about CE and deferred error. drm/amdgpu: Support poison error injection via ras_ctrl debugfs Charlene Liu (1): drm/amd/display: Update z8 latency Dafna Hirschfeld (1): drm/amdkfd: fixes for HMM mem allocation Daniel Miess (1): Revert "drm/amd/display: Fix conversions between bytes and KB" Felix Kuehling (4): drm/amdkfd: Fix lock dependency warning drm/amdkfd: Fix sparse __rcu annotation warnings drm/amdgpu: Auto-validate DMABuf imports in compute VMs drm/amdkfd: Bump KFD ioctl version George Shen (1): drm/amd/display: Disconnect phantom pipe OPP from OPTC being disabled Hawking Zhang (1): drm/amdgpu: Packed socket_id to ras feature mask Ivan Lipski (1): Revert "drm/amd/display: fix bandwidth validation failure on DCN 2.1" James Zhu (1): drm/amdgpu: make a correction on comment Le Ma (3): Revert "drm/amdgpu: add param to specify fw bo location for front-door loading" drm/amdgpu: add debug flag to place fw bo on vram for frontdoor loading drm/amdgpu: move debug options init prior to amdgpu device init Lijo Lazar (2): drm/amd/pm: Add error log for smu v13.0.6 reset drm/amd/pm: Fix smuv13.0.6 current clock reporting Likun Gao (1): drm/amdgpu: correct the cu count for gfx v11 Martin Leung (2): drm/amd/display: revert "for FPO & SubVP/DRR config program vmin/max" drm/amd/display: revert "Optimize VRR updates to only necessary ones" Martin Tsai (1): drm/amd/display: To adjust dprefclk by down spread percentage Meenakshikumar Somasundaram (1): drm/amd/display: Dpia hpd status not in sync after S4 Melissa Wen (1): drm/amd/display: cleanup inconsistent indenting in amdgpu_dm_color Peichen Huang (1): drm/amd/display: Request usb4 bw for mst streams Philip Yang (1): drm/amdkfd: Fix lock dependency warning with srcu Srinivasan Shanmugam (6): drm/amd/powerplay: Fix kzalloc parameter 'ATOM_Tonga_PPM_Table' in 'get_platform_power_management_table()' drm/amdgpu: Fix with right return code '-EIO' in 'amdgpu_gmc_vram_checking()' drm/amdgpu: Fix unsigned comparison with less than zero in vpe_u1_8_from_fraction() drm/amdgpu: Release 'adev->pm.fw' before return in 'amdgpu_device_need_post()' drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay() drm/amdkfd: Fix 'node' NULL check in 'svm_range_get_range_boundaries()' Victor Lu (1): drm/amdgpu: Do not program VM_L2_CNTL under SRIOV Yifan Zhang (3): drm/amdgpu: update headers for nbio v7.11 drm/amdgpu: update ATHUB_MISC_CNTL offset for athub v3.3 drm/amdgpu: update regGL2C_CTRL4 value in golden setting drivers/gpu/drm/amd/amdgpu/amdgpu.h| 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 12 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 43 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 - drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c| 4 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 15 ++--- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c| 29 - drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c| 21 --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.
RE: [PATCH 1/2] drm/amdgpu: check PS, WS index
[Public] > -Original Message- > From: amd-gfx On Behalf Of > Alexander > Sent: Thursday, January 11, 2024 10:05 AM > To: amd-gfx@lists.freedesktop.org > Cc: Alexander Richards > Subject: [PATCH 1/2] drm/amdgpu: check PS, WS index > > From: Alexander Richards > > Theoretically, it would be possible for a buggy or malicious VBIOS to > overwrite > past the bounds of the passed parameters (or its own workspace); add > bounds checking to prevent this from happening. > > Signed-off-by: Alexander Richards Applied the series. Thanks! > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 24 +++ > .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 3 +- > drivers/gpu/drm/amd/amdgpu/atom.c | 41 +- > drivers/gpu/drm/amd/amdgpu/atom.h | 2 +- > drivers/gpu/drm/amd/amdgpu/atombios_crtc.c| 28 ++--- > drivers/gpu/drm/amd/amdgpu/atombios_dp.c | 4 +- > .../gpu/drm/amd/amdgpu/atombios_encoders.c| 16 +++ > drivers/gpu/drm/amd/amdgpu/atombios_i2c.c | 4 +- > .../drm/amd/display/dc/bios/command_table.c | 2 +- > .../drm/amd/display/dc/bios/command_table2.c | 2 +- > .../drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 42 +-- > .../drm/amd/pm/powerplay/hwmgr/ppatomfwctrl.c | 4 +- > .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c| 2 +- > .../gpu/drm/amd/pm/swsmu/smu12/smu_v12_0.c| 2 +- > 14 files changed, 102 insertions(+), 74 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c > index dce9e7d5e..52b12c171 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c > @@ -1018,7 +1018,8 @@ int amdgpu_atombios_get_clock_dividers(struct > amdgpu_device *adev, > if (clock_type == COMPUTE_ENGINE_PLL_PARAM) { > args.v3.ulClockParams = cpu_to_le32((clock_type << > 24) | clock); > > - amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args); > + amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args, > + sizeof(args)); > > dividers->post_div = args.v3.ucPostDiv; > dividers->enable_post_div = (args.v3.ucCntlFlag & > @@ -1038,7 +1039,8 @@ int amdgpu_atombios_get_clock_dividers(struct > amdgpu_device *adev, > if (strobe_mode) > args.v5.ucInputFlag = > ATOM_PLL_INPUT_FLAG_PLL_STROBE_MODE_EN; > > - amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args); > + amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args, > + sizeof(args)); > > dividers->post_div = args.v5.ucPostDiv; > dividers->enable_post_div = (args.v5.ucCntlFlag & > @@ -1056,7 +1058,8 @@ int amdgpu_atombios_get_clock_dividers(struct > amdgpu_device *adev, > /* fusion */ > args.v4.ulClock = cpu_to_le32(clock); /* 10 khz */ > > - amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args); > + amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args, > + sizeof(args)); > > dividers->post_divider = dividers->post_div = > args.v4.ucPostDiv; > dividers->real_clock = le32_to_cpu(args.v4.ulClock); @@ - > 1067,7 +1070,8 @@ int amdgpu_atombios_get_clock_dividers(struct > amdgpu_device *adev, > args.v6_in.ulClock.ulComputeClockFlag = clock_type; > args.v6_in.ulClock.ulClockFreq = cpu_to_le32(clock);/* 10 > khz */ > > - amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args); > + amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args, > + sizeof(args)); > > dividers->whole_fb_div = > le16_to_cpu(args.v6_out.ulFbDiv.usFbDiv); > dividers->frac_fb_div = > le16_to_cpu(args.v6_out.ulFbDiv.usFbDivFrac); > @@ -1109,7 +1113,8 @@ int > amdgpu_atombios_get_memory_pll_dividers(struct amdgpu_device *adev, > if (strobe_mode) > args.ucInputFlag |= > MPLL_INPUT_FLAG_STROBE_MODE_EN; > > - amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args); > + amdgpu_atom_execute_table(adev- > >mode_info.atom_context, index, (uint32_t *)&args, > + sizeof(args)); > > mpll_param->clkfrac = > le16_to_cpu(args.ulFbDiv.usFbDivFrac); > mpll_param->clkf = > le16_to_cpu(args.ulFbDiv.usFbDiv); > @@ -1151,7 +1156,8 @@ void > amdgpu_atombios_set_engine_dram_timin
[linux-next:master] BUILD REGRESSION 8d04a7e2ee3fd6aabb8096b00c64db0d735bc874
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master branch HEAD: 8d04a7e2ee3fd6aabb8096b00c64db0d735bc874 Add linux-next specific files for 20240112 Error/Warning: (recently discovered and may have been fixed) WARNING: modpost: vmlinux: section mismatch in reference: size_mul+0x40 (section: .text.unlikely) -> initcall_level_names (section: .init.data) Unverified Error/Warning (likely false positive, please contact us if interested): (.exception.text+0x25b): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: make_task_dead WARNING: modpost: vmlinux: section mismatch in reference: vmap_block_vaddr.part.0+0x28 (section: .text.unlikely) -> initcall_level_names (section: .init.data) Error/Warning ids grouped by kconfigs: gcc_recent_errors |-- alpha-allyesconfig | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-dst_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-filled_descs_num-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-size-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-src_addr-not-described-in-xdma_fill_descs | `-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-sw_desc-not-described-in-xdma_fill_descs |-- arc-allmodconfig | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-dst_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-filled_descs_num-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-size-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-src_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-sw_desc-not-described-in-xdma_fill_descs | `-- drivers-gpu-drm-msm-disp-dpu1-dpu_encoder.c:warning:Excess-struct-member-debugfs_root-description-in-dpu_encoder_virt |-- arc-allyesconfig | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-dst_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-filled_descs_num-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-size-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-src_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-sw_desc-not-described-in-xdma_fill_descs | `-- drivers-gpu-drm-msm-disp-dpu1-dpu_encoder.c:warning:Excess-struct-member-debugfs_root-description-in-dpu_encoder_virt |-- arc-randconfig-001-20240112 | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-dst_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-filled_descs_num-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-size-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-src_addr-not-described-in-xdma_fill_descs | `-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-sw_desc-not-described-in-xdma_fill_descs |-- arc-randconfig-r132-20240113 | |-- drivers-usb-gadget-function-f_ncm.c:sparse:sparse:incorrect-type-in-assignment-(different-base-types)-expected-unsigned-short-usertype-max_segment_size-got-restricted-__le16-usertype | |-- fs-bcachefs-btree_iter.c:sparse:sparse:incompatible-types-in-comparison-expression-(different-address-spaces): | `-- fs-bcachefs-btree_locking.c:sparse:sparse:incompatible-types-in-comparison-expression-(different-address-spaces): |-- arm-allmodconfig | |-- WARNING:modpost:vmlinux:section-mismatch-in-reference:vmap_init_free_space-(section:.text.unlikely)-vmlist-(section:.init.data) | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-dst_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-filled_descs_num-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-size-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-src_addr-not-described-in-xdma_fill_descs | |-- drivers-dma-xilinx-xdma.c:warning:Function-parameter-or-struct-member-sw_desc-not-described-in-xdma_fill_descs | `-- drivers-gpu-drm-msm-disp-dpu1-dpu_encoder.c:warning:Excess-struct-member-debugfs_root-description-in-dpu_encoder_virt |-- arm-allyes
[PATCH v3] drm/amd/amdgpu: Update RLC_SPM_MC_CNT by ring wreg
[Why] RLC_SPM_MC_CNTL can not updated by MMIO since MMIO protection is enabled during runtime in guest machine. [How] Submit command of wreg in amdgpu ring to update RLC_SPM_MC_CNT. Signed-off-by: YuanShang --- drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 12 +--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 4 ++-- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h index b591d33af264..5a17e0ff2ab8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_rlc.h @@ -169,7 +169,7 @@ struct amdgpu_rlc_funcs { void (*stop)(struct amdgpu_device *adev); void (*reset)(struct amdgpu_device *adev); void (*start)(struct amdgpu_device *adev); - void (*update_spm_vmid)(struct amdgpu_device *adev, unsigned vmid); + void (*update_spm_vmid)(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned vmid); bool (*is_rlcg_access_range)(struct amdgpu_device *adev, uint32_t reg); }; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 7da71b6a9dc6..13b2c82e5f48 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -650,7 +650,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, amdgpu_gmc_emit_pasid_mapping(ring, job->vmid, job->pasid); if (spm_update_needed && adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid(adev, job->vmid); + adev->gfx.rlc.funcs->update_spm_vmid(adev, ring, job->vmid); if (!ring->is_mes_queue && ring->funcs->emit_gds_switch && gds_switch_needed) { diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index c8a3bf01743f..830ed6fe1baf 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -7951,7 +7951,7 @@ static void gfx_v10_0_update_spm_vmid_internal(struct amdgpu_device *adev, WREG32_SOC15_NO_KIQ(GC, 0, mmRLC_SPM_MC_CNTL, data); } -static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, unsigned int vmid) +static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned int vmid) { amdgpu_gfx_off_ctrl(adev, false); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index c659ef0f47ce..42e9976c053e 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -749,7 +749,7 @@ static int gfx_v11_0_rlc_init(struct amdgpu_device *adev) /* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf); + adev->gfx.rlc.funcs->update_spm_vmid(adev, NULL, 0xf); return 0; } @@ -5002,7 +5002,7 @@ static int gfx_v11_0_update_gfx_clock_gating(struct amdgpu_device *adev, return 0; } -static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid) +static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned vmid) { u32 data; @@ -5013,9 +5013,15 @@ static void gfx_v11_0_update_spm_vmid(struct amdgpu_device *adev, unsigned vmid) data &= ~RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK; data |= (vmid & RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK) << RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT; - WREG32_SOC15_NO_KIQ(GC, 0, regRLC_SPM_MC_CNTL, data); + if (ring == NULL) + WREG32_SOC15_NO_KIQ(GC, 0, regRLC_SPM_MC_CNTL, data); amdgpu_gfx_off_ctrl(adev, true); + + if (ring) { + uint32_t reg = SOC15_REG_OFFSET(GC, 0, regRLC_SPM_MC_CNTL); + amdgpu_ring_emit_wreg(ring, reg, data); + } } static const struct amdgpu_rlc_funcs gfx_v11_0_rlc_funcs = { diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index c2faf6b4c2fc..86a4865b1ae5 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c @@ -3274,7 +3274,7 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev) /* init spm vmid with 0xf */ if (adev->gfx.rlc.funcs->update_spm_vmid) - adev->gfx.rlc.funcs->update_spm_vmid(adev, 0xf); + adev->gfx.rlc.funcs->update_spm_vmid(adev, NULL, 0xf); return 0; } @@ -3500,7 +3500,7 @@ static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev) return 0; } -static void gfx_v7_0_update_spm_vmid(struct amdgpu_dev