From patchwork Fri Mar 15 12:46:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10854677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0DE9B6C2 for ; Fri, 15 Mar 2019 12:48:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAA2F2A99D for ; Fri, 15 Mar 2019 12:48:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDC972A9A0; Fri, 15 Mar 2019 12:48:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EE362A99D for ; Fri, 15 Mar 2019 12:48:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h4mEQ-00038v-Uj; Fri, 15 Mar 2019 12:46:38 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h4mEP-00038q-I2 for xen-devel@lists.xenproject.org; Fri, 15 Mar 2019 12:46:37 +0000 X-Inumbo-ID: 5e817eb3-4720-11e9-bc90-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 5e817eb3-4720-11e9-bc90-bc764e045a96; Fri, 15 Mar 2019 12:46:36 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Fri, 15 Mar 2019 06:46:35 -0600 Message-Id: <5C8B9EAB020000780021F439@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Fri, 15 Mar 2019 06:46:35 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] x86/MCE: mcequirk stuff is AMD-specific X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mcheck/mce_amd.c +++ b/xen/arch/x86/cpu/mcheck/mce_amd.c @@ -70,12 +70,22 @@ #include "x86_mca.h" #include "mce_amd.h" #include "mcaction.h" -#include "mce_quirks.h" #include "vmce.h" -#define ANY -1 +#define ANY (~0U) -static const struct mce_quirkdata mce_amd_quirks[] = { +enum mcequirk_amd_flags { + MCEQUIRK_NONE, + MCEQUIRK_K8_GART, + MCEQUIRK_F10_GART +}; + +static const struct mce_quirkdata { + unsigned int cpu_family; + unsigned int cpu_model; + unsigned int cpu_stepping; + enum mcequirk_amd_flags quirk; +} mce_amd_quirks[] = { { 0xf /* cpu family */, ANY /* all models */, ANY /* all steppings */, MCEQUIRK_K8_GART }, { 0x10 /* cpu family */, ANY /* all models */, ANY /* all steppings */, @@ -157,10 +167,10 @@ bool mc_amd_addrcheck(uint64_t status, u } /* MC quirks */ -enum mcequirk_amd_flags -mcequirk_lookup_amd_quirkdata(struct cpuinfo_x86 *c) +static enum mcequirk_amd_flags +mcequirk_lookup_amd_quirkdata(const struct cpuinfo_x86 *c) { - int i; + unsigned int i; BUG_ON(c->x86_vendor != X86_VENDOR_AMD); @@ -176,10 +186,11 @@ mcequirk_lookup_amd_quirkdata(struct cpu continue; return mce_amd_quirks[i].quirk; } - return 0; + + return MCEQUIRK_NONE; } -int mcequirk_amd_apply(enum mcequirk_amd_flags flags) +static void mcequirk_amd_apply(enum mcequirk_amd_flags flags) { uint64_t val; @@ -197,11 +208,12 @@ int mcequirk_amd_apply(enum mcequirk_amd case MCEQUIRK_F10_GART: if ( rdmsr_safe(MSR_AMD64_MCx_MASK(4), val) == 0 ) - wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10)); + wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10)); break; - } - return 0; + default: + ASSERT(flags == MCEQUIRK_NONE); + } } static struct mcinfo_extended * --- a/xen/arch/x86/cpu/mcheck/mce_quirks.h +++ /dev/null @@ -1,53 +0,0 @@ -/* * MCA quirks - * Copyright (c) 2009 Advanced Micro Devices, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; If not, see . - */ - -#ifndef _MCE_QUIRK_H -#define _MCE_QUIRK_H - -#include - -struct mce_quirkdata { - int32_t cpu_family; - int16_t cpu_model; - int16_t cpu_stepping; - uint32_t quirk; -}; - -/* use a binary flag if multiple quirks apply - * to one CPU family/model - */ - -enum mcequirk_amd_flags { - MCEQUIRK_K8_GART = 2, - MCEQUIRK_F10_GART -}; - -enum mcequirk_intel_flags { - MCEQUIRK_DUMMY = 0x1, /* nothing known yet */ -}; - -enum mcequirk_amd_flags -mcequirk_lookup_amd_quirkdata(struct cpuinfo_x86 *c); - -int mcequirk_amd_apply(enum mcequirk_amd_flags flags); - -enum mcequirk_intel_flags -mcequirk_lookup_intel_quirkdata(struct cpuinfo_x86 *c); - -int mcequirk_intel_apply(enum mcequirk_intel_flags flags); - -#endif /* _MCE_QUIRK_H */