Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5999243ybe; Tue, 10 Sep 2019 11:58:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFLBWTdT6/uKg87rBq21j6FqA6Fs/oPq429Wda7BXn1M0v515/lbM/f6lKJvqUNZoAO+9o X-Received: by 2002:a17:906:8406:: with SMTP id n6mr26527849ejx.138.1568141893117; Tue, 10 Sep 2019 11:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568141893; cv=none; d=google.com; s=arc-20160816; b=CwnYibV7M4qthcMXBEkKZqcQgU7B0Jxqn1tTm4moxJds9TqpVJY9H/jnFRPsfJNVfc r2pAFqPyrv+UF6x1DkGXBIjk/tUbrZ9wnNhR3KDHyk8DQo5oP9+l9JRPgxrgKJ6UuhC/ chtwB0SydZ+O5MV3QEfMp/hC7QPFSrhJJOnxxMyEjmZKu/juDXrhj6lnHeCUmYpDOgQd Rl/Yxao7q8sSIbzx0qMncHnjjGPNYchJ37m4R4STp/B9lLNjbfccWom5vKSJl6HKN5N6 vVZlqL/3dPy0IdqkaAproEAVUlCi27nVoXKtTq8PBlH8hpUQ8RyOeg6fo8/3SCWf3WTy b8lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OF2GNeo9EcoV7r2cxiD5XuZ5iJsWKvLEg2fxOrk40c8=; b=aEjeqas+p4vXtEilnB/R0wr6YeB656Z73+JrTn3Md7NFQ3Za4cd/yH1FdnWVEs3svF r2qyEo+hidQ+xEfS88ft/shqqsTBP3IDZj3FmJC1F2ilqOBF4HP6Ycgd7JCTgItEBsIk qHFW9rbmYh5nLOlCxtfSxyVmE7oIOgu2ElIm8w1w9yIGDB/AjozeIt53QrHO9QWXvbBS XstnVHwLrjXZepyffZ0qS/Vx2u16HaxzjH/Xpb4F2NaXghIWwUwd9Vs7b4+8UHF1FjLL kFh7uUTjsFKTS28OwFai4jKh//RUsFsOr6EpOd8dgTr8n7125GDrH6X6C/ngyGdkywD2 f9KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=fLz3HvLx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w58si12137376edc.312.2019.09.10.11.57.49; Tue, 10 Sep 2019 11:58:13 -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; dkim=pass header.i=@alien8.de header.s=dkim header.b=fLz3HvLx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727927AbfIJLvX (ORCPT + 99 others); Tue, 10 Sep 2019 07:51:23 -0400 Received: from mail.skyhub.de ([5.9.137.197]:60502 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfIJLvX (ORCPT ); Tue, 10 Sep 2019 07:51:23 -0400 Received: from zn.tnic (p200300EC2F0ABE00B4DC6059A6D53D5D.dip0.t-ipconnect.de [IPv6:2003:ec:2f0a:be00:b4dc:6059:a6d5:3d5d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id DEB3D1EC09F7; Tue, 10 Sep 2019 13:51:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1568116282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=OF2GNeo9EcoV7r2cxiD5XuZ5iJsWKvLEg2fxOrk40c8=; b=fLz3HvLx3ynrT+1I5v54lpWSEP0T5DZtDyTIyhmmXWLKHuL1r6rIfCW/9jCtoY3MzqyKYy hSkVCejAFaityap4Vi2JjYj5R4mVLRnlmF+WdQ7c7ec0iayRvWnFggfJDZoijnK/8mVzOM pIDycg6TvNudv251RJWFzwSVD21fWhw= Date: Tue, 10 Sep 2019 13:51:16 +0200 From: Borislav Petkov To: Tony W Wang-oc Cc: "tony.luck@intel.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "hpa@zytor.com" , "x86@kernel.org" , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "yazen.ghannam@amd.com" , "vishal.l.verma@intel.com" , "qiuxu.zhuo@intel.com" , David Wang , "Cooper Yan(BJ-RD)" , "Qiyuan Wang(BJ-RD)" , "Herry Yang(BJ-RD)" Subject: Re: [PATCH v2 1/4] x86/mce: Add Zhaoxin MCE support Message-ID: <20190910115116.GD23931@zn.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 10, 2019 at 08:19:08AM +0000, Tony W Wang-oc wrote: > All Zhaoxin newer CPUs support MCE that compatible with Intel's > "Machine-Check Architecture", so add support for Zhaoxin MCE in > mce/core.c. > > Signed-off-by: Tony W Wang-oc > --- > arch/x86/kernel/cpu/mce/core.c | 30 ++++++++++++++++++++++++------ > 1 file changed, 24 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c > index 743370e..3f878f6 100644 > --- a/arch/x86/kernel/cpu/mce/core.c > +++ b/arch/x86/kernel/cpu/mce/core.c > @@ -488,8 +488,9 @@ int mce_usable_address(struct mce *m) > if (!(m->status & MCI_STATUS_ADDRV)) > return 0; > > - /* Checks after this one are Intel-specific: */ > - if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) > + /* Checks after this one are Intel/Zhaoxin-specific: */ > + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL && > + boot_cpu_data.x86_vendor != X86_VENDOR_ZHAOXIN) > return 1; > > if (!(m->status & MCI_STATUS_MISCV)) > @@ -510,7 +511,8 @@ bool mce_is_memory_error(struct mce *m) > if (m->cpuvendor == X86_VENDOR_AMD || > m->cpuvendor == X86_VENDOR_HYGON) { > return amd_mce_is_memory_error(m); > - } else if (m->cpuvendor == X86_VENDOR_INTEL) { > + } else if (m->cpuvendor == X86_VENDOR_INTEL || > + m->cpuvendor == X86_VENDOR_ZHAOXIN) { > /* > * Intel SDM Volume 3B - 15.9.2 Compound Error Codes > * Make that a switch-case for better readability pls. > @@ -1697,6 +1699,21 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c) > if (c->x86 == 6 && c->x86_model == 45) > quirk_no_way_out = quirk_sandybridge_ifu; > } > + > + if (c->x86_vendor == X86_VENDOR_ZHAOXIN) { > + /* > + * All newer Zhaoxin CPUs support MCE broadcasting. Enable > + * synchronization with a one second timeout. > + */ > + if ((c->x86 == 6 && c->x86_model == 0x19 && > + (c->x86_stepping > 3 && c->x86_stepping < 8)) || > + (c->x86 == 6 && c->x86_model == 0x1f) || > + c->x86 > 6) { Can this be simplified into maybe something like this: if (c->x86 > 6 || (c->x86_model == 0x19 || c->x86_model == 0x1f)) this is, of course, assuming that Zhaoxin doesn't do family < 6 and that the other steppings for model 0x19 don't matter because they don't exist or so... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette