Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2776753imm; Mon, 10 Sep 2018 06:23:56 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda3zLXBfUF1f8lci0k6WhliizHTUAFsTqMwfs1xC4ussKZ25sEMRxqoUvy8S6TUfWJ8Jgsa X-Received: by 2002:a65:6292:: with SMTP id f18-v6mr22426185pgv.85.1536585836351; Mon, 10 Sep 2018 06:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536585836; cv=none; d=google.com; s=arc-20160816; b=AGZeLjf6j2pM9gEuyzfzUtPCsCG/QCnrVbQXPmcbkVhOOIE20W+fe6LLa7cDMSw5pQ 3YTENfmth5xCKQ9Ju1FPTGLDIJmQN5Tind3T2y7uzpBYkoCgA24WqUwAAIfXpluQgcgx mV2PXp4P3UD3U//BBwtawY7kdrpk7h2+1udEhkPmx9jBUAWqhUMdMEpWxOCkWhIcC5fi uutJ/0NVZ++1OxrH7mtPQNlY2BjcOpsshVj8MU5vYm5PO5DBk57oKmZYPltVgLtYqrqP Bssf+tGLyeZ0EhBv/cuqz1H+iciBpwiUTMQVvos6/cbsVDJC8D45ow0Q67Y14Efs40LR hrqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=4PF5Ym8V1vTX2vnsGsiESUJgnzKXdADFq/GNsJTMP6k=; b=NXj+rSf2tRFsw+RnSx5TpE3JCb5i5UR4QxXeddgoawiYBua1e3IbO22raObkPsEw8q Je3Z+22mVK7ExFmvYMLIxy5cLblUbAZOiA+vIU5O3jpjGmFZTb1xpiVF1CmH/RapJ3X0 kFYBDJ5DygCrUVH6+y+Gz3QGhi4mLfct/dukKOOG5wr4vofLf2oQfqcCav+ALJY5BlUG WRpTWjYogt93nqRX0JA6Hs1P3PEHCKTo5g+8fWpWo9j4IIjg73p+17ooUwM8MEHG9j5U s6sPbgfWC6HhgQ4+bLvEClYNVSf42jvLJ+h15Ragg3TXtEOxCc5yOMrIUZ6uZSLCWP4u GSeg== 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 v6-v6si12617924plp.434.2018.09.10.06.23.40; Mon, 10 Sep 2018 06:23:56 -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 S1728910AbeIJSOq (ORCPT + 99 others); Mon, 10 Sep 2018 14:14:46 -0400 Received: from smtp20.cstnet.cn ([159.226.251.20]:53438 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728241AbeIJSOq (ORCPT ); Mon, 10 Sep 2018 14:14:46 -0400 Received: from pw-vbox.higon.com (unknown [182.150.46.145]) by APP-10 (Coremail) with SMTP id tACowAAnL2Ocb5ZbPSyaCQ--.1731S2; Mon, 10 Sep 2018 21:20:32 +0800 (CST) From: Pu Wen To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, thomas.lendacky@amd.com, bp@alien8.de, pbonzini@redhat.com, mchehab@kernel.org, mikhail.jin@gmail.com Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-edac@vger.kernel.org, Pu Wen Subject: [PATCH v6 15/16] EDAC, amd64: Add Hygon Dhyana support Date: Mon, 10 Sep 2018 21:20:24 +0800 Message-Id: <7deadc44054d62e3617b9f302f4e5d1fd0d382e7.1536550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VW8JVWxJwCI42IY6I8E87Iv6xkF7I0E14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43 ZEXa7VUbKLvtUUUUU== X-Originating-IP: [182.150.46.145] X-CM-SenderInfo: psxzv046klw03qof0z/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To make AMD64 EDAC and MCE drivers working on Hygon platforms, add support for Hygon Dhyana CPU by using the code path of AMD family 17h. Signed-off-by: Pu Wen --- drivers/edac/amd64_edac.c | 8 +++++++- drivers/edac/mce_amd.c | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 18aeabb..bf3314b 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -211,7 +211,7 @@ static int __set_scrub_rate(struct amd64_pvt *pvt, u32 new_bw, u32 min_rate) scrubval = scrubrates[i].scrubval; - if (pvt->fam == 0x17) { + if (pvt->fam == 0x17 || pvt->fam == 0x18) { __f17h_set_scrubval(pvt, scrubval); } else if (pvt->fam == 0x15 && pvt->model == 0x60) { f15h_select_dct(pvt, 0); @@ -264,6 +264,7 @@ static int get_scrub_rate(struct mem_ctl_info *mci) break; case 0x17: + case 0x18: amd64_read_pci_cfg(pvt->F6, F17H_SCR_BASE_ADDR, &scrubval); if (scrubval & BIT(0)) { amd64_read_pci_cfg(pvt->F6, F17H_SCR_LIMIT_ADDR, &scrubval); @@ -1044,6 +1045,7 @@ static void determine_memory_type(struct amd64_pvt *pvt) goto ddr3; case 0x17: + case 0x18: if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(5)) pvt->dram_type = MEM_LRDDR4; else if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(4)) @@ -3188,8 +3190,11 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt) break; case 0x17: + case 0x18: fam_type = &family_types[F17_CPUS]; pvt->ops = &family_types[F17_CPUS].ops; + if (pvt->fam == 0x18) + family_types[F17_CPUS].ctl_name = "F18h"; break; default: @@ -3428,6 +3433,7 @@ static const struct x86_cpu_id amd64_cpuids[] = { { X86_VENDOR_AMD, 0x15, X86_MODEL_ANY, X86_FEATURE_ANY, 0 }, { X86_VENDOR_AMD, 0x16, X86_MODEL_ANY, X86_FEATURE_ANY, 0 }, { X86_VENDOR_AMD, 0x17, X86_MODEL_ANY, X86_FEATURE_ANY, 0 }, + { X86_VENDOR_HYGON, 0x18, X86_MODEL_ANY, X86_FEATURE_ANY, 0 }, { } }; MODULE_DEVICE_TABLE(x86cpu, amd64_cpuids); diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c index 2ab4d61..c605089 100644 --- a/drivers/edac/mce_amd.c +++ b/drivers/edac/mce_amd.c @@ -1059,7 +1059,8 @@ static int __init mce_amd_init(void) { struct cpuinfo_x86 *c = &boot_cpu_data; - if (c->x86_vendor != X86_VENDOR_AMD) + if (c->x86_vendor != X86_VENDOR_AMD && + c->x86_vendor != X86_VENDOR_HYGON) return -ENODEV; fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); @@ -1113,6 +1114,7 @@ static int __init mce_amd_init(void) break; case 0x17: + case 0x18: xec_mask = 0x3f; if (!boot_cpu_has(X86_FEATURE_SMCA)) { printk(KERN_WARNING "Decoding supported only on Scalable MCA processors.\n"); -- 2.7.4