From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0ACEC4338F for ; Sat, 31 Jul 2021 08:46:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1D5FD6023F for ; Sat, 31 Jul 2021 08:46:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1D5FD6023F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6F22083268; Sat, 31 Jul 2021 10:46:15 +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="qUh9+r56"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5812A8325E; Sat, 31 Jul 2021 10:45:52 +0200 (CEST) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (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 23DE483249 for ; Sat, 31 Jul 2021 10:45:44 +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-x62b.google.com with SMTP id e21so13896242pla.5 for ; Sat, 31 Jul 2021 01:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UiofjX+DOie71c2X0Hn2UIhvKhI5jkdPYpdHSIJJ42o=; b=qUh9+r56Rx9S9uVmqbSjFDSD6FNgJzO33mXW3ZWdgXlSvgmW0cwIbQ+bvJZ8ZQF4WK 6wWG2NJbuTTER1qRUDG2loCppFZFwP1SkX+zOiba6CbO7MIbVdeMV3gh1+FmBnvTQr86 NCT2V1sb1nb/fWwgZCVUVTnDLGS+4SImFsaEkKvX0n869He8Ylhp2FsviG6t68Rp891V KXd/ckJYZDtLz/EFO9UnGEy5IOVLfOYqLXVawXjvqbleC/8SZ8GWfZX9IypNu9gi0lfi /lu73/YdnstaxVtdhH6M2CZu/9U/v+DkngJIT+Lf+T1+4mDLEs+y0qfxAz+tVny4xihA H/fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UiofjX+DOie71c2X0Hn2UIhvKhI5jkdPYpdHSIJJ42o=; b=ovuZfys3FQ3URooMASvLEibuvQgTkudAydQIp8Z+koWOs2YnZ+5ZoSmYqCBxLIPcnd AdJgtLZvfnY0EH1nYkqF8NtpVXC1kMEJfy0Ws4dzNLm7vt4HetiCt4JezIDtsGGQNcvS oxgNpzC0a63jyGv7BX5pTRL3iFa82J3tthjnIfMxFge2RLGjWVO4uY/MlUelv32B2Yho kb5U7CA5lWtyV8rguYvENEq3X9A69GJS2aEPRCbkrtjIXjZmZ0Uhw7D7nQxU1daFgf0w wHODIAJbdIoJnGyLjOSrJbgpoFAPbyKquPh7hQrW/iSw3TfXVP21Jg8+0CrfKvXFNWfU eJiQ== X-Gm-Message-State: AOAM530NNG5Ksl7vLngUUH1hV/npFWfv5KFoPG92RjTx50b1Afreoi+w Dmi2ry4NiW4MASzsRTmOOcM= X-Google-Smtp-Source: ABdhPJwAR6/7DEOs0bTE82RcOfZ58PnSxMFeBzs+kV3Y00ChWctTko6120xyEXKu5lz055VIuwUDHQ== X-Received: by 2002:a17:902:f703:b029:12c:982:c9ae with SMTP id h3-20020a170902f703b029012c0982c9aemr5614666plo.20.1627721142496; Sat, 31 Jul 2021 01:45:42 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id h6sm688355pfv.155.2021.07.31.01.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 01:45:42 -0700 (PDT) From: Bin Meng To: Simon Glass , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH 2/7] x86: mtrr: Do not clear the unused ones in mtrr_commit() Date: Sat, 31 Jul 2021 16:45:24 +0800 Message-Id: <20210731084529.7524-3-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210731084529.7524-1-bmeng.cn@gmail.com> References: <20210731084529.7524-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.34 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.2 at phobos.denx.de X-Virus-Status: Clean Current mtrr_commit() logic assumes that MTRR MSRs are programmed consecutively from index 0 to its maximum number, and whenever it detects an unused one, it clears all other MTRRs starting from that one. However this may not always be the case. In fact, the clear is not much helpful because these MTRRs come out of reset as disabled already. Drop the clear codes. Signed-off-by: Bin Meng --- arch/x86/cpu/mtrr.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c index 166aff380c..73cf7bb2be 100644 --- a/arch/x86/cpu/mtrr.c +++ b/arch/x86/cpu/mtrr.c @@ -157,10 +157,6 @@ int mtrr_commit(bool do_caches) for (i = 0; i < gd->arch.mtrr_req_count; i++, req++) 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.25.1