From patchwork Thu Nov 10 12:21:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 18093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp111833wru; Thu, 10 Nov 2022 04:24:16 -0800 (PST) X-Google-Smtp-Source: AMsMyM5FnyIXr8UWXQcibcKc/sAfLyKmPQrHW2XWFz7iPEas4mAQ0JQ3FpNnpRJvJq2tjOxE5DRA X-Received: by 2002:aa7:9537:0:b0:56c:8c13:234c with SMTP id c23-20020aa79537000000b0056c8c13234cmr2430201pfp.12.1668083056026; Thu, 10 Nov 2022 04:24:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668083056; cv=none; d=google.com; s=arc-20160816; b=Vv0DX8XFNeAs4B6flE52z5+1/zo5TSD4C85QuRab+cQ2VwAi5k/PEbEqcdlPueTTNi EeT1nrRG3VDQV+uBtkre387la1amMKcTo+DWze29mvQVsUI6TIHcmWh0Qi/wKtZmKln3 Z2t1tQ1Bw70757xGWekyFlsJdGwNDEnqdY+cT1Lkow/gizGfvdSq7s3EIjVrf+O06p/d bCbEFDZF/omHZ+cypVwk1mrYYH0NZQJiXBqzVa3Rxk6NiSi1pPU/spJA19Nr5RXq7hWT daAdyUVOp4lgBI/7oSw2UEK6HzmhE6k+3jZYf45Yiy8Qh2ouCbJMt8Eh2Gk1151HUL6I euvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=FXUGUmHVztvXiUFfSp49JyGGH77rTqfAQ5M+mn70WN0=; b=0LGJ0fBxmY+pM+2GbGRpB7lJ4LKQZuujJq+C0GkhTJfnph3dLr6r9MJcWb9L/CaL3X BIKLyul8XBjFMDiWHy5CyUQ73KMDKRIuTDFmIndGMrTIqfA7ok9mGIGAlyAPUtfmeTMq 0O+0d1dInQViZwKQj7O45egkVca7BZGb293dMgVR9HJLMRGbhe+QWSNtnZEdooVjwpcT wKme923I/kkiFLbm2uJUaXeaZN4tQeid5hp2PomtDVki/mU81Lk8PGxB87cjK3CaaI32 QpTZeq1PKzIMB/ueIFgUndImDlug5A8g2di/ns+xjEa/TecNMcViU1ohwoEE4uC95f28 yH9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LzFXk6Ds; dkim=neutral (no key) header.i=@linutronix.de header.b=31r5zjYQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x196-20020a6331cd000000b0045a43a568casi21570552pgx.717.2022.11.10.04.24.01; Thu, 10 Nov 2022 04:24:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LzFXk6Ds; dkim=neutral (no key) header.i=@linutronix.de header.b=31r5zjYQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229951AbiKJMWL (ORCPT + 99 others); Thu, 10 Nov 2022 07:22:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230511AbiKJMVz (ORCPT ); Thu, 10 Nov 2022 07:21:55 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6388671F39; Thu, 10 Nov 2022 04:21:54 -0800 (PST) Date: Thu, 10 Nov 2022 12:21:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1668082912; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FXUGUmHVztvXiUFfSp49JyGGH77rTqfAQ5M+mn70WN0=; b=LzFXk6Ds37LC6Na+1TnUv8xQ+mmNLtP6bvkrpMet29roROd6uK1UZ2eDSwOMbvc7g/Vtt5 qc9bPe3WpzRhOJknumC2O6ruixMsu6PXOL8OYAQwDCiF43wTQPe+dMHbpYDa66zKzl3g4c FNAsePdDLGi/rFRNBMDcDrVZLSsvTWf4ohXW00XGu61BQuraXhG7/1ezjmN2Er2kB8ZjQL 7S/dnb0pQwQ4DG7VQfMdRWb64akuaDYStXTXtI+T/vaw6ovHWbRG9BVeuHouLOlclXbI7F 1WTg6RVp5aelEHPu6xt50TImqIiPh2354iAEBLANeJ6kq547Kn42O4GKFkTIpA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1668082912; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FXUGUmHVztvXiUFfSp49JyGGH77rTqfAQ5M+mn70WN0=; b=31r5zjYQW8oC1rn5Dm2YDyoJOS/4M9QwidvlDxdDkWzWk5eC8i/uqV/Dl6Y83uAoVGw4c7 a2cjm2JmM/Imp+AA== From: "tip-bot2 for Juergen Gross" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/mtrr: Get rid of __mtrr_enabled bool Cc: Juergen Gross , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221102074713.21493-11-jgross@suse.com> References: <20221102074713.21493-11-jgross@suse.com> MIME-Version: 1.0 Message-ID: <166808291144.4906.5479534942233014334.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749111858617494271?= X-GMAIL-MSGID: =?utf-8?q?1749111858617494271?= The following commit has been merged into the x86/cpu branch of tip: Commit-ID: 2c15679e8687d5934e1a70fe50ce409bb8a2aba1 Gitweb: https://git.kernel.org/tip/2c15679e8687d5934e1a70fe50ce409bb8a2aba1 Author: Juergen Gross AuthorDate: Wed, 02 Nov 2022 08:47:07 +01:00 Committer: Borislav Petkov CommitterDate: Thu, 10 Nov 2022 13:12:45 +01:00 x86/mtrr: Get rid of __mtrr_enabled bool There is no need for keeping __mtrr_enabled as it can easily be replaced by testing mtrr_if to be not NULL. Signed-off-by: Juergen Gross Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20221102074713.21493-11-jgross@suse.com Signed-off-by: Borislav Petkov --- arch/x86/kernel/cpu/mtrr/mtrr.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c index a468be5..f671be9 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.c +++ b/arch/x86/kernel/cpu/mtrr/mtrr.c @@ -59,11 +59,9 @@ #define MTRR_TO_PHYS_WC_OFFSET 1000 u32 num_var_ranges; -static bool __mtrr_enabled; - static bool mtrr_enabled(void) { - return __mtrr_enabled; + return !!mtrr_if; } unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES]; @@ -755,18 +753,17 @@ void __init mtrr_bp_init(void) } } - if (mtrr_if) { - __mtrr_enabled = true; + if (mtrr_enabled()) { set_num_var_ranges(mtrr_if == &generic_mtrr_ops); init_table(); if (mtrr_if == &generic_mtrr_ops) { /* BIOS may override */ - __mtrr_enabled = get_mtrr_state(); - - if (mtrr_enabled()) { + if (get_mtrr_state()) { memory_caching_control |= CACHE_MTRR | CACHE_PAT; changed_by_mtrr_cleanup = mtrr_cleanup(phys_addr); cache_cpu_init(); + } else { + mtrr_if = NULL; } } }