Message ID | 20240229001952.325275-1-ak@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-85914-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp161922dyb; Wed, 28 Feb 2024 20:01:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHSUgxvGZTEYL85e1Weteeqa6m0hc5YXeSoG6ifSD6hgW9C4qkyi2kuA+6tF981NfehAow4YmZFTznJwCchad0WXjkWg== X-Google-Smtp-Source: AGHT+IHTgtvsSRG6r18qopBRyiVkSSRhNkXPKyUGa+T0EUyhMyhDtmLbr52KSNREvxx6UIAqsZrg X-Received: by 2002:a50:c8ca:0:b0:564:f9d1:6b14 with SMTP id k10-20020a50c8ca000000b00564f9d16b14mr585654edh.14.1709179307454; Wed, 28 Feb 2024 20:01:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709179307; cv=pass; d=google.com; s=arc-20160816; b=T9F6rCVeM9FebAO4iM2cTscEntvHoSjp1F2uyNJhZs6eLRJEAwaml1qFG5yK7i7nZi epGH89bsFdiia2qJYWBP3KDqX/Dcxj3YmSUJJTHPCHMFa/t8heCmOyVwqfy5jBYqge3t OAgRoVqG7YRtZBefqOSEYZdND9Ws7VXoZIHdvyi6ntumJtQuzpvUtQmoaqFcQhzkfp7k fEsrNrJCf35r2T8WWQhhOjI5Y/spwy9BFsaumjxf4ITnGwn19OY7aIbwlK6/mqiJPX9u W010nHA6PvXUCXJPtfrAqF6xnAN6IJ15KHGINDffiddxJmLiq+sX4N336KUXMGwUPSuC r34w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=RnBLtuB2b648Rh4Bbl7xtWAZwHz8024rDkxnu3D5mL0=; fh=+6KIiIQx7RlBEpiJo3aozMdAMX7u/fPcgwx32k1QFuY=; b=iY8lPGNaG96lPgtfDQvNo90E7w5HVxPfuUFsvRBQtT0/fvQg4fPHGaobLHG9lhxSIP SaSlBuRRZTHtSaGr1SSIoslmD/iVUuu7bAriczlzynGMcBba34QF70Vrv92rJGSwlMvQ 95r3o3zjaTQA95Otl23FbgLmo00J/UsnhkfqjCXnlznGpHjjG4vX5JoqHiUqaPnNb117 LWcjfIJWIAVtCdBCgufe86v5PoF5NkMeoU9dYmNfScfDnmPC3OybChuNcI36eQ5xSnKC fYt3dNYDlPnpgIBGS40aN26gUJND0v191gk6i41ar3uwh3Ye+D/PBzxQUQjhobsEhNOj UnKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nsa10gvd; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-85914-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85914-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l19-20020a056402255300b0056628e3201bsi194152edb.12.2024.02.28.20.01.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 20:01:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85914-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nsa10gvd; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-85914-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85914-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 94E051F24B01 for <ouuuleilei@gmail.com>; Thu, 29 Feb 2024 00:24:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C93B31E4BD; Thu, 29 Feb 2024 00:20:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nsa10gvd" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9123C7FE for <linux-kernel@vger.kernel.org>; Thu, 29 Feb 2024 00:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709166007; cv=none; b=d4d7KMXFtNAM1CWqMXyjp4O+kfP0InOAQeDU1hsk1UIPlDqDIa0fttY2c3aSNk6P9X+Hh/p/Wjx0w2VqpBZK5R+qefVVZC0z2VnF89Z6QZrW/D512E40cwsvf5fDI5dqhdqImlb4nvCTf51P0asuHsihDSjR04eMO9R8/yKlc8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709166007; c=relaxed/simple; bh=WP9vvbV2njaVQ8t02r3r/YNcGX7SRKU79ihqdWRNDkM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=i6ci/PfTrviFVtKKgNMUULvCvGDrWriZj9I+qA+I3DqW5XrEhJuVOPH8y+OCP4Jb2JWkTMCnxx7Y+e5DiVDFlRkHeUZDvcPOb8j31X5o8LYpl9PdooyG8q++d12knwkL7VazoSKBD7rhw8uIn1wCO0P272JBOWdbkkRPtURC8Vs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nsa10gvd; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709166005; x=1740702005; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WP9vvbV2njaVQ8t02r3r/YNcGX7SRKU79ihqdWRNDkM=; b=nsa10gvdVvnxt8tj8NKhW+QJSqYy0EtqpkOF38hRhm+h3XgEIPvETLV9 WUyKaJU6kKPliZer7oI6fJqHFfpo9ESIL2ZN+EiGn1m7Hi2AlgnCldVmC KAnmttBgG1Si0l+kUyE2RlxLDXtFQwKDH/we4AbPLvOpiuSfalmx0Fj+m ZCk7eA/St614gg7yW23xP8l9zPeGVq+VavbayvsHmkoQtRdTA7W2o2xhi FAnPUyTOyLtRgSjgMtUFesoOPQUnk+Xcy9oqQbuFjMZt+y0NIjuofsm3n S1fmE/lZ1pDsRhzFO1Q2yKmohTzmOTfcY36WwNNciEwiySIRiKCHbkkTz Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="14245922" X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="14245922" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 16:20:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,191,1705392000"; d="scan'208";a="12275188" Received: from tassilo.jf.intel.com ([10.54.38.190]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 16:20:05 -0800 From: Andi Kleen <ak@linux.intel.com> To: x86@kernel.org Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com> Subject: [PATCH v3] x86/mtrr: Check if fixed MTRRs exist before saving them Date: Wed, 28 Feb 2024 16:19:52 -0800 Message-ID: <20240229001952.325275-1-ak@linux.intel.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792204401477930885 X-GMAIL-MSGID: 1792204401477930885 |
Series |
[v3] x86/mtrr: Check if fixed MTRRs exist before saving them
|
|
Commit Message
Andi Kleen
Feb. 29, 2024, 12:19 a.m. UTC
MTRRs have a obsolete fixed variant for fine grained
caching control of the 640K-1MB region. This fixed variant has a
separate capability bit in the MTRR capability MSR. The MTRR code
checks this capability bit before trying to access the fixed MTRR MSRs,
except in one place. This patch fixes this place to also
check the capability.
Otherwise there will be a WARN_ON when the respective MSRS don't exist.
Fixes: 2b1f6278d77c ("[PATCH] x86: Save the MTRRs of the BSP before booting an AP")
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
v2: Add Fixes tag and expand description.
v3: Expand description
---
arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c index 767bf1c71aad..2a2fc14955cd 100644 --- a/arch/x86/kernel/cpu/mtrr/mtrr.c +++ b/arch/x86/kernel/cpu/mtrr/mtrr.c @@ -609,7 +609,7 @@ void mtrr_save_state(void) { int first_cpu; - if (!mtrr_enabled()) + if (!mtrr_enabled() || !mtrr_state.have_fixed) return; first_cpu = cpumask_first(cpu_online_mask);