Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2044021imm; Mon, 16 Jul 2018 00:47:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcjjquCyy6x669kga1/AnR6N60XODWZ8duizQkeWpuK4eIcN5cWce7+xFKuOy9ATm6zEwrZ X-Received: by 2002:a63:9856:: with SMTP id l22-v6mr14963534pgo.208.1531727229516; Mon, 16 Jul 2018 00:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531727229; cv=none; d=google.com; s=arc-20160816; b=qSHd6y9q6PAq30QLuGLwvvz1EyujZZNIybL/3ycCS4K9a5yamJT9q5wiBTyW5MM1mb 4++aHAUw+koxubIN8pUicQV4RUS4SPDvFFkXsQTrN00xI6BlfU5ezuWb6y5hBld8Kyyh PsZg07qQPgloJAHCqwO1vKh6hOZr+imNKyrpPnIC0RwQ9cma25ARe6/AEXN0lq0GSUbR brwvCBI0B5341SYad1aSQsrNUN8W/ZX1kGGArrYNgo0vrwqi+vOT1gKNrnUM3GoYxP7r uVFVHvk8L59OrMkoqo4xxpBoxEO4JxBExwOSemooR/9NVyyBV69Wyqnd6KdE2cktCmKQ o7NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=b1OGoplnupyivrY7vj404m6o+MTp2Rc9iSpABY/n/Vc=; b=p2O8ZucsORFLIVKcA73g8H0fvoRs5rL9r4jqKUIx2mYsRfpBd00wQbnQ6G7yMFgTkr f7FV7z+oHcSd4Jkze3oeHpPnSAnVjkK8hmdLOwaUzeJigtfDwefcNXr3r+N491EtGWEc pL76RJtS+dMRSUcPuG3tjL117dMZGlWrky0wHnL5xfTmqG95jZCwl6ktYtkYZ6GeIuf8 qqHbl5s0x6bb8wEXHJcg8zRW+t4x9j4pYUF2V7mTQP83a9VHmLSshs1SBvLnB/RKCjOf 0o5ZjEzLBGRWs5V5osUNWYuUyNeZDwhkm14iCIqcZU1/ZMH0NOzMoz2OhDIzah0IMRk0 DARw== 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 r10-v6si27976109pgm.535.2018.07.16.00.46.54; Mon, 16 Jul 2018 00:47:09 -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 S2389509AbeGPILE (ORCPT + 99 others); Mon, 16 Jul 2018 04:11:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48404 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388939AbeGPILD (ORCPT ); Mon, 16 Jul 2018 04:11:03 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 61756CA8; Mon, 16 Jul 2018 07:44:59 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yazen Ghannam , Borislav Petkov , Andy Lutomirski , Borislav Petkov , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Tony Luck , linux-edac , Ingo Molnar , "Srivatsa S. Bhat" , "Matt Helsley (VMware)" , Alexey Makhalov , Bo Gan Subject: [PATCH 4.4 32/43] x86/cpu: Add detection of AMD RAS Capabilities Date: Mon, 16 Jul 2018 09:36:37 +0200 Message-Id: <20180716073515.436640999@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073511.796555857@linuxfoundation.org> References: <20180716073511.796555857@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yazen Ghannam commit 71faad43060d3d2040583635fbf7d1bdb3d04118 upstream Add a new CPUID leaf to hold the contents of CPUID 0x80000007_EBX (RasCap). Define bits that are currently in use: Bit 0: McaOverflowRecov Bit 1: SUCCOR Bit 3: ScalableMca Signed-off-by: Yazen Ghannam [ Shorten comment. ] Signed-off-by: Borislav Petkov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tony Luck Cc: linux-edac Link: http://lkml.kernel.org/r/1462971509-3856-5-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar Signed-off-by: Srivatsa S. Bhat Reviewed-by: Matt Helsley (VMware) Reviewed-by: Alexey Makhalov Reviewed-by: Bo Gan Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/cpufeature.h | 1 + arch/x86/include/asm/cpufeatures.h | 7 ++++++- arch/x86/kernel/cpu/common.c | 10 +++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -27,6 +27,7 @@ enum cpuid_leafs CPUID_6_EAX, CPUID_8000_000A_EDX, CPUID_7_ECX, + CPUID_8000_0007_EBX, }; #ifdef CONFIG_X86_FEATURE_NAMES --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -12,7 +12,7 @@ /* * Defines x86 CPU feature bits */ -#define NCAPINTS 17 /* N 32-bit words worth of info */ +#define NCAPINTS 18 /* N 32-bit words worth of info */ #define NBUGINTS 1 /* N 32-bit bug flags */ /* @@ -280,6 +280,11 @@ #define X86_FEATURE_PKU (16*32+ 3) /* Protection Keys for Userspace */ #define X86_FEATURE_OSPKE (16*32+ 4) /* OS Protection Keys Enable */ +/* AMD-defined CPU features, CPUID level 0x80000007 (ebx), word 17 */ +#define X86_FEATURE_OVERFLOW_RECOV (17*32+0) /* MCA overflow recovery support */ +#define X86_FEATURE_SUCCOR (17*32+1) /* Uncorrectable error containment and recovery */ +#define X86_FEATURE_SMCA (17*32+3) /* Scalable MCA */ + /* * BUG word(s) */ --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -741,6 +741,13 @@ void get_cpu_cap(struct cpuinfo_x86 *c) } } + if (c->extended_cpuid_level >= 0x80000007) { + cpuid(0x80000007, &eax, &ebx, &ecx, &edx); + + c->x86_capability[CPUID_8000_0007_EBX] = ebx; + c->x86_power = edx; + } + if (c->extended_cpuid_level >= 0x80000008) { cpuid(0x80000008, &eax, &ebx, &ecx, &edx); @@ -753,9 +760,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c) c->x86_phys_bits = 36; #endif - if (c->extended_cpuid_level >= 0x80000007) - c->x86_power = cpuid_edx(0x80000007); - if (c->extended_cpuid_level >= 0x8000000a) c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a);