Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3096952imm; Sun, 3 Jun 2018 19:39:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJkYBbZqwEOfXrZrygRw8O581cdRQr3lSp+9jiezr6foyNmsf1SvmzOKpy4ADzqfhZKKx+6 X-Received: by 2002:a62:67c5:: with SMTP id t66-v6mr15419718pfj.20.1528079967871; Sun, 03 Jun 2018 19:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528079967; cv=none; d=google.com; s=arc-20160816; b=p+PQtBrDfPS1ue8sspCT1VjL9m6NuOuTICqYe2gV96xvbmb2ubpUrRM/Egl4aycw7s wUyeY9CQq5os/e+cvKd7hOTKZyg06g39cnW+kRJUi8vyS0lN7HcT5gz5JKyZKNpBSJzK vG2CF8cJStjzJwNZPhq9rElQ57X5OUjyR5YvOZKYamTOSb8FxPfnHDDJtP1+9rZjFWI7 i8orxVE6FejAfNeOvLwl8f7UQC84rJybhLmvV7ePSDu3Nsopet1XwNXnONIVHYn0tTZU FDxknTrHcnkzt0dYQVPEJ7TCsMbLuJpRV/co4HLLJ0/w9uyrfLHs+d808Ge5EWsxWLO5 2Yvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=6pQN8B4PQnXuOaDWQYHXt2b4OllRuDNT3MOtLJef6Es=; b=XdpnyFtek2WZMhWnPKf0RrmlIrruESTNwcERFlYX4SlzYIrevNmra0av8hFO/PzX1c BDP4rZ6HY7/9NZR2jkirWp5T5vdRqAbI8mVP94vDEiek3h7sZOYEua430aM5FEocpNa7 r+aSCZKJ8PU2i6ihzQfcm9MfUrAqupaGX88G1nc0paDzSRKgVMmtKGMfS3ioPWzx3qMw ZomxBVu9uXb0DEQzv/zu5NqjLfst3g6fAvZNWVunrTSvVrKcoyeT8GLJjpYv3SBncXMa eKK582QkCL1EgX5PliQonvbVx1rJrhFCdOUEXOxGICm3Ub4aYUhncjSAn0Ge9xJmHWon WwIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2-v6si7070916plk.473.2018.06.03.19.39.12; Sun, 03 Jun 2018 19:39:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751881AbeFDChp (ORCPT + 99 others); Sun, 3 Jun 2018 22:37:45 -0400 Received: from ZXSHCAS1.zhaoxin.com ([203.148.12.81]:53074 "EHLO ZXSHCAS1.zhaoxin.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751412AbeFDChn (ORCPT ); Sun, 3 Jun 2018 22:37:43 -0400 Received: from zxbjmbx3.zhaoxin.com (10.29.252.165) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Mon, 4 Jun 2018 10:37:38 +0800 Received: from timguo-System-Product-Name.zhaoxin.com (10.29.8.54) by zxbjmbx3.zhaoxin.com (10.29.252.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1261.35; Mon, 4 Jun 2018 10:37:37 +0800 From: David Wang To: , , , , , , , CC: , , , , , "David Wang" Subject: [PATCH v2] x86/mce: add CMCI support for Centaur CPUs Date: Mon, 4 Jun 2018 10:37:33 +0800 Message-ID: <1528079853-8101-1-git-send-email-davidwang@zhaoxin.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.29.8.54] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx3.zhaoxin.com (10.29.252.165) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org New Centaur CPU support CMCI mechanism, which is compatible with INTEL CMCI. Signed-off-by: David Wang Changes from v1 to v2: *1, add vendor check for Centaur CPU in cmci_supported. *2, Only call intel_init_cmci for Centaur CPU in mce_intel_feature_init function. --- arch/x86/Kconfig | 12 ++++++++++++ arch/x86/kernel/cpu/mcheck/mce.c | 6 ++++++ arch/x86/kernel/cpu/mcheck/mce_intel.c | 21 ++++++++++++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index dda87a3..1adff5f 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1130,6 +1130,18 @@ config X86_MCE_AMD Additional support for AMD specific MCE features such as the DRAM Error Threshold. +config X86_MCE_CENTAUR + def_bool y + prompt "CENTAUR MCE features" + depends on CPU_SUP_CENTAUR && X86_MCE_INTEL + help + Additional support for Centaur specific MCE features such as + MCE broadcasting and CMCI support. + New Centaur CPU support MCE broadcasting. + New Centaur CPU support CMCI which is fully compliant with Intel CMCI. + + If unsure, say N here. + config X86_ANCIENT_MCE bool "Support for old Pentium 5 / WinChip machine checks" depends on X86_32 && X86_MCE diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index cd76380..2ebafc7 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -1727,6 +1727,7 @@ static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c) } } +#ifdef CONFIG_X86_MCE_CENTAUR static void mce_centaur_feature_init(struct cpuinfo_x86 *c) { struct mca_config *cfg = &mca_cfg; @@ -1740,7 +1741,12 @@ static void mce_centaur_feature_init(struct cpuinfo_x86 *c) if (cfg->monarch_timeout < 0) cfg->monarch_timeout = USEC_PER_SEC; } + mce_intel_feature_init(c); + mce_adjust_timer = cmci_intel_adjust_timer; } +#else +static inline void mce_centaur_feature_init(struct cpuinfo_x86 *c) { } +#endif static void __mcheck_cpu_init_vendor(struct cpuinfo_x86 *c) { diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c index d05be30..5b1b68f 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_intel.c +++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c @@ -85,7 +85,8 @@ static int cmci_supported(int *banks) * initialization is vendor keyed and this * makes sure none of the backdoors are entered otherwise. */ - if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) + if ((boot_cpu_data.x86_vendor != X86_VENDOR_INTEL && + boot_cpu_data.x86_vendor != X86_VENDOR_CENTAUR)) return 0; if (!boot_cpu_has(X86_FEATURE_APIC) || lapic_get_maxlvt() < 6) return 0; @@ -506,10 +507,20 @@ static void intel_ppin_init(struct cpuinfo_x86 *c) void mce_intel_feature_init(struct cpuinfo_x86 *c) { - intel_init_thermal(c); - intel_init_cmci(); - intel_init_lmce(); - intel_ppin_init(c); + + switch (c->x86_vendor) { + case X86_VENDOR_INTEL: + intel_init_thermal(c); + intel_init_cmci(); + intel_init_lmce(); + intel_ppin_init(c); + break; + case X86_VENDOR_CENTAUR: + intel_init_cmci(); + break; + default: + break; + } } void mce_intel_feature_clear(struct cpuinfo_x86 *c) -- 1.9.1