Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E2A9C41513 for ; Mon, 31 Jul 2023 06:04:47 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9195086990; Mon, 31 Jul 2023 08:04:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 6110F86990; Mon, 31 Jul 2023 08:04:44 +0200 (CEST) Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.221.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 96999869EE for ; Mon, 31 Jul 2023 08:04:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinylab.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng@tinylab.org X-QQ-mid: bizesmtp84t1690783473ter6w344 Received: from pek-vx-bsp2.wrs.com ( [60.247.85.88]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 31 Jul 2023 14:04:31 +0800 (CST) X-QQ-SSF: 01200000000000F0H000000A0000000 X-QQ-FEAT: jZMLTuftd+P4TXvT66YiGcuQaxOw1L00yg42IyA1Quif+ClgtD7v6ZR6/3FuP +sXs+hTX4gTZ5ihUXJEqZaoN1D73ut1jlRzbR/4OrIgxu5fr1WlHgwsllWRK2sD/dEP3Iaq HX90bNySbW0DnidLPf7c3/HUmuTl7QE7JEg2MhQGr/sbwjhQP2QmmT71FMWQPvfy0DA2RV5 9LGX/CIaCsob8RZFjtYLBBDKXFbH4ErtCbY8y/uE+840u2ycdQLScqPed12SQJYhKQdd0Fd P5nblhAcia4dPGJBAcwNoRkEgKY1dA+Z6GQM0Rq8WIFeX6xTQjVUdSQX83APFiI7qaGok8Y tpzTb3OvzSvUMyQVxWIkLyY1FsREPb0SMs0GlVdS2Swfj8bpa8= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 12117186415307703346 From: Bin Meng To: Simon Glass , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH v2 4/6] video: ivybridge: Use mtrr_set_next_var() for graphics memory Date: Mon, 31 Jul 2023 14:01:06 +0800 Message-Id: <20230731060108.577470-4-bmeng@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230731060108.577470-1-bmeng@tinylab.org> References: <20230731060108.577470-1-bmeng@tinylab.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz7a-0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Bin Meng At present this uses mtrr_add_request() & mtrr_commit() combination to program the MTRR for graphics memory. This usage has two major issues as below: - mtrr_commit() will re-initialize all MTRR registers from index 0, using the settings previously added by mtrr_add_request() and saved in gd->arch.mtrr_req[], which won't cause any issue but is unnecessary - The way such combination works is based on the assumption that U-Boot has full control with MTRR programming (e.g.: U-Boot without any blob that does all low-level initialization on its own, or using FSP2 which does not touch MTRR), but this is not the case with FSP. FSP programs some MTRRs during its execution but U-Boot does not have the settings saved in gd->arch.mtrr_req[] and when doing mtrr_commit() it will corrupt what was already programmed previously. Correct this to use mtrr_set_next_var() instead. Signed-off-by: Bin Meng --- (no changes since v1) drivers/video/ivybridge_igd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c index 9264dd6770..c2cc976618 100644 --- a/drivers/video/ivybridge_igd.c +++ b/drivers/video/ivybridge_igd.c @@ -774,8 +774,7 @@ static int bd82x6x_video_probe(struct udevice *dev) /* Use write-combining for the graphics memory, 256MB */ fbbase = IS_ENABLED(CONFIG_VIDEO_COPY) ? plat->copy_base : plat->base; - mtrr_add_request(MTRR_TYPE_WRCOMB, fbbase, 256 << 20); - mtrr_commit(true); + mtrr_set_next_var(MTRR_TYPE_WRCOMB, fbbase, 256 << 20); return 0; } -- 2.25.1