From patchwork Fri Oct 18 15:31:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 11198705 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A15B3112C for ; Fri, 18 Oct 2019 15:31:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79342222C3 for ; Fri, 18 Oct 2019 15:31:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="hQepJu7Q" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410520AbfJRPb3 (ORCPT ); Fri, 18 Oct 2019 11:31:29 -0400 Received: from mail-eopbgr720052.outbound.protection.outlook.com ([40.107.72.52]:48496 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2408745AbfJRPb3 (ORCPT ); Fri, 18 Oct 2019 11:31:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fcWebCUi/WXOIN5DeFqpcimtprjFZyxxhZiVcb6A+FgwGx6UCVVQ3FKSXwIdkRG14Cze+nmJZNjaHFCPWoNdpNd1+5NDtWYGPLQ/tKSzic1PK6hYbmtIki+WdhFW4H5QzCQp5QAoiKYfkeg4Tuy4mxEl8210PWB/Wo2yuDmiKKEEEEmm0qHZS6hozwmMgjdnqp6jGocBuxlQn3NLgYvmvSyU1m6c0xVNpGg63arjvahU3xvUWjqb089Ylq1Q1igcpdK6ov4NtYgZ+jjulEPP4FIv+ayboZSdvMAEVpFxTQ+gX25zXazfyYuQPN88e2Ds7TkASZWjK8y8EkIwhPsKcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+lCcAUaPzb54VPC0T5iazEqMwS2rgCfSl8XvicBiD7Y=; b=N7DCE/sRAu70GNeB+nJWcPzV1i3iUo3J3sQpF0BUshcmw0mG1euDF15w/5GLz2JKSsf0RcaV9Mq9nV1vtcTjccCOugMJCCIXcn3YM2FL6kRNZukW+yCwvuR5dBZuKmP/HSLyKsH5fRX53M+uUcA35EOsg/3FHeO7Tr9Q51jDkUq6MHDknCevq2j0UUrWT4UtGr6tTstKiWZtvH5tGsh4cj+x1qtKijIYvxIu7w2SDeO79fm99WUg/7DmYUo7k6ixvPAaSn0mFfX3Qalpvw2u9hly1E9DIyCbl7jxVAtZOjir/SlIk5pUv1N54v0SYWrJRRo0PyLfn/vW27QW5ABMFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+lCcAUaPzb54VPC0T5iazEqMwS2rgCfSl8XvicBiD7Y=; b=hQepJu7QynBxiclv4XaNa9qVAgaD1915F+eMvU4ZN8zLyyI40PIecD0z/CmJg35e0L1gdmYthcvem/iiivwX2Iah/5VAXzZuVsWrfyawWVGUbXN0ylIAzFpfSuekPPepglCOPwiffboB6mezfWSv1JWIPI3/TanPRu2Bp1g5jBE= Received: from SN6PR12MB2639.namprd12.prod.outlook.com (52.135.103.16) by SN6PR12MB2608.namprd12.prod.outlook.com (52.135.102.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Fri, 18 Oct 2019 15:31:26 +0000 Received: from SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8]) by SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8%7]) with mapi id 15.20.2367.019; Fri, 18 Oct 2019 15:31:26 +0000 From: "Ghannam, Yazen" To: "linux-edac@vger.kernel.org" CC: "Ghannam, Yazen" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" Subject: [PATCH 1/6] EDAC/amd64: Make struct amd64_family_type global Thread-Topic: [PATCH 1/6] EDAC/amd64: Make struct amd64_family_type global Thread-Index: AQHVhckaqc6P0belS027Gy5HBkDl1Q== Date: Fri, 18 Oct 2019 15:31:25 +0000 Message-ID: <20191018153114.39378-2-Yazen.Ghannam@amd.com> References: <20191018153114.39378-1-Yazen.Ghannam@amd.com> In-Reply-To: <20191018153114.39378-1-Yazen.Ghannam@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN1PR12CA0046.namprd12.prod.outlook.com (2603:10b6:802:20::17) To SN6PR12MB2639.namprd12.prod.outlook.com (2603:10b6:805:6f::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d1aa95c9-cf74-4fd1-6302-08d753e03ce7 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: SN6PR12MB2608: x-ms-exchange-purlcount: 1 x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2733; x-forefront-prvs: 01949FE337 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(376002)(346002)(396003)(136003)(189003)(199004)(6506007)(386003)(186003)(2906002)(6512007)(6436002)(6486002)(2351001)(6306002)(3846002)(478600001)(6116002)(5640700003)(7736002)(305945005)(26005)(102836004)(966005)(446003)(76176011)(71190400001)(71200400001)(66446008)(64756008)(66556008)(66476007)(66946007)(11346002)(476003)(256004)(2616005)(52116002)(50226002)(86362001)(6916009)(99286004)(8936002)(81156014)(25786009)(81166006)(486006)(8676002)(2501003)(36756003)(1076003)(5660300002)(4326008)(14454004)(316002)(66066001)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2608;H:SN6PR12MB2639.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2AQa5hCciifKDo7Al/Q3YxBgRKmaFwj5u4rJ0qBs3Fz29KDx1ZUDr1sYeFwoTBAOUtYtR+qKHy5aVLgISOG1tZvniuXU68yYytzzedKf8JViDO4pVSNuD3/8+jenKvs9449Ns1Ttjvrx1LUwQTFpqI7pbLJZXC43o4fBPi0iradyRhaOHyuAQWehAJyge2ATYOX4auP0HyavEM6HxTAMnABIfPf9xyFOi0cLunEdOFBEikzCdmgF5yB2mIRlGYAHI26AMLroE2H4IsjXGAN3biKkc7FWazslHbgCgk8VtgayjY1Jmz4KKzt4o6V9GNk04olRBkka+PwwZNicp6PHhCj92O6uPefbRzRu5Zr0mPbC+DdJO+vMu+uFyBL7viDwEVFCQiBC20c7QBh5gHhfDRmx9+Tv0TNMqGgtMyBJr+6+1NarwoikX9nStZZ5bTiCkEi7m2evwaQ4HWnlbNNPqg== MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1aa95c9-cf74-4fd1-6302-08d753e03ce7 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2019 15:31:25.7920 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Bh1TOAAqKL3zwPR0SuGRhnPRGM+0wNzTec9WSCHp2xhDbDscCN0I2reHJvXeDDmrgcyM0TvQVSBAZ6+1qcAd/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2608 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Yazen Ghannam The struct amd64_family_type doesn't change between multiple nodes and instances of the modules, so make it global. Signed-off-by: Yazen Ghannam --- Link: https://lkml.kernel.org/r/20190821235938.118710-9-Yazen.Ghannam@amd.com rfc -> v1: * New patch based on suggestion from Boris. drivers/edac/amd64_edac.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index c1d4536ae466..b9a712819c68 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -16,6 +16,8 @@ module_param(ecc_enable_override, int, 0644); static struct msr __percpu *msrs; +static struct amd64_family_type *fam_type; + /* Per-node stuff */ static struct ecc_settings **ecc_stngs; @@ -3278,8 +3280,7 @@ f17h_determine_edac_ctl_cap(struct mem_ctl_info *mci, struct amd64_pvt *pvt) } } -static void setup_mci_misc_attrs(struct mem_ctl_info *mci, - struct amd64_family_type *fam) +static void setup_mci_misc_attrs(struct mem_ctl_info *mci) { struct amd64_pvt *pvt = mci->pvt_info; @@ -3298,7 +3299,7 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci, mci->edac_cap = determine_edac_cap(pvt); mci->mod_name = EDAC_MOD_STR; - mci->ctl_name = fam->ctl_name; + mci->ctl_name = fam_type->ctl_name; mci->dev_name = pci_name(pvt->F3); mci->ctl_page_to_phys = NULL; @@ -3312,8 +3313,6 @@ static void setup_mci_misc_attrs(struct mem_ctl_info *mci, */ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt) { - struct amd64_family_type *fam_type = NULL; - pvt->ext_model = boot_cpu_data.x86_model >> 4; pvt->stepping = boot_cpu_data.x86_stepping; pvt->model = boot_cpu_data.x86_model; @@ -3420,7 +3419,6 @@ static void compute_num_umcs(void) static int init_one_instance(unsigned int nid) { struct pci_dev *F3 = node_to_amd_nb(nid)->misc; - struct amd64_family_type *fam_type = NULL; struct mem_ctl_info *mci = NULL; struct edac_mc_layer layers[2]; struct amd64_pvt *pvt = NULL; @@ -3497,7 +3495,7 @@ static int init_one_instance(unsigned int nid) mci->pvt_info = pvt; mci->pdev = &pvt->F3->dev; - setup_mci_misc_attrs(mci, fam_type); + setup_mci_misc_attrs(mci); if (init_csrows(mci)) mci->edac_cap = EDAC_FLAG_NONE; From patchwork Fri Oct 18 15:31:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 11198697 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3E6B2112C for ; Fri, 18 Oct 2019 15:31:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 14EF821852 for ; Fri, 18 Oct 2019 15:31:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="M5TbhZSE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410541AbfJRPbf (ORCPT ); Fri, 18 Oct 2019 11:31:35 -0400 Received: from mail-eopbgr720052.outbound.protection.outlook.com ([40.107.72.52]:48496 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2410521AbfJRPbf (ORCPT ); Fri, 18 Oct 2019 11:31:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EJhUX9FkWaKsb3gRNO5a4M0+d9gbZGzlIL2CSgq8FOhTaLVhD0CSpvEYG/so5mp4iQbmLwUXIKdDfWTbMfWUkLCin8eiqhMWBIQ+H6kcgW6OQETdQVvMuH91yEqyczLuN/x2WUi3y27KOKNoCv3KYOM+To4TWu/AiOA/cO1Smgsm+FuyQC4s3/rDsvATAO8Q0q/pIXtvTRiFItRG2nK80HpcmFH6kw8p0MJuoPbiU86VPhxujJSiA02x75MDnTY5cPGTzX6BYWHKOXaYB98V/8Cz5oT5AmcempjTF7Efr5iAapco1FkC2ajTYBhBroJSSF1WjOZaZnrz8wL0nwiz6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dS6KTJ97QxtdsAKJ2WW/4o2Kd2V2uuT2ipfngT37fTw=; b=Qg7voFNI+ylfHsJZOnNDr37Kunl+953vDHC0XpJG39H/zxZ/qkOMmdmHwbqX1C4unihvTunhGIRQXqR7ddWD3ukDshBudvw2PZr6IcFsxKLkstgGzEV2xfS/96476QxWZkA2aSooJebkf7lTV4S3rBZDGwBQ+yW/8u2PH3jpPDlX4L6xdI/PEdkfD9flv+oK0tnAWWgBL2s6JoDlTXEtpTILg5RkjVfGzb9bEYd/Gfrvf5sKYauOtFwL9zN4uzgIrULDmm/dAyzOHwrxfPgjLJw8lwP4DyVUH6N7u2wikBnXDPbZp2bxWoSTQ99zGe1Sv1yLnTJKH/UD8mcFVhrtRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dS6KTJ97QxtdsAKJ2WW/4o2Kd2V2uuT2ipfngT37fTw=; b=M5TbhZSEta9Q70wdbblKQmaRm7iGtXXm3XCK8L7AW4JqbvKrDXhacYzEhmFqr3qPGCPFx/JZgxQmRP11q9jl7HeApO3fVDJqC3dTIsEE3n0dpW/dSZXy6rysr661pncVlgPNHtBn+64F2u//J8kopLGl5UlD7MZb7xXNGHKn/vQ= Received: from SN6PR12MB2639.namprd12.prod.outlook.com (52.135.103.16) by SN6PR12MB2608.namprd12.prod.outlook.com (52.135.102.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Fri, 18 Oct 2019 15:31:26 +0000 Received: from SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8]) by SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8%7]) with mapi id 15.20.2367.019; Fri, 18 Oct 2019 15:31:26 +0000 From: "Ghannam, Yazen" To: "linux-edac@vger.kernel.org" CC: "Ghannam, Yazen" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" Subject: [PATCH 2/6] EDAC/amd64: Gather hardware information early Thread-Topic: [PATCH 2/6] EDAC/amd64: Gather hardware information early Thread-Index: AQHVhcka6ITY3m6nckKaJPEC+sNcVg== Date: Fri, 18 Oct 2019 15:31:26 +0000 Message-ID: <20191018153114.39378-3-Yazen.Ghannam@amd.com> References: <20191018153114.39378-1-Yazen.Ghannam@amd.com> In-Reply-To: <20191018153114.39378-1-Yazen.Ghannam@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN1PR12CA0046.namprd12.prod.outlook.com (2603:10b6:802:20::17) To SN6PR12MB2639.namprd12.prod.outlook.com (2603:10b6:805:6f::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a9f1ed8c-ad54-4665-2993-08d753e03d35 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: SN6PR12MB2608: x-ms-exchange-purlcount: 1 x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1775; x-forefront-prvs: 01949FE337 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(376002)(346002)(396003)(136003)(189003)(199004)(6506007)(386003)(186003)(2906002)(6512007)(6436002)(6486002)(2351001)(6306002)(3846002)(478600001)(6116002)(5640700003)(7736002)(305945005)(26005)(102836004)(966005)(446003)(76176011)(71190400001)(71200400001)(66446008)(64756008)(66556008)(66476007)(66946007)(11346002)(476003)(256004)(2616005)(52116002)(50226002)(86362001)(6916009)(99286004)(8936002)(81156014)(25786009)(81166006)(486006)(8676002)(2501003)(36756003)(1076003)(5660300002)(4326008)(14454004)(316002)(66066001)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2608;H:SN6PR12MB2639.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dMvV8cKiLYPbbcHVYRxmcxPyjpe4CRIsLAxV/Dsaef894hfJNzF8UgValq3drriR4RqCauk4W1UlG9rLUK4rA+TnUTZnvo57bQsEkcovA5R7231VER4Ao9vswylMEKfbPF79niSQf1iwP9siNnC53EL/+3rqYFuQvIe8BF5HjeotJmYamvCGnWixou0O4SU+dpZgPfdZzod0jX5+WnHrQNDszRjfryEc4mU6tvCAIRSywD2LPBuZQvcel8sSrJeSuONf5EqcFCD+UEeoZR46e4Az30Q3Q9K1b6+BmyZUjD961QiygT35eARVMybzZnBb6XvuT6xta0dA/PeaKqMEukagSVo2eetFrZ8mpXK+SJYnxCfRMgNAl6wn5FwMA2fJYgTGyirEhUm5okFu1hNkHG7fhG0C4Exn90cgXMsDxX76CyZj16pGzjByLk955RlinxCv9hhKXYyvp9hIeccwkQ== MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9f1ed8c-ad54-4665-2993-08d753e03d35 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2019 15:31:26.2997 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: pDB6TbB49dKgGAxwy/9joxFEtuwdy7I56UvIOA/cIkXDqZfTX/V74VmyguCSKvippsA9TI0yx+p3WK/aDtOWxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2608 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Yazen Ghannam Split out gathering hardware information from init_one_instance() into a separate function get_hardware_info(). This is necessary so that the information can be cached earlier and used to check if memory is populated and if ECC is enabled on a node. Signed-off-by: Yazen Ghannam --- Link: https://lkml.kernel.org/r/20190821235938.118710-9-Yazen.Ghannam@amd.com rfc -> v1: * Fixup after making struct amd64_family_type fam_type global. drivers/edac/amd64_edac.c | 72 +++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index b9a712819c68..4410da7c3a25 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3416,33 +3416,16 @@ static void compute_num_umcs(void) edac_dbg(1, "Number of UMCs: %x", num_umcs); } -static int init_one_instance(unsigned int nid) +static int get_hardware_info(struct amd64_pvt *pvt) { - struct pci_dev *F3 = node_to_amd_nb(nid)->misc; - struct mem_ctl_info *mci = NULL; - struct edac_mc_layer layers[2]; - struct amd64_pvt *pvt = NULL; u16 pci_id1, pci_id2; - int err = 0, ret; - - ret = -ENOMEM; - pvt = kzalloc(sizeof(struct amd64_pvt), GFP_KERNEL); - if (!pvt) - goto err_ret; - - pvt->mc_node_id = nid; - pvt->F3 = F3; - - ret = -EINVAL; - fam_type = per_family_init(pvt); - if (!fam_type) - goto err_free; + int ret = -EINVAL; if (pvt->fam >= 0x17) { pvt->umc = kcalloc(num_umcs, sizeof(struct amd64_umc), GFP_KERNEL); if (!pvt->umc) { ret = -ENOMEM; - goto err_free; + goto err_ret; } pci_id1 = fam_type->f0_id; @@ -3452,18 +3435,33 @@ static int init_one_instance(unsigned int nid) pci_id2 = fam_type->f2_id; } - err = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2); - if (err) + ret = reserve_mc_sibling_devs(pvt, pci_id1, pci_id2); + if (ret) goto err_post_init; read_mc_regs(pvt); + return 0; + +err_post_init: + if (pvt->fam >= 0x17) + kfree(pvt->umc); + +err_ret: + return ret; +} + +static int init_one_instance(struct amd64_pvt *pvt) +{ + struct mem_ctl_info *mci = NULL; + struct edac_mc_layer layers[2]; + int ret = -EINVAL; + /* * We need to determine how many memory channels there are. Then use * that information for calculating the size of the dynamic instance * tables in the 'mci' structure. */ - ret = -EINVAL; pvt->channel_count = pvt->ops->early_channel_count(pvt); if (pvt->channel_count < 0) goto err_siblings; @@ -3488,7 +3486,7 @@ static int init_one_instance(unsigned int nid) layers[1].size = 2; layers[1].is_virt_csrow = false; - mci = edac_mc_alloc(nid, ARRAY_SIZE(layers), layers, 0); + mci = edac_mc_alloc(pvt->mc_node_id, ARRAY_SIZE(layers), layers, 0); if (!mci) goto err_siblings; @@ -3514,20 +3512,16 @@ static int init_one_instance(unsigned int nid) err_siblings: free_mc_sibling_devs(pvt); -err_post_init: if (pvt->fam >= 0x17) kfree(pvt->umc); -err_free: - kfree(pvt); - -err_ret: return ret; } static int probe_one_instance(unsigned int nid) { struct pci_dev *F3 = node_to_amd_nb(nid)->misc; + struct amd64_pvt *pvt = NULL; struct ecc_settings *s; int ret; @@ -3538,6 +3532,21 @@ static int probe_one_instance(unsigned int nid) ecc_stngs[nid] = s; + pvt = kzalloc(sizeof(struct amd64_pvt), GFP_KERNEL); + if (!pvt) + goto err_settings; + + pvt->mc_node_id = nid; + pvt->F3 = F3; + + fam_type = per_family_init(pvt); + if (!fam_type) + goto err_enable; + + ret = get_hardware_info(pvt); + if (ret < 0) + goto err_enable; + if (!ecc_enabled(F3, nid)) { ret = 0; @@ -3554,7 +3563,7 @@ static int probe_one_instance(unsigned int nid) goto err_enable; } - ret = init_one_instance(nid); + ret = init_one_instance(pvt); if (ret < 0) { amd64_err("Error probing instance: %d\n", nid); @@ -3567,6 +3576,9 @@ static int probe_one_instance(unsigned int nid) return ret; err_enable: + kfree(pvt); + +err_settings: kfree(s); ecc_stngs[nid] = NULL; From patchwork Fri Oct 18 15:31:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 11198695 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96858112B for ; Fri, 18 Oct 2019 15:31:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63E3A21852 for ; Fri, 18 Oct 2019 15:31:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="OewSOied" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408745AbfJRPbc (ORCPT ); Fri, 18 Oct 2019 11:31:32 -0400 Received: from mail-eopbgr810051.outbound.protection.outlook.com ([40.107.81.51]:25120 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2408746AbfJRPba (ORCPT ); Fri, 18 Oct 2019 11:31:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNQc3BSBxm+q46DenpSj1at9nMR9pSt+GJZTxeRqvirF2CCPR8fB4+gOnYgLSEhO8RBXH2fKngr/Yf8vc5dgHQxGnBERPBqcNkToNS1eg5nk9kJL0X8Uds9fPTkyQ+S+2nWNZ3Imir3NabBRLcx9RndCcVa3xJKDmQxOLqv85SPQsAuMKXgOA00xuMHh2hnahB65VYXYHaA49LrH84zW3LkJRP8QpNzYvVZMfInFGadkV5FSveKY04raQ/OORNgppGKxuBKt6jocI16bbc6WGcJ1PqEObCxfYpC3swk7jt/Yb5m1+pOTF1euwQQaDFwEPuPS7J6UxY3j4Aj+Ad/ogw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zdDnu0mZPu9t0RGqUjxBqXtlbVQYMmOr6qufEl7SIbs=; b=cVph4N2aQPuEgL8WV8bg9LXH+Em1bmVk25q0LSDWYO1tNA4bP0Bt9RuAvXFsN0sxjqrMD46qRrcYz1eo4X73DV0qzQY19CyzhAaIeuTwh+EVtLzWxUsWqu/Qat4L2ogsr5KeoOwZas9uSWvjSqsAtBdGzz7xyoK/Wxh9oWSPU6hSlSNj7K2RZZB0Vlev9Ay5dBy3J6a8JqoTdELymu2KFWaT3w3jdIofOgxp2O8oCft5RKjYeJdlx3AxBlVYUNyYnRW7dvFcmBMmGHqs1TNlf6ZHLH3KmlXIawDFU9Jqak5/QbomO+wPaUiNnS5h73riwh4JXb0INO3Lqa+PwBABAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zdDnu0mZPu9t0RGqUjxBqXtlbVQYMmOr6qufEl7SIbs=; b=OewSOiedztjwZb+iwHVRzYXeF+k9dGXBfiS9bkgnXI1qb8/i38lyPysdgCRyijDaYXiwa7xweZxGiu0guDyv/ld72QIu1wxws4F8QBJbyq/uP74Dh48ORF9hqBVJP19LM3puP01eqaGH2D4aAyk9daqNypypjvvskDsfsXluyHI= Received: from SN6PR12MB2639.namprd12.prod.outlook.com (52.135.103.16) by SN6PR12MB2670.namprd12.prod.outlook.com (52.135.103.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 18 Oct 2019 15:31:27 +0000 Received: from SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8]) by SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8%7]) with mapi id 15.20.2367.019; Fri, 18 Oct 2019 15:31:27 +0000 From: "Ghannam, Yazen" To: "linux-edac@vger.kernel.org" CC: "Ghannam, Yazen" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" Subject: [PATCH 3/6] EDAC/amd64: Save max number of controllers to family type Thread-Topic: [PATCH 3/6] EDAC/amd64: Save max number of controllers to family type Thread-Index: AQHVhckbtn+w81QWL0WFYihGLnPZQw== Date: Fri, 18 Oct 2019 15:31:26 +0000 Message-ID: <20191018153114.39378-4-Yazen.Ghannam@amd.com> References: <20191018153114.39378-1-Yazen.Ghannam@amd.com> In-Reply-To: <20191018153114.39378-1-Yazen.Ghannam@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN1PR12CA0046.namprd12.prod.outlook.com (2603:10b6:802:20::17) To SN6PR12MB2639.namprd12.prod.outlook.com (2603:10b6:805:6f::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a56fd85f-b561-4beb-a211-08d753e03d82 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: SN6PR12MB2670: x-ms-exchange-purlcount: 1 x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 01949FE337 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(346002)(376002)(396003)(366004)(136003)(39860400002)(199004)(189003)(6512007)(6306002)(1076003)(316002)(3846002)(4326008)(6116002)(66946007)(66066001)(25786009)(256004)(66476007)(5660300002)(6916009)(2351001)(66556008)(66446008)(14454004)(26005)(486006)(76176011)(99286004)(52116002)(305945005)(2616005)(446003)(11346002)(50226002)(7736002)(476003)(2501003)(478600001)(6436002)(2906002)(5640700003)(6506007)(102836004)(71200400001)(36756003)(966005)(8676002)(64756008)(186003)(81166006)(81156014)(8936002)(6486002)(86362001)(386003)(71190400001)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2670;H:SN6PR12MB2639.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: M62KFx1eRu6ZYZIMO0KP2b78KGPUOGkJCR0RgBcisChOZLtrsgIOWsRDFV5OTCSgFdJPe2jiFMYNePNk7rZHQOwXA03im0cJKtVJCGFunMDwYkucgLIJH7202DH+lXpE7r5z17Al0evP4dGWexmRfUgYaiUDmTo5M33AK/Q/azFFRJjD78BZ7nQPnXSrG/CLt/C60gY06eCmRufy9sThg0qKsPM3syGbWm/HnnlQNY2N9xbrVa97cuucYUpEaSi9WDOdmp41FBv3FCHEZeRmLdVGCrhgrYOyRrjDzOwUIt4qYts+D/mB9heqFx3ZLWkJpRKGhOCwcZvHj19SaNo4AksKV/mMFWWIOvgF34ZZku7Lr2snFie2nM9Eae9z9219AWXMmPQakH5a5xyZdo2jFGzDNhPGQAN/Xfe8HQlVpZUbzq151VEAVVrMTO0CTeBvHS+GdIYVc10DCn1Bq3JMyQ== MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a56fd85f-b561-4beb-a211-08d753e03d82 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2019 15:31:26.7974 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: MbgyUPHqk1xhNMPmQMZA0T/s695Ay6r4gD9V/NWGnv4x8CnaLfpsAemb8m5JjRv/pFFFguitDgdX2U7GUulx3A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2670 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Yazen Ghannam The maximum number of memory controllers is fixed within a family/model group. In most cases, this has been fixed at 2, but some systems may have up to 8. The struct amd64_family_type already contains family/model-specific information, and this can be used rather than adding model checks to various functions. Create a new field in struct amd64_family_type for max_num_controllers. Set this when setting other family type information, and use this when needing the maximum number of memory controllers possible for a system. Signed-off-by: Yazen Ghannam --- Link: https://lkml.kernel.org/r/20190821235938.118710-9-Yazen.Ghannam@amd.com rfc -> v1: * New patch. * Idea came up from Boris' comment about compute_num_umcs(). drivers/edac/amd64_edac.c | 45 +++++++++++++-------------------------- drivers/edac/amd64_edac.h | 1 + 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 4410da7c3a25..0fde5ad2fdcd 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -21,9 +21,6 @@ static struct amd64_family_type *fam_type; /* Per-node stuff */ static struct ecc_settings **ecc_stngs; -/* Number of Unified Memory Controllers */ -static u8 num_umcs; - /* * Valid scrub rates for the K8 hardware memory scrubber. We map the scrubbing * bandwidth to a valid bit pattern. The 'set' operation finds the 'matching- @@ -456,7 +453,7 @@ static void get_cs_base_and_mask(struct amd64_pvt *pvt, int csrow, u8 dct, for (i = 0; i < pvt->csels[dct].m_cnt; i++) #define for_each_umc(i) \ - for (i = 0; i < num_umcs; i++) + for (i = 0; i < fam_type->max_num_controllers; i++) /* * @input_addr is an InputAddr associated with the node given by mci. Return the @@ -2226,6 +2223,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "K8", .f1_id = PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP, .f2_id = PCI_DEVICE_ID_AMD_K8_NB_MEMCTL, + .max_num_controllers = 2, .ops = { .early_channel_count = k8_early_channel_count, .map_sysaddr_to_csrow = k8_map_sysaddr_to_csrow, @@ -2236,6 +2234,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F10h", .f1_id = PCI_DEVICE_ID_AMD_10H_NB_MAP, .f2_id = PCI_DEVICE_ID_AMD_10H_NB_DRAM, + .max_num_controllers = 2, .ops = { .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, @@ -2246,6 +2245,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F15h", .f1_id = PCI_DEVICE_ID_AMD_15H_NB_F1, .f2_id = PCI_DEVICE_ID_AMD_15H_NB_F2, + .max_num_controllers = 2, .ops = { .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, @@ -2256,6 +2256,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F15h_M30h", .f1_id = PCI_DEVICE_ID_AMD_15H_M30H_NB_F1, .f2_id = PCI_DEVICE_ID_AMD_15H_M30H_NB_F2, + .max_num_controllers = 2, .ops = { .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, @@ -2266,6 +2267,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F15h_M60h", .f1_id = PCI_DEVICE_ID_AMD_15H_M60H_NB_F1, .f2_id = PCI_DEVICE_ID_AMD_15H_M60H_NB_F2, + .max_num_controllers = 2, .ops = { .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, @@ -2276,6 +2278,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F16h", .f1_id = PCI_DEVICE_ID_AMD_16H_NB_F1, .f2_id = PCI_DEVICE_ID_AMD_16H_NB_F2, + .max_num_controllers = 2, .ops = { .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, @@ -2286,6 +2289,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F16h_M30h", .f1_id = PCI_DEVICE_ID_AMD_16H_M30H_NB_F1, .f2_id = PCI_DEVICE_ID_AMD_16H_M30H_NB_F2, + .max_num_controllers = 2, .ops = { .early_channel_count = f1x_early_channel_count, .map_sysaddr_to_csrow = f1x_map_sysaddr_to_csrow, @@ -2296,6 +2300,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h", .f0_id = PCI_DEVICE_ID_AMD_17H_DF_F0, .f6_id = PCI_DEVICE_ID_AMD_17H_DF_F6, + .max_num_controllers = 2, .ops = { .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, @@ -2305,6 +2310,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h_M10h", .f0_id = PCI_DEVICE_ID_AMD_17H_M10H_DF_F0, .f6_id = PCI_DEVICE_ID_AMD_17H_M10H_DF_F6, + .max_num_controllers = 2, .ops = { .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, @@ -2314,6 +2320,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h_M30h", .f0_id = PCI_DEVICE_ID_AMD_17H_M30H_DF_F0, .f6_id = PCI_DEVICE_ID_AMD_17H_M30H_DF_F6, + .max_num_controllers = 8, .ops = { .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, @@ -2323,6 +2330,7 @@ static struct amd64_family_type family_types[] = { .ctl_name = "F17h_M70h", .f0_id = PCI_DEVICE_ID_AMD_17H_M70H_DF_F0, .f6_id = PCI_DEVICE_ID_AMD_17H_M70H_DF_F6, + .max_num_controllers = 2, .ops = { .early_channel_count = f17_early_channel_count, .dbam_to_cs = f17_addr_mask_to_cs_size, @@ -3400,29 +3408,14 @@ static const struct attribute_group *amd64_edac_attr_groups[] = { NULL }; -/* Set the number of Unified Memory Controllers in the system. */ -static void compute_num_umcs(void) -{ - u8 model = boot_cpu_data.x86_model; - - if (boot_cpu_data.x86 < 0x17) - return; - - if (model >= 0x30 && model <= 0x3f) - num_umcs = 8; - else - num_umcs = 2; - - edac_dbg(1, "Number of UMCs: %x", num_umcs); -} - static int get_hardware_info(struct amd64_pvt *pvt) { u16 pci_id1, pci_id2; int ret = -EINVAL; if (pvt->fam >= 0x17) { - pvt->umc = kcalloc(num_umcs, sizeof(struct amd64_umc), GFP_KERNEL); + pvt->umc = kcalloc(fam_type->max_num_controllers, + sizeof(struct amd64_umc), GFP_KERNEL); if (!pvt->umc) { ret = -ENOMEM; goto err_ret; @@ -3476,14 +3469,8 @@ static int init_one_instance(struct amd64_pvt *pvt) * Always allocate two channels since we can have setups with DIMMs on * only one channel. Also, this simplifies handling later for the price * of a couple of KBs tops. - * - * On Fam17h+, the number of controllers may be greater than two. So set - * the size equal to the maximum number of UMCs. */ - if (pvt->fam >= 0x17) - layers[1].size = num_umcs; - else - layers[1].size = 2; + layers[1].size = fam_type->max_num_controllers; layers[1].is_virt_csrow = false; mci = edac_mc_alloc(pvt->mc_node_id, ARRAY_SIZE(layers), layers, 0); @@ -3678,8 +3665,6 @@ static int __init amd64_edac_init(void) if (!msrs) goto err_free; - compute_num_umcs(); - for (i = 0; i < amd_nb_num(); i++) { err = probe_one_instance(i); if (err) { diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h index 8c3cda81e619..0d5a9bc4d6de 100644 --- a/drivers/edac/amd64_edac.h +++ b/drivers/edac/amd64_edac.h @@ -479,6 +479,7 @@ struct low_ops { struct amd64_family_type { const char *ctl_name; u16 f0_id, f1_id, f2_id, f6_id; + u8 max_num_controllers; struct low_ops ops; }; From patchwork Fri Oct 18 15:31:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 11198699 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F0CD5112C for ; Fri, 18 Oct 2019 15:31:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C85F7222C6 for ; Fri, 18 Oct 2019 15:31:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="T5ABbgbZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633014AbfJRPbh (ORCPT ); Fri, 18 Oct 2019 11:31:37 -0400 Received: from mail-eopbgr720052.outbound.protection.outlook.com ([40.107.72.52]:48496 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2408746AbfJRPbg (ORCPT ); Fri, 18 Oct 2019 11:31:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KY+lypjij6sTpD6ukQ9hx9uSLp//5k+15k2OmAEtSGSkOGGcz37A0unUNULPcHd2CilWaB6nUN16y2+3uhM3gY3cMUKsE6d/i9iOosC+My5eMBH+GdK/ay81Uha79f+kOZMWtr30GNLRJjBxgj0ZW6dMq6z0lOSUPNVNvR8+g499hbk9KHCwMuSOpi7f3QcP8SEskQxPI3vECVcUJpgku1FjaTXBfClz6z9BfUnhpvtMFzxD1Np30HDm4NNfheebGrf7QVdGOoviW5bPFHkQiUNPM2jddx/atmFL1gTotqQXqKszQSDdUhdja+IoaGi+O9LGKtTiWXP0aGYafHeP5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fol9OOZLxxNWJqKD/tmNGGKZ+qsRGzYVtZmhPLNlM2Q=; b=N5TmW16qffCItbCwzFOtSEgjIoddeIlZ9/LWn0HCI9hMAHAXau8H1ujJ5PU4PXZ1hi2u42KQ4L/rq8yzE4xoA5O7tz7Bi92EUxX5KKwpwNNOrmJHVuRuPUcuJytdq8xrBQfGnNB/ialDG0YHtF7PndrnXTXIHuZDYsEMvMckKjht5FeSVLpl2tsPYn8V93A91Rq0kC/va8wTiERsuZ/72TqRKOs0sr6juJL2H3zs2RFrqoWnF8j3bzFOtPmOkKZse+ykqOW695ta1zH44XycOueWfdLuzf0j7XdutEg1YYXHBfQq5uc0Wj0RGVSEyLAqKzUrwC3ESgx2DH1+Y2nW3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Fol9OOZLxxNWJqKD/tmNGGKZ+qsRGzYVtZmhPLNlM2Q=; b=T5ABbgbZDELaVTWJyjF2zaLVRvqpmgAZ2GIAdia0mSNEKGwsTr30N/CVuDuGQF5TTNGj3NNEQt3/uwsNNnuYHjZJzGwkHAPABI1UCUrTedA6xsVqXbg98GbozoDcsZMKw1YBIP1/ZtMLM/dNZaNkikBMfVy0lbGmefD/Vh5C8qE= Received: from SN6PR12MB2639.namprd12.prod.outlook.com (52.135.103.16) by SN6PR12MB2608.namprd12.prod.outlook.com (52.135.102.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Fri, 18 Oct 2019 15:31:27 +0000 Received: from SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8]) by SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8%7]) with mapi id 15.20.2367.019; Fri, 18 Oct 2019 15:31:27 +0000 From: "Ghannam, Yazen" To: "linux-edac@vger.kernel.org" CC: "Ghannam, Yazen" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" Subject: [PATCH 4/6] EDAC/amd64: Use cached data when checking for ECC Thread-Topic: [PATCH 4/6] EDAC/amd64: Use cached data when checking for ECC Thread-Index: AQHVhckbG/+gEL4Cd0umc2ocXEdT9Q== Date: Fri, 18 Oct 2019 15:31:27 +0000 Message-ID: <20191018153114.39378-5-Yazen.Ghannam@amd.com> References: <20191018153114.39378-1-Yazen.Ghannam@amd.com> In-Reply-To: <20191018153114.39378-1-Yazen.Ghannam@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN1PR12CA0046.namprd12.prod.outlook.com (2603:10b6:802:20::17) To SN6PR12MB2639.namprd12.prod.outlook.com (2603:10b6:805:6f::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f92f19ca-8cba-4562-2bcf-08d753e03dd1 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: SN6PR12MB2608: x-ms-exchange-purlcount: 1 x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3513; x-forefront-prvs: 01949FE337 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(376002)(346002)(396003)(136003)(189003)(199004)(6506007)(386003)(186003)(2906002)(6512007)(6436002)(6486002)(2351001)(6306002)(3846002)(478600001)(6116002)(5640700003)(7736002)(305945005)(26005)(102836004)(966005)(446003)(76176011)(71190400001)(71200400001)(66446008)(64756008)(66556008)(66476007)(66946007)(11346002)(476003)(256004)(2616005)(52116002)(50226002)(86362001)(6916009)(99286004)(8936002)(81156014)(25786009)(81166006)(486006)(8676002)(2501003)(36756003)(1076003)(5660300002)(4326008)(14454004)(316002)(66066001)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2608;H:SN6PR12MB2639.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XuP91kQbI0RKca1apmOrgRof9MVZ0Vy8BdL3ZxeiYr4XoJpc79GDTp/kks5fHMnhvI+PVl1gPzT5DUOBcNhcGgRwrlwzbXsB1oBiHCIhxs1rAwxhe3Jqguk+cUD6ZIOvxl9f2LlI4HRyhjfOVJVOgdE6FVxn6tJ67ENdiTtRv2pU+MsJ3Pmr3xQlwxPriXk28wsPpCZ2RCWzYsJCnuCuys20WQbYNat9hrFrXxWc/Mkm8qJrT74DLWl9AJuaJvD3AFFPw7YKu+GJ33HHIyU3XN1Po5YnnfGgYBNMhYS0yx6cpAIkTLhqCJEghxtEn/4yeMtRiW3qelaYNs+fTWjq77v3qLB+RmZ9FcZ7UX1jaMdUvSjG8+9IaBGOq/SICZhT9DPwsnnuGk7bEkdJEuK32GEMzE65+VNT5FpGdvWhEYVZnOn1LNpCh1B0XQTfd2FGGFbHVBuvvHem8SUB0MR2+w== MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f92f19ca-8cba-4562-2bcf-08d753e03dd1 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2019 15:31:27.3551 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 9Ay3xXFpZ9V1RzkD2LcrUOv5MpV6frgQfzHZm4MYSUtGiTvInKLIidTiQIr1RKM4tABcv7Oev0kBJgaSlIFCzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2608 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Yazen Ghannam ...now that the data is available earlier. Signed-off-by: Yazen Ghannam --- Link: https://lkml.kernel.org/r/20190821235938.118710-10-Yazen.Ghannam@amd.com rfc -> v1: * No change. drivers/edac/amd64_edac.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 0fde5ad2fdcd..feb68c0a3217 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -3200,31 +3200,27 @@ static const char *ecc_msg = "'ecc_enable_override'.\n" " (Note that use of the override may cause unknown side effects.)\n"; -static bool ecc_enabled(struct pci_dev *F3, u16 nid) +static bool ecc_enabled(struct amd64_pvt *pvt) { + u16 nid = pvt->mc_node_id; bool nb_mce_en = false; u8 ecc_en = 0, i; u32 value; if (boot_cpu_data.x86 >= 0x17) { u8 umc_en_mask = 0, ecc_en_mask = 0; + struct amd64_umc *umc; for_each_umc(i) { - u32 base = get_umc_base(i); + umc = &pvt->umc[i]; /* Only check enabled UMCs. */ - if (amd_smn_read(nid, base + UMCCH_SDP_CTRL, &value)) - continue; - - if (!(value & UMC_SDP_INIT)) + if (!(umc->sdp_ctrl & UMC_SDP_INIT)) continue; umc_en_mask |= BIT(i); - if (amd_smn_read(nid, base + UMCCH_UMC_CAP_HI, &value)) - continue; - - if (value & UMC_ECC_ENABLED) + if (umc->umc_cap_hi & UMC_ECC_ENABLED) ecc_en_mask |= BIT(i); } @@ -3237,7 +3233,7 @@ static bool ecc_enabled(struct pci_dev *F3, u16 nid) /* Assume UMC MCA banks are enabled. */ nb_mce_en = true; } else { - amd64_read_pci_cfg(F3, NBCFG, &value); + amd64_read_pci_cfg(pvt->F3, NBCFG, &value); ecc_en = !!(value & NBCFG_ECC_ENABLE); @@ -3534,7 +3530,7 @@ static int probe_one_instance(unsigned int nid) if (ret < 0) goto err_enable; - if (!ecc_enabled(F3, nid)) { + if (!ecc_enabled(pvt)) { ret = 0; if (!ecc_enable_override) From patchwork Fri Oct 18 15:31:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 11198703 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6331D112B for ; Fri, 18 Oct 2019 15:31:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 391B0222C6 for ; Fri, 18 Oct 2019 15:31:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="wijl5GYz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633135AbfJRPbi (ORCPT ); Fri, 18 Oct 2019 11:31:38 -0400 Received: from mail-eopbgr720052.outbound.protection.outlook.com ([40.107.72.52]:48496 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2501906AbfJRPbh (ORCPT ); Fri, 18 Oct 2019 11:31:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mapa8PI2QyeSUY0KQON7HmLzYgWj+y18HnKp1DsxrXFO32EOUent9xe2+XVIkw8C5+HFRJXK6FgeEGseqHhMkK47onDs+rJBcJZgh3+MFxJTOAkQQIwazprZcqkD1WHAcu1efDkORkMnaRu2r1HLTWocRrW8otdhQXZl81vJph3J8zp+WDa834RAsG8f85XurTueIbIgroF3iUnhuVwLu/LL4Q85xr8rOwkoJ6/E6bcPzpJvF+ozip3ZPfjpIJHYcml+m7KkJxgH5l9oN11lwsivGrxAujsOkKvu/Qzd8M/cceuGm8E+sEutjV8wf1E44KdTANmzJBmVRWAGNoCtTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KC8zJqJtdxmy/HxrTxNIEVgY48Vc+1j1tgy8Abxr7mM=; b=VSPwO+Z2Ql6FRhNM3l65lzr2Eequ4zCs0cyW4Fca34CnfwtNFU77yR3zesNoduv4W8W7EA4QLNJF8V3QLW/yRDV71uVo9L1eeww89rsMgUeBYnm2iIrbblqduI4f/UsldU6dp9Ln8mg8rnD0q/wVn1RRESI9NTk3bz9Ra75RAkUnraHN+XrTwGQI+ZDkwwhYK3QJFrygXVwcFlCVRU41svfsxxzQQki713FXRxExvCpIJiE+Vqx/iBTurO+F8w7YuqzjqOP8qfCVa1y569/t3WSu4H3ZiC3Zdq45Pk0qeR8GJgqhQlR3Su/kpl58r9dmGclda+wINM/WVc2u/seNvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KC8zJqJtdxmy/HxrTxNIEVgY48Vc+1j1tgy8Abxr7mM=; b=wijl5GYz8QrLqyatCr235iBzgJUH8yHk/APDIiNlrS/hEmZF2UYZ49oIxi0mFvvJqUjnHXE49q5vEK/+AbKs2STUcnqK1NQ5fXS6sj+5bn6ZCMHWMfGA4cDiQKTHO4jeeUEcvJL6Q9ougqa46DHlgx03o4eb5yoIEJrfq0X8/k8= Received: from SN6PR12MB2639.namprd12.prod.outlook.com (52.135.103.16) by SN6PR12MB2608.namprd12.prod.outlook.com (52.135.102.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Fri, 18 Oct 2019 15:31:28 +0000 Received: from SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8]) by SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8%7]) with mapi id 15.20.2367.019; Fri, 18 Oct 2019 15:31:28 +0000 From: "Ghannam, Yazen" To: "linux-edac@vger.kernel.org" CC: "Ghannam, Yazen" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" Subject: [PATCH 5/6] EDAC/amd64: Check for memory before fully initializing an instance Thread-Topic: [PATCH 5/6] EDAC/amd64: Check for memory before fully initializing an instance Thread-Index: AQHVhckb2h8vvebLQEi9ylCDe5/coQ== Date: Fri, 18 Oct 2019 15:31:27 +0000 Message-ID: <20191018153114.39378-6-Yazen.Ghannam@amd.com> References: <20191018153114.39378-1-Yazen.Ghannam@amd.com> In-Reply-To: <20191018153114.39378-1-Yazen.Ghannam@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN1PR12CA0046.namprd12.prod.outlook.com (2603:10b6:802:20::17) To SN6PR12MB2639.namprd12.prod.outlook.com (2603:10b6:805:6f::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e5b276ba-5d6f-4578-d788-08d753e03e2a x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: SN6PR12MB2608: x-ms-exchange-purlcount: 1 x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 01949FE337 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(376002)(346002)(396003)(136003)(189003)(199004)(6506007)(386003)(186003)(2906002)(6512007)(6436002)(6486002)(2351001)(6306002)(3846002)(478600001)(6116002)(5640700003)(7736002)(305945005)(26005)(102836004)(966005)(446003)(76176011)(71190400001)(71200400001)(66446008)(64756008)(66556008)(66476007)(66946007)(11346002)(476003)(256004)(14444005)(2616005)(52116002)(50226002)(86362001)(6916009)(99286004)(8936002)(81156014)(25786009)(81166006)(486006)(8676002)(2501003)(36756003)(1076003)(5660300002)(4326008)(14454004)(316002)(66066001)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2608;H:SN6PR12MB2639.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mxzz45lXjBfdsfBs/3p95V1h5ag1c+tF1v/Nv2yyOJP/FbEXb3Ml/xzNCuTYA7AsOkyoEo2pJFigp1a+TLUzB+rpjicDqDuhpV+TuyHEwbMojth2nf86lrEkI1oLudseNYB+K/SiEujZ78q91PM7f3IV+9x74GbPXRIm80hnfkfWKAl5W7zRuozCN+mJBv/kLY4udLUcOqiEKSZYpHvxk8WbSsRie/8Pqlt9Q4iHXdj9t2O9zkcYciGV7UHRQQ6mdDZ/TKYLOmDuTbymyUkjSNfdUgVYNxKaDVsbEokB2212qMmIATeM7aAiGa62YKqzsHllC0+8Zi3F38fHBunUIs29W92TCB+qppXjpaBvr4YD7ARknonupKvaU4FNkaLeYvvygrE6R7n5YNkLrWFP2XjGGtC1hOTc3/kzIcel2+8bLD5mdMy1udza8RniVPRTs1B12RZF2q4TqISZeEiGSA== MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5b276ba-5d6f-4578-d788-08d753e03e2a X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2019 15:31:27.9347 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: abyQS1ckWwzBYaAXq52dLlTYivEX3bOz8Ahchx+qA/C+iE3ALWiD0E/roZD5fQHNC+uKWWdwUbyLUHQ+WJGaWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2608 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Yazen Ghannam Return early before checking for ECC if the node does not have any populated memory. Free any cached hardware data before returning. Also, return 0 in this case since this is not a failure. Other nodes may have memory and the module should attempt to load an instance for them. Move printing of hardware information to after the instance is initialized, so that the information is only printed for nodes with memory. Signed-off-by: Yazen Ghannam --- Link: https://lkml.kernel.org/r/20190821235938.118710-11-Yazen.Ghannam@amd.com rfc -> v1: * Change message severity to "info". * Nodes without memory is a valid configuration. The user doesn't need to be warned. * Drop "DRAM ECC disabled" from message. * The message is given when no memory was detected on a node. * The state of DRAM ECC is not checked here. drivers/edac/amd64_edac.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index feb68c0a3217..2a0a8be8f767 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2848,8 +2848,6 @@ static void read_mc_regs(struct amd64_pvt *pvt) edac_dbg(1, " DIMM type: %s\n", edac_mem_types[pvt->dram_type]); determine_ecc_sym_sz(pvt); - - dump_misc_regs(pvt); } /* @@ -3501,6 +3499,19 @@ static int init_one_instance(struct amd64_pvt *pvt) return ret; } +static bool instance_has_memory(struct amd64_pvt *pvt) +{ + bool cs_enabled = false; + int cs = 0, dct = 0; + + for (dct = 0; dct < fam_type->max_num_controllers; dct++) { + for_each_chip_select(cs, dct, pvt) + cs_enabled |= csrow_enabled(cs, dct, pvt); + } + + return cs_enabled; +} + static int probe_one_instance(unsigned int nid) { struct pci_dev *F3 = node_to_amd_nb(nid)->misc; @@ -3530,6 +3541,12 @@ static int probe_one_instance(unsigned int nid) if (ret < 0) goto err_enable; + ret = 0; + if (!instance_has_memory(pvt)) { + amd64_info("Node %d: No DIMMs detected.\n", nid); + goto err_enable; + } + if (!ecc_enabled(pvt)) { ret = 0; @@ -3556,6 +3573,8 @@ static int probe_one_instance(unsigned int nid) goto err_enable; } + dump_misc_regs(pvt); + return ret; err_enable: From patchwork Fri Oct 18 15:31:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yazen Ghannam X-Patchwork-Id: 11198701 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93E28112C for ; Fri, 18 Oct 2019 15:31:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 74204222C3 for ; Fri, 18 Oct 2019 15:31:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="Kf7tzTmf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2410555AbfJRPbk (ORCPT ); Fri, 18 Oct 2019 11:31:40 -0400 Received: from mail-eopbgr720052.outbound.protection.outlook.com ([40.107.72.52]:48496 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2633040AbfJRPbk (ORCPT ); Fri, 18 Oct 2019 11:31:40 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R31TNP8+MneVngwpQUVtAXNqO604IO7hXSw965kfa+oKmwqRFqaAepi4+FVmoMTrK3Ps2be1BCKu7fdmh02yqETyGcSpE3yFFPCKzKppCK1lIKVTTj3xSxfGZGq6M2fcY/1mGzI1mL86zADlKo3dJQ41Q3YZhcdIWPy6c4QYwnZ/1jdhp2A1rVXzwou/3xHki/49QQYwp3ZfNUX2/uH7RW0DwLAIr9uoXIuGF1jz7+agxbdf4VTuDYKl3dX7KgaQC05eNMjLwv3UVqnVPE1ROVEvSX/S7P3/4obAN8MdKsbQws1hslAmHD9/I6EPETfschD0xbYzLJW+e0UAIQzKSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Td1BXkUXW9JNviE3Bg/x8ltLF81YFqQStp1Y/CXOY8=; b=Dtp9YpZ8aV+iPUQW5+My6eUNIlgmeQEQFCQ/MKXhy5hwkWDifhQpdQAlslGdyH8ehqKkPFaQD4oVJtzTn0UFaipXkwnMhqVsqwzMVLrMyOm5OIR0/JYo7nnPPAiCUr9ulza7F9X5bB194ljMnRB99Wbt6aCjC9TnmAOwx93oR8XHI+ZqJ2Fah4Vt7lUn3FOyFdRE395NLAL5+ODWWRkHWzX9kHX0i8BeqcP4GckYeSS2GCRbnns61Oeo8M9bh8JR5b23EWiKdDT4gINLzAv0adNn7A148aOLxSW4Db1jZsrVELKi0lyxYRO/L+U0jxos271x022arQ01KHXMblmQ8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Td1BXkUXW9JNviE3Bg/x8ltLF81YFqQStp1Y/CXOY8=; b=Kf7tzTmfu3oYf5X7mxSqOkj7MtFBv+B3FDH84VUJw6OKN8JyFTnSFbJcmXoN/bxfrlY92kVftYld39L9pMvQyf5nSilz+CQWw5Iwg7ZKqk0FeQC7+xm/nn+BgBSBdAk6PfTDX/uQ428cASBgRRNruPXDf/Fy1S8J27e45eYrF0Q= Received: from SN6PR12MB2639.namprd12.prod.outlook.com (52.135.103.16) by SN6PR12MB2608.namprd12.prod.outlook.com (52.135.102.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Fri, 18 Oct 2019 15:31:30 +0000 Received: from SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8]) by SN6PR12MB2639.namprd12.prod.outlook.com ([fe80::ac86:15de:e8d6:61c8%7]) with mapi id 15.20.2367.019; Fri, 18 Oct 2019 15:31:30 +0000 From: "Ghannam, Yazen" To: "linux-edac@vger.kernel.org" CC: "Ghannam, Yazen" , "linux-kernel@vger.kernel.org" , "bp@alien8.de" Subject: [PATCH 6/6] EDAC/amd64: Set grain per DIMM Thread-Topic: [PATCH 6/6] EDAC/amd64: Set grain per DIMM Thread-Index: AQHVhckcH8Q3hhJGUEaVQKby7sMplg== Date: Fri, 18 Oct 2019 15:31:28 +0000 Message-ID: <20191018153114.39378-7-Yazen.Ghannam@amd.com> References: <20191018153114.39378-1-Yazen.Ghannam@amd.com> In-Reply-To: <20191018153114.39378-1-Yazen.Ghannam@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN1PR12CA0046.namprd12.prod.outlook.com (2603:10b6:802:20::17) To SN6PR12MB2639.namprd12.prod.outlook.com (2603:10b6:805:6f::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Yazen.Ghannam@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [165.204.78.2] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b9b58ad7-6155-480d-6e1e-08d753e03e7c x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: SN6PR12MB2608: x-ms-exchange-purlcount: 1 x-ld-processed: 3dd8961f-e488-4e60-8e11-a82d994e183d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:240; x-forefront-prvs: 01949FE337 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(376002)(346002)(396003)(136003)(189003)(199004)(6506007)(386003)(186003)(2906002)(6512007)(6436002)(6486002)(2351001)(6306002)(3846002)(478600001)(6116002)(5640700003)(7736002)(305945005)(26005)(102836004)(966005)(446003)(76176011)(71190400001)(71200400001)(66446008)(64756008)(66556008)(66476007)(66946007)(11346002)(476003)(256004)(14444005)(2616005)(52116002)(50226002)(86362001)(6916009)(99286004)(8936002)(81156014)(25786009)(81166006)(486006)(8676002)(2501003)(36756003)(1076003)(5660300002)(4326008)(14454004)(316002)(66066001)(54906003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR12MB2608;H:SN6PR12MB2639.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: iCTunEawsZ5bsUHK7Bgxjn75gltqf6MsKatui5Qty8hWi9cWoB52BJBst0wvYAuprdaXvKQE83+QcloXNu4IArI9bmfTofWTW3vOfuvWjPpVNVSZoVmwMNcZiaEqZXU6hh95VytmT9ydoAmR3W+ktJFGPzC9Pz8AshycwHCyCs3zrdCILxdArFDc4a++pS6i1DL0BmCH63eYYzMajMtiQ7esGP5jhzRL+xvUZzz4FVWvXgTtnYb/EbJxxhtONYX4a57BX0IXXd4W5qY144wogICDJomc26KCbkUoqzcRKaBQHFi3M1GbesKKbZWP16w/90IDn8BqWQjTQC2daWolgU5rWbqr1tWnshYD5oje87nxcsIGaKH9iOLquf4NNri+j7pHZECfFcfSPjUlLDkKboCyGeCv5UbayFsGPVh5fmydyG91Cu6p+YW+tn3g4xbAA1SQk8tlYgBXwDQbVwE2Cw== MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9b58ad7-6155-480d-6e1e-08d753e03e7c X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2019 15:31:28.4934 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /FXKKJFTk2UkTChpyscJLRr9sb9o43WNdp4OclOTrC0FgPokLo+WMtIn81Ma9V8fsKE3DCSQk+Gh3pzz8BjQ7w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2608 Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Yazen Ghannam The following commit introduced a warning on error reports without a non-zero grain value. 3724ace582d9 ("EDAC/mc: Fix grain_bits calculation") The amd64_edac_mod module does not provide a value, so the warning will be given on the first reported memory error. Set the grain per DIMM to cacheline size (64 bytes). This is the current recommendation. Fixes: 3724ace582d9 ("EDAC/mc: Fix grain_bits calculation") Signed-off-by: Yazen Ghannam --- Link: https://lkml.kernel.org/r/724d6f97-61f2-94bd-3f4b-793a55b6ac15@amd.com rfc -> v1: * New patch. drivers/edac/amd64_edac.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c index 2a0a8be8f767..b5c0accfefcf 100644 --- a/drivers/edac/amd64_edac.c +++ b/drivers/edac/amd64_edac.c @@ -2944,6 +2944,7 @@ static int init_csrows_df(struct mem_ctl_info *mci) dimm->mtype = pvt->dram_type; dimm->edac_mode = edac_mode; dimm->dtype = dev_type; + dimm->grain = 64; } } @@ -3020,6 +3021,7 @@ static int init_csrows(struct mem_ctl_info *mci) dimm = csrow->channels[j]->dimm; dimm->mtype = pvt->dram_type; dimm->edac_mode = edac_mode; + dimm->grain = 64; } }