Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3814149ybi; Mon, 29 Jul 2019 13:08:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwiuxYVtq96TF43gG3xgYUzZFWEgeJiHF2cdRyRZRnQbfBV39P2ORxa7FTJguIKrXa/35u7 X-Received: by 2002:a63:6154:: with SMTP id v81mr71989430pgb.296.1564430920521; Mon, 29 Jul 2019 13:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564430920; cv=none; d=google.com; s=arc-20160816; b=RINHSw5fxMiFSzkzezud7i3KU65IZntSV3QTGCCifmXJdvKn6Z69b5wPrS+AFkqLAg Zfw4K6Q5qETovLOchU4PsgR/+cn1wWTxHoKK2V8FY0Wsm1FcexQk13n4ILu8H0KMGJZY CqDQZJE/B7wDdE9/AgL7Bz5lZ9xrdNCbnJZbud4/1BobYOkPD7V4pz2O0sgy2m+5FTEL Lj0mzFSJAFPOzfO9KsV6bLdGPLXRjq1G0+1odvm/bMOQYet0aiLRzc4gS3+/ZE0WibG1 slb/9iRdXXOBo0hEWMw1xnMSaAZWKkaCS+qxEqpYIWXsihjIyGkYwWFRsLKUNlK09atz DNaw== 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=KbOXmgGQ9AClMypotNlZNdouVP4LN7W2j43ffhI9whk=; b=RjU6vaLUzhqHx0Iq82Dohl2cwdQ5J9KGSIa0OyhBnm3U5sP/lQ2yIlUVQ1O6lDoQDv Zu/8ZUHALJDmXdIXcdhYUGHmJeBPcrPY1OHxRILt7BYZQt6PDypKhYId92kBI3fM6YYS JcOzVI/OMown6XysIINquaZs9kpgrfnE+e7OCHw3XLzQsYByCu00OE7Du/j/WCZC64VP eAcwciytdO8EwP53+tqbiziymlDA2cnTw1azyajpoKSwQ3RnQ73sG1khO8Jx1CzU2VzN 63du/iCuXuvWky2cvjAW5wI7rwqRMg0tJtGS8WsePUISWrErJ73tb8rd2hA/mAXvSZSN n1ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X2AhP249; 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 g11si5715838pgs.59.2019.07.29.13.08.25; Mon, 29 Jul 2019 13:08:40 -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=X2AhP249; 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 S2389017AbfG2Tjg (ORCPT + 99 others); Mon, 29 Jul 2019 15:39:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:54662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388703AbfG2Tja (ORCPT ); Mon, 29 Jul 2019 15:39:30 -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 7A78820C01; Mon, 29 Jul 2019 19:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429170; bh=IVXdRM5+Db/zHXqEOgOBGy6yUwhnZISPXBSlWQVgVNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X2AhP249cVvTnCtDOYJ9g16cyLVRu6i7XKs8DlwsfN8tQrdBvh4BIkVhBiq5LXhUa gTde3PdPLqUSEm4SIXwK/xAZl2R0zCCXFehdzdIlocs0ddQGgsDNwR4jcErC1XQcvp UC64RsgJnqMHhE13QQOUVxx6JnbGIqz290kRGjYk= 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 4.19 014/113] drm/amdkfd: Fix sdma queue map issue Date: Mon, 29 Jul 2019 21:21:41 +0200 Message-Id: <20190729190659.165537194@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190655.455345569@linuxfoundation.org> References: <20190729190655.455345569@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 4f22e745df51..189212cb3547 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