Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3727942pxb; Mon, 24 Jan 2022 16:30:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEozWTPqHM0mZ3Xxns7EpWvv81N9gAI4SbxzFTKrznzfcERokoi0jtkw9XI5qgkmqsyUgX X-Received: by 2002:a05:6a00:1755:b0:4c7:f879:5577 with SMTP id j21-20020a056a00175500b004c7f8795577mr10228282pfc.71.1643070602146; Mon, 24 Jan 2022 16:30:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643070602; cv=none; d=google.com; s=arc-20160816; b=Sod4srhX/QYY1OObSv+wji8ndbPBI0QKolbEZmXXCAsimJWQ44pPpSzQFrXv7/VLEc YTbvyW/N1sLm+TpHz22gMV9H7sDm++f8qsdq1xN7uJVenZQShHVqn8RrMnyfNK8MEiye PbSE3oHDOgFzqqGNwp1JMzOPWQ+vexpHhiObO/QjGwy+1zkF1lDPTP4L80M4T/u3qh3Z J7qauLXrmda2mp/LTiytlazEBTx7gEMYsz+eeOGXt229xSKCy5OeCA23BMDIAV7btkMn vS0UT4tssilYzGRXFGn83ZIyuMOBPOlDGmuDIiUJi0KKu08CMlDNLrfu3D6jKAY+gEqx Cvow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uvSsM7Jy+BdXVDPL8iR2SOTErPw/kZLItnl521htDpo=; b=XjfHCqRHAwsVoUbFe+IqTtlwSnPMlxtepkCia/8tFqq5vjX/uRfl4DTe+46Qb4L6a0 ytTCkSIx44rtnQoZtn+Ds5umIrlkSIi4xOpkp3qpHSwnedtS7letxP2q2dTYFrDBqqzJ ApH+UgeDR6Zyc0Fbxra0YC+LeDRAtqRfc/qf86De8U8gf61bHNBXpYzsodV6yAry6A1h O4aScyxML2lpXouLeX+CTZAJwC74QCUG/WLtX38VFcEOTdZ43VuFGqfHLLkNbrjSykjB Yat2xTaehgbcsHruKye/ynHGcrKbbVCGVIINiSHHxRtU/Q3uUzkZ+o2R6Q6T8fOj29G7 0iGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2uKnYvkL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si16889034plh.251.2022.01.24.16.29.48; Mon, 24 Jan 2022 16:30:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2uKnYvkL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2375273AbiAYATl (ORCPT + 99 others); Mon, 24 Jan 2022 19:19:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1849731AbiAXXej (ORCPT ); Mon, 24 Jan 2022 18:34:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0E2C0AD1B9; Mon, 24 Jan 2022 13:36:51 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 474946131F; Mon, 24 Jan 2022 21:36:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1407CC340E4; Mon, 24 Jan 2022 21:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060210; bh=j4CfaJ67L6Sih9eb4i6T6w8XsJayxWU/gOmexyDIggA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2uKnYvkLzNp/n+cDKHHbH4KLSeii4U0j+RxaX5qW+H+oLOmgN1LV8PvsBtMdo4B6m Z4YG4ZMC5cNyNWjP1pS9xTI9Y5+/d7uhARAKdODVjVXgEhpLE2sQaLqj53XJXoMnNk owjtLFxZOfgZz8PvWZrwq7fPkuSQ0DX8/tLAx0K4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Huang Rui , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher Subject: [PATCH 5.16 0867/1039] drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2 Date: Mon, 24 Jan 2022 19:44:16 +0100 Message-Id: <20220124184154.442512752@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Harry Wentland commit dc5d4aff2e99c312df8abbe1ee9a731d2913bc1b upstream. For some reason this file isn't using the appropriate register headers for DCN headers, which means that on DCN2 we're getting the VIEWPORT_DIMENSION offset wrong. This means that we're not correctly carving out the framebuffer memory correctly for a framebuffer allocated by EFI and therefore see corruption when loading amdgpu before the display driver takes over control of the framebuffer scanout. Fix this by checking the DCE_HWIP and picking the correct offset accordingly. Long-term we should expose this info from DC as GMC shouldn't need to know about DCN registers. Cc: stable@vger.kernel.org Signed-off-by: Harry Wentland Reviewed-by: Huang Rui Acked-by: Christian König Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c @@ -72,6 +72,9 @@ #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0 0x049d #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0_BASE_IDX 2 +#define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2 0x05ea +#define mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2_BASE_IDX 2 + static const char *gfxhub_client_ids[] = { "CB", @@ -1105,6 +1108,8 @@ static unsigned gmc_v9_0_get_vbios_fb_si u32 d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL); unsigned size; + /* TODO move to DC so GMC doesn't need to hard-code DCN registers */ + if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) { size = AMDGPU_VBIOS_VGA_ALLOCATION; } else { @@ -1113,11 +1118,18 @@ static unsigned gmc_v9_0_get_vbios_fb_si switch (adev->ip_versions[DCE_HWIP][0]) { case IP_VERSION(1, 0, 0): case IP_VERSION(1, 0, 1): - case IP_VERSION(2, 1, 0): viewport = RREG32_SOC15(DCE, 0, mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION); size = (REG_GET_FIELD(viewport, HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) * REG_GET_FIELD(viewport, + HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) * + 4); + break; + case IP_VERSION(2, 1, 0): + viewport = RREG32_SOC15(DCE, 0, mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_DCN2); + size = (REG_GET_FIELD(viewport, + HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) * + REG_GET_FIELD(viewport, HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) * 4); break;