Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932162AbeAOFnx (ORCPT + 1 other); Mon, 15 Jan 2018 00:43:53 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:60375 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932066AbeAOFnu (ORCPT ); Mon, 15 Jan 2018 00:43:50 -0500 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.08295922|-1;CH=green;FP=14332280652705668602|1|1|1|0|-1|-1|-1;HT=e01e04400;MF=zhang.jia@linux.alibaba.com;NM=1;PH=DS;RN=8;RT=8;SR=0;TI=SMTPD_---0SwbXybV_1515995014; From: Jia Zhang To: tony.luck@intel.com, bp@alien8.de Cc: mingo@redhat.com, hpa@zytor.com, tglx@linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org, Jia Zhang Subject: [PATCH 1/2] x86/intel: introduce platform_id Date: Mon, 15 Jan 2018 13:43:22 +0800 Message-Id: <1515995003-113069-2-git-send-email-zhang.jia@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515995003-113069-1-git-send-email-zhang.jia@linux.alibaba.com> References: <1515995003-113069-1-git-send-email-zhang.jia@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Platform ID retrieved from MSR_IA32_PLATFORM_ID may be used as a filtration condition in some cases. Signed-off-by: Jia Zhang --- arch/x86/include/asm/processor.h | 1 + arch/x86/kernel/cpu/intel.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index d3a67fb..c0b4d47 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -133,6 +133,7 @@ struct cpuinfo_x86 { u16 cpu_index; u32 microcode; unsigned initialized : 1; + u8 platform_id; } __randomize_layout; struct cpuid_regs { diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index b1af220..cee0554 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -229,6 +229,13 @@ static void early_init_intel(struct cpuinfo_x86 *c) } check_mpx_erratum(c); + + if ((c->x86 > 6) || (c->x86_model >= 5)) { + u32 val[2]; + + rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]); + c->platform_id = 1 << ((val[1] >> 18) & 7); + } } #ifdef CONFIG_X86_32 -- 1.8.3.1