Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3098156ybi; Thu, 18 Jul 2019 21:00:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW5HN8Kyg+El7oB8w1nBtqc0pUlu9q4HobQQOUeEDEf9qetIHqlHzYumnUaB8Gw1qrrK8n X-Received: by 2002:a63:c748:: with SMTP id v8mr20292985pgg.418.1563508815809; Thu, 18 Jul 2019 21:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563508815; cv=none; d=google.com; s=arc-20160816; b=E3vbBFDbIFx77hhYfHdIepDry79jZDW4HYfbvH2qiO55+U4k4Vko+lIxiL6LR+qKcz ZBftOnmHP/gBA7r4PykjZ7DxVP8XwGshVLZDkNAKVfq6f2SAQX15Qc7TDWNc12G1pn90 hsF2yjhadjaL/90XAjSwMniN5nxnm1wA4rhMdve+zlKz9GJd+QQod16URQ/tQwePCxbk 8eEYcCGgvyZz6MEBjhv2cC6eSsebOEeCdhpZuDl/PpvxnEKMboMDFCkODlWdSZtHVDml 8kXrkVsTGU76FaMwTNN6jtKiutj7QXdkyyp/xprkkrm+WRUYg7F2g4MRyoMREIQ6tRM4 m0fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1s5N5Zpzqzr8++AhQISCByc83F/C4lpEC0w6YzCT0ts=; b=nnewOB+8fNwlVLlr6nC6mrC2ol/bO7VuGY52ZXvfJuMYejoBIdbaPh229+6xl8IAZ0 drp9Vw4FQ4K1qLMr1XCyFlYnzXUC9ucj03lkbZNTi6spVx3Uz26+cNsb5/7bTpBYVDlc Vn8ZQGzdSNpuUYpY0sBF7hK/28ApnRXsbhoBRVmOSIgifLvFYZ9uuDgwEUlXCttk0EOq qLTi8j2we3BnQpzwgoR9PySkb5voHDl74KSWHmfQX1w5pWZvde+hQLcBrC1lcqWRgjs5 gsBHQyVtaEr1VaaMlSxCeYrRbcKcGFcz2N0tCoKQwZYtj+sq7cLMgDmgP8HSceOC6Hag 7xfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ppzYVLhh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32si233017pld.236.2019.07.18.21.00.00; Thu, 18 Jul 2019 21:00:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ppzYVLhh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727703AbfGSD57 (ORCPT + 99 others); Thu, 18 Jul 2019 23:57:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:57158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727580AbfGSD55 (ORCPT ); Thu, 18 Jul 2019 23:57:57 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E652C21851; Fri, 19 Jul 2019 03:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508676; bh=nxYKYXfveCqtb0rO+c1any+jTsC8a+P3hYgpDWMJbSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ppzYVLhhxtiAzF9JKFSdl9ZK2tATbBZYylqKBJnCLwjJzQo5pCz4Uo3OyGl0oQY8i wjeANxXNiXjN2vz42q27JX+vr5w8HQ5ZZ+A9hiT2h5doIbD632kCbc0wOFIYtVc5rt vdGYK4UhcEhUDX7SvuGMDlJDPV90xhaAf5gGpZaM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Oak Zeng , Felix Kuehling , Alex Deucher , Sasha Levin , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.2 028/171] drm/amdkfd: Fix sdma queue map issue Date: Thu, 18 Jul 2019 23:54:19 -0400 Message-Id: <20190719035643.14300-28-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oak Zeng [ Upstream commit 065e4bdfa1f3ab2884c110394d8b7e7ebe3b988c ] Previous codes assumes there are two sdma engines. This is not true e.g., Raven only has 1 SDMA engine. Fix the issue by using sdma engine number info in device_info. Signed-off-by: Oak Zeng Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) 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 ae381450601c..afbaf6f5131e 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1268,12 +1268,17 @@ int amdkfd_fence_wait_timeout(unsigned int *fence_addr, return 0; } -static int unmap_sdma_queues(struct device_queue_manager *dqm, - unsigned int sdma_engine) +static int unmap_sdma_queues(struct device_queue_manager *dqm) { - return pm_send_unmap_queue(&dqm->packets, KFD_QUEUE_TYPE_SDMA, - KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0, false, - sdma_engine); + int i, retval = 0; + + for (i = 0; i < dqm->dev->device_info->num_sdma_engines; i++) { + retval = pm_send_unmap_queue(&dqm->packets, KFD_QUEUE_TYPE_SDMA, + KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0, false, i); + if (retval) + return retval; + } + return retval; } /* dqm->lock mutex has to be locked before calling this function */ @@ -1312,10 +1317,8 @@ static int unmap_queues_cpsch(struct device_queue_manager *dqm, pr_debug("Before destroying queues, sdma queue count is : %u\n", dqm->sdma_queue_count); - if (dqm->sdma_queue_count > 0) { - unmap_sdma_queues(dqm, 0); - unmap_sdma_queues(dqm, 1); - } + if (dqm->sdma_queue_count > 0) + unmap_sdma_queues(dqm); retval = pm_send_unmap_queue(&dqm->packets, KFD_QUEUE_TYPE_COMPUTE, filter, filter_param, false, 0); -- 2.20.1