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 3E697C4338F for ; Sat, 31 Jul 2021 08:46:09 +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 66B646023F for ; Sat, 31 Jul 2021 08:46:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 66B646023F 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 CD71B8324A; Sat, 31 Jul 2021 10:46:06 +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="rUvyp0Yf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A3C4B83259; Sat, 31 Jul 2021 10:45:51 +0200 (CEST) Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (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 0D46582DD3 for ; Sat, 31 Jul 2021 10:45:46 +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-x62c.google.com with SMTP id c16so13872238plh.7 for ; Sat, 31 Jul 2021 01:45:45 -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=lRG40jv7C3FAgE39sCdArUtSDByZcbI2qoiy95el87U=; b=rUvyp0YfUhn4Mu85x357cOeQLw86OrXBLBIbxlsyaGrVr5Yb2/I3oOf+2u/enj4SkV kIkjx99waWnnU6+MExkPAbu+mRleFuu+kIHiA1+nIJrv0B1ZBlc+cLieweQdrPqIcZEo 4WgGXrVCL46gLz5Ajgh1J0/gQnOTsxTfBbQjKplsw5NaeI7QH5eMMbApKs1eYPOajzQv zKNh5Su5TYC0vO9TjuRbv1p1lps5CMYeEPXO0OYrCPmthrjmxjN7bqnuF82bVg8CL4Ta br2tyMkeoNANmklQ8LjkuWlacnKIGdKqPLL0i+pBu0hoa+XQ/itv/OsTU6Q5Opmzy3w4 iINQ== 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=lRG40jv7C3FAgE39sCdArUtSDByZcbI2qoiy95el87U=; b=hT1Os15B5o2MSWP4W/+wqU6rZAyPN7515JMDjmnT42/Wzke/b4c9V2KgAS/KX4oMcK IeXkCeSSje7kVRcjvUiF9Mv+Qy7rqq9kqhNmEE5m5w7etwBVTcd3ksYWgOOqPJK0YJDz 3nH+3qI2ODoA5rmkhLWi9BGwKzQcBEXEyI1BMo0EnRQoo5M1FEaW4eobeHNrPYPjJy2K vWj6RYHDo+gMVMz7d1/TfRZ2ccCYuky6cu8mD4duTDbKuFJbO77R7J0QvMIgVcgGRSes OcD+ERqdK5Mb7TJv3D9ELJWq99Ee3l2sICC0AzytmlHdm/j0Qy1qTIUpMNzkYbMDjyyQ s/YQ== X-Gm-Message-State: AOAM531FWq20KzvV+B7KImrkEugyFMWLmcvDGtuJ1mIQcLPWcpF5hGsp Se2HgoZmRHYDLIyjt9zWNHw= X-Google-Smtp-Source: ABdhPJwG10b4peRu+BWw3Niq8/BMw5d0DZPid1S5lZJdRvskvVB2szGzXZlJ2OhWGas+Ir/iC7iM+Q== X-Received: by 2002:a17:90a:ca8d:: with SMTP id y13mr7159482pjt.61.1627721144423; Sat, 31 Jul 2021 01:45:44 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 01:45:44 -0700 (PDT) From: Bin Meng To: Simon Glass , u-boot@lists.denx.de Cc: Bin Meng Subject: [PATCH 3/7] x86: mtrr: Skip MSRs that were already programmed in mtrr_commit() Date: Sat, 31 Jul 2021 16:45:25 +0800 Message-Id: <20210731084529.7524-4-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 At present mtrr_commit() programs the MTRR MSRs starting from index 0, which may overwrite MSRs that were already programmed by previous boot stage or FSP. Switch to call mtrr_set_next_var() instead. Signed-off-by: Bin Meng --- arch/x86/cpu/mtrr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c index 73cf7bb2be..14c644eb56 100644 --- a/arch/x86/cpu/mtrr.c +++ b/arch/x86/cpu/mtrr.c @@ -155,7 +155,7 @@ 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++) - set_var_mtrr(i, req->type, req->start, req->size); + mtrr_set_next_var(req->type, req->start, req->size); debug("close\n"); mtrr_close(&state, do_caches); -- 2.25.1