Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BABE0C63797 for ; Mon, 16 Jan 2023 14:03:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B5F210E42E; Mon, 16 Jan 2023 14:03:31 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id D1F1D10E434; Mon, 16 Jan 2023 14:03:27 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2D6F0B80F91; Mon, 16 Jan 2023 14:03:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B70A4C433F2; Mon, 16 Jan 2023 14:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673877804; bh=9bW+Y5q9GNqp0uZwNUBA+UrM1bzAjFJMd1MQ8mDzQjY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bqqA718pxab1KY1IkT/3za3x1wK43IpLJhhMeLCaRo/+o/NajWvhr/NMJ4KOwb5sw 3w+Kva1PKEyjBX9Q6geaeiPoJjq12CCWF7HQKjN/tSAQ4yM5BQu32eMm7jwEnJq+lL iHLWMDMACvPyXh+Z8j0Fms3yOLMsLF6dOSd+/nta1rXKsFa6f9JNdateLAByFqtD6G BkqH1ioFdHGRmDCKoRDsXA0sPcwhw0k+QwL07x5xqyIHU1zGdSg6FneyTpQ5JicLQl feiUjrzO5PWk32JqnIKx9d/79AS4x0IC3OWRJnhz9htjbDbqxbpbVHDDtGhzBSqnqC ZF4VkU6L2B8Rw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 36/53] drm/amdkfd: Fix NULL pointer error for GC 11.0.1 on mGPU Date: Mon, 16 Jan 2023 09:01:36 -0500 Message-Id: <20230116140154.114951-36-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230116140154.114951-1-sashal@kernel.org> References: <20230116140154.114951-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Felix Kuehling , Xinhui.Pan@amd.com, amd-gfx@lists.freedesktop.org, Alex Deucher , dri-devel@lists.freedesktop.org, daniel@ffwll.ch, Eric Huang , airlied@gmail.com, christian.koenig@amd.com Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" From: Eric Huang [ Upstream commit a6941f89d7c6a6ba49316bbd7da2fb2f719119a7 ] The point bo->kfd_bo is NULL for queue's write pointer BO when creating queue on mGPU. To avoid using the pointer fixes the error. Signed-off-by: Eric Huang Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 29f045079a3e..404c839683b1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -2130,7 +2130,7 @@ int amdgpu_amdkfd_map_gtt_bo_to_gart(struct amdgpu_device *adev, struct amdgpu_b } amdgpu_amdkfd_remove_eviction_fence( - bo, bo->kfd_bo->process_info->eviction_fence); + bo, bo->vm_bo->vm->process_info->eviction_fence); amdgpu_bo_unreserve(bo); diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index ecb4c3abc629..c06ada0844ba 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -200,7 +200,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q, queue_input.wptr_addr = (uint64_t)q->properties.write_ptr; if (q->wptr_bo) { - wptr_addr_off = (uint64_t)q->properties.write_ptr - (uint64_t)q->wptr_bo->kfd_bo->va; + wptr_addr_off = (uint64_t)q->properties.write_ptr & (PAGE_SIZE - 1); queue_input.wptr_mc_addr = ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + wptr_addr_off; } -- 2.35.1