Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3646604imm; Wed, 5 Sep 2018 03:46:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZu9xuoM1CTodmXR5OIHB2BdZ4Cs4soPybe0z/WIk+Vb8oO8T0lFJ/DUietgpFtaJUz6aKQ X-Received: by 2002:a62:c90a:: with SMTP id k10-v6mr39349752pfg.180.1536144377039; Wed, 05 Sep 2018 03:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536144377; cv=none; d=google.com; s=arc-20160816; b=iVz3x4O+Wi27Q07mRBv7sCDDsSwUNcc9HmSfBFx1snPtbb6dAP48ctKXuDSht+A94C x3FxayHKJlvp7MF2aoxAmF7sxn2Ifr4YAODowLb4tO+pcfYA1bewJitIVCIElFiz3sGC NecV0CAVhUoXW6T9DKVdg/xvh5dRKZxI01HyZ3fmWEGjyG//e+GdPF5IAyL0+PFI2RCG im8B5b/pkoxjB939l1h49TNWw3UdtGKR3r+PUsSw+Hl73Rtb6irUfGIGDJkh/SAQvwW8 O8TpzkcIfnmeY4HrjyLqlu2fG5b0EUsGMA5plYNE3b1WA0OQSMsVmLZ+1TvxYBN+mby+ moFQ== 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; bh=7Qn+F+U2upu7gJmKw/+U4p9wKrAyfB8yW8D1Jbc85Ss=; b=ekKIRnaOpU0zVLB0GLquVRTJhEcHZdvCIyfelSeULzTXT7ge6mV6fVvHLpxlRT2Jya r5A+58MI1BDDzMw7AK0ASMI4fzPXw7d/XBdmPdpfd71yPv/ezBDa5XPT9IBzXWPe0N8G VCseptvhPw9QBZ+bNxQLCvi9oWq1MWLsStgRV/n/QFrNj+ah8blQ2Chy5SWcwRsLfy60 ZWusnC0+3RDQfvXvPeSfJqTZcLbQ5CPQ+N+9FAanqpWVwgvMHXlJxLnAc0ywk9p/R2lR 4wTPZIe7E9VZqeg8MRHIcNCN1tfWkvnsZ1aHX6UweMyFnB7k9tAgeDAolyvUQrEiqg1N AXDQ== 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 b79-v6si1882124pfc.156.2018.09.05.03.46.01; Wed, 05 Sep 2018 03:46:17 -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 S1727818AbeIEPOE (ORCPT + 99 others); Wed, 5 Sep 2018 11:14:04 -0400 Received: from mail.skyhub.de ([5.9.137.197]:57734 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbeIEPOE (ORCPT ); Wed, 5 Sep 2018 11:14:04 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id EJeh4eubudYf; Wed, 5 Sep 2018 12:44:06 +0200 (CEST) Received: from zn.tnic (p200300EC2BCBB900329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bcb:b900:329c:23ff:fea6:a903]) (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 3AFF71EC02AE; Wed, 5 Sep 2018 12:44:06 +0200 (CEST) Date: Wed, 5 Sep 2018 12:44:05 +0200 From: Borislav Petkov To: Pu Wen Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, thomas.lendacky@amd.com, pbonzini@redhat.com, mchehab@kernel.org, mikhail.jin@gmail.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-edac@vger.kernel.org Subject: Re: [PATCH v5 15/16] driver/edac: enable Hygon support to AMD64 EDAC driver Message-ID: <20180905104405.GG2237@zn.tnic> References: <47e08d8bab1cef667be3955941e7eedc23187ae1.1535459013.git.puwen@hygon.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <47e08d8bab1cef667be3955941e7eedc23187ae1.1535459013.git.puwen@hygon.cn> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Subject should be: EDAC, amd64: Add Hygon Dhyana support On Wed, Aug 29, 2018 at 08:45:45PM +0800, Pu Wen wrote: > To make AMD64 EDAC and MCE drivers working on Hygon platforms, add > support for Hygon by using the code path of AMD family 0x17. > > As Hygon will negotiate with AMD to make sure that only Hygon will > use family 0x18, under this consideration try to minimize code > modifications and share most codes with AMD. > > Also Hygon PCI Device ID DF_F0/DF_F6(0x1460/0x1466) of Host bridges > is needed for edac driver. > > Signed-off-by: Pu Wen > --- > drivers/edac/amd64_edac.c | 20 +++++++++++++++++++- > drivers/edac/amd64_edac.h | 4 ++++ > drivers/edac/mce_amd.c | 4 +++- > 3 files changed, 26 insertions(+), 2 deletions(-) > > diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c > index 18aeabb..d8b4b0e 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)) > @@ -2200,6 +2202,16 @@ static struct amd64_family_type family_types[] = { > .dbam_to_cs = f17_base_addr_to_cs_size, > } > }, > + [HYGON_F18_CPUS] = { > + /* Hygon F18h uses the same AMD F17h support */ > + .ctl_name = "Hygon_F18h", > + .f0_id = PCI_DEVICE_ID_HYGON_18H_DF_F0, > + .f6_id = PCI_DEVICE_ID_HYGON_18H_DF_F6, > + .ops = { > + .early_channel_count = f17_early_channel_count, > + .dbam_to_cs = f17_base_addr_to_cs_size, > + } > + }, > }; > > /* > @@ -3192,6 +3204,11 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt) > pvt->ops = &family_types[F17_CPUS].ops; > break; > > + case 0x18: > + fam_type = &family_types[HYGON_F18_CPUS]; > + pvt->ops = &family_types[HYGON_F18_CPUS].ops; > + break; > + You can use the F17_CPUS array element here and overwrite the ->ctl_name string only. No need to define [HYGON_F18_CPUS] above... yet. > default: > amd64_err("Unsupported family!\n"); > return NULL; > @@ -3428,6 +3445,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/amd64_edac.h b/drivers/edac/amd64_edac.h > index 1d4b74e..6e5f609 100644 > --- a/drivers/edac/amd64_edac.h > +++ b/drivers/edac/amd64_edac.h > @@ -116,6 +116,9 @@ > #define PCI_DEVICE_ID_AMD_17H_DF_F0 0x1460 > #define PCI_DEVICE_ID_AMD_17H_DF_F6 0x1466 > > +#define PCI_DEVICE_ID_HYGON_18H_DF_F0 0x1460 > +#define PCI_DEVICE_ID_HYGON_18H_DF_F6 0x1466 As in the previous patch - use the AMD defines. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.