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 20641EB64D9 for ; Mon, 19 Jun 2023 12:01:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7219A8632E; Mon, 19 Jun 2023 14:01:27 +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="J9RTdaqC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CBE9786324; Mon, 19 Jun 2023 14:01:19 +0200 (CEST) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 9A536862F5 for ; Mon, 19 Jun 2023 14:01:10 +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-wr1-x430.google.com with SMTP id ffacd0b85a97d-31114b46d62so3430248f8f.3 for ; Mon, 19 Jun 2023 05:01:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687176070; x=1689768070; 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=y9/mL7iJTD+lcn28FJElm9dXGWtf3Vxshy85tRJFUko=; b=J9RTdaqCWMIPx+9jiFUffP6MfY5ucmUw78JxWLuNH+Qthz463ecG3fxEnnWV1JlGue L0ort8vJkbm2dm0w4bFOUs9Eymog1dSQHMMmpkEpiwPdym9P6UL1EzqU2PCFf2AquHdA tY5TeJU827EkLLzy0DEG9vCmV9xWSA39j0gUU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687176070; x=1689768070; 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=y9/mL7iJTD+lcn28FJElm9dXGWtf3Vxshy85tRJFUko=; b=etCOevnBQDGpwQUrPGQU3pM4LTQrIQW5ySVsHq3nEoFJah7rdrh07+tRF0WBgxh09g m5tEjOjo+RBJOu8X4Bw4PTyLyMaKKbpU5q7Aj5zkItwo7pJ5AVLxqHi9ckHSMT/Tb/9x JzQyzKzXJqfNtbB/CDISgo5Dl05hIKXnytO/q0IFKa3CQoZi8YofoC22qvQ9+xiDEpQ7 nTh5AvwnuZIKRTPmmsC1VpAirmbS1mQIH3e7dokV05lb+4pQeOHkVwU1EqP4nZuTYrUw 7Ih3wNIkECRqARFqnEAENlz1FeKxbHa1dsK6y3LPuJ8TDg8u0b2MqsKboIf9TsFZWowe kkVw== X-Gm-Message-State: AC+VfDyr2V5mT4lKvoRjMbWRlsMCb3j47KaLV+i5l1eQMRtiW9vXvECq LSvltwVViKDHalhaafd8Ijixkuix17wcq31sAn0= X-Google-Smtp-Source: ACHHUZ43hWOsvZ7Npn1iP1yZvuJa+z6nqUKzkz60RcoW0VW/uv9Lc3+UzxxJWOQCPkYtHhil9VShXA== X-Received: by 2002:adf:f552:0:b0:311:1823:5a9f with SMTP id j18-20020adff552000000b0031118235a9fmr8970184wrp.50.1687176069672; Mon, 19 Jun 2023 05:01:09 -0700 (PDT) Received: from sjg1.roam.corp.google.com (79-67-123-132.dynamic.dsl.as9105.com. [79.67.123.132]) by smtp.gmail.com with ESMTPSA id k6-20020adff5c6000000b0031122bd3c82sm8886794wrp.17.2023.06.19.05.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 05:01:08 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Bin Meng , Nikhil M Jain , Simon Glass Subject: [PATCH v4 01/45] x86: Return mtrr_add_request() to its old purpose Date: Mon, 19 Jun 2023 12:59:16 +0100 Message-ID: <20230619120011.1587499-2-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog In-Reply-To: <20230619120011.1587499-1-sjg@chromium.org> References: <20230619120011.1587499-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..") --- Changes in v4: - Bring in dropped mtrr_add_request() request patch 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.162.gfafddb0af9-goog