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 A4316EB64DC for ; Fri, 21 Jul 2023 16:12:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EB986867E8; Fri, 21 Jul 2023 18:12:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gnYVHOlH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8EBF7862B6; Fri, 21 Jul 2023 18:12:29 +0200 (CEST) Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0FF2D862B6 for ; Fri, 21 Jul 2023 18:12:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1b89cfb4571so15884825ad.3 for ; Fri, 21 Jul 2023 09:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689955945; x=1690560745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Wxi+MNKziistkIUTE4qv7vJUaPsqROIIOGJqGV5G7g=; b=gnYVHOlHe3t4rG7j8IiZTk4Mhcr8vDQwA+jI0wGXetrD7k28XbsQ8reMNTm1zq6qPs +lwN+aG1THuw2DE+u2cWMdDph5eDJX0V8AaVDLW1rKwG6cNbEDsIpBHu0aTa6uDMArq7 xrsar2b5elUg+hDPW7OeOfEppZ0q6GmHMZytx8qO9dgHDmwGHTVnnThQZ1RuaQvogFlH 1pB0Dp1Gj6Yu1aXercmni4X5YpAuJYRnttrytPn3R0x1mMlJ5eRhLdAlF9DrmJ9LCmSK x1Hwu5wBA4jyFhHUkmV0nvCA6Ry9hUS6PWbv2NF6igRn/0EtlHfNFa+W3W/7bJ7Q0cKr s0xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689955945; x=1690560745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Wxi+MNKziistkIUTE4qv7vJUaPsqROIIOGJqGV5G7g=; b=JO1sPmyFEI4JocC5dhA6J7wcTyw/OP8xTXoBtEg9f1OTxRvkPzdYTsHUr/rNbUi5Kr PA+3RzS527ZdQN27JU5bk9K++dswwCPBJWKrbYor/gYbFYFsf5t+V1dEAkBH7lYvbF0p Z8T+KuzXuvhhaonGVP84IdLDcuSgZEKAR5Sl4SZqYn1/SQVqB/bp0ZWPSAmsmLBY08ky RkRpfji7zxq9LEYL37giqYjQq7nBQWE2PZ1GFHMBJq/QvIHsvYgnfScH4epjocYioLUo TgYAcC9I6q9QQqxCt61VJGGrgd1fUbZ6+o9j8SvhUlwHvwlgAbj0ycMB1KFcnEupQyYm pGqQ== X-Gm-Message-State: ABy/qLavHm5AslCQvKtIGtQB4bKJYbuU8HwDhG9SkUHTm0aq2uTgJpgF hWcPXxbswpHCNPAJQC/PHh8HEYkT+90Fn3hu X-Google-Smtp-Source: APBJJlFkMi+Pq0W7b4FDFaVQOOZZj0LlZuZYD4l6wT5BGQn0bmqpilCmRxJYKylWKC+JLQasceM7HQ== X-Received: by 2002:a17:903:11c8:b0:1ae:8892:7d27 with SMTP id q8-20020a17090311c800b001ae88927d27mr2883824plh.42.1689955945208; Fri, 21 Jul 2023 09:12:25 -0700 (PDT) Received: from ubuntu.. (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id jw22-20020a170903279600b001b9da42cd7dsm3658239plb.279.2023.07.21.09.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 09:12:24 -0700 (PDT) From: Bin Meng To: Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH 3/5] video: ivybridge: Use mtrr_set_next_var() for graphics memory Date: Sat, 22 Jul 2023 00:12:15 +0800 Message-Id: <20230721161217.904008-3-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230721161217.904008-1-bmeng.cn@gmail.com> References: <20230721161217.904008-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- 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.34.1