Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3088210pxk; Mon, 7 Sep 2020 02:51:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxd662cK9/C9SmRJfEOBk+rtJplyvRXOfHsnjacSwN/rZkZX6bF2XF3ugG3ShLTizg0RmRK X-Received: by 2002:a17:906:380d:: with SMTP id v13mr19548952ejc.152.1599472302646; Mon, 07 Sep 2020 02:51:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599472302; cv=none; d=google.com; s=arc-20160816; b=czIU//srbJJ/DKp7x2svOJj8LoN80sqeYmBZJBJNfjMO9/P5gH2sFJMChc53VtLvSV kMnL1LrU5nx8n8ahQfNLMK3cSB0pKPhyKN4Y8sLHmWglaLa4AJojh7CF7DylgSIIaXty oXJj+aMhAm6xnBXJvlmTV440ndOa8BvRwmPgaSpQkMeiyCZcZl79jFFNplrXyXsDHeVn breIuDeizfzxItUmW4Je3a/rB/frYyTXINdvm+sdryceITQY8bHl0Qs+/4ogUIYrrbyU IZI4Z6tYDXRHRsOrRbSgP2C1z5l4XffvoPiOU72eVMqwkSeE8Qazp4lZjtq8Pie5ZUr5 eroA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iM4HD+kRO1syf6S/etlIC9hkWwYLw2z8Rfl1TLK+LqA=; b=otcTJwwqDbvpsy4RqyjBMwjJYfm3lo9usFos0SLe/S3EC7+1EiGjLWv/oZkZl3JmXp Ecth96Mg4cG9kqY5OFkgSAV5LuiG9GXYfXmVRCNcDau4797L3gQGH7DwdFZpTK5FwGc6 dAZ7VWwsD1qMpeGrcGzCUFhWamfXQ6EoxI22IaSVwoCy0gWAA2X7kmGwpvBSdeVB+ZOt BNapO0OQ1ATxkHBlVkU9aHT50Zts9i7i6dp1jLSgqy0OeZBG8/3cP51iBIJvs0FncRck p/k91WkGfSRvTxWQn8ga2SizCmQojxmFBtFdBARAf8eFe4vLcmohFLnhfAdjq/WdX3qS OZZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=iNNkv4mX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj16si244391ejb.382.2020.09.07.02.51.19; Mon, 07 Sep 2020 02:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=iNNkv4mX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728331AbgIGJsy (ORCPT + 99 others); Mon, 7 Sep 2020 05:48:54 -0400 Received: from mail.zx2c4.com ([192.95.5.64]:37625 "EHLO mail.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728243AbgIGJsy (ORCPT ); Mon, 7 Sep 2020 05:48:54 -0400 Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 9200af26; Mon, 7 Sep 2020 09:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=mail; bh=cQIv0FN/1r4pyfX0hFoYLi9BTW0=; b=iNNkv4mXUOxg5vAaCvKe 17VL2v+r80MJLDFm3WP9OYei28jMEkzDag0NSDB87wJuc3IIr1u6qoCQKluWu+84 ILk+6euSGq5OtIxPexizPLhCe/EoWl/dy2WBOhvGdPfydC8GnmJt/NTUHDaypBVF 72+V5x2PBeIXdoAj83SSQCJJ+IXecBi94rGZ4c5HMdAg5PKE5glcv+ULaa8i57o9 DOF4LcWOgqEYwYmfnb0G3dQB2hndt6PNdUqgPEuGHjF/XEoBcqvzY4fajqOX60AO 06j4rkQlSBwdLDQZ6T1yIHwrMxzdnQpdQQta6qdZVG7lmhgPWW3LyFGp1m62wZo3 nw== Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 01f808c3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 7 Sep 2020 09:20:07 +0000 (UTC) From: "Jason A. Donenfeld" To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: "Jason A. Donenfeld" , Borislav Petkov Subject: [PATCH] x86/msr: do not warn on writes to OC_MAILBOX Date: Mon, 7 Sep 2020 11:48:43 +0200 Message-Id: <20200907094843.1949-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Popular tools, like intel-undervolt, use MSR 0x150 to control the CPU voltage offset. In fact, evidently the intel_turbo_max_3 driver in-tree also uses this MSR. So, teach the kernel's MSR list about this, so that intel-undervolt and other such tools don't spew warnings to dmesg, while unifying the constant used throughout the kernel. Fixes: a7e1f67ed29f ("x86/msr: Filter MSR writes") Cc: Borislav Petkov Signed-off-by: Jason A. Donenfeld --- arch/x86/include/asm/msr-index.h | 2 ++ arch/x86/kernel/msr.c | 5 ++++- drivers/platform/x86/intel_turbo_max_3.c | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 2859ee4f39a8..0bcb3604d0e2 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -132,6 +132,8 @@ #define MSR_IA32_MCU_OPT_CTRL 0x00000123 #define RNGDS_MITG_DIS BIT(0) +#define MSR_IA32_OC_MAILBOX 0x00000150 + #define MSR_IA32_SYSENTER_CS 0x00000174 #define MSR_IA32_SYSENTER_ESP 0x00000175 #define MSR_IA32_SYSENTER_EIP 0x00000176 diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c index 49dcfb85e773..64f6200681e3 100644 --- a/arch/x86/kernel/msr.c +++ b/arch/x86/kernel/msr.c @@ -86,8 +86,11 @@ static int filter_write(u32 reg) default: break; } - if (reg == MSR_IA32_ENERGY_PERF_BIAS) + switch (reg) { + case MSR_IA32_ENERGY_PERF_BIAS: + case MSR_IA32_OC_MAILBOX: return 0; + } pr_err_ratelimited("Write to unrecognized MSR 0x%x by %s\n" "Please report to x86@kernel.org\n", diff --git a/drivers/platform/x86/intel_turbo_max_3.c b/drivers/platform/x86/intel_turbo_max_3.c index 892140b62898..991cdbc3295b 100644 --- a/drivers/platform/x86/intel_turbo_max_3.c +++ b/drivers/platform/x86/intel_turbo_max_3.c @@ -17,8 +17,8 @@ #include #include +#include -#define MSR_OC_MAILBOX 0x150 #define MSR_OC_MAILBOX_CMD_OFFSET 32 #define MSR_OC_MAILBOX_RSP_OFFSET 32 #define MSR_OC_MAILBOX_BUSY_BIT 63 @@ -41,14 +41,14 @@ static int get_oc_core_priority(unsigned int cpu) value = cmd << MSR_OC_MAILBOX_CMD_OFFSET; /* Set the busy bit to indicate OS is trying to issue command */ value |= BIT_ULL(MSR_OC_MAILBOX_BUSY_BIT); - ret = wrmsrl_safe(MSR_OC_MAILBOX, value); + ret = wrmsrl_safe(MSR_IA32_OC_MAILBOX, value); if (ret) { pr_debug("cpu %d OC mailbox write failed\n", cpu); return ret; } for (i = 0; i < OC_MAILBOX_RETRY_COUNT; ++i) { - ret = rdmsrl_safe(MSR_OC_MAILBOX, &value); + ret = rdmsrl_safe(MSR_IA32_OC_MAILBOX, &value); if (ret) { pr_debug("cpu %d OC mailbox read failed\n", cpu); break; -- 2.28.0