Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13473798ybl; Sun, 29 Dec 2019 12:46:09 -0800 (PST) X-Google-Smtp-Source: APXvYqwDpkQxp97MAqCgqNBKRD3CXIOZ4APi0JHcx5mNkP3DZGM8hQuUM+XK/yS8pvIoPrzJFXWc X-Received: by 2002:a9d:6481:: with SMTP id g1mr71980578otl.180.1577652369289; Sun, 29 Dec 2019 12:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652369; cv=none; d=google.com; s=arc-20160816; b=DU8Ytv4BH2TAUV8WJNgRjKHshQYxGjcOvb1GlF0zXD+I+4C1at8rJ8LPx/S3h3PuuY PJHrAbo0o5RxnWbu2f0Snl1xf+Pcz35UtKD0DV3w6he0Wc6kXXATT37T0xKifbofDDKu moK7W0gTO0rjTdcIKuIXvehAmbuUYxOKO7mHptCROSZSvAmmYpEdeGJwZx2KBFl4fmi1 vV8j+oHaRxqAFMKCMoQqXmNil25Ou6SkdHA4Uh/Se6lZRXSC4UU+Het/CUIwXAm4/GnC 2recDOEIQCrhSqVuwta9LW6BbmqS1TJO7/RwyzS3yl1pxCqCnY715QJyAn3m4EIVpVPe rKMQ== 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=BSJ3v/MWro6thZWsFiQ7mRAM9M08OjTTVTHJ7SiMJk8=; b=wKrt+EkyZWqpHWHMjbHIpDXmTRzQq0v0YoKfLDve9KWgKf3XngVgPs3+L+8OHYiBCh +NFPqPVY6bfE0ld53frSwCiX2TpFqZkTYmFgEaDr50k9ip2x36d82ixbD/ys5cYspuf3 I3JNbtDfyoHL+zjOY+ZikUPvECkJHfs6FQT0MqDG2YZUboMDwsCU+QL1zlSjqeNpZPyP Punv3MwpqqvVKots/LOCfkUY7d2e1ZIaOtXbfCk8gRs8rRcrz1gfyEqi6pkQNM2xCnZY mzbvDF1MZ+wMwXKhogcwqQtt+ZV9Kf1bu4lxfSfihWg83b64Es8uDALCyF7nVc+fsOtT xSnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vL+3Bdi4; 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 x5si20010032oic.72.2019.12.29.12.45.58; Sun, 29 Dec 2019 12:46:09 -0800 (PST) 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=vL+3Bdi4; 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 S1731313AbfL2Rrn (ORCPT + 99 others); Sun, 29 Dec 2019 12:47:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:58408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731303AbfL2Rrj (ORCPT ); Sun, 29 Dec 2019 12:47:39 -0500 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 BFCFF20718; Sun, 29 Dec 2019 17:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641658; bh=3b0gHIjKnUHzjsXComzu2oa9zoueGbYb4Yn1jt3U3Hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vL+3Bdi4aReQS/ZuhGu9l37jY+qBoD2dOwe2DwXM3Yg7Wrl5bQ2vZng+JUkoDWyKW 1BxWZ7E9L4SAob6SnyfaalDvyIrPA995Sc3by3H17iyKndWNgRl948x0v96kICfj1O Y73ubUp7U2sO89P4R3B5LIFZfygbOCamfei+0j4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmytro Laktyushkin , Bhawanpreet Lakha , Roman Li , Alex Deucher , Sasha Levin Subject: [PATCH 5.4 158/434] drm/amd/display: enable hostvm based on roimmu active for dcn2.1 Date: Sun, 29 Dec 2019 18:23:31 +0100 Message-Id: <20191229172712.259631013@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@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 From: Dmytro Laktyushkin [ Upstream commit 48d92e8eda3d9b61978377e7539bfc5958e850cf ] Enabling hostvm when ROIMMU is not active seems to break GPUVM. This fixes the issue by not enabling hostvm if ROIMMU is not activated. Signed-off-by: Dmytro Laktyushkin Acked-by: Bhawanpreet Lakha Reviewed-by: Roman Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../drm/amd/display/dc/dcn21/dcn21_hubbub.c | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c index d1266741763b..f5f6b4a0f0aa 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c +++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubbub.c @@ -22,6 +22,7 @@ * Authors: AMD * */ +#include #include "dm_services.h" #include "dcn20/dcn20_hubbub.h" #include "dcn21_hubbub.h" @@ -71,30 +72,39 @@ static uint32_t convert_and_clamp( void dcn21_dchvm_init(struct hubbub *hubbub) { struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); + uint32_t riommu_active; + int i; //Init DCHVM block REG_UPDATE(DCHVM_CTRL0, HOSTVM_INIT_REQ, 1); //Poll until RIOMMU_ACTIVE = 1 - //TODO: Figure out interval us and retry count - REG_WAIT(DCHVM_RIOMMU_STAT0, RIOMMU_ACTIVE, 1, 5, 100); + for (i = 0; i < 100; i++) { + REG_GET(DCHVM_RIOMMU_STAT0, RIOMMU_ACTIVE, &riommu_active); - //Reflect the power status of DCHUBBUB - REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_POWERSTATUS, 1); + if (riommu_active) + break; + else + udelay(5); + } + + if (riommu_active) { + //Reflect the power status of DCHUBBUB + REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_POWERSTATUS, 1); - //Start rIOMMU prefetching - REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_PREFETCH_REQ, 1); + //Start rIOMMU prefetching + REG_UPDATE(DCHVM_RIOMMU_CTRL0, HOSTVM_PREFETCH_REQ, 1); - // Enable dynamic clock gating - REG_UPDATE_4(DCHVM_CLK_CTRL, - HVM_DISPCLK_R_GATE_DIS, 0, - HVM_DISPCLK_G_GATE_DIS, 0, - HVM_DCFCLK_R_GATE_DIS, 0, - HVM_DCFCLK_G_GATE_DIS, 0); + // Enable dynamic clock gating + REG_UPDATE_4(DCHVM_CLK_CTRL, + HVM_DISPCLK_R_GATE_DIS, 0, + HVM_DISPCLK_G_GATE_DIS, 0, + HVM_DCFCLK_R_GATE_DIS, 0, + HVM_DCFCLK_G_GATE_DIS, 0); - //Poll until HOSTVM_PREFETCH_DONE = 1 - //TODO: Figure out interval us and retry count - REG_WAIT(DCHVM_RIOMMU_STAT0, HOSTVM_PREFETCH_DONE, 1, 5, 100); + //Poll until HOSTVM_PREFETCH_DONE = 1 + REG_WAIT(DCHVM_RIOMMU_STAT0, HOSTVM_PREFETCH_DONE, 1, 5, 100); + } } static int hubbub21_init_dchub(struct hubbub *hubbub, -- 2.20.1