Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3809750ybi; Mon, 29 Jul 2019 13:04:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8V2iDNDtLBuUHdgxrCotViBhqlU7ANDBHNIUvayVmiyZG1O6laBmf4KJHWKZqlGDmU46H X-Received: by 2002:a62:770e:: with SMTP id s14mr37043152pfc.150.1564430650206; Mon, 29 Jul 2019 13:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564430650; cv=none; d=google.com; s=arc-20160816; b=GCQwzeDz2efdIHca1cIQahB1oJl6ZRhWp8HlvlRtyJztanVbm63xl5aMMEEXDCR2y6 IjEmD2i34nBAAhNU5vbkdtKmflIbP5CZlhoftiYRA9+er+Za6wXf/QAeaLZWYG1nlSfP 98L/B8OTfmwxGhL+MEpp72iId6TCErYyVK3HRVtSLh/JgnHJeXFNkAd8FoRzJHi3BCj6 JTr5lKn1K10tBuRtaM9Y5Huvt+HB3fsEq15T1cHe2bD0kWVsd1E9YJNUojVM81QvWbOc Pcbt6rudOHlyWTkgqZ4es5IKYtgxF/7zvYAwvF6idYfquYU77iZ80C4Dh5604zk2CQ4g khPw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gqe0SOiHW3uGvIC1UXDcJrkplrRUnazgPIFtPNDoGZA=; b=IE+uNms5dNGeHPy+uW93K7ceTyfQs2dxaVDry7GfpnDlVHB4aQyFNnZr3lsz2180MC 7aCFsqKzz//fJp11zXqGYDF79UsqbT86UaJLr3RUIzl96AzIKphYUWnx/Cbs6CwVK9SX UIt2b2yDV+PgPMo5mCfrG0gg9Y8piT2OsswVTJMCF8y6j+TN17lCAmYwe5r/grZC74mj zJplnj5p4f9MHkjAjWbueb3WA6BER3VgSA5+rGlOtpjaDbkilA5N5uupdSDi/8ZoxFCN +Z1OZ+WpaQCKLIvjHCWp9NiSDbeXJspuKO22LdomuTXJ1C7sRXGKyqvTmP3Furc3zeuw T42w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dWZ9I9Ii; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si25883587plg.320.2019.07.29.13.03.55; Mon, 29 Jul 2019 13:04:10 -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=dWZ9I9Ii; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388499AbfG2UCS (ORCPT + 99 others); Mon, 29 Jul 2019 16:02:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:39348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390461AbfG2Ts7 (ORCPT ); Mon, 29 Jul 2019 15:48:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 44A8A2054F; Mon, 29 Jul 2019 19:48:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429738; bh=oECJ7UF9WFWlDfQ3kjKWWh6o07C5LWhV8cJjOLM7LJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dWZ9I9IiOUz+FYo1yFKGNxZvNb255s9DFIt2HJIxSaYhFjvxpr9zhMA7FsYvf57W2 UZkRryGFuw7HPc/YYK2mm6M1N5bnq9twhBWN79PK987A7RSW8H/qeqgdXj2yBJ7WYA Ip+Ku3L3FdJLpYDDHNWuYsoVk/Rc3gC2jJZgfgY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oak Zeng , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.2 030/215] drm/amdkfd: Fix sdma queue map issue Date: Mon, 29 Jul 2019 21:20:26 +0200 Message-Id: <20190729190745.366931434@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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