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 9C819EB64DA for ; Sun, 16 Jul 2023 03:40:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7D672862CD; Sun, 16 Jul 2023 05:39:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="fkHeX1dS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 333898634D; Sun, 16 Jul 2023 05:39:47 +0200 (CEST) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (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 DD384861D9 for ; Sun, 16 Jul 2023 05:39:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-78360b822abso132455539f.2 for ; Sat, 15 Jul 2023 20:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689478783; x=1692070783; 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=+aT5QoQiWky6bgojqG5feyt6P8FkIBMYgwdwN7LnsKc=; b=fkHeX1dS3jEBReZJ/d3cXIP2JFGu5wTXihg3qNTvQsiNz3RQoXIXMJO7w/qcSCZ9c7 ZaXNuG/k04/vqPKEgKbYlaq7hL9JHaNDb9yb3q2T1vI4y9B2LEjnhbM8An2MDQasyHmQ 8Wn5eOaH6TmE7jg6uiOfGYoNBKCyumaWUoo3Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689478783; x=1692070783; 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=+aT5QoQiWky6bgojqG5feyt6P8FkIBMYgwdwN7LnsKc=; b=KRlXKpQcHhHx1SoxkeAKMa1kLVOROVO1CCOwplC1NOhqh7J+o+Uhjfi0UE4yxlKEX/ paxBdcXFaCFsBkaufRBfdXX24bSWDp/d4RUwLfEyO+fIgZJ9jV98vHaj2cm7Xr2TxQNf w2X0F6bVX2GKPMSJRY/pELAm4UWMzX1RbSI7atK6Kqeyki+ofQnG36DvzwwPFc47UuIi Olgai+5j43KV7YH8KercUa0jA1hVisVjUFmFLE03rGpxMOxF91UOYZy9SD9EAU883JcI KxwSdKywoMwBA/3fVdUzjCIXDGkjxUlueNK3lvKJ+JgukDvcHjUCGG7ukb33Ir9VQHaz AGbA== X-Gm-Message-State: ABy/qLYr2wZL13J564lZoJwHggwANVb/bG9KCMkCFvlA5lYBru+gpIcE kc8yO0LVdY3OETBoefpnm3njzmHSB9CanOOL2CM= X-Google-Smtp-Source: APBJJlHmgQUV2NGbppdHGF6jQyUl78IoIxqeq386IReoiL8JBxUsdKDzqGd1tgIMoKJA8n67g57UWQ== X-Received: by 2002:a05:6602:18c:b0:786:2125:a034 with SMTP id m12-20020a056602018c00b007862125a034mr7689857ioo.18.1689478783475; Sat, 15 Jul 2023 20:39:43 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id x24-20020a029718000000b0042aec33bc26sm3714493jai.18.2023.07.15.20.39.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 20:39:43 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Nikhil M Jain , Heinrich Schuchardt , Bin Meng , Simon Glass Subject: [PATCH v5 02/46] x86: Return mtrr_add_request() to its old purpose Date: Sat, 15 Jul 2023 21:38:35 -0600 Message-ID: <20230716033929.253357-3-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.455.g037347b96a-goog In-Reply-To: <20230716033929.253357-1-sjg@chromium.org> References: <20230716033929.253357-1-sjg@chromium.org> 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 This function used to be for adding a list of requests to be actioned on relocation. Revert it back to this purpose, to avoid problems with boards which need control of their MTRRs (i.e. those which don't use FSP). The mtrr_set_next_var() function is available when the next free variable-MTRR must be set, so this can be used instead. Signed-off-by: Simon Glass Fixes: 3bcd6cf89ef ("x86: mtrr: Skip MSRs that were already programmed..") Fixes: 596bd0589ad ("x86: mtrr: Do not clear the unused ones..") --- (no changes since v3) Changes in v3: - Fix invalid commit IDs obtained from another branch arch/x86/cpu/mtrr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c index e69dfb552b16..c174dd9b3ad2 100644 --- a/arch/x86/cpu/mtrr.c +++ b/arch/x86/cpu/mtrr.c @@ -156,8 +156,12 @@ int mtrr_commit(bool do_caches) debug("open done\n"); qsort(req, gd->arch.mtrr_req_count, sizeof(*req), h_comp_mtrr); for (i = 0; i < gd->arch.mtrr_req_count; i++, req++) - mtrr_set_next_var(req->type, req->start, req->size); + set_var_mtrr(i, req->type, req->start, req->size); + /* Clear the ones that are unused */ + debug("clear\n"); + for (; i < mtrr_get_var_count(); i++) + wrmsrl(MTRR_PHYS_MASK_MSR(i), 0); debug("close\n"); mtrr_close(&state, do_caches); debug("mtrr done\n"); -- 2.41.0.455.g037347b96a-goog